Public report of paperclipai/paperclip, published 26 October 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.10.5). 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, 26 October 2026, 15:57 UTC · Survey ID cd_d3f40e083bcb490d9e61563abbdf11de
paperclipai/paperclip
Measured 26 October 2026, 15:25 UTC, at code version 49bd7a4
A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.
Code coverage is not measured: JavaScript/TypeScript suite (CouldNotMeasureNoCollector).
CAI scoreAt riskDown 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,364,739 lines of product code in 42 projects, tests not counted · Estimated rebuild effort: about 22.8 person-years · Weakest lens: Architecture, 48
Findings by how serious they are
261 critical9530 serious521 minor
7 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
26 October 2026, 15:25 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds Watchdog. It is open to any tool that
implements it, and today Watchdog is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. Watchdog works it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
104of 104 dimensions measured by tools.
10267of 10312 findings point to an exact file and line, so you can open each one in the code. The other 45 concern the repository as a whole, such as missing documentation.
104dimensions across 9 lenses, read from 1,364,739 lines of product code in 42 projects.
paperclipai/paperclip is rated At risk because critical security findings are open. Its score is held back in part because it has loops of files that import each other. It scores 51 out of 100, which the At risk rating leaves unchanged.
Architecture, at 48, is the weakest lens and counts most in the score. The best first step is replacing the six exposed passwords or keys and switching the old ones off, worth about 3 points. Respecting the front end's boundaries would lift Architecture itself, worth about 2 points. Raising Architecture to 70 would lift the score to about 53.
Fifty-one passwords or keys in the code's history and six in the code are open to anyone who can read the repository. Fifty pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Replacing each exposed password or key and pinning each tool to an exact version would close both risks. Updating the vulnerable packages would fix the 29 packages with a known security hole, and fixing the weaknesses the scanner points to would deal with the 15 security weaknesses in the code. The 24 controls that only work with a mouse need to work with the keyboard, or to become a real button.
The product code is 1,364,739 lines, about €3,300,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 Architecture rose from 48 to 70, the lowest score rated Strong, the score would rise from 51 to about 53.
Code composition: what the lines of code are
Product code 53%Tests 47%
New since the last survey: 2371 findings
These 2371 critical or serious findings weren't in the previous survey, on 12 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
Watchdog compares every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 5459 findings
These 5459 critical or serious findings were in the previous survey, on 12 October 2026, and are gone from this one. The first 100 are listed here.
€1,100,000 to €5,500,000, for 18,325 to 58,136 hours of work, about 22.8 person-years for 13 to 44 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.7 at a score of 51. 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,364,739 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: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 6 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2), REDACTED, REDACTED.
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,300,000 to build again, about 22.8 person-years of work. Its weakest lens is Architecture, at 48 (Weak). Architecture is about whether the structure holds up as the product grows, and when the structure is weak, a change in one place ripples into many others. Because the weakest lens counts most in the score, work on Architecture also moves the score most.
Based on: the rebuild estimate · the Architecture grade · how much each lens counts
What to do: Start with the Architecture actions in Top priorities.
If you do one thing first · First action
Resolve the 6 Leaked secret finding(s) in REDACTED Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 3 points for low effort, because it clears the 6 REDACTED Scanning findings. 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 4.3 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 9% to 21% on every change. The history of the code shows how much it changes: about 2,791,521 lines over the last 90 days, which is about 11,321,168 lines a year. At that pace, the extra work comes to an estimated 2586.7 to 15520.3 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.
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.
2119 modules, with 2692 dependencies between them. 5 loops run through 11 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 2079 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.
packages.adapter-utils.src uses packages.adapter-utils.src.types, so a change to packages.adapter-utils.src.types can break packages.adapter-utils.src, while a change to packages.adapter-utils.src can't break packages.adapter-utils.src.types.
Position
Below the diagonal: packages.adapter-utils.src uses a module listed above it, which is the healthy direction.
packages.adapter-utils.src.acpx-engine uses packages.adapter-utils.src.types, so a change to packages.adapter-utils.src.types can break packages.adapter-utils.src.acpx-engine, while a change to packages.adapter-utils.src.acpx-engine can't break packages.adapter-utils.src.types.
Position
Below the diagonal: packages.adapter-utils.src.acpx-engine uses a module listed above it, which is the healthy direction.
packages.adapters.codex-local.src.server uses packages.adapter-utils.src.types, so a change to packages.adapter-utils.src.types can break packages.adapters.codex-local.src.server, while a change to packages.adapters.codex-local.src.server can't break packages.adapter-utils.src.types.
Position
Below the diagonal: packages.adapters.codex-local.src.server uses a module listed above it, which is the healthy direction.
packages.paperclip-runner.src.contracts.harness-driver uses packages.adapter-utils.src.types, so a change to packages.adapter-utils.src.types can break packages.paperclip-runner.src.contracts.harness-driver, while a change to packages.paperclip-runner.src.contracts.harness-driver can't break packages.adapter-utils.src.types.
Position
Below the diagonal: packages.paperclip-runner.src.contracts.harness-driver uses a module listed above it, which is the healthy direction.
packages.paperclip-runner.src.contracts.harness-driver uses packages.paperclip-runner.src.contracts.types, so a change to packages.paperclip-runner.src.contracts.types can break packages.paperclip-runner.src.contracts.harness-driver, while a change to packages.paperclip-runner.src.contracts.harness-driver can't break packages.paperclip-runner.src.contracts.types.
Position
Below the diagonal: packages.paperclip-runner.src.contracts.harness-driver uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in packages.paperclip-runner.src.contracts.harness-driver uses a type in packages.paperclip-runner.src.protocol.replay-contract.
packages.paperclip-runner.src.contracts.harness-driver uses packages.paperclip-runner.src.protocol.replay-contract, so a change to packages.paperclip-runner.src.protocol.replay-contract can break packages.paperclip-runner.src.contracts.harness-driver, while a change to packages.paperclip-runner.src.contracts.harness-driver can't break packages.paperclip-runner.src.protocol.replay-contract.
Position
Below the diagonal: packages.paperclip-runner.src.contracts.harness-driver uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in packages.paperclip-runner.src.semantic-tools.types uses a type in packages.paperclip-runner.src.mock-core.capability-control-plane-types.
packages.paperclip-runner.src.semantic-tools.types uses packages.paperclip-runner.src.mock-core.capability-control-plane-types, so a change to packages.paperclip-runner.src.mock-core.capability-control-plane-types can break packages.paperclip-runner.src.semantic-tools.types, while a change to packages.paperclip-runner.src.semantic-tools.types can't break packages.paperclip-runner.src.mock-core.capability-control-plane-types.
Position
Below the diagonal: packages.paperclip-runner.src.semantic-tools.types uses a module listed above it, which is the healthy direction.
packages.shared.src uses packages.shared.src.types.issue, so a change to packages.shared.src.types.issue can break packages.shared.src, while a change to packages.shared.src can't break packages.shared.src.types.issue.
Position
Below the diagonal: packages.shared.src uses a module listed above it, which is the healthy direction.
packages.shared.src uses packages.shared.src.types.plugin, so a change to packages.shared.src.types.plugin can break packages.shared.src, while a change to packages.shared.src can't break packages.shared.src.types.plugin.
Position
Below the diagonal: packages.shared.src uses a module listed above it, which is the healthy direction.
packages.shared.src.types.agent uses packages.adapter-utils.src.types, so a change to packages.adapter-utils.src.types can break packages.shared.src.types.agent, while a change to packages.shared.src.types.agent can't break packages.adapter-utils.src.types.
Position
Below the diagonal: packages.shared.src.types.agent uses a module listed above it, which is the healthy direction.
server.src.routes uses packages.adapter-utils.src.types, so a change to packages.adapter-utils.src.types can break server.src.routes, while a change to server.src.routes can't break packages.adapter-utils.src.types.
Position
Below the diagonal: server.src.routes uses a module listed above it, which is the healthy direction.
server.src.routes uses packages.shared.src.types.issue, so a change to packages.shared.src.types.issue can break server.src.routes, while a change to server.src.routes can't break packages.shared.src.types.issue.
Position
Below the diagonal: server.src.routes uses a module listed above it, which is the healthy direction.
server.src.services.heartbeat uses packages.adapter-utils.src.types, so a change to packages.adapter-utils.src.types can break server.src.services.heartbeat, while a change to server.src.services.heartbeat can't break packages.adapter-utils.src.types.
Position
Below the diagonal: server.src.services.heartbeat uses a module listed above it, which is the healthy direction.
ui.src.api uses packages.shared.src.types.issue, so a change to packages.shared.src.types.issue can break ui.src.api, while a change to ui.src.api can't break packages.shared.src.types.issue.
Position
Below the diagonal: ui.src.api uses a module listed above it, which is the healthy direction.
ui.src.components.artifacts.v1 uses packages.shared.src.types.issue, so a change to packages.shared.src.types.issue can break ui.src.components.artifacts.v1, while a change to ui.src.components.artifacts.v1 can't break packages.shared.src.types.issue.
Position
Below the diagonal: ui.src.components.artifacts.v1 uses a module listed above it, which is the healthy direction.
ui.src.components.task-chat uses packages.adapter-utils.src.types, so a change to packages.adapter-utils.src.types can break ui.src.components.task-chat, while a change to ui.src.components.task-chat can't break packages.adapter-utils.src.types.
Position
Below the diagonal: ui.src.components.task-chat uses a module listed above it, which is the healthy direction.
ui.src.components.task-chat uses packages.shared.src.types.issue, so a change to packages.shared.src.types.issue can break ui.src.components.task-chat, while a change to ui.src.components.task-chat can't break packages.shared.src.types.issue.
Position
Below the diagonal: ui.src.components.task-chat uses a module listed above it, which is the healthy direction.
ui.src.hooks uses packages.shared.src.types.issue, so a change to packages.shared.src.types.issue can break ui.src.hooks, while a change to ui.src.hooks can't break packages.shared.src.types.issue.
Position
Below the diagonal: ui.src.hooks uses a module listed above it, which is the healthy direction.
cli.src.commands.client uses packages.shared.src.types.company-skill, so a change to packages.shared.src.types.company-skill can break cli.src.commands.client, while a change to cli.src.commands.client can't break packages.shared.src.types.company-skill.
Position
Below the diagonal: cli.src.commands.client uses a module listed above it, which is the healthy direction.
cli.src.commands.client uses packages.shared.src.types.secrets, so a change to packages.shared.src.types.secrets can break cli.src.commands.client, while a change to cli.src.commands.client can't break packages.shared.src.types.secrets.
Position
Below the diagonal: cli.src.commands.client uses a module listed above it, which is the healthy direction.
cli.src.commands.client uses packages.shared.src.types.agent, so a change to packages.shared.src.types.agent can break cli.src.commands.client, while a change to cli.src.commands.client can't break packages.shared.src.types.agent.
Position
Below the diagonal: cli.src.commands.client uses a module listed above it, which is the healthy direction.
5 pairs of types, where a type in packages.paperclip-runner.src.contracts.native-session-backend uses a type in packages.paperclip-runner.src.contracts.types.
packages.paperclip-runner.src.contracts.native-session-backend uses packages.paperclip-runner.src.contracts.types, so a change to packages.paperclip-runner.src.contracts.types can break packages.paperclip-runner.src.contracts.native-session-backend, while a change to packages.paperclip-runner.src.contracts.native-session-backend can't break packages.paperclip-runner.src.contracts.types.
Position
Below the diagonal: packages.paperclip-runner.src.contracts.native-session-backend uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in packages.paperclip-runner.src.contracts.native-session-backend uses a type in packages.paperclip-runner.src.protocol.replay-contract.
packages.paperclip-runner.src.contracts.native-session-backend uses packages.paperclip-runner.src.protocol.replay-contract, so a change to packages.paperclip-runner.src.protocol.replay-contract can break packages.paperclip-runner.src.contracts.native-session-backend, while a change to packages.paperclip-runner.src.contracts.native-session-backend can't break packages.paperclip-runner.src.protocol.replay-contract.
Position
Below the diagonal: packages.paperclip-runner.src.contracts.native-session-backend uses a module listed above it, which is the healthy direction.
4 pairs of types, where a type in packages.paperclip-runner.src.contracts.native-session-backend uses a type in packages.paperclip-runner.src.contracts.harness-driver.
packages.paperclip-runner.src.contracts.native-session-backend uses packages.paperclip-runner.src.contracts.harness-driver, so a change to packages.paperclip-runner.src.contracts.harness-driver can break packages.paperclip-runner.src.contracts.native-session-backend, while a change to packages.paperclip-runner.src.contracts.native-session-backend can't break packages.paperclip-runner.src.contracts.harness-driver.
Position
Below the diagonal: packages.paperclip-runner.src.contracts.native-session-backend uses a module listed above it, which is the healthy direction.
packages.paperclip-runner.src.drivers.acpx uses packages.adapter-utils.src.types, so a change to packages.adapter-utils.src.types can break packages.paperclip-runner.src.drivers.acpx, while a change to packages.paperclip-runner.src.drivers.acpx can't break packages.adapter-utils.src.types.
Position
Below the diagonal: packages.paperclip-runner.src.drivers.acpx uses a module listed above it, which is the healthy direction.
packages.paperclip-runner.src.drivers.acpx uses packages.paperclip-runner.src.contracts.native-execution, so a change to packages.paperclip-runner.src.contracts.native-execution can break packages.paperclip-runner.src.drivers.acpx, while a change to packages.paperclip-runner.src.drivers.acpx can't break packages.paperclip-runner.src.contracts.native-execution.
Position
Below the diagonal: packages.paperclip-runner.src.drivers.acpx uses a module listed above it, which is the healthy direction.
packages.paperclip-runner.src.drivers.acpx uses packages.paperclip-runner.src.contracts.types, so a change to packages.paperclip-runner.src.contracts.types can break packages.paperclip-runner.src.drivers.acpx, while a change to packages.paperclip-runner.src.drivers.acpx can't break packages.paperclip-runner.src.contracts.types.
Position
Below the diagonal: packages.paperclip-runner.src.drivers.acpx uses a module listed above it, which is the healthy direction.
packages.paperclip-runner.src.drivers.acpx uses packages.paperclip-runner.src.contracts.harness-driver, so a change to packages.paperclip-runner.src.contracts.harness-driver can break packages.paperclip-runner.src.drivers.acpx, while a change to packages.paperclip-runner.src.drivers.acpx can't break packages.paperclip-runner.src.contracts.harness-driver.
Position
Below the diagonal: packages.paperclip-runner.src.drivers.acpx uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in packages.paperclip-runner.src.live.live-session uses a type in packages.paperclip-runner.src.mock-core.capability-control-plane-types.
packages.paperclip-runner.src.live.live-session uses packages.paperclip-runner.src.mock-core.capability-control-plane-types, so a change to packages.paperclip-runner.src.mock-core.capability-control-plane-types can break packages.paperclip-runner.src.live.live-session, while a change to packages.paperclip-runner.src.live.live-session can't break packages.paperclip-runner.src.mock-core.capability-control-plane-types.
Position
Below the diagonal: packages.paperclip-runner.src.live.live-session uses a module listed above it, which is the healthy direction.
packages.paperclip-runner.src.live.live-session uses packages.paperclip-runner.src.semantic-tools.types, so a change to packages.paperclip-runner.src.semantic-tools.types can break packages.paperclip-runner.src.live.live-session, while a change to packages.paperclip-runner.src.live.live-session can't break packages.paperclip-runner.src.semantic-tools.types.
Position
Below the diagonal: packages.paperclip-runner.src.live.live-session uses a module listed above it, which is the healthy direction.
packages.plugins.sdk.src.types uses packages.shared.src.types.issue, so a change to packages.shared.src.types.issue can break packages.plugins.sdk.src.types, while a change to packages.plugins.sdk.src.types can't break packages.shared.src.types.issue.
Position
Below the diagonal: packages.plugins.sdk.src.types uses a module listed above it, which is the healthy direction.
packages.plugins.sdk.src.types uses packages.shared.src.types.plugin, so a change to packages.shared.src.types.plugin can break packages.plugins.sdk.src.types, while a change to packages.plugins.sdk.src.types can't break packages.shared.src.types.plugin.
Position
Below the diagonal: packages.plugins.sdk.src.types uses a module listed above it, which is the healthy direction.
packages.plugins.sdk.src.types uses packages.shared.src.types.agent, so a change to packages.shared.src.types.agent can break packages.plugins.sdk.src.types, while a change to packages.plugins.sdk.src.types can't break packages.shared.src.types.agent.
Position
Below the diagonal: packages.plugins.sdk.src.types uses a module listed above it, which is the healthy direction.
ui.src.components uses packages.adapter-utils.src.types, so a change to packages.adapter-utils.src.types can break ui.src.components, while a change to ui.src.components can't break packages.adapter-utils.src.types.
Position
Below the diagonal: ui.src.components uses a module listed above it, which is the healthy direction.
ui.src.components uses packages.shared.src.types.issue, so a change to packages.shared.src.types.issue can break ui.src.components, while a change to ui.src.components can't break packages.shared.src.types.issue.
Position
Below the diagonal: ui.src.components uses a module listed above it, which is the healthy direction.
ui.src.components uses packages.shared.src.types.secrets, so a change to packages.shared.src.types.secrets can break ui.src.components, while a change to ui.src.components can't break packages.shared.src.types.secrets.
Position
Below the diagonal: ui.src.components uses a module listed above it, which is the healthy direction.
ui.src.components uses packages.shared.src.types.agent, so a change to packages.shared.src.types.agent can break ui.src.components, while a change to ui.src.components can't break packages.shared.src.types.agent.
Position
Below the diagonal: ui.src.components uses a module listed above it, which is the healthy direction.
ui.src.lib uses packages.adapter-utils.src.types, so a change to packages.adapter-utils.src.types can break ui.src.lib, while a change to ui.src.lib can't break packages.adapter-utils.src.types.
Position
Below the diagonal: ui.src.lib uses a module listed above it, which is the healthy direction.
ui.src.lib uses packages.shared.src.types.company-skill, so a change to packages.shared.src.types.company-skill can break ui.src.lib, while a change to ui.src.lib can't break packages.shared.src.types.company-skill.
Position
Below the diagonal: ui.src.lib uses a module listed above it, which is the healthy direction.
27 pairs of types, where a type in ui.src.lib uses a type in packages.shared.src.types.issue. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
ui.src.lib uses packages.shared.src.types.issue, so a change to packages.shared.src.types.issue can break ui.src.lib, while a change to ui.src.lib can't break packages.shared.src.types.issue.
Position
Below the diagonal: ui.src.lib uses a module listed above it, which is the healthy direction.
ui.src.lib uses packages.shared.src.types.tool-access, so a change to packages.shared.src.types.tool-access can break ui.src.lib, while a change to ui.src.lib can't break packages.shared.src.types.tool-access.
Position
Below the diagonal: ui.src.lib uses a module listed above it, which is the healthy direction.
ui.src.lib uses packages.shared.src.types.agent, so a change to packages.shared.src.types.agent can break ui.src.lib, while a change to ui.src.lib can't break packages.shared.src.types.agent.
Position
Below the diagonal: ui.src.lib uses a module listed above it, which is the healthy direction.
packages.paperclip-runner.src.cli uses packages.paperclip-runner.src.contracts.harness-driver, so a change to packages.paperclip-runner.src.contracts.harness-driver can break packages.paperclip-runner.src.cli, while a change to packages.paperclip-runner.src.cli can't break packages.paperclip-runner.src.contracts.harness-driver.
Position
Below the diagonal: packages.paperclip-runner.src.cli uses a module listed above it, which is the healthy direction.
packages.paperclip-runner.src.cli uses packages.paperclip-runner.src.live.live-session, so a change to packages.paperclip-runner.src.live.live-session can break packages.paperclip-runner.src.cli, while a change to packages.paperclip-runner.src.cli can't break packages.paperclip-runner.src.live.live-session.
Position
Below the diagonal: packages.paperclip-runner.src.cli uses a module listed above it, which is the healthy direction.
packages.paperclip-runner.src.live uses packages.paperclip-runner.src.contracts.types, so a change to packages.paperclip-runner.src.contracts.types can break packages.paperclip-runner.src.live, while a change to packages.paperclip-runner.src.live can't break packages.paperclip-runner.src.contracts.types.
Position
Below the diagonal: packages.paperclip-runner.src.live uses a module listed above it, which is the healthy direction.
4 pairs of types, where a type in packages.paperclip-runner.src.live uses a type in packages.paperclip-runner.src.mock-core.capability-control-plane-types.
packages.paperclip-runner.src.live uses packages.paperclip-runner.src.mock-core.capability-control-plane-types, so a change to packages.paperclip-runner.src.mock-core.capability-control-plane-types can break packages.paperclip-runner.src.live, while a change to packages.paperclip-runner.src.live can't break packages.paperclip-runner.src.mock-core.capability-control-plane-types.
Position
Below the diagonal: packages.paperclip-runner.src.live uses a module listed above it, which is the healthy direction.
packages.paperclip-runner.src.live uses packages.paperclip-runner.src.semantic-tools.types, so a change to packages.paperclip-runner.src.semantic-tools.types can break packages.paperclip-runner.src.live, while a change to packages.paperclip-runner.src.live can't break packages.paperclip-runner.src.semantic-tools.types.
Position
Below the diagonal: packages.paperclip-runner.src.live uses a module listed above it, which is the healthy direction.
packages.paperclip-runner.src.live uses packages.paperclip-runner.src.live.live-session, so a change to packages.paperclip-runner.src.live.live-session can break packages.paperclip-runner.src.live, while a change to packages.paperclip-runner.src.live can't break packages.paperclip-runner.src.live.live-session.
Position
Below the diagonal: packages.paperclip-runner.src.live uses a module listed above it, which is the healthy direction.
packages.plugins.sdk.src.protocol uses packages.shared.src.types.plugin, so a change to packages.shared.src.types.plugin can break packages.plugins.sdk.src.protocol, while a change to packages.plugins.sdk.src.protocol can't break packages.shared.src.types.plugin.
Position
Below the diagonal: packages.plugins.sdk.src.protocol uses a module listed above it, which is the healthy direction.
packages.plugins.sdk.src.protocol uses packages.plugins.sdk.src.types, so a change to packages.plugins.sdk.src.types can break packages.plugins.sdk.src.protocol, while a change to packages.plugins.sdk.src.protocol can't break packages.plugins.sdk.src.types.
Position
Below the diagonal: packages.plugins.sdk.src.protocol uses a module listed above it, which is the healthy direction.
server.src.services.native-runtime uses packages.adapter-utils.src.types, so a change to packages.adapter-utils.src.types can break server.src.services.native-runtime, while a change to server.src.services.native-runtime can't break packages.adapter-utils.src.types.
Position
Below the diagonal: server.src.services.native-runtime uses a module listed above it, which is the healthy direction.
server.src.services.native-runtime uses packages.paperclip-runner.src.contracts.native-execution, so a change to packages.paperclip-runner.src.contracts.native-execution can break server.src.services.native-runtime, while a change to server.src.services.native-runtime can't break packages.paperclip-runner.src.contracts.native-execution.
Position
Below the diagonal: server.src.services.native-runtime uses a module listed above it, which is the healthy direction.
server.src.services.native-runtime uses packages.paperclip-runner.src.protocol.replay-contract, so a change to packages.paperclip-runner.src.protocol.replay-contract can break server.src.services.native-runtime, while a change to server.src.services.native-runtime can't break packages.paperclip-runner.src.protocol.replay-contract.
Position
Below the diagonal: server.src.services.native-runtime uses a module listed above it, which is the healthy direction.
server.src.services.native-runtime uses packages.shared.src.types.issue, so a change to packages.shared.src.types.issue can break server.src.services.native-runtime, while a change to server.src.services.native-runtime can't break packages.shared.src.types.issue.
Position
Below the diagonal: server.src.services.native-runtime uses a module listed above it, which is the healthy direction.
server.src.services.native-runtime uses packages.paperclip-runner.src.contracts.native-session-backend, so a change to packages.paperclip-runner.src.contracts.native-session-backend can break server.src.services.native-runtime, while a change to server.src.services.native-runtime can't break packages.paperclip-runner.src.contracts.native-session-backend.
Position
Below the diagonal: server.src.services.native-runtime uses a module listed above it, which is the healthy direction.
ui.src.pages uses packages.adapter-utils.src.types, so a change to packages.adapter-utils.src.types can break ui.src.pages, while a change to ui.src.pages can't break packages.adapter-utils.src.types.
Position
Below the diagonal: ui.src.pages uses a module listed above it, which is the healthy direction.
ui.src.pages uses packages.shared.src.types.company-skill, so a change to packages.shared.src.types.company-skill can break ui.src.pages, while a change to ui.src.pages can't break packages.shared.src.types.company-skill.
Position
Below the diagonal: ui.src.pages uses a module listed above it, which is the healthy direction.
ui.src.pages uses packages.shared.src.types.issue, so a change to packages.shared.src.types.issue can break ui.src.pages, while a change to ui.src.pages can't break packages.shared.src.types.issue.
Position
Below the diagonal: ui.src.pages uses a module listed above it, which is the healthy direction.
ui.src.pages uses packages.shared.src.types.secrets, so a change to packages.shared.src.types.secrets can break ui.src.pages, while a change to ui.src.pages can't break packages.shared.src.types.secrets.
Position
Below the diagonal: ui.src.pages uses a module listed above it, which is the healthy direction.
ui.src.pages uses packages.shared.src.types.tool-access, so a change to packages.shared.src.types.tool-access can break ui.src.pages, while a change to ui.src.pages can't break packages.shared.src.types.tool-access.
Position
Below the diagonal: ui.src.pages uses a module listed above it, which is the healthy direction.
ui.src.pages uses packages.shared.src.types.agent, so a change to packages.shared.src.types.agent can break ui.src.pages, while a change to ui.src.pages can't break packages.shared.src.types.agent.
Position
Below the diagonal: ui.src.pages uses a module listed above it, which is the healthy direction.
ui.src.pages uses packages.plugins.sdk.src.types, so a change to packages.plugins.sdk.src.types can break ui.src.pages, while a change to ui.src.pages can't break packages.plugins.sdk.src.types.
Position
Below the diagonal: ui.src.pages uses a module listed above it, which is the healthy direction.
packages.plugins.sandbox-providers.kubernetes.src uses packages.plugins.sdk.src.protocol, so a change to packages.plugins.sdk.src.protocol can break packages.plugins.sandbox-providers.kubernetes.src, while a change to packages.plugins.sandbox-providers.kubernetes.src can't break packages.plugins.sdk.src.protocol.
Position
Below the diagonal: packages.plugins.sandbox-providers.kubernetes.src uses a module listed above it, which is the healthy direction.
server.src.services uses packages.adapter-utils.src.types, so a change to packages.adapter-utils.src.types can break server.src.services, while a change to server.src.services can't break packages.adapter-utils.src.types.
Position
Below the diagonal: server.src.services uses a module listed above it, which is the healthy direction.
48 pairs of types, where a type in server.src.services uses a type in packages.shared.src.types.company-skill. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
server.src.services uses packages.shared.src.types.company-skill, so a change to packages.shared.src.types.company-skill can break server.src.services, while a change to server.src.services can't break packages.shared.src.types.company-skill.
Position
Below the diagonal: server.src.services uses a module listed above it, which is the healthy direction.
42 pairs of types, where a type in server.src.services uses a type in packages.shared.src.types.issue. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
server.src.services uses packages.shared.src.types.issue, so a change to packages.shared.src.types.issue can break server.src.services, while a change to server.src.services can't break packages.shared.src.types.issue.
Position
Below the diagonal: server.src.services uses a module listed above it, which is the healthy direction.
server.src.services uses packages.shared.src.types.plugin, so a change to packages.shared.src.types.plugin can break server.src.services, while a change to server.src.services can't break packages.shared.src.types.plugin.
Position
Below the diagonal: server.src.services uses a module listed above it, which is the healthy direction.
server.src.services uses packages.shared.src.types.secrets, so a change to packages.shared.src.types.secrets can break server.src.services, while a change to server.src.services can't break packages.shared.src.types.secrets.
Position
Below the diagonal: server.src.services uses a module listed above it, which is the healthy direction.
34 pairs of types, where a type in server.src.services uses a type in packages.shared.src.types.tool-access. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
server.src.services uses packages.shared.src.types.tool-access, so a change to packages.shared.src.types.tool-access can break server.src.services, while a change to server.src.services can't break packages.shared.src.types.tool-access.
Position
Below the diagonal: server.src.services uses a module listed above it, which is the healthy direction.
server.src.services uses server.src.services.chat-sdk-runtime, so a change to server.src.services.chat-sdk-runtime can break server.src.services, while a change to server.src.services can't break server.src.services.chat-sdk-runtime.
Position
Below the diagonal: server.src.services uses a module listed above it, which is the healthy direction.
server.src.services uses packages.shared.src.types.agent, so a change to packages.shared.src.types.agent can break server.src.services, while a change to server.src.services can't break packages.shared.src.types.agent.
Position
Below the diagonal: server.src.services uses a module listed above it, which is the healthy direction.
server.src.services uses server.src.services.heartbeat, so a change to server.src.services.heartbeat can break server.src.services, while a change to server.src.services can't break server.src.services.heartbeat.
Position
Below the diagonal: server.src.services uses a module listed above it, which is the healthy direction.
server.src.services uses packages.plugins.sdk.src.types, so a change to packages.plugins.sdk.src.types can break server.src.services, while a change to server.src.services can't break packages.plugins.sdk.src.types.
Position
Below the diagonal: server.src.services uses a module listed above it, which is the healthy direction.
server.src.services uses ui.src.components, so a change to ui.src.components can break server.src.services, while a change to server.src.services can't break ui.src.components.
Position
Below the diagonal: server.src.services uses a module listed above it, which is the healthy direction.
server.src.services uses packages.plugins.sdk.src.protocol, so a change to packages.plugins.sdk.src.protocol can break server.src.services, while a change to server.src.services can't break packages.plugins.sdk.src.protocol.
Position
Below the diagonal: server.src.services uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 57% · Adequate · gated by D1, D2 ·
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
A05:2025 — Injection
231
High / Critical
A07:2025 — Authentication Failures
58
High / Critical
A03:2025 — Software Supply Chain Failures
52
High / Critical
A02:2025 — Security Misconfiguration
41
High / Critical
Roadmap
Immediately resolve the six leaked secrets and break the ten circular import cycles to secure the codebase and improve modularity. Next, enforce strict import boundaries by routing dependencies through public entry points and reorganizing shared test helpers to maintain proper layering. Finally, address the seventy-three low-cohesion findings by refactoring tightly coupled modules and clean up dependency hygiene by removing unused packages and correcting their declarations.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 6 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2), REDACTED, REDACTED.
Fix the listed violations: import through the target package's declared public entry rather than a deep path into its internals or a relative path into its directory (249 rows); move the shared test helper into a source directory production code may depend on (56 rows); respect the layer/slice order — import only through a slice's public index and never upward into a higher layer (46 rows).
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 — 261
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 — 9530
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 — 521
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 7
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 104 of 104 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); none rely on LLM judgement. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 104 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, 10267 of 10312 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, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — 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.
D10 Test Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 36,013 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 27 test source file(s) (.rs) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability not included — the JavaScript/TypeScript suite (vitest via `pnpm install --frozen-lockfile --ignore-scripts` in the repository root; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/adapters/hermes/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/adapters/hermes-gateway/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/db/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/google-sheets-mcp-server/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/kv-demo-mcp-server/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/mcp-server/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/paperclip-runner/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/plugins/create-paperclip-plugin/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/plugins/examples/plugin-authoring-smoke-example/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/plugins/examples/plugin-orchestration-smoke-example/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/plugins/paperclip-plugin-fake-sandbox/) did not finish re-running within its budget: the tier's time budget ran out before a run finished.
D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares REDACTED, 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.
D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
D21 Naming Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
D24 Comment Value — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
D31 IaC & Container Security — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Checkov ran but its report could not be read (checkov produced no output — not a clean result). Every misconfiguration only checkov reports — most of its Terraform, CloudFormation, Bicep and Ansible policies — is absent from this card, so its absence here is not evidence those resources are configured correctly.
D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `.agents/skills/pr-gardening/scripts/lib.mjs`, `.github/scripts/check-pr-linked-issue.mjs`, `packages/adapter-utils/src/acpx-engine/run-contracts.ts`, `packages/adapter-utils/src/paperclip-runner-permissions.ts`, `REDACTED`, … (+446 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
AC2 Forms & labels — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 187 further occurrence(s) are not listed individually; the score already reflects all 227.
AC6 Visual & motion safety — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 72 further occurrence(s) are not listed individually; the score already reflects all 112.
AXR1 Runtime accessibility — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DockerCompose (docker/docker-compose.quickstart.yml). compose up failed (exit 15 — the compose project is invalid) — error while interpolating services.paperclip.environment.BETTER_AUTH_SECRET: required variable BETTER_AUTH_SECRET is missing a value: BETTER_AUTH_SECRET must be set; runtime evidence skipped.
DM9 Scattered domain decisions — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Arm two tells a construction that PRODUCES a measurement from one that merely passes it along, and this repository's frontend does not compute that fact. A measurement built independently in two places would not appear above.
DM9 Scattered domain decisions — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Some of this repository's production types come from a frontend that does not bind comparison operands to the members they read, which arm one needs, and those types were not walked for this dimension. The counts above speak for the languages that declare it.
IC1 Incompleteness & stubs — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 132 further occurrence(s) are not listed individually; the score already reflects all 172.
M4 Documentation accuracy — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9). Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
P2 Observability — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 39 further occurrence(s) are not listed individually; the score already reflects all 79.
PF3 Async & latency hygiene — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 340 further occurrence(s) are not listed individually; the score already reflects all 380.
R10 Code Duplication — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 3506 further occurrence(s) are not listed individually; the score already reflects all 3546.
R11 Import Boundaries — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 313 further occurrence(s) are not listed individually; the score already reflects all 353.
R3 Large Files — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 660 further occurrence(s) are not listed individually; the score already reflects all 700.
R4 Test Coverage — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 240 further occurrence(s) are not listed individually; the score already reflects all 280.
R7 Dead Code — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 274 further occurrence(s) are not listed individually; the score already reflects all 314.
X17 Uncapped recursion over a caller-supplied document — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 1 further occurrence(s) are not listed individually; the score already reflects all 41.
X2 Cancellation propagation — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 2 further occurrence(s) are not listed individually; the score already reflects all 42.
X3 Exception handling — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 770 further occurrence(s) are not listed individually; the score already reflects all 810.
X7 Silent fallback defaults — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 70 further occurrence(s) are not listed individually; the score already reflects all 110.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
D23 Boundary Type-Coupling: Boundary leakage is detected from type references across detected contexts — leaks that flow through primitives, serialization or shared infrastructure may not surface as a typed reference.
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 REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (REDACTED, 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.
AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
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.
AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
C3 Audit Trail: This control is scored from in-repo evidence only — a working control configured outside the repository leaves no signal a static scan can credit.
C4 Data Retention: This control is scored from in-repo evidence only — its real-world effectiveness, exercised only at runtime, is outside a static scan.
DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
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.
2774 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was IssueDetail.TaskDetailSurface at 767. A further 77 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 paperclip_runner_core::acpx_sidecar_transport::response_error_classification at 60 — they are counted neither in the figure above nor in this dimension's score. 14 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: server/src/services/pre-dispatch-review-wait.ts (pre-dispatch-review-wait.isPreDispatchReviewWait at 28), server/src/services/chat-telegram-video-note.ts (chat-telegram-video-note.normalizeTelegramVideoNoteAttachments at 24), server/src/worktree-seed-manifest.ts (worktree-seed-manifest.isVerifiedWorktreeSeedManifest at 24), server/src/services/connectors/slack/setup/development-manager.ts (development-manager.developmentSlackManager.credentials at 22), server/src/services/native-runtime/native-workspace-export-resume.ts (native-workspace-export-resume.readNativeWorkspaceExportResume at 22), and 9 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.
+ 2687 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 1065 bodies over 30 down to 30 or less in Cyclomatic Complexity — start with IssueDetail.TaskDetailSurface (cyclomatic 767), TaskChatThread.TaskChatThread (cyclomatic 683), ConnectionSetupFlow.StandardConnectionSetupFlow (cyclomatic 559). — 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 1065 together lifts Cyclomatic Complexity from 2.0 to about 5.6/10, projected with the scoring formula itself and assuming each lands exactly at 30; a cleaner split scores higher.
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
+ 2892 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 1301 bodies over 30 down to 30 or less in Cognitive Complexity — start with TaskChatThread.TaskChatThread (cognitive 1060), IssueDetail.TaskDetailSurface (cognitive 904), company-portability.companyPortabilityService.importBundle (cognitive 689). — 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 1301 together lifts Cognitive Complexity from 2.0 to about 5.6/10, projected with the scoring formula itself and assuming each lands exactly at 30; a cleaner split scores higher.
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes6.5 / 10Adequate✓ 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.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1293 FunctionTooLong finding(s) in God Classes — start with native-session-executor.ts (19), REDACTED (19), execute.ts (15). — One of this dimension's main actionable groups (1293 warning-level).
Resolve the 414 FileTooLong finding(s) in God Classes — start with execute.ts (12), REDACTED (4), issues.ts (3). — One of this dimension's main actionable groups (414 warning-level).
Resolve the 72 ClassTooLong finding(s) in God Classes — start with execute.ts (7), provider_backend.rs (2), IssueDetail.tsx. — One of this dimension's main actionable groups (72 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
100 duplicated block group(s) detected. A further 19 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. Measured on part of this repository only: .ts, .tsx (95% of production source) was not exposed to THIS dimension's token comparison and is not in this count; duplication there is measured by R10 Code Duplication, the frontend lens's card running the same clone algorithm over the JS/TS token stream.
+ 52 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 10 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with managed_provider_backend.rs (2), client.py, acpx_sidecar_transport.rs. — One of this dimension's main actionable groups (10 warning-level).
Resolve the 7 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with client.py, acpx_provider_backend.rs, acpx_sidecar_transport.rs. — One of this dimension's main actionable groups (7 warning-level).
Resolve the 7 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with client.py (2), aws_agentcore_provider.rs, mod.rs. — One of this dimension's main actionable groups (7 warning-level).
Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling8.5 / 10Strong✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
42 production modules (Cargo+npm+Go), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 9 module(s) off the main sequence, with abstractness counted on 40 of the 42 (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: @paperclipai/hermes-paperclip-adapter · ×8
Off the main sequence: @paperclipai/shared
What to do
Resolve the 8 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (8 warning-level).
Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D6 · Cohesion (LCOM4)3.4 / 10Weak✓ Tool-verified
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 73 Low cohesion finding(s) in Cohesion (LCOM4) — start with REDACTED (3), REDACTED (3), runnerd-codex-transport.ts (2). — One of this dimension's main actionable groups (73 warning-level).
Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the code respects its intended layering / architecture rules.
Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.
No mechanizable ADR was identified, so enforcement is not measured. Dependency cycles not checked (no project-reference graph; where this repository's language has an import-cycle lens, cycles are reported there).
Resolve the 1 Classify ADR enforcement finding(s) in Architectural Integrity — start with 0001-runner-testing-eval-package-boundaries.md. — One of this dimension's main actionable groups (1 recommendation-level).
Enforce Architectural Integrity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d7_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D9 · Test Distribution9.9 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
36779 test methods: 36229 unit, 338 integration, 0 BDD, 212 e2e. The JavaScript/TypeScript suite contributes 36013 `it`/`test` case(s) across 3323 test file(s) declaring at least one; its tier split is read from package names and paths only. The Rust suite contributes 745 `#[test]` function(s) across 55 file(s) declaring at least one; its unit/integration split is Cargo's own — 25 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test. The Python suite contributes 19 test function(s) across 2 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only. The Go suite contributes 2 test case(s) across 1 `_test.go` file(s) declaring at least one — every `func Test…(t *testing.T)` that `go test` would collect, plus the suite methods a testify-style runner reaches; a table-driven case list counts once, so this is a floor. Its tier split is INFERRED from file names, paths and build constraints, not declared: 0 of those file(s) use Go's external test package (`package x_test`), which is a visibility boundary rather than a pyramid tier and was not read as one.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality10.0 / 10Stronggated by 80 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.
202 skipped (179 with a documented reason), 19 zero-assertion, 37 synchronised by a fixed sleep, 1 racing the wall clock, no mocking-framework packages referenced (hand-written doubles or no mocking) across 36013 tests. Measured on the JavaScript/TypeScript suite only — at least 27 test source file(s) (.rs) went unread, so its test quality is unmeasured and is not in these counts.
Fixed-sleep synchronisation: returns no row when the claim row lock holds until after the deadline · ×37server/src/services/setup-token-session.test.ts:1503
No assertions: map sources combine without tracked index edits · ×19ui/storybook/map-tooling.test.ts:5
Races the wall clock: getBuiltinRoutineVariableValues returns date in YYYY-MM-DD formatpackages/shared/src/routine-variables.test.ts:85
Mock-dominated test: does not open a skill when keyboard-activating its actions button · ×126ui/src/pages/CompanySkills.test.tsx:550
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 37 Fixed-sleep synchronisation finding(s) in Test Quality — start with codex-app-server-driver.runtime-requests.test.ts (6), secrets-service.test.ts (3), codex-auth-cache.test.ts (3). — One of this dimension's main actionable groups (37 warning-level).
Resolve the 23 Skipped test finding(s) in Test Quality — start with multi-user.spec.ts (3), task-list-reproduction-trial.spec.ts (2), mcp-user-stories.spec.ts (2). — One of this dimension's main actionable groups (23 warning-level).
Resolve the 19 No assertions finding(s) in Test Quality — start with mcp-user-stories.spec.ts (2), map-tooling.test.ts, chat-qualification.test.ts. — One of this dimension's main actionable groups (19 warning-level).
Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether dependencies are current, secure, and not bloated.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.
13 outdated, 0 yanked direct Cargo dependencies. 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: aws-config · ×13
✓ On the Gold path — maintain.
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.
Resolve the 6 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2), REDACTED, REDACTED. — One of this dimension's main actionable groups (6 issue-level).
Enforce REDACTED Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.
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 333 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. This repository publishes itself under MIT, 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 REDACTED, and the licences of those dependencies 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.
Top hotspots: server/src/routes/issues.ts (130×2421=314730); server/src/routes/agents.ts (110×1251=137610); server/src/services/heartbeat.ts (284×348=98832) Repeated repair below the complexity floor: packages/shared/src/types/execution-projection.ts (11 of 13 changes were fixes); server/src/services/recovery/stranded-notice.ts (8 of 10 changes were fixes); packages/paperclip-runner/src/drivers/codex/codex-driver-types.ts (7 of 11 changes were fixes)
Resolve the 682 Hotspot finding(s) in Churn × Complexity Hotspots — start with execute.ts (12), test.ts (5), build-config.ts (4). — One of this dimension's main actionable groups (682 warning-level).
Resolve the 36 Repeated repair finding(s) in Churn × Complexity Hotspots — start with auth.ts (2), execution-projection.ts, stranded-notice.ts. — One of this dimension's main actionable groups (36 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 Factor8.2 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
524 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs. Counted over 3000 of the 4530 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 · ×5
Further sole-owners (lower concentration)
What to do
Resolve the 5 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (5 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
8 deducted task-comment markers across 1318989 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 8 TodoComment finding(s) in Explicit Debt — start with plugin.ts (3), AgentDetail.production.tsx, useLiveRunTranscripts.ts. — One of this dimension's main actionable groups (8 warning-level).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.
0 of 1 evaluated ADRs have a defect readable from the log itself (a missing or empty section, no title, a single option, consequences with no cost, no status, a missing enforcement field, a status the log contradicts, a dangling link, an unlinked second decision on one question). How well each record argues its case is not measured.
What it measures: Whether domain types (IDs, enums, value objects) leak across bounded-context boundaries.
Method: Cross-context domain-type leakage via Roslyn structural classification (strongly-typed IDs / value objects) over every public surface. Exhaustive, deterministic, type-level aggregate-boundary check.
Coverage: Bounded contexts derived from NAMESPACE prefix (or graph-inferred where available); cross-boundary domain-type leakage then checked exhaustively over every public member of every type.
99 domain type(s) cross context boundaries across 34 contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) · ×27server/src/services/native-runtime/codex-model-fallback.ts:68
Cross-context type ChatProvider (ui → server) · ×16server/src/services/chat-provider-inventory.ts:13
Cross-context type Platform (ui → paperclip-runner) · ×8packages/paperclip-runner/src/drivers/acpx/verified-runtime-executable.ts:18
Cross-context type AdapterExecutionTarget (adapter-utils → claude-local) · ×5packages/adapters/claude-local/src/server/claude-config.ts:236
Cross-context type Json (paperclip-runner → server) · ×5server/src/services/native-runtime/runner-api-catalog.ts:15
+ 22 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 27 Cross-context type AdapterExecutionTarget (adapter-utils → server) finding(s) in Boundary Type-Coupling — start with native-session-executor.ts (8), agent-directory-working-copies.ts (4), agent-instruction-working-copies.ts (4). — One of this dimension's main actionable groups (27 warning-level).
Resolve the 16 Cross-context type ChatProvider (ui → server) finding(s) in Boundary Type-Coupling — start with surfaces.ts (5), credentials.ts (3), message-lifecycle.ts (2). — One of this dimension's main actionable groups (16 warning-level).
Resolve the 8 Cross-context type Platform (ui → paperclip-runner) finding(s) in Boundary Type-Coupling — start with installation-integrity.ts (3), verified-runtime-executable.ts (2), cursor-launch-policy.ts. — One of this dimension's main actionable groups (8 warning-level).
Enforce Boundary Type-Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d23_recommendation.md · top locations in Appendix A, every location in findings.md.
10 of 42 build units (Cargo, Go, 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: REDACTED 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.
51 finding(s): 0 critical, 51 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
REDACTED
What to do
Resolve the 50 REDACTED finding(s) in Secrets (history) — start with REDACTED (24), REDACTED (11), REDACTED (6). — One of this dimension's main actionable groups (50 issue-level).
Resolve the 1 High secret finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
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).
234 finding(s): 0 critical, 77 high, 145 medium, 12 low. 50 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 605 file(s) — `.agents/skills/pr-gardening/scripts/lib.mjs` (line 95), `.github/scripts/check-pr-linked-issue.mjs` (line 146), `REDACTED` (line 45), `cli/src/__tests__/http.test.ts` (line 60, line 74), `docker/daytona-runner/REDACTED` (line 46, lines 85–86, lines 100–101), … (+600 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 8 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
+ 20 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 9 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (9 issue-level).
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3), REDACTED. — One of this dimension's main actionable groups (4 issue-level).
No action in Static Analysis (SAST) — all 48 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (48 issue-level, 0 of them charged here).
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.
+ 3 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 25 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (23), REDACTED, REDACTED. — One of this dimension's main actionable groups (25 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 Critical 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 28 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (10), REDACTED.base (2), REDACTED.claude (2). — One of this dimension's main actionable groups (28 warning-level).
Resolve the 5 High IaC finding(s) in IaC & Container Security — start with REDACTED (2), REDACTED, REDACTED.onboard-smoke. — One of this dimension's main actionable groups (5 issue-level).
Resolve the 8 Low IaC finding(s) in IaC & Container Security — start with REDACTED (3), REDACTED (3), REDACTED. — One of this dimension's main actionable groups (8 recommendation-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.
7 of 3000 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is packages/db/scripts/clean-poisoned-claude-sessions.ts. Counted over 3000 of the 4530 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
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 12 Boundary-crossing change coupling finding(s) in Change Coupling — start with agents.ts (2), issues.ts (2), REDACTED. — One of this dimension's main actionable groups (12 issue-level).
Resolve the 15 Change coupling finding(s) in Change Coupling — start with fake-codex-app-server.rs (2), plugin.ts, company-portability.ts. — One of this dimension's main actionable groups (15 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.
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 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).
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. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.
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 2 platform declaration(s) and 0 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.
AC1 · Text alternatives5.4 / 10Adequate✓ Tool-verified
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative. (×3) — scripts/generate-org-chart-satori-comparison.ts:191, scripts/generate-org-chart-satori-comparison.ts:192, scripts/generate-org-chart-satori-comparison.ts:193
Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation). (×8) — ui/src/artifact-directions/directions/d1-solid/PanelLead.tsx:23, ui/src/artifact-directions/directions/d2-tint/PanelLead.tsx:45, ui/src/artifact-directions/directions/d3-tactile/objects/Print.tsx:60, …
What to do
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Do you agree with this assessment?
AC2 · Forms & labels5.4 / 10Adequate✓ Tool-verified
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.
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label. (×5) — packages/paperclip-runner/devtools/issue-thread/src/DevtoolsInspector.tsx:408, ui/src/adapters/openclaw-gateway/config-fields.tsx:44, ui/src/adapters/schema-config-fields.tsx:137, …
This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×12) — packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4083, packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4111, packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4115, …
This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×8) — packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4112, packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4116, packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4120, …
This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×2) — packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4510, packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6565
This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×5) — packages/plugins/plugin-llm-wiki/src/ui/app.tsx:5772, ui/src/components/AttentionQueueRow.tsx:706, ui/src/components/DecisionDateChips.tsx:54, …
A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one. (×2) — packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6274, packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6382
A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one). (×4) — ui/src/adapters/schema-config-fields.tsx:158, ui/src/components/AgentConfigForm.tsx:4080, ui/src/components/ArtifactsPanel.tsx:274, …
A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label. (×2) — ui/src/components/AgentConfigForm.tsx:2976, ui/src/components/AgentConfigForm.tsx:3750
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Do you agree with this assessment?
AC3 · Page structure7.8 / 10Strong✓ Tool-verified
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). — scripts/generate-org-chart-satori-comparison.ts:158
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×5) — scripts/generate-org-chart-satori-comparison.ts:158, ui/index.html:2, ui/storybook/public/browser-viewer.html:2, …
Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. — ui/src/pages/CompanyAccess.tsx:320
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 interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. (×4) — packages/paperclip-runner/devtools/issue-thread/src/App.tsx:1541, packages/plugins/plugin-llm-wiki/src/ui/app.tsx:2109, ui/src/components/DocumentAnnotationPopover.tsx:79, …
This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. (×6) — packages/paperclip-runner/devtools/issue-thread/src/EvidencePanel.tsx:237, packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx:37, packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx:255, …
The repo's own CSS styles .pit-strip-button with `cursor: pointer`, so this <div> is a control — but it has no role, no tabIndex={0} and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabIndex={0} + a key handler. — packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx:417
This <article> carries tabIndex={0}, so it is in the tab order and a keyboard user will land on it — but its behaviour is bound to the pointer only, with no key handler. A tabindex makes an element focusable, not operable: Enter and Space fire a click on a native <button> or <a href> and nowhere else, so this can be focused and never activated. Use a <button>, or handle Enter/Space in a key handler. — ui/src/components/DocumentAnnotationPanel.tsx:338
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler. (×11) — ui/src/components/EntityRow.tsx:153, ui/src/components/GoalTree.tsx:69, ui/src/components/IssueAttachmentsSection.tsx:296, …
This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus. (×3) — ui/src/components/IssueRow.tsx:291, ui/src/components/SidebarShell.production.tsx:199, ui/src/components/SidebarShell.tsx:213
A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}. (×8) — ui/src/components/IssuesList.tsx:2098, ui/src/components/LegacyIssuesList.tsx:1980, ui/src/components/folders/SkillFolderTree.tsx:892, …
This <div> binds pointerdown, pointerup, pointermove and double-click — pointer gestures with no keyboard form, a double-click among them. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click. — ui/src/components/PropertiesPanel.tsx:393
What to do
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
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.
aria-hidden="true" here hides the subtree from assistive tech, but a focusable descendant stays in the tab order — a keyboard user can land on a control screen readers can't see. Add inert, take the descendants out of the tab order (tabindex="-1"), or drop aria-hidden. — ui/src/components/DocumentAnnotationLayer.tsx:530
What to do
Use valid, non-abstract roles, supply the ARIA state each role requires, and never put aria-hidden on a focusable element.
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.
<span> moves — its inline style sets `animation: tone.pulse` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — packages/plugins/plugin-llm-wiki/src/ui/app.tsx:434
<span> moves — its inline style sets `transition: transform 120ms ease` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — packages/plugins/plugin-llm-wiki/src/ui/app.tsx:3588
<input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×14) — packages/plugins/plugin-workspace-diff/src/ui/index.tsx:669, ui/src/adapters/schema-config-fields.tsx:137, ui/src/components/AgentConfigForm.tsx:4072, …
<div> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×4) — packages/plugins/plugin-workspace-diff/src/ui/index.tsx:733, ui/src/components/DesignPageAside.tsx:121, ui/src/components/SidebarShell.production.tsx:219, …
`.toc .toc-summary .chevron` moves (`transition: transform 120ms ease`) 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. — packages/skills-catalog/catalog/bundled/product/wireframe/assets/site-template.html:106
`.wire` moves (`transition: transform 80ms ease, box-shadow 80ms ease`) 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. — packages/skills-catalog/catalog/bundled/product/wireframe/assets/site-template.html:145
<span> moves — its `animate-ping` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. (×4) — ui/src/components/ActivityFeed.tsx:701, ui/src/components/ArtifactsPanel.tsx:197, ui/src/components/OnboardingChat.tsx:326, …
<button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×7) — ui/src/components/AttentionQueueRow.tsx:179, ui/src/components/IssueThreadInteractionCard.tsx:997, ui/src/components/IssueThreadInteractionCard.tsx:1322, …
<textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×4) — ui/src/components/InlineEditor.tsx:392, REDACTED:1363, ui/src/components/agent-config-primitives.tsx:246, …
<select> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×3) — ui/src/components/IssueWorkspaceCard.tsx:458, ui/src/components/ProjectProperties.tsx:852, ui/src/components/ProjectProperties.tsx:909
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 · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.
Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.
Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
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.
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.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
`WakeQueueTransaction` declares 19 required operations: `findInvokableAgent`, `findNextDeferredWake`, `getQueuedCommentLiveness`, `cancelDeferredWake`, `normalizeDeferredWakeCommentIds`, `failDeferredWake`, `getPauseHoldFacts`, `getCommentSelfAuthorship`, `isCompletedDelegationMention`, `reopenIssue`, `isCompletedOnboardingHandoffWake`, `claimDeferredWakeForPromotion`, `finalizePromotedWake`, `hasExistingExecutionPath`, `hasExplicitBlockerPath`, `isAutomaticRecoverySuppressedByPauseHold`, `isImmediateRecoverySourceBlocked`, `queueReviewParticipantRecoveryRun`, `queueImmediateRecoveryRun`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — server/src/modules/wake-queue/application/ports.ts:111
`HeartbeatRecoveryDependencies` declares 16 required operations: `enterShutdown`, `getRun`, `executeRun`, `scheduleNativeSessionResumeDispatch`, `cancelHeartbeatNativeRun`, `terminateHeartbeatRunProcess`, `setRunStatus`, `setRunStatusFromLive`, `mergeRunStopMetadataForAgent`, `classifyAndPersistRunLiveness`, `releaseEnvironmentLeasesForRun`, `acknowledgeRemoteStop`, `resumeRemoteStopComments`, `dispatchPendingNativeStatusWakeups`, `cancelRunInternal`, `startNextQueuedRunForAgent`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — server/src/services/heartbeat/recovery.ts:97
`HeartbeatQueueDependencies` declares 16 required operations: `isHeartbeatRunTerminalStatus`, `isSameTaskScope`, `runTaskKey`, `filterZombieCoalesceTarget`, `getSchedulingSuppression`, `canStartNewExternalBotWork`, `executeRun`, `releaseIssueExecutionAndPromote`, `applyWakeQueuePostCommitEffects`, `publishRunLifecyclePluginEvent`, `cancelRunInternal`, `cancelActiveForAgentInternal`, `resumeExecutionWaitComments`, `resumeQueuedCommentInterrupt`, `resumeSavedLegacyComments`, `formatIssueIdentifierLink`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — server/src/services/heartbeat/queue.ts:179
`PluginIssuesClient` declares 19 required operations: `list`, `get`, `create`, `update`, `assertCheckoutOwner`, `getSubtree`, `requestWakeup`, `requestWakeups`, `listComments`, `createComment`, `createInteraction`, `suggestTasks`, `askUserQuestions`, `requestConfirmation`, `requestCheckboxConfirmation`, `listInteractions`, `respondInteraction`, `listAttachments`, `getAttachmentContent`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — packages/plugins/sdk/src/types.ts:1462
What to do
Split fat interfaces into focused role-interfaces so clients depend only on what they use.
Do you agree with this assessment?
AX8 · Test isolation10.0 / 10Exemplary✓ 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.
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.
Do you agree with this assessment?
C1 · Data Protection8.5 / 10Strong✓ Tool-verified
Other · Security — Whether sensitive data is encrypted at rest and in transit and keys are vaulted.
Method: Roslyn plus filesystem scan: encryption presence (EF ColumnEncryption, key-vault references, HTTPS enforcement) and key-derivation KDF detection. Deterministic.
No in-app HTTPS enforcement, but a trusted-proxy setting ('trust proxy' / trustProxy) indicates a reverse-proxy topology — terminating TLS in the app would be wrong in this layout. Verify the reverse proxy enforces TLS. — server/src/middleware/trust-proxy.ts:116
What to do
Strengthen data-at-rest protection: vault your keys (AWS KMS / Secrets Manager, Azure Key Vault, GCP KMS / REDACTED Manager, HashiCorp Vault) and encrypt the most sensitive columns (typeorm-encrypted, prisma-field-encryption, mongoose-field-encryption or MongoDB CSFLE) — partial coverage still leaves gaps.
Do you agree with this assessment?
C2 · Access Controls7.0 / 10Strong✓ Tool-verified
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.
Authorization IS enforced here (by route guards, auth middleware or checks that refuse a caller) — this is NOT a claim that endpoints are unprotected. What's missing is a NAMED rule set: who may do what is encoded inline where it is checked, so the rules can't be listed, reviewed or tested apart from the code that applies them. Recommendation, not a defect.
What to do
Name the access rules — roles/permissions declared once (a @Roles/@Permissions decorator with its guard, a CASL ability, a casbin model, or Supabase CREATE POLICY) and consulted where access is checked, so the rule set is reviewable and testable on its own.
Do you agree with this assessment?
C3 · Audit Trail7.5 / 10Strong✓ Tool-verified
Other · Security — Whether changes to sensitive data are recorded (who, what, when) for compliance + incident response.
An audit mechanism is present, but the trail is not yet complete — missing: an ORM write hook every change flows through (a TypeORM/MikroORM subscriber, a Sequelize or Mongoose hook, Prisma middleware or a query extension, or an event-store append), per-model coverage (@Audited, or a change-history plugin such as mongoose-history or sequelize-paper-trail applied to each model).
What to do
Back the audit convention with a structural mechanism: an ORM write hook (a TypeORM/MikroORM subscriber, a Sequelize or Mongoose hook, Prisma middleware) writing every sensitive change to an audit-log table, and apply it to each model that needs a who-changed-what trail.
Do you agree with this assessment?
C4 · Data Retention10.0 / 10Exemplary✓ Tool-verified
Other · Security — Whether data has a defined lifetime — retention periods, TTLs, cleanup jobs (storage limitation).
Method: Roslyn scan: retention/TTL configuration presence in schema; CascadeDelete detected but not scored as retention control. Deterministic, gated by PII presence.
Do you agree with this assessment?
DM10 · One transaction, one aggregate10.0 / 10Exemplary○ Nothing flagged
Other · Domain Modelling — Whether a single operation mutates more than one aggregate root. An aggregate is a consistency boundary, so saving two together fuses them into one — the second's invariants come to depend on the first's transaction, and the pair can no longer be separated. Reads of other aggregates are not counted.
Method: Neutral body surface (DDD-gated): every method body scanned for repository WRITE calls (Add/Update/Save/Remove/Delete/Insert/Store and their async forms), keyed on the ARGUMENT type rather than the repository type — three `IRepository<T>` writes collapse to one repository but are three distinct aggregates. Reads (Get/Find/Load/Query) are excluded, so loading another aggregate for context never counts. Score is offending methods over methods that write at all. Deterministic.
Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain aggregate fused to a persistence ORM (TypeORM/Prisma/MikroORM/Sequelize/Mongoose) 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 · Domain Modelling — Whether one domain rule is decided — or one measurement produced — in more than one place, rather than living on the type that owns it.
Method: Neutral body surface plus Roslyn (DDD-gated), two arms. DECISION (Roslyn only): a predicate over a domain type's members judged in two or more types, where none of those decisions live on the owning type — operands of comparisons and relational property patterns only, so a member merely passed as an argument is not judged. DERIVATION: a plain all-numeric carrier of ≥2 members, with no base type and exactly one constructor, CONSTRUCTED as the result of a method (returned or assigned, never inline as an argument) in two or more types other than its own — the same measurement produced twice, which centralising the judgement does not fix. DERIVATION runs on every language whose frontend declares the produced-or-passed fact per construction (Roslyn and the Java sidecar today); a target with only the derivation arm carries an engine gap naming the decision arm as not assessed, and a frontend that declares nothing keeps the dimension not measured rather than clean. Single-member rules, test code and generated code are out of population for both. Advisory.
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.
Other · Code Health — Unreviewed-generation residue in this repository's JavaScript/TypeScript: functions whose whole body still throws a "not implemented" error, and placeholder text (lorem ipsum, changeme/replace_me…) left in strings and JSX of non-test, non-generated code. Scored as a quality signature, never as a claim about authorship.
Method: Roslyn syntax scan: NotImplementedException throws and placeholder string literals in non-test, non-generated shipped code. Deterministic, code-shape signature.
Other · Code Health — Unfinished work detected by code SHAPE, not keywords, in this repository's JavaScript/TypeScript: functions that only throw a "not implemented" error, functions that take inputs and return a constant or do nothing, async functions that never await, dead `if (false)` branches, and skeleton classes most of whose methods are holes.
Method: Roslyn syntax scan: incompleteness by code shape (constant-returning methods, async-never-await, #if false branches, guards that return what the code already falls through to, tests an earlier guard already decided, comparisons against NaN, skeleton types), not keyword-gated. Deterministic, code-shape heuristic.
`addAllowedHostname` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — cli/src/commands/allowed-hostname.ts:6
`envCommand` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — cli/src/commands/env.ts:39
`worktreeCleanupCommand` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — cli/src/commands/worktree.ts:2882
`worktreeEnvCommand` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — cli/src/commands/worktree.ts:3018
`worktreeListCommand` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — cli/src/commands/worktree.ts:3628
Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition. (×12) — doc/plans/chat-adapters/generate-wireframes.mjs:264, packages/paperclip-runner/src/contracts/provider-trace-file-sink.ts:79, packages/paperclip-runner/src/eval/live-workflow-executor.ts:1187, …
`isPidRunning` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — REDACTED:1204
`writeCheckpointBaseline` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — packages/adapter-utils/src/workspace-checkpoint.ts:8
The guard above `return appliedFromHashes;` also returns `appliedFromHashes`, so no input can make it matter. Implement the distinction that was intended, or delete the guard. — REDACTED:898
The guard above `return false;` also returns `false`, so no input can make it matter. Implement the distinction that was intended, or delete the guard. (×2) — packages/paperclip-runner/src/drivers/codex/codex-thread-normalization.ts:180, server/src/services/heartbeat/recovery.ts:287
`main` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — scripts/ci-profile/authorize.mjs:52
The guard above `return "engineer";` also returns `"engineer"`, so no input can make it matter. Implement the distinction that was intended, or delete the guard. — scripts/generate-company-assets.ts:119
`verify` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — scripts/storybook-visual-baseline.mjs:133
`pack` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — scripts/storybook-visual-baseline.mjs:152
`upload` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — scripts/storybook-visual-baseline.mjs:214
The guard above `return "text";` also returns `"text"`, so no input can make it matter. Implement the distinction that was intended, or delete the guard. — server/src/services/agent-instructions.ts:113
`readCompanyApprovalDefault` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — server/src/services/company-portability.ts:3012
`onConnected` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it. — ui/src/components/ai-connections/AiConnectionCredentialStep.tsx:96
`onConnect` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it. — ui/src/components/ai-connections/AiConnectionDesignExamples.tsx:52
`onChange` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it. — ui/src/components/ai-connections/AiConnectionDesignExamples.tsx:58
`onSubmit` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it. — ui/src/components/ai-connections/AiConnectionDesignExamples.tsx:59
`onStored` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it. — ui/src/components/new-agent/AgentProviderConnection.tsx:369
`onSelect` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it. — ui/src/components/new-agent/ExternalAgentInviteDialog.tsx:233
`onBack` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it. (×2) — ui/src/components/onboarding/ConnectModelPreview.tsx:145, ui/src/features/connections/ConnectionSetupFlow.tsx:4619
`onPrimary` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it. — ui/src/components/onboarding/ConnectModelPreview.tsx:148
`onConnectionChange` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it. — ui/src/features/connections/AgentMailApiKeyField.tsx:13
`onContinue` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it. — ui/src/features/connections/ConnectionSetupFlow.tsx:4619
What to do
Finish or delete the unfinished stubs (functions that throw "not implemented", or whose body is empty or a bare constant) — they are dead surface that looks live.
Clear the softer debt: re-enable or delete skipped tests, decide whether each empty function is a deliberate no-op (and say so in a comment), and replace blanket `eslint-disable` / `@ts-nocheck` with targeted, justified suppressions.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
Add a README to the 21 of 50 project(s) that lack one — worth up to 0.8 pts.
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
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 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 19/29 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `.`, `packages/adapter-utils`, `packages/google-sheets-mcp-server`, `packages/kv-demo-mcp-server` and 5 more.
`packages/db/src/backup.ts` reports through `console.*` at line 74 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/backup.ts:74
`packages/db/src/backup.ts` reports through `console.*` at line 75 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/backup.ts:75
`packages/db/src/backup.ts` reports through `console.*` at line 76 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/backup.ts:76
`packages/db/src/backup.ts` reports through `console.*` at line 86 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/backup.ts:86
`packages/db/src/backup.ts` reports through `console.*` at line 88 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/backup.ts:88
`packages/db/src/backup.ts` reports through `console.*` at line 90 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/backup.ts:90
`packages/db/src/backup.ts` reports through `console.*` at line 92 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/backup.ts:92
`packages/db/src/migrate.ts` reports through `console.*` at line 7 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/migrate.ts:7
`packages/db/src/migrate.ts` reports through `console.*` at line 12 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/migrate.ts:12
`packages/db/src/migrate.ts` reports through `console.*` at line 16 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/migrate.ts:16
`packages/db/src/migrate.ts` reports through `console.*` at line 23 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/migrate.ts:23
`packages/db/src/response-capture.ts` reports through `console.*` at line 153 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/response-capture.ts:153
`packages/db/src/test-embedded-postgres.ts` reports through `console.*` at line 453 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/test-embedded-postgres.ts:453
`packages/db/src/test-embedded-postgres.ts` reports through `console.*` at line 692 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/test-embedded-postgres.ts:692
`packages/db/src/__fixtures__/postgres-connection-recovery.mjs` reports through `console.*` at line 118 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/db/src/__fixtures__/postgres-connection-recovery.mjs:118
`packages/plugins/sandbox-providers/daytona/src/file-sync.ts` reports through `console.*` at line 946 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/plugins/sandbox-providers/daytona/src/file-sync.ts:946
`packages/plugins/sandbox-providers/daytona/src/plugin.ts` reports through `console.*` at line 494 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/plugins/sandbox-providers/daytona/src/plugin.ts:494
`packages/plugins/sandbox-providers/daytona/src/plugin.ts` reports through `console.*` at line 1775 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/plugins/sandbox-providers/daytona/src/plugin.ts:1775
`packages/plugins/sandbox-providers/daytona/src/plugin.ts` reports through `console.*` at line 2929 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/plugins/sandbox-providers/daytona/src/plugin.ts:2929
`packages/plugins/sandbox-providers/daytona/src/plugin.ts` reports through `console.*` at line 2948 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/plugins/sandbox-providers/daytona/src/plugin.ts:2948
`packages/plugins/sandbox-providers/e2b/src/plugin.ts` reports through `console.*` at line 195 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/plugins/sandbox-providers/e2b/src/plugin.ts:195
`packages/plugins/sandbox-providers/e2b/src/plugin.ts` reports through `console.*` at line 208 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/plugins/sandbox-providers/e2b/src/plugin.ts:208
`packages/plugins/sandbox-providers/kubernetes/src/plugin.ts` reports through `console.*` at line 319 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/plugins/sandbox-providers/kubernetes/src/plugin.ts:319
`packages/plugins/sandbox-providers/kubernetes/src/plugin.ts` reports through `console.*` at line 323 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/plugins/sandbox-providers/kubernetes/src/plugin.ts:323
`packages/plugins/sandbox-providers/modal/src/plugin.ts` reports through `console.*` at line 177 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/plugins/sandbox-providers/modal/src/plugin.ts:177
`packages/plugins/sdk/src/ui/components.ts` reports through `console.*` at line 573 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/plugins/sdk/src/ui/components.ts:573
`packages/plugins/sdk/src/ui/types.ts` reports through `console.*` at line 505 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/plugins/sdk/src/ui/types.ts:505
`REDACTED` reports through `console.*` at line 1170 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:1170
`server/src/config-file.ts` reports through `console.*` at line 37 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — server/src/config-file.ts:37
`server/src/dev-native-runner-status.ts` reports through `console.*` at line 50 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — server/src/dev-native-runner-status.ts:50
`server/src/instrumentation.ts` reports through `console.*` at line 111 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — server/src/instrumentation.ts:111
`server/src/instrumentation.ts` reports through `console.*` at line 181 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — server/src/instrumentation.ts:181
`server/src/instrumentation.ts` reports through `console.*` at line 324 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — server/src/instrumentation.ts:324
`server/src/instrumentation.ts` reports through `console.*` at line 357 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — server/src/instrumentation.ts:357
`server/src/instrumentation.ts` reports through `console.*` at line 460 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — server/src/instrumentation.ts:460
`server/src/instrumentation.ts` reports through `console.*` at line 493 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — server/src/instrumentation.ts:493
`server/src/instrumentation.ts` reports through `console.*` at line 529 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — server/src/instrumentation.ts:529
`server/src/instrumentation.ts` reports through `console.*` at line 562 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — server/src/instrumentation.ts:562
`server/src/sentry.ts` reports through `console.*` at line 73 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — server/src/sentry.ts:73
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Route service-code `console.*` output through the module's structured logger (with named fields), so delivery outcomes and failures reach the log pipeline with a level.
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.
`REDACTED` run(s) a static-analysis scan, but no workflow that runs one is triggered by a pull request (or a merge queue, or an unfiltered push) — the scan fires on a schedule or a manual dispatch only. A vulnerable change therefore merges clean and is reported on the next scheduled run, by which time it is on the default branch and the only remedy is a follow-up fix. Add the pull-request trigger to the workflow that runs the scan so the finding arrives before the merge rather than after it.
What to do
Trigger your SAST workflow on pull requests — a scan that only runs on a cron reports history, it does not gate.
Dependabot is configured but does not watch `cargo`, `gomod` — add those `package-ecosystem` entries to REDACTED 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.
Do you agree with this assessment?
P5 · DR & Backup10.0 / 10Exemplary✓ Tool-verified
Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.
Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.
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.
`http.request(` 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. — packages/adapter-utils/src/local-process-sandbox.ts:262
`fetch(` 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. (×13) — scripts/benchmark-apps-startup.mjs:14, scripts/dev-runner.mjs:435, scripts/dev-runner.ts:683, …
`superagent` 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) — scripts/ingest-app-definitions.mjs:1048, scripts/ingest-app-definitions.mjs:1156, scripts/ingest-app-definitions.mjs:1820
`fetcher(` 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. — server/src/services/chat-sdk-runtime.ts:2874
`fetchImpl(` 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. (×2) — server/src/services/github-commit-details.ts:110, server/src/services/github-external-object-provider.ts:473
What to do
Bound every outbound call: pass `signal: AbortSignal.timeout(ms)` to `fetch`, set `timeout` on the axios instance (`axios.create({ timeout })`), and add retries with back-off (`axios-retry`, `p-retry`) and a breaker (`opossum`, `cockatiel`) around dependencies that fail.
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 the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
`fs.existsSync` in `databaseCheck` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/checks/database-check.ts:73
`fs.mkdirSync` in `databaseCheck` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/checks/database-check.ts:74
`fs.mkdtempSync` in `runGitHubCurl` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/commands/install.ts:152
`fs.writeFileSync` in `runGitHubCurl` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/commands/install.ts:155
`fs.rmSync` in `runGitHubCurl` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/commands/install.ts:158
`fs.existsSync` in `smokePayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/commands/install.ts:176
`fs.existsSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/commands/install.ts:190
`fs.mkdirSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/commands/install.ts:195
`fs.lstatSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/commands/install.ts:196
`fs.chmodSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×3) — cli/src/commands/install.ts:200, cli/src/commands/install.ts:201, cli/src/commands/install.ts:202
`fs.rmSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×3) — cli/src/commands/install.ts:205, cli/src/commands/install.ts:234, cli/src/commands/install.ts:235
`fs.writeFileSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/commands/install.ts:207
`fs.renameSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/commands/install.ts:231
`fs.existsSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/commands/install.ts:250
`fs.readFileSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×3) — cli/src/commands/install.ts:251, cli/src/commands/install.ts:283, cli/src/commands/install.ts:287
`fs.mkdirSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×3) — cli/src/commands/install.ts:256, cli/src/commands/install.ts:269, cli/src/commands/install.ts:273
`fs.lstatSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/commands/install.ts:257
`fs.chmodSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×3) — cli/src/commands/install.ts:261, cli/src/commands/install.ts:262, cli/src/commands/install.ts:263
`fs.rmSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — cli/src/commands/install.ts:268, cli/src/commands/install.ts:308
`fs.readdirSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/commands/install.ts:298
`fs.renameSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — cli/src/commands/install.ts:306
`fs.existsSync` in `callback to withInstallStoreLock` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — cli/src/commands/install.ts:377, cli/src/commands/install.ts:404
`fs.readlinkSync` in `callback to withInstallStoreLock` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — cli/src/commands/install.ts:377, cli/src/commands/install.ts:404
`fs.rmSync` in `callback to withInstallStoreLock` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — cli/src/commands/install.ts:379, cli/src/commands/install.ts:410
`fs.existsSync` in `ensureEmbeddedPostgres` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — cli/src/commands/routines.ts:145, cli/src/commands/routines.ts:156
What to do
TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
Do you agree with this assessment?
R1 · Type Safety9.5 / 10Exemplary✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
What to do
Migrate the remaining .js/.jsx files to TypeScript.
React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Deterministic.
289 duplicated blocks under the repository root have copies in at least two of the sibling directories cli, docker, packages, scripts, server, ui — 175 of them are reported below, and 114 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 289 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 289 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 289 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — scripts/ensure-workspace-package-links.ts:9
198 duplicated blocks under packages/adapters/ have copies in at least two of the sibling directories claude-local, codex-local, cursor-cloud, cursor-local, gemini-local, grok-local (+5 more sibling(s) not listed) — 179 of them are reported below, and 19 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 198 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 198 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 198 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/adapters/gemini-local/src/server/execute.ts:99
191 duplicated blocks under server/src/ have copies in at least two of the sibling directories adapters, auth, lib, middleware, modules, realtime (+4 more sibling(s) not listed) — 94 of them are reported below, and 97 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 191 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 191 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 191 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — server/src/modules/wake-queue/domain/context.ts:28
169 duplicated blocks under server/src/services/ have copies in at least two of the sibling directories chat-channels, connectors, grok-bot, heartbeat, native-runtime, recovery (+2 more sibling(s) not listed) — 77 of them are reported below, and 92 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 169 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 169 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 169 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — server/src/services/connectors/slack-catalog.ts:94
96 duplicated blocks under packages/ have copies in at least two of the sibling directories adapter-utils, adapters, db, google-sheets-mcp-server, kv-demo-mcp-server, mcp-server (+5 more sibling(s) not listed) — 58 of them are reported below, and 38 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 96 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 96 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 96 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/skills-catalog/src/catalog-builder.ts:72
60 duplicated blocks under packages/paperclip-runner/src/ have copies in at least two of the sibling directories backends, browser, catalog, cli, conformance, contracts (+15 more sibling(s) not listed) — 38 of them are reported below, and 22 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 60 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 60 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 60 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/paperclip-runner/src/protocol/semantic-tool-receipts.ts:86
55 duplicated blocks under server/src/services/chat-channels/ have copies in at least two of the sibling directories discord, github, imessage-photon, inbound, interactions, microsoft-teams (+4 more sibling(s) not listed) — 29 of them are reported below, and 26 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 55 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 55 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 55 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — server/src/services/chat-channels/discord/publication-preparation.ts:18
50 duplicated blocks under packages/paperclip-runner/ have copies in at least two of the sibling directories devtools, scripts, src — 41 of them are reported below, and 9 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 50 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 50 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 50 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/paperclip-runner/devtools/browser/src/live/use-live-console.ts:1
32 duplicated blocks under packages/plugins/sandbox-providers/ have copies in at least two of the sibling directories cloudflare, daytona, e2b, exe-dev, kubernetes, modal (+1 more sibling(s) not listed) — 23 of them are reported below, and 9 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 32 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 32 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 32 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/plugins/sandbox-providers/daytona/src/file-sync.ts:258
20 duplicated blocks under packages/paperclip-runner/src/drivers/ have copies in at least two of the sibling directories acpx, codex, dot, external, opencode — 16 of them are reported below, and 4 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 20 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 20 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 20 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/paperclip-runner/src/drivers/codex/codex-harness-session.ts:508
14 duplicated blocks under server/src/services/tool-access/ have copies in at least two of the sibling directories activity, catalog, connections, oauth, profiles, token-broker — 10 of them are reported below, and 4 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 14 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 14 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 14 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — server/src/services/tool-access/catalog/discovery.ts:275
13 duplicated blocks under ui/src/adapters/ have copies in at least two of the sibling directories claude-local, codex-local, cursor, gemini-local, grok-local, hermes-gateway (+6 more sibling(s) not listed) — 11 of them are reported below, and 2 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 13 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 13 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 13 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — ui/src/adapters/claude-local/config-fields.tsx:76
12 duplicated blocks under ui/src/artifact-directions/directions/ have copies in at least two of the sibling directories d1-solid, d2-tint, d4-hybrid — 11 of them are reported below, and 1 is counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 12 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 12 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 12 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — ui/src/artifact-directions/directions/d2-tint/Content.tsx:1
8 duplicated blocks under packages/plugins/plugin-llm-wiki/src/ have copies in at least two of the sibling directories ui, wiki — 0 of them are reported below, and 8 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 8 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 8 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 8 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/plugins/plugin-llm-wiki/src/ui/app.tsx:839
6 of the duplicated blocks reported below have copies in at least two of the sibling directories checks, client, commands, config, services under cli/src/. That concentration is one structural fact, not 6 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 6 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — cli/src/checks/llm-check.ts:22
ui/src/components/IssuesList.tsx:1 · ui/src/components/LegacyIssuesList.tsx:2 — these 2 files are line-for-line copies of one another — 1625 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui/src/components/IssuesList.tsx:1
ui/src/pages/Routines.production.tsx:1 · ui/src/pages/Routines.tsx:1 — these 2 files are line-for-line copies of one another — 987 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui/src/pages/Routines.production.tsx:1
ui/src/pages/RoutineDetail.production.tsx:1 · ui/src/pages/RoutineDetail.tsx:1 — these 2 files are line-for-line copies of one another — 598 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui/src/pages/RoutineDetail.production.tsx:1
ui/src/components/SidebarAgents.production.tsx:1 · ui/src/components/SidebarAgents.tsx:1 — these 2 files are line-for-line copies of one another — 485 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui/src/components/SidebarAgents.production.tsx:1
ui/src/pages/OrgChart.production.tsx:1 · ui/src/pages/OrgChart.tsx:1 — these 2 files are line-for-line copies of one another — 427 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui/src/pages/OrgChart.production.tsx:1
ui/src/pages/Agents.production.tsx:1 · ui/src/pages/Agents.tsx:1 — these 2 files are line-for-line copies of one another — 420 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui/src/pages/Agents.production.tsx:1
packages/adapters/gemini-local/src/server/execute.ts:99 · packages/adapters/kimi-local/src/server/execute.ts:136 — the two spans are one implementation copied and then locally edited — 2470 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/adapters/gemini-local/src/server/execute.ts:99
packages/paperclip-runner/devtools/browser/src/live/use-live-console.ts:1 · packages/paperclip-runner/src/react/use-runner-console.ts:1 — these 2 files are line-for-line copies of one another — 345 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — packages/paperclip-runner/devtools/browser/src/live/use-live-console.ts:1
packages/paperclip-runner/devtools/browser/src/live/transcript-model.ts:2 · packages/paperclip-runner/src/browser/transcript-model.ts:2 — these 2 files are line-for-line copies of one another — 250 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — packages/paperclip-runner/devtools/browser/src/live/transcript-model.ts:2
packages/adapters/cursor-local/src/server/execute.ts:401 · packages/adapters/opencode-local/src/server/execute.ts:458 — the two spans are one implementation copied and then locally edited — 1440 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/adapters/cursor-local/src/server/execute.ts:401
packages/adapters/gemini-local/src/server/acp.ts:37 · packages/adapters/kimi-local/src/server/acp.ts:31 — the two spans are one implementation copied and then locally edited — 1663 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/adapters/gemini-local/src/server/acp.ts:37
ui/src/components/SidebarCompanyMenu.production.tsx:1 · ui/src/components/SidebarCompanyMenu.tsx:1 — these 2 files are line-for-line copies of one another — 241 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui/src/components/SidebarCompanyMenu.production.tsx:1
packages/adapters/gemini-local/src/server/execute.ts:249 · packages/adapters/opencode-local/src/server/execute.ts:249 — the two spans are one implementation copied and then locally edited — 1361 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/adapters/gemini-local/src/server/execute.ts:249
ui/src/components/SidebarAccountMenu.production.tsx:2 · ui/src/components/SidebarAccountMenu.tsx:2 — these 2 files are line-for-line copies of one another — 169 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui/src/components/SidebarAccountMenu.production.tsx:2
packages/paperclip-runner/devtools/browser/src/live/SessionPanel.tsx:33 · packages/paperclip-runner/src/react/session-timeline.tsx:61 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — packages/paperclip-runner/devtools/browser/src/live/SessionPanel.tsx:33
packages/skills-catalog/src/catalog-builder.ts:72 · packages/teams-catalog/src/catalog-builder.ts:68 — the two spans are one implementation copied and then locally edited — 1163 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/skills-catalog/src/catalog-builder.ts:72
ui/src/components/SidebarStarredProjects.production.tsx:1 · ui/src/components/SidebarStarredProjects.tsx:1 — these 2 files are line-for-line copies of one another — 148 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui/src/components/SidebarStarredProjects.production.tsx:1
server/src/services/chat-teams-inline-images.ts:33 · server/src/services/chat-telegram-photo.ts:18 — the two spans are one implementation copied and then locally edited — 997 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — server/src/services/chat-teams-inline-images.ts:33
packages/paperclip-runner/devtools/browser/src/live/Inspector.tsx:1 · packages/paperclip-runner/src/react/inspector.tsx:1 — these 2 files are line-for-line copies of one another — 145 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — packages/paperclip-runner/devtools/browser/src/live/Inspector.tsx:1
server/src/services/activity.ts:145 · server/src/services/heartbeat/run-lifecycle.ts:2752 — the two spans are one implementation copied and then locally edited — 906 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — server/src/services/activity.ts:145
server/src/services/chat-channels/slack/task-start-resolution.ts:274 · server/src/services/chat-channels/slack/task-start.ts:639 — the two spans are one implementation copied and then locally edited — 645 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — server/src/services/chat-channels/slack/task-start-resolution.ts:274
server/src/services/secrets.ts:5307 · server/src/services/secrets.ts:5464 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — server/src/services/secrets.ts:5307
server/src/services/decision-models.ts:38 · server/src/services/prompt-injection-prevention.ts:37 — the two spans are one implementation copied and then locally edited — 2211 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — server/src/services/decision-models.ts:38
server/src/services/chat-github-registration.ts:94 · server/src/services/chat-github-wizard.ts:134 — the two spans are one implementation copied and then locally edited — 646 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — server/src/services/chat-github-registration.ts:94
server/src/services/managed-agent-profiles.ts:83 · server/src/services/remote-agent-profiles.ts:132 — the two spans are one implementation copied and then locally edited — 707 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — server/src/services/managed-agent-profiles.ts:83
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 · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).
Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.
cli/src/commands/client/plugin.ts:4 reaches into another package with a relative path (../../../../packages/plugins/create-paperclip-plugin/src/index.js) — import the package by name instead. — cli/src/commands/client/plugin.ts:4
cli/src/config/schema.ts:1 reaches into another package with a relative path (../../../packages/shared/src/config-schema.js) — import the package by name instead. — cli/src/config/schema.ts:1
cli/src/telemetry.ts:2 reaches into another package with a relative path (../../packages/shared/src/telemetry/index.js) — import the package by name instead. — cli/src/telemetry.ts:2
packages/paperclip-runner/scripts/controlled-evals/manifest.mjs:6 reaches into another package with a relative path (../../../../server/package.json) — import the package by name instead. — packages/paperclip-runner/scripts/controlled-evals/manifest.mjs:6
packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:1 reaches into another package with a relative path (../../../../tests/runner-e2e/cost-ledger.js) — import the package by name instead. — packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:1
packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:1 imports tests/runner-e2e/cost-ledger.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on. — packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:1
packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:2 reaches into another package with a relative path (../../../../tests/runner-e2e/eval-gateway.js) — import the package by name instead. — packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:2
packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:2 imports tests/runner-e2e/eval-gateway.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on. — packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:2
packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:3 reaches into another package with a relative path (../../../../tests/runner-e2e/operating-overhead.js) — import the package by name instead. — packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:3
packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:3 imports tests/runner-e2e/operating-overhead.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on. — packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:3
packages/paperclip-runner/scripts/generate-protocol-schema-module.mjs:5 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/paperclip-runner/scripts/generate-protocol-schema-module.mjs:5
packages/paperclip-runner/scripts/generate-protocol-schema-module.mjs:6 imports ajv/dist/standalone/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/paperclip-runner/scripts/generate-protocol-schema-module.mjs:6
packages/paperclip-runner/scripts/grok-native-smoke.mjs:27 reaches into another package with a relative path (../../../server/package.json) — import the package by name instead. — packages/paperclip-runner/scripts/grok-native-smoke.mjs:27
packages/paperclip-runner/scripts/lib/capability-inventory.mjs:4 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/paperclip-runner/scripts/lib/capability-inventory.mjs:4
REDACTED:6 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — REDACTED:6
packages/paperclip-runner/scripts/run-pr-vitest-lane.mjs:27 reaches into another package with a relative path (../../../scripts/ci-profile/record.mjs) — import the package by name instead. — packages/paperclip-runner/scripts/run-pr-vitest-lane.mjs:27
packages/paperclip-runner/src/drivers/opencode/mcp-bridge.ts:3 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/paperclip-runner/src/drivers/opencode/mcp-bridge.ts:3
packages/paperclip-runner/src/drivers/runner-tool-bridge.ts:10 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/paperclip-runner/src/drivers/runner-tool-bridge.ts:10
packages/paperclip-runner/src/semantic-tools/dispatcher.ts:1 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/paperclip-runner/src/semantic-tools/dispatcher.ts:1
packages/paperclip-runner/src/semantic-tools/paperclip-dispatcher.ts:1 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/paperclip-runner/src/semantic-tools/paperclip-dispatcher.ts:1
packages/shared/scripts/generate-runner-skill-frontmatter.ts:5 reaches into another package with a relative path (../../paperclip-runner/package.json) — import the package by name instead. — packages/shared/scripts/generate-runner-skill-frontmatter.ts:5
scripts/__tests__/grok-public-install-sandbox.test.mjs:13 reaches past another workspace package's public entry into its internals with a relative path (../../packages/paperclip-runner/src/live/runner-binary.ts) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — scripts/__tests__/grok-public-install-sandbox.test.mjs:13
scripts/backfill-issue-reference-mentions.ts:1 reaches into another package with a relative path (../packages/db/src/index.js) — import the package by name instead. — scripts/backfill-issue-reference-mentions.ts:1
scripts/backfill-issue-reference-mentions.ts:2 reaches into another package with a relative path (../server/src/config.js) — import the package by name instead. — scripts/backfill-issue-reference-mentions.ts:2
scripts/backfill-issue-reference-mentions.ts:3 reaches into another package with a relative path (../server/src/services/issue-references.js) — import the package by name instead. — scripts/backfill-issue-reference-mentions.ts:3
REDACTED:6 reaches into another package with a relative path (../server/package.json) — import the package by name instead. — REDACTED:6
REDACTED:7 reaches into another package with a relative path (../packages/db/src/index.js) — import the package by name instead. — REDACTED:7
REDACTED:8 reaches into another package with a relative path (../server/src/agent-run-cancellation.js) — import the package by name instead. — REDACTED:8
REDACTED:9 reaches into another package with a relative path (../server/src/middleware/agent-run-authentication.js) — import the package by name instead. — REDACTED:9
scripts/benchmark-budget-enforcement.ts:8 reaches into another package with a relative path (../packages/db/src/index.js) — import the package by name instead. — scripts/benchmark-budget-enforcement.ts:8
scripts/benchmark-budget-enforcement.ts:10 reaches into another package with a relative path (../server/package.json) — import the package by name instead. — scripts/benchmark-budget-enforcement.ts:10
scripts/benchmark-budget-enforcement.ts:39 reaches into another package with a relative path (../server/src/services/budgets.js) — import the package by name instead. — scripts/benchmark-budget-enforcement.ts:39
scripts/benchmark-budget-enforcement.ts:42 reaches into another package with a relative path (../server/src/services/budget-reservations.js) — import the package by name instead. — scripts/benchmark-budget-enforcement.ts:42
scripts/benchmark-budget-enforcement.ts:43 reaches into another package with a relative path (../server/src/modules/run-dispatch/adapters/postgres.js) — import the package by name instead. — scripts/benchmark-budget-enforcement.ts:43
scripts/benchmark-chat-native-progress.mjs:5 reaches into another package with a relative path (../packages/db/src/index.js) — import the package by name instead. — scripts/benchmark-chat-native-progress.mjs:5
scripts/benchmark-chat-native-progress.mjs:207 reaches into another package with a relative path (../server/src/services/chat-run-publications.js) — import the package by name instead. — scripts/benchmark-chat-native-progress.mjs:207
scripts/benchmark-recovery-queries.ts:7 reaches into another package with a relative path (../packages/db/src/index.js) — import the package by name instead. — scripts/benchmark-recovery-queries.ts:7
scripts/benchmark-recovery-queries.ts:8 reaches into another package with a relative path (../server/src/services/conversation-continuation.js) — import the package by name instead. — scripts/benchmark-recovery-queries.ts:8
scripts/benchmark-recovery-queries.ts:9 reaches into another package with a relative path (../server/src/services/execution-blocker.js) — import the package by name instead. — scripts/benchmark-recovery-queries.ts:9
scripts/benchmark-recovery-queries.ts:10 reaches into another package with a relative path (../server/src/services/execution-status-delivery.js) — import the package by name instead. — scripts/benchmark-recovery-queries.ts:10
What to do
Fix the listed violations: import through the target package's declared public entry rather than a deep path into its internals or a relative path into its directory (249 rows); move the shared test helper into a source directory production code may depend on (56 rows); respect the layer/slice order — import only through a slice's public index and never upward into a higher layer (46 rows).
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.
OnboardingWizardInner has cyclomatic complexity 436 and cognitive complexity 327; 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. — ui/src/components/OnboardingWizard.tsx:490
(anonymous) has cyclomatic complexity 403 and cognitive complexity 445; 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. — server/src/routes/issues.ts:13693
TaskDetailSurface has cyclomatic complexity 396 and cognitive complexity 352; 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. — ui/src/pages/IssueDetail.tsx:3146
AgentConfigForm has cyclomatic complexity 396 and cognitive complexity 341; 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. — ui/src/components/AgentConfigForm.tsx:345
(anonymous) has cyclomatic complexity 387 and cognitive complexity 659; 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. — tests/runner-e2e/runner.spec.ts:588
executeRunAttempt has cyclomatic complexity 380 and cognitive complexity 478; 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. — server/src/services/heartbeat.ts:1764
IssueProperties has cyclomatic complexity 378 and cognitive complexity 349; 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. — ui/src/components/issue-properties/IssueProperties.tsx:233
importBundle has cyclomatic complexity 360 and cognitive complexity 768; 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. — server/src/services/company-portability.ts:5255
connectGalleryApp has cyclomatic complexity 336 and cognitive complexity 422; 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. — server/src/services/tool-access.ts:1592
(anonymous) has cyclomatic complexity 313 and cognitive complexity 371; 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. — server/src/services/heartbeat/queue.ts:2812
executeFixture has cyclomatic complexity 298 and cognitive complexity 386; 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. — server/src/__tests__/native-status-arbiter-corpus.test.ts:559
StandardConnectionSetupFlow has cyclomatic complexity 281 and cognitive complexity 235; 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. — ui/src/features/connections/ConnectionSetupFlow.tsx:634
exportBundle has cyclomatic complexity 257 and cognitive complexity 417; 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. — server/src/services/company-portability.ts:3877
Setup has cyclomatic complexity 254 and cognitive complexity 198; 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. — ui/src/components/new-agent/NewAgentSetup.tsx:109
executeEnvironmentTask has cyclomatic complexity 242 and cognitive complexity 259; 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. — server/src/services/environment-task-runtime.ts:32
resolveQuestionResponseChain has cyclomatic complexity 240 and cognitive complexity 184; 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. — server/src/services/native-runtime/external-chat-question-response.ts:206
(anonymous) has cyclomatic complexity 237 and cognitive complexity 452; 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. — ui/src/components/TaskChatThread.tsx:1512
#resume has cyclomatic complexity 225 and cognitive complexity 256; 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. — packages/paperclip-runner/src/live/runnerd-codex-transport.ts:5146
renderPaperclipWakePromptBody has cyclomatic complexity 223 and cognitive complexity 354; 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. — REDACTED:2264
createRunnerdBackendWithinSessionClaim has cyclomatic complexity 218 and cognitive complexity 215; 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. — server/src/services/native-runtime/native-session-executor.ts:11789
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files4.4 / 10Weak✓ 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.
server/src/routes/issues.ts has 19001 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/routes/issues.ts:1
server/src/services/native-runtime/native-session-executor.ts has 13856 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/native-runtime/native-session-executor.ts:1
server/src/services/issues.ts has 13250 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/issues.ts:1
server/src/routes/openapi.ts has 11856 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/routes/openapi.ts:1
server/src/services/tool-gateway.ts has 11359 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/tool-gateway.ts:1
server/src/services/workspace-runtime.ts has 8672 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/workspace-runtime.ts:1
ui/src/pages/IssueDetail.tsx has 8593 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui/src/pages/IssueDetail.tsx:1
packages/paperclip-runner/src/live/runnerd-codex-transport.ts has 7345 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/paperclip-runner/src/live/runnerd-codex-transport.ts:1
server/src/routes/agents.ts has 7331 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/routes/agents.ts:1
server/src/services/company-skills.ts has 7006 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/company-skills.ts:1
packages/plugins/plugin-llm-wiki/src/ui/app.tsx has 6653 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/plugins/plugin-llm-wiki/src/ui/app.tsx:1
ui/src/components/IssueChatThread.tsx has 6539 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui/src/components/IssueChatThread.tsx:1
REDACTED has 6193 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
server/src/services/company-portability.ts has 6122 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/company-portability.ts:1
packages/adapter-utils/src/acpx-engine/execute.ts has 5736 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/adapter-utils/src/acpx-engine/execute.ts:1
server/src/services/secrets.ts has 5521 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/secrets.ts:1
ui/src/pages/CompanySkills.production.tsx has 5411 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui/src/pages/CompanySkills.production.tsx:1
ui/src/pages/CompanySkills.tsx has 5388 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui/src/pages/CompanySkills.tsx:1
server/src/services/issue-thread-interactions.ts has 5081 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/issue-thread-interactions.ts:1
server/src/services/execution-workspaces.ts has 4913 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/execution-workspaces.ts:1
server/src/services/heartbeat/queue.ts has 4745 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/heartbeat/queue.ts:1
REDACTED has 4716 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
REDACTED has 4696 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
server/src/services/tool-access.ts has 4694 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/tool-access.ts:1
packages/plugins/plugin-llm-wiki/src/wiki/core.ts has 4662 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/plugins/plugin-llm-wiki/src/wiki/core.ts:1
ui/src/pages/Secrets.tsx has 4650 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui/src/pages/Secrets.tsx:1
ui/src/pages/AgentDetail.tsx has 4557 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui/src/pages/AgentDetail.tsx:1
ui/src/features/connections/ConnectionSetupFlow.tsx has 4556 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui/src/features/connections/ConnectionSetupFlow.tsx:1
server/src/services/environment-runtime.ts has 4491 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/environment-runtime.ts:1
REDACTED has 4388 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
ui/src/pages/AgentDetail.production.tsx has 4274 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui/src/pages/AgentDetail.production.tsx:1
cli/src/commands/worktree.ts has 4231 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — cli/src/commands/worktree.ts:1
ui/src/components/AgentConfigForm.tsx has 4098 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui/src/components/AgentConfigForm.tsx:1
server/src/services/heartbeat.ts has 3985 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/heartbeat.ts:1
ui/src/components/IssueThreadInteractionCard.tsx has 3823 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui/src/components/IssueThreadInteractionCard.tsx:1
REDACTED has 3668 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
server/src/services/plugin-worker-manager.ts has 3647 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/plugin-worker-manager.ts:1
server/src/services/heartbeat/workspaces.ts has 3546 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — server/src/services/heartbeat/workspaces.ts:1
packages/plugins/sandbox-providers/daytona/src/plugin.ts has 3510 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/plugins/sandbox-providers/daytona/src/plugin.ts:1
ui/src/components/OnboardingWizard.tsx has 3490 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui/src/components/OnboardingWizard.tsx: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 Coverage9.4 / 10Exemplary✓ 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.
cli/src/__tests__/worktree.test.ts:1687 imports '../../../packages/db/src/migrations/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — cli/src/__tests__/worktree.test.ts:1687
packages/db/src/adapter-auth-sessions-schema.test.ts:34 imports './migrations/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — packages/db/src/adapter-auth-sessions-schema.test.ts:34
packages/db/src/client.test.ts:416 imports './migrations', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either (1 further unresolvable import(s) in the same file). The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — packages/db/src/client.test.ts:416
packages/db/src/migration-snapshot-drift.test.ts:15 imports './migrations', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — packages/db/src/migration-snapshot-drift.test.ts:15
packages/paperclip-runner/src/drivers/acpx/profile-compatibility.test.ts:43 imports '../../../test/fixtures/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — packages/paperclip-runner/src/drivers/acpx/profile-compatibility.test.ts:43
packages/paperclip-runner/src/protocol/replay-contract.test.ts:12 imports '../../protocol/fixtures/replay/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — packages/paperclip-runner/src/protocol/replay-contract.test.ts:12
packages/paperclip-runner/src/reducer/session-reducer.test.ts:17 imports '../../protocol/fixtures/replay/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — packages/paperclip-runner/src/reducer/session-reducer.test.ts:17
packages/paperclip-runner/test-fixtures/untracked-import/consumer.ts:5 imports './absent.js', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — packages/paperclip-runner/test-fixtures/untracked-import/consumer.ts:5
scripts/__tests__/storybook-viewport-config.test.mjs:7 imports '../../ui/storybook/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — scripts/__tests__/storybook-viewport-config.test.mjs:7
server/src/__tests__/agent-commentary-skills.test.ts:33 imports '../../../skills', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — server/src/__tests__/agent-commentary-skills.test.ts:33
server/src/__tests__/browser-use-connection.test.ts:371 imports '../../../skills', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — server/src/__tests__/browser-use-connection.test.ts:371
tests/runner-e2e/catalog.ts:1062 imports './fixtures/warm-continuity/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either (1 further unresolvable import(s) in the same file). The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — tests/runner-e2e/catalog.ts:1062
ui/src/lib/clipboard-usage.test.ts:21 imports '../', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either (2 further unresolvable import(s) in the same file). The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — ui/src/lib/clipboard-usage.test.ts:21
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. (×27) — packages/paperclip-runner/devtools/issue-thread/src/App.tsx:1, scripts/paperclip-commit-metrics.ts:1, scripts/generate-org-chart-images.ts:1, …
What to do
Add tests that import the unreached modules (directly or through their public entry).
React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).
Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.
What to do
Bump outdated dependencies to current versions to limit upgrade debt.
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 REDACTED 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: REDACTED scanned for test/lint/typecheck script wiring. Deterministic presence check.
This repository declares test tooling, and the ✓ above records that declaration — but cli/src/__tests__/worktree.test.ts and 12 other test file(s) in this workspace cannot be loaded at all: it imports a module that names no file in this repository, so the runner throws while collecting it and none of its cases execute. The wiring is present and the suite it points at does not run as written, which is why the tooling tick must not be read as a statement that the tests pass. Fix the unloadable file(s) — each one is reported with its failing import under Test Coverage — then the declared script exercises what it claims to. — cli/src/__tests__/worktree.test.ts:1687
Do you agree with this assessment?
R7 · Dead Code7.9 / 10Strong✓ 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.
Unreachable from the 1808 application, 304 tooling and 4289 test entry point(s) detected in this repo. Gate removals on `pnpm run build` — an undetected custom entry would make these reachable.
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×12) — ui/src/components/OnboardingChat.tsx, scripts/benchmark-chat-native-progress.mjs, ui/src/components/ArtifactsPanel.tsx, …
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 16 in-repo import(s) from 16 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/GalleryItem.tsx, ui/src/artifact-directions/directions/d3-tactile/GalleryStacks.tsx, ui/src/artifact-directions/directions/d3-tactile/MetaLine.tsx and 13 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d3-tactile/kind.ts
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 2 in-repo import(s) from 2 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/GalleryPreview.tsx, ui/src/artifact-directions/directions/d1-solid/PanelCard.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d1-solid/ExcerptSheet.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 4 in-repo import(s) from 4 other file(s) do name it (ui/src/artifact-directions/directions/today/Gallery.tsx, ui/src/artifact-directions/directions/today/ThreadAttachments.tsx, ui/src/artifact-directions/directions/today/ThreadWorkProduct.tsx and 1 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/today/adapters.ts
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/index.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it (×2) — ui/src/artifact-directions/directions/d3-tactile/GalleryStacks.tsx, ui/src/artifact-directions/directions/d3-tactile/ThreadAttachments.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 5 in-repo import(s) from 5 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/objects/ArtifactObject.tsx, ui/src/artifact-directions/directions/d3-tactile/objects/Formats.tsx, ui/src/artifact-directions/directions/d3-tactile/objects/Print.tsx and 2 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d3-tactile/objects/Paper.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 6 in-repo import(s) from 6 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/ExcerptSheet.tsx, ui/src/artifact-directions/directions/d1-solid/GalleryPreview.tsx, ui/src/artifact-directions/directions/d1-solid/PanelCard.tsx and 3 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d1-solid/KindBlock.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/PanelBody.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d3-tactile/PanelItem.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/PanelBody.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d1-solid/PanelCard.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/Gallery.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d1-solid/StackTile.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d5-v1-mvp/Front.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d5-v1-mvp/Sheet.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d5-v1-mvp/index.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d5-v1-mvp/GalleryView.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d5-v1-mvp/Tile.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d5-v1-mvp/Stack.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d2-tint/PanelSection.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d2-tint/PanelCard.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/objects/ArtifactObject.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it (×2) — ui/src/artifact-directions/directions/d3-tactile/objects/Sheets.tsx, ui/src/artifact-directions/directions/d3-tactile/objects/Things.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 5 in-repo import(s) from 5 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/GalleryItem.tsx, ui/src/artifact-directions/directions/d3-tactile/GalleryStack.tsx, ui/src/artifact-directions/directions/d3-tactile/GalleryStacks.tsx and 2 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d3-tactile/gallery-model.ts
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/GalleryStack.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d3-tactile/GalleryItem.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/index.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it (×3) — ui/src/artifact-directions/directions/d1-solid/Gallery.tsx, ui/src/artifact-directions/directions/d1-solid/ThreadAttachments.tsx, ui/src/artifact-directions/directions/d1-solid/ThreadWorkProduct.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 13 in-repo import(s) from 13 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/Gallery.tsx, ui/src/artifact-directions/directions/d1-solid/GalleryPreview.tsx, ui/src/artifact-directions/directions/d1-solid/KindBlock.tsx and 10 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d1-solid/kinds.ts
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 6 in-repo import(s) from 6 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/GalleryItem.tsx, ui/src/artifact-directions/directions/d3-tactile/GalleryStacks.tsx, ui/src/artifact-directions/directions/d3-tactile/PanelBody.tsx and 3 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d3-tactile/objects/ArtifactObject.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d2-tint/index.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d2-tint/ThreadAttachments.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 4 in-repo import(s) from 4 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/Gallery.tsx, ui/src/artifact-directions/directions/d1-solid/GalleryPreview.tsx, ui/src/artifact-directions/directions/d1-solid/GalleryTile.tsx and 1 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d1-solid/gallery-model.ts
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 2 in-repo import(s) from 2 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/GalleryStack.tsx, ui/src/artifact-directions/directions/d3-tactile/GalleryStacks.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d3-tactile/objects/Folder.tsx
no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d2-tint/PanelBody.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/artifact-directions/directions/d2-tint/PanelIndex.tsx
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
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 REDACTED — installs work only by hoisting accident. (×11) — scripts/codex-acp-network-policy.test.mjs:8, tests/runner-e2e/remote-native-bootstrap.ts:46, tests/runner-e2e/public-mcp-client.ts:10, …
Declared in packages/adapters/claude-local/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Declared in REDACTED but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Declared in server/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Every import is type-only — move it to devDependencies. — packages/paperclip-runner/src/protocol/replay-contract.ts:2
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.
packages/db/src/schema/execution_workspaces.ts → packages/db/src/schema/issues.ts → packages/db/src/schema/execution_workspaces.ts (one verified cycle inside a mutually-dependent group of 3 files) — packages/db/src/schema/execution_workspaces.ts:11
Other · Security — Read from this repository's JavaScript/TypeScript 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. This repository commits the configuration that serves its own HTTP surface, so that configuration was read in full for the security response headers it sets. The server controls — HTTPS enforcement, HSTS, cookie flags, input validation — are NOT assessed for JavaScript/TypeScript: each is scored as an absence, an absence is only reportable over the production HTTP server, and in this ecosystem the file that opens the port is build output or a framework launcher rather than a file in the source tree. Their absence here is not a finding about this repository. Its Node HTTP listeners were read for HTTPS enforcement alone — TLS served, a redirect to https:// or HSTS, or a TLS-terminating proxy configuration committed beside the server — each judged per server package.
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.
The value is the MAC 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. — server/src/auth/workspace-login-handoff.ts: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+ (`createHash("sha256")`) 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. (×4) — packages/paperclip-runner/src/cli/codex-app-server-unix-proxy.ts:39, REDACTED:2072, packages/plugins/plugin-llm-wiki/src/wiki/core.ts:495, …
`input.password !== SMOKE_LAB_DEMO_PASSWORD` checks a password against the stored one in plaintext, so the store holds the password itself and whoever reads it holds every account. — REDACTED:555
`server.listen(…)` serves plain HTTP on a network address, and nothing in its package enforces HTTPS: no TLS served (`https.createServer`, Fastify `https`, Nest `httpsOptions`), no redirect of plain requests to `https://`, no `Strict-Transport-Security` (helmet sends it by default), and no TLS-terminating proxy configuration committed beside it — so a browser may talk to it in clear text. (−2.0 on this card.) (×6) — docker/openclaw-smoke/server.mjs:100, packages/adapter-utils/src/local-process-sandbox.ts:299, REDACTED:1162, …
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 4 sites, not one: `packages/paperclip-runner/src/cli/codex-app-server-unix-proxy.ts:39` (createHash("sha1")), `REDACTED:2072` (createHash("sha1")), `packages/plugins/plugin-llm-wiki/src/wiki/core.ts:495` (createHash("md5")), `REDACTED:174` (createHash("md5")). Each is a separate decision — fixing only the line this row cites leaves the others in place.
Store passwords with a salted, deliberately slow KDF — scrypt or PBKDF2 from node:crypto, or bcrypt/Argon2 — and compare with a constant-time check. A fast digest of a password, however it is encoded, is reversed by precomputed tables or GPU guessing. Start in `REDACTED:555`.
Enforce HTTPS on each listed server: serve TLS itself, or redirect plain requests to `https://` and send `Strict-Transport-Security` (`helmet()` does by default) behind the TLS-terminating proxy — and commit that proxy's configuration beside the service. A server only this machine reaches should bind `127.0.0.1`.
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 · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.
Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.
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.
This function unwraps IPv4-MAPPED IPv6 (`::ffff:`, line 124) and then rejects `10.0.0.0/8` on its IPv4 path — but the IPv6 decision at line 139 classifies the address as written, and IPv4 reaches IPv6 through three MORE embeddings this function never mentions: IPv4-compatible (`::a.b.c.d`), 6to4 (`2002::/16`) and NAT64 (`64:ff9b::/96`). So `::10.0.0.1`, `2002:0a00:0001::` and `64:ff9b::10.0.0.0` all name a host inside `10.0.0.0/8` — the range this same function declares non-public — and all reach the IPv6 decision un-unwrapped, taking the opposite verdict. Unwrap every embedding to its IPv4 form before classifying, or reject any IPv6 address carrying an embedded IPv4 outright. — server/src/services/plugin-host-services.ts:139
What to do
Each finding names the IPv4 branch that rejects the host and the IPv6 branch that accepts the same host in another notation. Confirm from the two, then unwrap every IPv4-in-IPv6 embedding before classifying, or reject non-native IPv6 outright.
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 loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document2.5 / 10Weak✓ Tool-verified
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.
`formatHydratedSnippetConfig` is exported, takes a document from its caller (line 243) and hands it to `replaceSnippetConfigValue`, which calls itself at line 233 (`replaceSnippetConfigValue`) with a piece of `value` (and at line 237) — and nowhere in `replaceSnippetConfigValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `replaceSnippetConfigValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — ui/src/pages/apps/gateways/gateway-helpers.ts:233
`validateLocaleMessages` is exported, takes a document from its caller (line 110) and hands it to `validateNode`, which calls itself at line 105 (`validateNode`) with a piece of `candidate` — and nowhere in `validateNode` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `validateNode` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — ui/src/i18n/locale-validation.ts:105
`overlayValuesEqual` is exported and takes `a: unknown` from its caller, and it calls itself at line 211 (`overlayValuesEqual`) with a piece of `a` (and at line 221) — and nowhere in `overlayValuesEqual` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `overlayValuesEqual` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — ui/src/components/AgentConfigForm.tsx:211
`validateJsonSchemaForm` is exported and takes `values: Record<string, unknown>` from its caller, and it calls itself at line 309 (`validateJsonSchemaForm`) with a piece of `values` (and at line 325) — and nowhere in `validateJsonSchemaForm` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `validateJsonSchemaForm` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:309
`isDatabaseConnectionUnavailableError` is exported and takes `err: unknown` from its caller, and it calls itself at line 254 (`isDatabaseConnectionUnavailableError`) with a piece of `err` — and nowhere in `isDatabaseConnectionUnavailableError` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `isDatabaseConnectionUnavailableError` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:254
`sanitizeRecord` is exported, takes a document from its caller (line 899) and hands it to `sanitizeValue`, which calls itself at line 763 (`sanitizeValue`) with a piece of `value` (and at line 799) — and nowhere in `sanitizeValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sanitizeValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/redaction.ts:763
`sanitizeBrowserUse` is exported and takes `value: unknown` from its caller, and it calls itself at line 59 (`sanitizeBrowserUse`) with a piece of `value` (and at line 69) — and nowhere in `sanitizeBrowserUse` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sanitizeBrowserUse` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/browser-use-client.ts:59
`signDecisionSpec` is exported, takes a document from its caller (line 155) and hands it to `canonical`, which calls itself at line 147 (`canonical`) with a piece of `value` (and at line 150) — and nowhere in `canonical` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonical` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/decision-signing.ts:147
`sanitizeFeedbackValue` is exported and takes `value: unknown` from its caller, and it calls itself at line 150 (`sanitizeFeedbackValue`) with a piece of `value` (and at line 164) — and nowhere in `sanitizeFeedbackValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sanitizeFeedbackValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/feedback-redaction.ts:150
`stableStringify` is exported and takes `value: unknown` from its caller, and it calls itself at line 185 (`stableStringify`) with a piece of `value` (and at line 190) — and nowhere in `stableStringify` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `stableStringify` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/feedback-redaction.ts:185
`googleChatToolInputSchema` is exported, takes a document from its caller (line 77) and hands it to `withoutUnreadFields`, which calls itself at line 60 (`withoutUnreadFields`) with a piece of `value` (and at line 68, line 73) — and nowhere in `withoutUnreadFields` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `withoutUnreadFields` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/google-chat-tool-policy.ts:60
`collectSecretRefPaths` is exported, takes a document from its caller (line 33) and hands it to `walk`, which calls itself at line 45 (`walk`) with a piece of `node` (and at line 57) — and nowhere in `walk` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `walk` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/json-schema-secret-refs.ts:45
`stableJson` is exported and takes `value: unknown` from its caller, and it calls itself at line 10 (`stableJson`) with a piece of `value` (and at line 14) — and nowhere in `stableJson` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `stableJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/managed-resource-drift.ts:10
`extractSecretRefBindingsFromConfig` is exported, takes a document from its caller (line 81) and hands it to `walk`, which calls itself at line 114 (`walk`) with a piece of `value` (and at line 119) — and nowhere in `walk` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `walk` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/plugin-secrets-handler.ts:114
`assertProfileMetadataContainsNoSecrets` is exported, takes a document from its caller (line 55) and hands it to `containsSecretShapedValue`, which calls itself at line 35 (`containsSecretShapedValue`) with a piece of `value` (and at line 37) — and nowhere in `containsSecretShapedValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `containsSecretShapedValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/provider-profile-qualification.ts:35
`assertProfileMetadataContainsNoSecrets` is exported, takes a document from its caller (line 55) and hands it to `normalizeKnownPublicValues`, which calls itself at line 47 (`normalizeKnownPublicValues`) with a piece of `value` (and at line 51) — and nowhere in `normalizeKnownPublicValues` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `normalizeKnownPublicValues` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/provider-profile-qualification.ts:47
`computeQualifiedProfileRevision` is exported, takes a document from its caller (line 158) and hands it to `canonicalize`, which calls itself at line 146 (`canonicalize`) with a piece of `value` (and at line 152) — and nowhere in `canonicalize` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonicalize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/provider-profile-qualification.ts:146
`receiptFingerprint` is exported, takes a document from its caller (line 10) and hands it to `canonical`, which calls itself at line 5 (`canonical`) with a piece of `value` (and at line 6) — and nowhere in `canonical` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonical` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/receipt-fingerprint.ts:5
`projectConnectionMethodToolArguments` is exported, takes a document from its caller (line 258) and hands it to `mergeManagedToolArguments`, which calls itself at line 249 (`mergeManagedToolArguments`) with a piece of `supplied` — and nowhere in `mergeManagedToolArguments` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `mergeManagedToolArguments` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:249
`projectConnectionMethodToolInputSchema` is exported, takes a document from its caller (line 306) and hands it to `stripManagedToolArgumentSchema`, which calls itself at line 284 (`stripManagedToolArgumentSchema`) with a piece of `schema` — and nowhere in `stripManagedToolArgumentSchema` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `stripManagedToolArgumentSchema` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:284
`canonicalNativeJson` is exported and takes `value: unknown` from its caller, and it calls itself at line 4 (`canonicalNativeJson`) with a piece of `value` (and at line 10) — and nowhere in `canonicalNativeJson` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonicalNativeJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/native-runtime/canonical.ts:4
`canonicalProviderPackJson` is exported and takes `value: unknown` from its caller, and it calls itself at line 6 (`canonicalProviderPackJson`) with a piece of `value` (and at line 8) — and nowhere in `canonicalProviderPackJson` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonicalProviderPackJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/native-runtime/remote-provider-pack-verification.ts:6
`buildRunnerApiCatalog` is exported, takes a document from its caller (line 71) and hands it to `dereference`, which calls itself at line 73 (`dereference`) with a piece of `value` (and at line 79, line 81) — and nowhere in `dereference` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `dereference` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/native-runtime/runner-api-catalog.ts:73
`vercelClient` is exported, takes a document from its caller (line 23) and hands it to `sanitize`, which calls itself at line 52 (`sanitize`) with a piece of `value` (and at line 53) — and nowhere in `sanitize` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sanitize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/connectors/vercel/index.ts:52
`supabaseClient` is exported, takes a document from its caller (line 84) and hands it to `sanitize`, which calls itself at line 112 (`sanitize`) with a piece of `value` (and at line 113) — and nowhere in `sanitize` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sanitize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/services/connectors/supabase/index.ts:112
`containsRedactedMarker` is exported and takes `value: unknown` from its caller, and it calls itself at line 155 (`containsRedactedMarker`) with a piece of `value` (and at line 157) — and nowhere in `containsRedactedMarker` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `containsRedactedMarker` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — server/src/lib/agent-records.ts:155
`findPaperclipConfigKeyWarnings` is exported, takes a document from its caller (line 344) and hands it to `collectConfigKeyWarnings`, which calls itself at line 338 (`collectConfigKeyWarnings`) with a piece of `value` — and nowhere in `collectConfigKeyWarnings` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `collectConfigKeyWarnings` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/shared/src/config-schema.ts:338
`canonicalJson` is exported and takes `value: unknown` from its caller, and it calls itself at line 123 (`canonicalJson`) with a piece of `value` (and at line 128) — and nowhere in `canonicalJson` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonicalJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/shared/src/customer-success.ts:123
`canonicalJson` is exported, takes a document from its caller (line 9) and hands it to `sortJson`, which calls itself at line 18 (`sortJson`) with a piece of `value` (and at line 23) — and nowhere in `sortJson` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sortJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/shared/src/portability-hash.ts:18
`digestPaperclipSemanticContent` is exported, takes a document from its caller (line 90) and hands it to `canonicalJson`, which calls itself at line 190 (`canonicalJson`) with a piece of `value` (and at line 195) — and nowhere in `canonicalJson` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonicalJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/paperclip-runner/src/semantic-tools/receipts.ts:190
`digestPrpSemanticContent` is exported, takes a document from its caller (line 218) and hands it to `canonicalJson`, which calls itself at line 244 (`canonicalJson`) with a piece of `value` (and at line 249) — and nowhere in `canonicalJson` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonicalJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/paperclip-runner/src/protocol/semantic-tool-receipts.ts:244
`parsePaperclipNativeExecution` is exported, takes a document from its caller (line 203) and hands it to `canonicalJson`, which calls itself at line 177 (`canonicalJson`) with a piece of `value` (and at line 182) — and nowhere in `canonicalJson` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonicalJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/paperclip-runner/src/evals/native-execution.ts:177
`assertEvalArtifactSecretFree` is exported, takes a document from its caller (line 206) and hands it to `visit`, which calls itself at line 223 (`visit`) with a piece of `entry` (and at line 235) — and nowhere in `visit` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `visit` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/paperclip-runner/src/eval/eval-bundle.ts:223
`semanticCanonicalJson` is exported and takes `value: unknown` from its caller, and it calls itself at line 27 (`semanticCanonicalJson`) with a piece of `value` (and at line 28) — and nowhere in `semanticCanonicalJson` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `semanticCanonicalJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/paperclip-runner/src/drivers/semantic-tool-receipt.ts:27
`canonicalJson` is exported and takes `value: unknown` from its caller, and it calls itself at line 177 (`canonicalJson`) with a piece of `value` (and at line 185) — and nowhere in `canonicalJson` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonicalJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/paperclip-runner/src/drivers/codex/codex-driver-values.ts:177
`stringifyAcpxSidecarFrame` is exported, takes a document from its caller (line 184) and hands it to `safeSidecarJsonValue`, which calls itself at line 192 (`safeSidecarJsonValue`) with a piece of `value` (and at line 205) — and nowhere in `safeSidecarJsonValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `safeSidecarJsonValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/paperclip-runner/src/drivers/acpx/sidecar-protocol.ts:192
`installPreparedQueries` is exported, takes a document from its caller (line 3) and hands it to `visit`, which calls itself at line 39 (`visit`) with a piece of `value` — and nowhere in `visit` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `visit` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/db/src/prepared-queries.ts:39
`installDatabaseResponseCapture` is exported, takes a document from its caller (line 179) and hands it to `query`, which calls itself at line 201 (`query`) with a piece of `value` — and nowhere in `query` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `query` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/db/src/response-capture.ts:201
`installDatabaseResponseCapture` is exported, takes a document from its caller (line 179) and hands it to `client`, which calls itself at line 257 (`client`) with a piece of `value` (and at line 265) — and nowhere in `client` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `client` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/db/src/response-capture.ts:257
`installDatabaseResponseCapture` is exported, takes a document from its caller (line 179) and hands it to `root`, which calls itself at line 278 (`root`) with a piece of `value` (and at line 292) — and nowhere in `root` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `root` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/db/src/response-capture.ts:278
What to do
Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.
Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether async functions that make a cancellable request accept or pass on an AbortSignal (adoption curve).
Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. 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 question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.
Only 121/162 async functions that make a cancellable request (fetch, axios, ky, ofetch) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
`queryFn` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui/storybook/prototypes/AiTaskConnectionReview.tsx:50
`importPluginModule` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui/src/plugins/slots.tsx:422
`loadManifest` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui/src/lib/app-brand-assets.ts:46
`prepareOAuthNavigation` awaits `json(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `json(url, { signal })`. — ui/src/lib/oauthHandoff.ts:118
`fetchAttachmentText` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui/src/components/IssueAttachmentsSection.tsx:39
`current` awaits `json(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `json(url, { signal })`. — ui/src/api/announcements.ts:14
`exportAgentActionsCsv` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui/src/api/audit.ts:104
`authPost` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui/src/api/auth.ts:115
`authPatch` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui/src/api/auth.ts:138
`getSession` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui/src/api/auth.ts:155
`getProfile` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui/src/api/auth.ts:182
`get` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui/src/api/health.ts:55
`requestDevServerRestart` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui/src/api/health.ts:71
`downloadProviderTrace` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui/src/api/heartbeats.ts:181
`loadDynamicParser` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui/src/adapters/dynamic-loader.ts:218
`fetchConfigSchema` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui/src/adapters/schema-config-fields.tsx:211
`getDevHealthPayload` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. (×2) — scripts/dev-runner.ts:682, scripts/dev-runner.mjs:433
`getJson` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — scripts/paperclip-commit-metrics.ts:835
`fetchArchive` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — scripts/storybook-visual-baseline.mjs:272
`api` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — scripts/smoke/terminal-bench-loop-skill-smoke.mjs:103
`fetchGitHubTree` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — packages/skills-catalog/src/catalog-builder.ts:611
`fetchReferencedFileBytes` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — packages/skills-catalog/src/catalog-builder.ts:642
`json` awaits `json(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `json(url, { signal })`. — packages/plugins/sandbox-providers/createos/src/client.ts:72
`syncFiles` awaits `upload(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `upload(url, { signal })`. — packages/plugins/sandbox-providers/createos/src/file-sync.ts:59
`post` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — packages/paperclip-runner/devtools/issue-thread/src/live-client.ts:111
`devtools` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — packages/paperclip-runner/devtools/issue-thread/src/live-client.ts:160
`load` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — packages/paperclip-runner/devtools/issue-thread/src/live-client.ts:177
`loadCleanRoom` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — packages/paperclip-runner/devtools/issue-thread/src/live-client.ts:187
`requestJson` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — packages/mcp-server/src/client.ts:78
`callRuntimeConnectionTool` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. (×2) — packages/mcp-server/src/tools.ts:58, cli/src/commands/client/connections.ts:13
`apiFetch` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — packages/adapters/hermes/skills/paperclip-task-bridge/paperclip-task.mjs:137
`fetchCodexQuota` awaits `json(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `json(url, { signal })`. — packages/adapters/codex-local/src/server/quota.ts:282
`fetchClaudeQuota` awaits `json(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `json(url, { signal })`. — packages/adapters/claude-local/src/server/quota.ts:274
`onboard` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — cli/src/commands/onboard.ts:383
`uploadAsset` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — cli/src/commands/client/asset.ts:88
`downloadAsset` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — cli/src/commands/client/asset.ts:112
`uploadAttachment` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — cli/src/commands/client/issue.ts:1407
What to do
Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
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.
Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped5.5 / 10Adequate✓ Tool-verified
Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.
Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.
`repository` is text this program did not author, and it is written into a URL attribute through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:23
`escape(run.publicUrl)` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. (×2) — packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:59, packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:116
`escape(destination.publicUrl)` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:70
`escape(previous.publicUrl)` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:72
`escape(stylesheetHref)` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:122
`continuePath===undefined?"0":`0;url=${attribute}`` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — server/src/lib/oauth-browser-return.ts:23
`theme.cardRadius` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×5) — server/src/routes/org-chart-svg.ts:243, server/src/routes/org-chart-svg.ts:307, server/src/routes/org-chart-svg.ts:308, …
`theme.font` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×7) — server/src/routes/org-chart-svg.ts:245, server/src/routes/org-chart-svg.ts:246, server/src/routes/org-chart-svg.ts:310, …
`theme.cardShadow` is text this program did not author, and it is written into a quoted attribute value through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — server/src/routes/org-chart-svg.ts:462
`dotFill` is text this program did not author, and it is written into a quoted attribute value through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — server/src/routes/org-chart-svg.ts:488
`theme.nameColor` is text this program did not author, and it is written into a quoted attribute value through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — server/src/routes/org-chart-svg.ts:742
`theme.roleColor` is text this program did not author, and it is written into a quoted attribute value through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — server/src/routes/org-chart-svg.ts:745
`theme.defs(TARGET_W,TARGET_H)` is text this program did not author, and it is written into the text of an element through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — server/src/routes/org-chart-svg.ts:749
`theme.bgColor` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — server/src/routes/org-chart-svg.ts:750
`theme.bgExtras(TARGET_W,TARGET_H)` is text this program did not author, and it is written into the text of an element through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — server/src/routes/org-chart-svg.ts:751
`theme.watermarkColor` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — server/src/routes/org-chart-svg.ts:752
`renderCards(layout,theme)` is text this program did not author, and it is written into the text of an element through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — server/src/routes/org-chart-svg.ts:759
`message` is text this program did not author, and it is written into a script or style context through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. A script or style context needs its own escaping (or a JSON serialiser that escapes `<`); better, pass the value through a data attribute. — REDACTED:197
`fallback` is text this program did not author, and it is written into a script or style context through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. A script or style context needs its own escaping (or a JSON serialiser that escapes `<`); better, pass the value through a data attribute. — REDACTED:223
`escapeHtml(markdownUrl.toString())` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — server/src/services/public-mcp/setup.ts:13
`normalized.slice(slashIndex+1)` is text this program did not author, and it is written into the text of an element through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — server/src/services/workspace-runtime.ts:964
`svg` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:766
`text` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — ui/src/pages/IssueDetail.tsx:6503
What to do
Each finding names the expression, the attribute it lands in and the line. Confirm the value's origin from the read this analyzer traced, then escape it at the sink or validate it against the shape the attribute accepts before interpolating.
Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.
Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.
Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.
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.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×29) — ui/storybook/prototypes/github-chat/GitHubChatPreview.tsx:483, ui/storybook/prototypes/github-chat/GitHubChatPreview.tsx:610, REDACTED:928, …
`.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it. (×2) — ui/storybook/prototypes/agent-settings/AgentSettingsPreview.tsx:505, ui/src/pages/AgentDetail.tsx:1522
`catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×9) — ui/src/pages/AgentDetail.production.tsx:4070, ui/src/pages/AgentDetail.tsx:4359, ui/src/pages/CompanySkills.production.tsx:4870, …
What to do
Swallowed exception (empty catch)
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 `REDACTED` 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 1320 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:1320
`warn` at line 313 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:313
`warn` at line 323 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:323
`info` at line 335 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:335
`info` at line 356 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:356
`warn` at line 563 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:563
`warn` at line 575 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:575
`warn` at line 581 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:581
`info` at line 584 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:584
`info` at line 608 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:608
`info` at line 881 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:881
`info` at line 907 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:907
`error` at line 921 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:921
`warn` at line 985 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:985
`info` at line 1055 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:1055
`info` at line 2039 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:2039
`info` at line 2049 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — REDACTED:2049
`warn` at line 593 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/external-objects.ts:593
`error` at line 1821 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/plugin-host-services.ts:1821
`warn` at line 1822 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/plugin-host-services.ts:1822
`debug` at line 1823 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/plugin-host-services.ts:1823
`info` at line 1824 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/plugin-host-services.ts:1824
`info` at line 366 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/plugin-lifecycle.ts:366
`info` at line 569 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/plugin-lifecycle.ts:569
`info` at line 332 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/plugin-tool-registry.ts:332
`info` at line 345 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/plugin-tool-registry.ts:345
`error` at line 2040 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/plugin-worker-manager.ts:2040
`error` at line 2829 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/plugin-worker-manager.ts:2829
`warn` at line 2831 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/plugin-worker-manager.ts:2831
`debug` at line 2833 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/plugin-worker-manager.ts:2833
`info` at line 2835 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/plugin-worker-manager.ts:2835
`warn` at line 2970 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/services/plugin-worker-manager.ts:2970
`info` at line 134 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — server/src/adapters/plugin-loader.ts:134
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.
~4.0 `!` null assertions per 1k TypeScript source lines — 5195 assertion(s) across the 1298419 source line(s) of the 4409 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: ui/src/pages/IssueDetail.tsx (119), ui/src/pages/CompanySkills.production.tsx (94), ui/src/pages/CompanySkills.tsx (94). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
What to do
The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 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 — 5 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 — 36 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X6 Hand-rolled structured-format parsing — 8 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X9 Subsumed condition operand — 3 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.
C5 Data-Subject Rights — Repo shows no corroborated data-subject-rights mechanism (erasure / export-portability / consent) tied to a subject id or GDPR vocabulary — absence of evidence is not evidence of a working control. Implement erasure, data export/portability and consent tracking over the subject's records.
Not included — 32 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.
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; 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 Go request handler (a net/http, Gin, Echo, Fiber or fasthttp handler, or a gRPC service method) is declared as a method or function, and no handler function literal writes a value captured from outside it, so no state is shared between request goroutines. 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).
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 — compose up failed (exit 15 — the compose project is invalid) — error while interpolating services.paperclip.environment.BETTER_AUTH_SECRET: required variable BETTER_AUTH_SECRET is missing a value: BETTER_AUTH_SECRET must be set; runtime evidence skipped 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.
D11 Test Reliability — Test reliability not included
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D21 Naming Consistency — Naming consistency is measured on C# only; Go, JavaScript, Python, Rust, TypeScript, html not measured.
D22 Internal API Consistency — API consistency is measured on C# only; the exposed JavaScript, Rust, TypeScript surface was not measured.
D24 Comment Value — D24 reads C# and Visual Basic comments only — this repository's production source is .go, .py, .rs, .ts, .tsx, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D25 ADR Conformance — None of 1 binding record(s) states a rule in checkable form (a backticked element with a prohibition, or an `adr-rules` block), so conformance cannot be read from the code. Write the rule as an `adr-rules` block (`forbid:` a symbol, a package or a dependency) to make it checkable.
D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.ts), 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) — 451 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D8 Code Coverage — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — the repository root runs vitest but declares no coverage provider, so the suite can run and still produce no lcov — add `@vitest/coverage-v8` (or `@vitest/coverage-istanbul`) as a devDependency. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan. Alternatively, commit the lcov/Cobertura report your CI produces and it is read without a re-run.
DM1 Aggregate boundaries — no aggregates detected — aggregate-boundary check not applicable
DM11 Constructible invalid state — no entities detected — construction-time invariants not assessable
DM2 Strongly-typed ids — no id-bearing domain types detected — strongly-typed-id adoption not assessable
DM3 Integration-event coupling — no integration events detected — coupling check not applicable
DM4 Rich vs anemic model — no data-bearing entities detected — rich-vs-anemic model not assessable
DM5 Encapsulated state — no domain entities found — DM5 grades how entities protect their state, and this repository declares none
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 — no mutating command handlers or message consumers detected — idempotency check not applicable
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (lcov — `vitest --coverage --coverage.reporter=lcovonly`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
PF2 Allocation hygiene — Not applicable: allocation awareness is rated where code engineers for it — at least 400 production lines that ship benchmarks or already use allocation-aware idioms (8 or more). This repository's Go code has 69 production line(s), 0 such use(s) and no benchmarks, so there is no allocation work to rate. The card is reward-only: its absence costs nothing.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
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.
AC4 · Keyboard semantics· Click handler on a non-interactive <div> · ×18
Click handler on a non-interactive <div> ui/src/components/EntityRow.tsx:153— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> ui/src/components/GoalTree.tsx:69— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> ui/src/components/IssueAttachmentsSection.tsx:296— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> ui/src/components/IssuesList.tsx:2098— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> ui/src/components/LegacyIssuesList.tsx:1980— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> ui/src/components/MetricCard.tsx:51— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> ui/src/components/WorkspaceFileMarkdownBody.tsx:57— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> ui/src/components/folders/SkillFolderTree.tsx:892— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> ui/src/components/folders/SkillFolderTree.tsx:959— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> ui/src/pages/Costs.tsx:782— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> ui/src/pages/Inbox.tsx:3019— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> ui/src/pages/Inbox.tsx:3066— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> ui/src/pages/Inbox.tsx:3263— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> ui/src/pages/LegacyInbox.tsx:2820— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> ui/src/pages/LegacyInbox.tsx:2867— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> ui/src/pages/LegacyInbox.tsx:3036— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> ui/src/pages/Secrets.tsx:2133— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> ui/src/pages/apps/gateways/GatewaysList.tsx:257— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC2 · Forms & labels· <label> that labels no control · ×12
<label> that labels no control packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4083— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4111— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4115— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4119— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4179— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6273— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6381— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6564— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control ui/src/components/BudgetIncidentCard.tsx:101— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control ui/src/components/BudgetPolicyCard.tsx:178— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control ui/src/components/DecisionDateChips.tsx:51— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control ui/src/components/DecisionDateChips.tsx:63— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
Boundary-crossing change coupling: REDACTED ↔ REDACTED REDACTED:1— `REDACTED` (context routes) and `ui/src/api/access.ts` (context ui) sit in DIFFERENT parts of the tree yet change together 92% of the time (11 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `8da50dbc` [codex] Add private browser first-admin claim flow (#6755); `73fbdf36` Gate stale-run watchdog decisions by board access (#4446); `d8b63a18` [codex] Add access cleanup and user profile page (#4088) — run `git show` on any of them.
Boundary-crossing change coupling: health.ts ↔ health.ts server/src/routes/health.ts:1— `server/src/routes/health.ts` (context routes) and `ui/src/api/health.ts` (context ui) sit in DIFFERENT parts of the tree yet 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 — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `202c2d30` fix(server): leave unclaimed warm Cloud databases idle (#15314); `b2acc674` fix: enable isolated subscription login on authenticated self-hosted …; `765a7520` Add experimental server info debug view (#8676) — run `git show` on any of them.
Boundary-crossing change coupling: companies.ts ↔ companies.ts server/src/routes/companies.ts:1— `server/src/routes/companies.ts` (context routes) and `ui/src/api/companies.ts` (context ui) sit in DIFFERENT parts of the tree yet change together 56% of the time (9 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `be6bb768` fix(ui): restrict company navigation to accessible memberships (#13039); `0a95ada1` feat(server): chunked import preview endpoint and resumable upload in…; `075951f6` Fix import completion UX: inbox flood, false-failure message, stale c… — run `git show` on any of them.
Boundary-crossing change coupling: agents.ts ↔ heartbeats.ts server/src/routes/agents.ts:1— `server/src/routes/agents.ts` (context routes) and `ui/src/api/heartbeats.ts` (context ui) sit in DIFFERENT parts of the tree yet change together 56% of the time (10 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `5c7a0250` fix(ui): clear consumed messages from the pending queue (#16317); `ebeac833` perf(runs): bound history and reduce repeated context reads (#16286); `efc2e681` fix: show each task once in dashboard agent cards (#14847) — run `git show` on any of them.
Boundary-crossing change coupling: adapters.ts ↔ AdapterManager.tsx server/src/routes/adapters.ts:1— `server/src/routes/adapters.ts` (context routes) and `ui/src/pages/AdapterManager.tsx` (context ui) sit in DIFFERENT parts of the tree yet change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `50cd76d8` feat(adapters): add capability flags to ServerAdapterModule (#3540); `b81d765d` feat: server-side override pause/resume for builtin adapter types; `4efe018a` fix(ui): external adapter UI parser can now override builtin parsers — run `git show` on any of them.
Boundary-crossing change coupling: issues.ts ↔ issues.ts server/src/services/issues.ts:1— `server/src/services/issues.ts` (context services) and `ui/src/api/issues.ts` (context ui) sit in DIFFERENT parts of the tree yet change together 54% of the time (19 of the 35 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 19 shared commits counted here, the most recent 3 are `7b829efd` feat: show tasks created from a task by project (#13241); `627728bd` feat: add authoritative issue PATCH receipts (#10478); `2f94a66b` Show live descendant status in inbox rows (#8876) — run `git show` on any of them.
Boundary-crossing change coupling: issues.ts ↔ activity.ts server/src/routes/issues.ts:1— `server/src/routes/issues.ts` (context routes) and `server/src/services/activity.ts` (context services) sit in DIFFERENT parts of the tree yet change together 50% of the time (9 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `0e583088` perf: reveal task content sooner and parallelize issue reads (#14727); `88ce6d35` Speed up issue detail payloads (#9125); `67b22d87` [codex] Clarify interrupt handoffs and scoped wake semantics (#7855) — run `git show` on any of them.
Boundary-crossing change coupling: REDACTED ↔ CompanyEnvironments.tsx server/src/routes/environments.ts:1— `server/src/routes/environments.ts` (context routes) and `ui/src/pages/CompanyEnvironments.tsx` (context ui) sit in DIFFERENT parts of the tree yet change together 50% of the time (8 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `c62bb4b1` feat: environment delete with agent reassignment and consented sandbo…; `120ae542` feat(server): add a one-click relink action for detached custom-image…; `ff5fd62d` Resolve the environment secret companyId context on first save (#11291) — run `git show` on any of them.
Boundary-crossing change coupling: activity.ts ↔ issues.ts server/src/routes/activity.ts:1— `server/src/routes/activity.ts` (context routes) and `server/src/services/issues.ts` (context services) sit in DIFFERENT parts of the tree yet change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `d6bee62f` Fix Cloud tenant issue identifier routes (#5196); `fe63c10d` Include issue identifier in all activity log details for notifications; `9906a5ba` Support issue identifiers (PAP-39) in URLs and prefer them throughout — run `git show` on any of them.
Boundary-crossing change coupling: projects.ts ↔ heartbeat.ts server/src/routes/projects.ts:1— `server/src/routes/projects.ts` (context routes) and `server/src/services/heartbeat.ts` (context services) sit in DIFFERENT parts of the tree yet change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `417336f8` fix(workspaces): attach PR preparation to existing branches (#11703); `549ef11c` [codex] Respect manual workspace runtime controls (#4125); `8f23270f` Add project-level environment variables — run `git show` on any of them.
Boundary-crossing change coupling: agents.ts ↔ NewAgent.tsx server/src/routes/agents.ts:1— `server/src/routes/agents.ts` (context routes) and `ui/src/pages/NewAgent.tsx` (context ui) sit in DIFFERENT parts of the tree yet change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `c139d6c0` fix(codex-local): omit default model so codex CLI picks per auth mode…; `bb7d0408` Switch OpenCode to explicit static/local-aware model selection (#5117); `9b99d303` Add dedicated environment settings page and test-in-environment (#4798) — run `git show` on any of them.
Boundary-crossing change coupling: use-cases.ts ↔ heartbeat.ts server/src/modules/wake-queue/application/use-cases.ts:1— `server/src/modules/wake-queue/application/use-cases.ts` (context wake-queue) and `server/src/services/heartbeat.ts` (context services) sit in DIFFERENT parts of the tree yet change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `d0b67bfe` feat: queue approvals and answers during active runs (#13539); `f2c5e54d` fix(runner): preserve handoff work and publish requested files (#13355); `ae0c1fbb` refactor(server): move the admission half of the deferred wake state … — run `git show` on any of them.
AC2 · Forms & labels· <input> without a programmatic label · ×7
<input> without a programmatic label packages/paperclip-runner/devtools/issue-thread/src/DevtoolsInspector.tsx:408— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label ui/src/adapters/schema-config-fields.tsx:137— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label ui/src/components/AttentionQueueRow.tsx:706— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label ui/src/components/DecisionDateChips.tsx:54— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label ui/src/components/DecisionDateChips.tsx:66— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label ui/src/components/DecisionTriageStrip.tsx:186— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label ui/src/components/DecisionTriageStrip.tsx:357— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
AC2 · Forms & labels· <button> with no accessible text · ×4
<button> with no accessible text ui/src/adapters/schema-config-fields.tsx:158— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text ui/src/components/AgentConfigForm.tsx:4080— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text ui/src/components/ArtifactsPanel.tsx:274— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text ui/src/components/ArtifactsPanel.tsx:278— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
AC1 · Text alternatives· <img> without a text alternative · ×3
<img> without a text alternative scripts/generate-org-chart-satori-comparison.ts:191— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative scripts/generate-org-chart-satori-comparison.ts:192— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative scripts/generate-org-chart-satori-comparison.ts:193— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
AC4 · Keyboard semantics· Hover-only interaction on <div> · ×3
Hover-only interaction on <div> ui/src/components/IssueRow.tsx:291— This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus.
Hover-only interaction on <div> ui/src/components/SidebarShell.production.tsx:199— This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus.
Hover-only interaction on <div> ui/src/components/SidebarShell.tsx:213— This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus.
AC2 · Forms & labels· <textarea> without a programmatic label · ×2
<textarea> without a programmatic label ui/src/adapters/openclaw-gateway/config-fields.tsx:44— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label ui/src/components/ChatComposer.tsx:262— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
AC2 · Forms & labels· Link with no accessible name · ×2
Link with no accessible name ui/src/components/AgentConfigForm.tsx:2976— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Link with no accessible name ui/src/components/AgentConfigForm.tsx:3750— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Unlisted import '@daytonaio/sdk' tests/runner-e2e/remote-native-bootstrap.ts:46— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import '@daytonaio/sdk' server/src/__tests__/helpers/dot-daytona.ts:14— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Import cycle (4 files) server/src/modules/external-agents/dot.ts:3— server/src/modules/external-agents/dot.ts → server/src/modules/external-agents/native-broker.ts → server/src/services/dot-assignment-follow-up.ts → server/src/modules/external-agents/index.ts → server/src/modules/external-agents/dot.ts (one verified cycle inside a mutually-dependent group of 52 files)
Import cycle (4 files) ui/src/components/AgentConfigForm.tsx:8— ui/src/components/AgentConfigForm.tsx → ui/src/components/ai-connections/AiConnectionField.tsx → ui/src/components/ai-connections/AiConnectionCredentialStep.tsx → ui/src/components/new-agent/AgentProviderConnection.tsx → ui/src/components/AgentConfigForm.tsx (one verified cycle inside a mutually-dependent group of 8 files)
AC2 · Forms & labels· <select> without a programmatic label · ×1
<select> without a programmatic label packages/plugins/plugin-llm-wiki/src/ui/app.tsx:5772— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<html> without a lang scripts/generate-org-chart-satori-comparison.ts:158— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
AC4 · Keyboard semantics· Clickable element isn't keyboard-operable · ×1
Clickable element isn't keyboard-operable packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx:417— The repo's own CSS styles .pit-strip-button with `cursor: pointer`, so this <div> is a control — but it has no role, no tabIndex={0} and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabIndex={0} + a key handler.
Focusable <article> isn't keyboard-operable ui/src/components/DocumentAnnotationPanel.tsx:338— This <article> carries tabIndex={0}, so it is in the tab order and a keyboard user will land on it — but its behaviour is bound to the pointer only, with no key handler. A tabindex makes an element focusable, not operable: Enter and Space fire a click on a native <button> or <a href> and nowhere else, so this can be focused and never activated. Use a <button>, or handle Enter/Space in a key handler.
AC4 · Keyboard semantics· Double-click handler on a non-interactive <div> · ×1
Double-click handler on a non-interactive <div> ui/src/components/PropertiesPanel.tsx:393— This <div> binds pointerdown, pointerup, pointermove and double-click — pointer gestures with no keyboard form, a double-click among them. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click.
AC4 · Keyboard semantics· Click handler on a non-interactive <g> · ×1
Click handler on a non-interactive <g> ui/src/components/timeline/WorkTimelineChart.tsx:606— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC5 · ARIA correctness· aria-hidden hides a focusable element · ×1
aria-hidden hides a focusable element ui/src/components/DocumentAnnotationLayer.tsx:530— aria-hidden="true" here hides the subtree from assistive tech, but a focusable descendant stays in the tab order — a keyboard user can land on a control screen readers can't see. Add inert, take the descendants out of the tab order (tabindex="-1"), or drop aria-hidden.
Unlisted import '@agentclientprotocol/codex-acp' scripts/codex-acp-network-policy.test.mjs:8— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import '@modelcontextprotocol/sdk' tests/runner-e2e/public-mcp-client.ts:10— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import '@opentelemetry/otlp-transformer' tests/runner-e2e/braintrust.ts:123— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import '@opentelemetry/resources' tests/runner-e2e/braintrust.ts:122— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import 'axe-core' tests/storybook-visual/speko-voice.spec.ts:9— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import 'drizzle-orm' scripts/migrate-inline-env-secrets.ts:1— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import 'express' tests/speko-native/app.ts:106— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import 'protobufjs' tests/runner-e2e/braintrust.test.ts:11— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import '@opentelemetry/sdk-trace-base' server/src/__tests__/instrumentation.test.ts:310— Imported but not declared in any reachable REDACTED — 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 server/src/auth/workspace-login-handoff.ts:393— The value is the MAC 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.
S1 · Web-Security Posture· Password hashing without a KDF · ×1
Password hashing without a KDF REDACTED:555— `input.password !== SMOKE_LAB_DEMO_PASSWORD` checks a password against the stored one in plaintext, so the store holds the password itself and whoever reads it holds every account.
FunctionTooLong: issues.issueService server/src/services/issues.ts:6737— FunctionTooLong — issueService runs 5407 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 5307 over it, 54.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: secrets.secretService server/src/services/secrets.ts:973— FunctionTooLong — secretService runs 3664 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3564 over it, 36.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.
FunctionTooLong: company-skills.companySkillService server/src/services/company-skills.ts:2966— FunctionTooLong — companySkillService runs 3617 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3517 over it, 36.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: queue.createHeartbeatQueue server/src/services/heartbeat/queue.ts:349— FunctionTooLong — createHeartbeatQueue runs 3462 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3362 over it, 34.62× 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: execution-workspaces.executionWorkspaceService server/src/services/execution-workspaces.ts:1416— FunctionTooLong — executionWorkspaceService runs 2782 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2682 over it, 27.82× 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: IssueProperties.IssueProperties ui/src/components/issue-properties/IssueProperties.tsx:233— FunctionTooLong — IssueProperties runs 2637 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2537 over it, 26.37× 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: chat-channels.chatChannelService server/src/services/chat-channels.ts:497— FunctionTooLong — chatChannelService runs 2402 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2302 over it, 24.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: TaskChatThread.TaskChatThread ui/src/components/TaskChatThread.tsx:497— FunctionTooLong — TaskChatThread runs 2339 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2239 over it, 23.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: Secrets.Secrets ui/src/pages/Secrets.tsx:652— FunctionTooLong — Secrets runs 2239 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2139 over it, 22.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: company-portability.companyPortabilityService server/src/services/company-portability.ts:3570— FunctionTooLong — companyPortabilityService runs 2219 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2119 over it, 22.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: Inbox.StreamlinedInbox ui/src/pages/Inbox.tsx:835— FunctionTooLong — StreamlinedInbox runs 2091 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1991 over it, 20.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: LegacyInbox.Inbox ui/src/pages/LegacyInbox.tsx:692— FunctionTooLong — Inbox runs 2003 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1903 over it, 20.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: DesignGuide.DesignGuide REDACTED:508— FunctionTooLong — DesignGuide runs 1884 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1784 over it, 18.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.
FunctionTooLong: queue.createHeartbeatQueue.enqueueWakeup server/src/services/heartbeat/queue.ts:2145— FunctionTooLong — createHeartbeatQueue.enqueueWakeup runs 1867 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1767 over it, 18.67× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: testing.createTestHarness packages/plugins/sdk/src/testing.ts:491— FunctionTooLong — createTestHarness runs 1854 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1754 over it, 18.54× 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: run-lifecycle.createHeartbeatLifecycle server/src/services/heartbeat/run-lifecycle.ts:634— FunctionTooLong — createHeartbeatLifecycle runs 1809 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1709 over it, 18.09× 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: ConnectionSetupFlow.StandardConnectionSetupFlow ui/src/features/connections/ConnectionSetupFlow.tsx:634— FunctionTooLong — StandardConnectionSetupFlow runs 1718 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1618 over it, 17.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: native-session-executor.executePaperclipNativeSessionWithinScope server/src/services/native-runtime/native-session-executor.ts:7907— FunctionTooLong — executePaperclipNativeSessionWithinScope runs 1690 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1590 over it, 16.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: native-session-executor.createRunnerdBackendWithinSessionClaim server/src/services/native-runtime/native-session-executor.ts:11789— FunctionTooLong — createRunnerdBackendWithinSessionClaim runs 1551 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1451 over it, 15.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: recovery.createHeartbeatRecovery server/src/services/heartbeat/recovery.ts:356— FunctionTooLong — createHeartbeatRecovery runs 1548 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1448 over it, 15.48× 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: IssuesList.StreamlinedIssuesList ui/src/components/IssuesList.tsx:720— FunctionTooLong — StreamlinedIssuesList runs 1520 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1420 over it, 15.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.
FunctionTooLong: AgentConfigForm.AgentConfigForm ui/src/components/AgentConfigForm.tsx:345— FunctionTooLong — AgentConfigForm runs 1514 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1414 over it, 15.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: plugin-worker-manager.createPluginWorkerHandle server/src/services/plugin-worker-manager.ts:879— FunctionTooLong — createPluginWorkerHandle runs 1509 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1409 over it, 15.09× 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: failed-run-retry.createChatFailedRunRetry server/src/services/chat-channels/failed-run-retry.ts:112— FunctionTooLong — createChatFailedRunRetry runs 1473 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1373 over it, 14.73× 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: callbacks.createChatInteractionCallbacks server/src/services/chat-channels/interactions/callbacks.ts:143— FunctionTooLong — createChatInteractionCallbacks runs 1466 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1366 over it, 14.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Hotspot: server/src/routes/issues.ts server/src/routes/issues.ts:3389— server/src/routes/issues.ts changed 130 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 2421 in issues.issueRoutes at line 3389. 65 of those changes were fix/bug commits, and the other 65 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/routes/issues.ts`: 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: server/src/routes/agents.ts server/src/routes/agents.ts:500— server/src/routes/agents.ts changed 110 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 1251 in agents.agentRoutes at line 500. 40 of those changes were fix/bug commits, and the other 70 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/routes/agents.ts`: 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: server/src/services/heartbeat.ts server/src/services/heartbeat.ts:1764— server/src/services/heartbeat.ts changed 284 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 348 in heartbeat.heartbeatService.executeRunAttempt at line 1764. 139 of those changes were fix/bug commits, and the other 145 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/heartbeat.ts`: 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: server/src/services/issues.ts server/src/services/issues.ts:6737— server/src/services/issues.ts changed 90 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 930 in issues.issueService at line 6737. 45 of those changes were fix/bug commits, and the other 45 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/issues.ts`: 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: ui/src/pages/IssueDetail.tsx ui/src/pages/IssueDetail.tsx:3146— ui/src/pages/IssueDetail.tsx changed 97 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 767 in IssueDetail.TaskDetailSurface at line 3146. 52 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/src/pages/IssueDetail.tsx`: 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: server/src/services/native-runtime/native-session-executor.ts server/src/services/native-runtime/native-session-executor.ts:7907— server/src/services/native-runtime/native-session-executor.ts changed 137 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 422 in native-session-executor.executePaperclipNativeSessionWithinScope at line 7907. 84 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/native-runtime/native-session-executor.ts`: 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: ui/src/components/TaskChatThread.tsx ui/src/components/TaskChatThread.tsx:497— ui/src/components/TaskChatThread.tsx changed 80 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 683 in TaskChatThread.TaskChatThread at line 497. 43 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/src/components/TaskChatThread.tsx`: 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: ui/src/components/OnboardingWizard.tsx ui/src/components/OnboardingWizard.tsx:490— ui/src/components/OnboardingWizard.tsx changed 53 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 853 in OnboardingWizard.OnboardingWizardInner at line 490. 18 of those changes were fix/bug commits, and the other 35 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/src/components/OnboardingWizard.tsx`: 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: REDACTED REDACTED:245— REDACTED changed 94 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 332 in index.startServerWithDatabaseTeardown at line 245. 39 of those changes were fix/bug commits, and the other 55 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- REDACTED`: 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: ui/src/components/AgentConfigForm.tsx ui/src/components/AgentConfigForm.tsx:345— ui/src/components/AgentConfigForm.tsx changed 53 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 519 in AgentConfigForm.AgentConfigForm at line 345. 16 of those changes were fix/bug commits, and the other 37 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/src/components/AgentConfigForm.tsx`: 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: server/src/services/tool-access.ts server/src/services/tool-access.ts:1592— server/src/services/tool-access.ts changed 92 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 292 in tool-access.toolAccessService.connectGalleryApp at line 1592. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/tool-access.ts`: 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: ui/src/features/connections/ConnectionSetupFlow.tsx ui/src/features/connections/ConnectionSetupFlow.tsx:634— ui/src/features/connections/ConnectionSetupFlow.tsx changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 559 in ConnectionSetupFlow.StandardConnectionSetupFlow at line 634. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/src/features/connections/ConnectionSetupFlow.tsx`: 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: packages/adapter-utils/src/acpx-engine/execute.ts packages/adapter-utils/src/acpx-engine/execute.ts:4033— packages/adapter-utils/src/acpx-engine/execute.ts changed 69 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 292 in execute.createAcpxEngineExecutor at line 4033. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- packages/adapter-utils/src/acpx-engine/execute.ts`: 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: ui/src/components/issue-properties/IssueProperties.tsx ui/src/components/issue-properties/IssueProperties.tsx:233— ui/src/components/issue-properties/IssueProperties.tsx changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 475 in IssueProperties.IssueProperties at line 233. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/src/components/issue-properties/IssueProperties.tsx`: 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: server/src/services/environment-runtime.ts server/src/services/environment-runtime.ts:1307— server/src/services/environment-runtime.ts changed 46 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 375 in environment-runtime.createSandboxEnvironmentDriver at line 1307. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/environment-runtime.ts`: 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: REDACTED REDACTED:237— REDACTED changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 412 in tool-access.toolAccessRoutes at line 237. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- REDACTED`: 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: packages/paperclip-runner/src/live/runnerd-codex-transport.ts packages/paperclip-runner/src/live/runnerd-codex-transport.ts:5146— packages/paperclip-runner/src/live/runnerd-codex-transport.ts changed 74 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 198 in DurablePrpCodexTransport.#resume at line 5146. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- packages/paperclip-runner/src/live/runnerd-codex-transport.ts`: 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: REDACTED REDACTED:4513— REDACTED changed 75 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 191 in service.recoveryService.reconcileStrandedAssignedIssues at line 4513. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- REDACTED`: 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: server/src/services/chat-channels.ts server/src/services/chat-channels.ts:1384— server/src/services/chat-channels.ts changed 57 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 215 in chat-channels.chatChannelService.processMessage at line 1384. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/chat-channels.ts`: 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: server/src/services/native-runtime/paperclip-runner-tool-authority.ts server/src/services/native-runtime/paperclip-runner-tool-authority.ts:334— server/src/services/native-runtime/paperclip-runner-tool-authority.ts changed 57 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 188 in PaperclipRunnerToolAuthority.execute at line 334. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/native-runtime/paperclip-runner-tool-authority.ts`: 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: REDACTED REDACTED:2264— REDACTED changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 232 in server-utils.renderPaperclipWakePromptBody at line 2264. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- REDACTED`: 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: server/src/services/heartbeat/queue.ts server/src/services/heartbeat/queue.ts:2145— server/src/services/heartbeat/queue.ts changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 518 in queue.createHeartbeatQueue.enqueueWakeup at line 2145. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/heartbeat/queue.ts`: 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: ui/src/components/IssueChatThread.tsx ui/src/components/IssueChatThread.tsx:4649— ui/src/components/IssueChatThread.tsx changed 41 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 225 in IssueChatThread.IssueChatComposer at line 4649. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/src/components/IssueChatThread.tsx`: 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: server/src/services/tool-gateway.ts server/src/services/tool-gateway.ts:10134— server/src/services/tool-gateway.ts changed 55 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 161 in tool-gateway.createToolGatewayService.executeTool at line 10134. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/tool-gateway.ts`: 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: server/src/services/company-portability.ts server/src/services/company-portability.ts:5255— server/src/services/company-portability.ts changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 271 in company-portability.companyPortabilityService.importBundle at line 5255. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/company-portability.ts`: 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.
FileTooLong: routes/issues.ts server/src/routes/issues.ts— FileTooLong — 15347 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 14847 over it, 30.69× 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: native-runtime/native-session-executor.ts server/src/services/native-runtime/native-session-executor.ts— FileTooLong — 11127 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 10627 over it, 22.25× 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: services/issues.ts server/src/services/issues.ts— FileTooLong — 10657 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 10157 over it, 21.31× 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: routes/openapi.ts server/src/routes/openapi.ts— FileTooLong — 9547 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 9047 over it, 19.09× 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: services/tool-gateway.ts server/src/services/tool-gateway.ts— FileTooLong — 9120 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 8620 over it, 18.24× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: pages/IssueDetail.tsx ui/src/pages/IssueDetail.tsx— FileTooLong — 7108 significant lines (blank, comment-only and punctuation-only lines excluded), about 62% of them inside a single declaration: IssueDetail (3143-8795). The bar is 500 significant lines; this is 6608 over it, 14.22× 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: services/workspace-runtime.ts server/src/services/workspace-runtime.ts— FileTooLong — 6734 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 6234 over it, 13.47× 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: ui/app.tsx packages/plugins/plugin-llm-wiki/src/ui/app.tsx— FileTooLong — 5867 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 5367 over it, 11.73× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: services/company-skills.ts server/src/services/company-skills.ts— FileTooLong — 5863 significant lines (blank, comment-only and punctuation-only lines excluded), about 62% of them inside a single declaration: companySkillService (2966-7468). The bar is 500 significant lines; this is 5363 over it, 11.73× 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: live/runnerd-codex-transport.ts packages/paperclip-runner/src/live/runnerd-codex-transport.ts— FileTooLong — 5772 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 5272 over it, 11.54× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: components/IssueChatThread.tsx ui/src/components/IssueChatThread.tsx— FileTooLong — 5645 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 5145 over it, 11.29× 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: routes/agents.ts server/src/routes/agents.ts— FileTooLong — 5322 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4822 over it, 10.64× 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: services/company-portability.ts server/src/services/company-portability.ts— FileTooLong — 4887 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4387 over it, 9.77× 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 REDACTED— FileTooLong — 4850 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4350 over it, 9.70× 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: pages/CompanySkills.production.tsx ui/src/pages/CompanySkills.production.tsx— FileTooLong — 4807 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4307 over it, 9.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: pages/CompanySkills.tsx ui/src/pages/CompanySkills.tsx— FileTooLong — 4775 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4275 over it, 9.55× 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: services/secrets.ts server/src/services/secrets.ts— FileTooLong — 4320 significant lines (blank, comment-only and punctuation-only lines excluded), about 85% of them inside a single declaration: secretService (973-5772). The bar is 500 significant lines; this is 3820 over it, 8.64× 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: pages/Secrets.tsx ui/src/pages/Secrets.tsx— FileTooLong — 4109 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3609 over it, 8.22× 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: wiki/core.ts packages/plugins/plugin-llm-wiki/src/wiki/core.ts— FileTooLong — 4012 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3512 over it, 8.02× 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: pages/AgentDetail.tsx ui/src/pages/AgentDetail.tsx— FileTooLong — 3932 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3432 over it, 7.86× 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: services/execution-workspaces.ts server/src/services/execution-workspaces.ts— FileTooLong — 3833 significant lines (blank, comment-only and punctuation-only lines excluded), about 73% of them inside a single declaration: executionWorkspaceService (1416-5140). The bar is 500 significant lines; this is 3333 over it, 7.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: connections/ConnectionSetupFlow.tsx ui/src/features/connections/ConnectionSetupFlow.tsx— FileTooLong — 3824 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3324 over it, 7.65× 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 REDACTED— FileTooLong — 3815 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3315 over it, 7.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: heartbeat/queue.ts server/src/services/heartbeat/queue.ts— FileTooLong — 3761 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: createHeartbeatQueue (349-4930). The bar is 500 significant lines; this is 3261 over it, 7.52× 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: services/tool-access.ts server/src/services/tool-access.ts— FileTooLong — 3743 significant lines (blank, comment-only and punctuation-only lines excluded), about 85% of them inside a single declaration: toolAccessService (723-4838). The bar is 500 significant lines; this is 3243 over it, 7.49× 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.
Low cohesion: DurablePrpCodexTransport (LCOM4 48) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:3487— DurablePrpCodexTransport's methods fall into 48 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 48 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: CapabilityMockControlPlaneAdapter (LCOM4 47) packages/paperclip-runner/src/mock-core/capability-mock-control-plane-adapter.ts:74— CapabilityMockControlPlaneAdapter's methods fall into 47 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 47 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: CapabilityLiveSession (LCOM4 43) packages/paperclip-runner/src/live/live-session.ts:1181— CapabilityLiveSession's methods fall into 43 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 43 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: PaperclipRunnerToolAuthority (LCOM4 35) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:241— PaperclipRunnerToolAuthority's methods fall into 35 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 35 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: DurablePrpControlPlane (LCOM4 31) REDACTED:1495— DurablePrpControlPlane's methods fall into 31 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 31 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: CodexAcpxSession (LCOM4 26) REDACTED:740— CodexAcpxSession's methods fall into 26 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 26 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: ChatSdkEndpointRuntime (LCOM4 24) server/src/services/chat-sdk-runtime.ts:2008— ChatSdkEndpointRuntime's methods fall into 24 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 24 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: SetupTokenSessionService (LCOM4 24) server/src/services/setup-token-session.ts:742— SetupTokenSessionService's methods fall into 24 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 24 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: CapabilitySemanticToolRuntime (LCOM4 23) packages/paperclip-runner/src/tools/capability-semantic-tool-runtime.ts:105— CapabilitySemanticToolRuntime's methods fall into 23 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 23 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: OpenCodeHarnessSession (LCOM4 22) REDACTED:465— OpenCodeHarnessSession's methods fall into 22 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 22 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: SharedPollingCoordinator (LCOM4 20) ui/src/lib/cross-tab-poll.ts:524— SharedPollingCoordinator's methods fall into 20 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 20 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: HarnessNativeSession (LCOM4 17) packages/paperclip-runner/src/backends/harness-driver-backend.ts:394— HarnessNativeSession's methods fall into 17 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 17 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: ScenarioChatDemoRuntime (LCOM4 17) REDACTED:239— ScenarioChatDemoRuntime's methods fall into 17 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 17 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: PaperclipChatSdkStateAdapter (LCOM4 17) server/src/services/chat-sdk-state.ts:118— PaperclipChatSdkStateAdapter's methods fall into 17 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 17 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: WorkspaceGitOperationScheduler (LCOM4 17) server/src/services/workspace-git-operation-scheduler.ts:279— WorkspaceGitOperationScheduler's methods fall into 17 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 17 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: PhotonChatAdapter (LCOM4 16) server/src/services/photon/adapter.ts:100— PhotonChatAdapter's methods fall into 16 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 16 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: BrokerCore (LCOM4 15) packages/tailscale-https-broker/src/broker-core.ts:120— BrokerCore's methods fall into 15 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 15 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: CodexAcpxDriver (LCOM4 13) REDACTED:273— CodexAcpxDriver's methods fall into 13 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 13 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: CodexSessionState (LCOM4 12) packages/paperclip-runner/src/drivers/codex/codex-session-state.ts:87— CodexSessionState's methods fall into 12 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 12 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: LiveConsoleScriptedSession (LCOM4 12) packages/paperclip-runner/src/mock-core/live-console-scripted-driver.ts:129— LiveConsoleScriptedSession's methods fall into 12 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 12 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: RunnerdExternalSession (LCOM4 11) packages/paperclip-runner/src/drivers/external/runnerd-external-driver.ts:136— RunnerdExternalSession's methods fall into 11 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 11 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: ChatRuntime (LCOM4 11) server/src/services/chat-runtime.ts:6— ChatRuntime's methods fall into 11 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 11 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: CodexAppServerDriver (LCOM4 10) packages/paperclip-runner/src/drivers/codex/codex-app-server-driver-impl.ts:128— CodexAppServerDriver's methods fall into 10 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 10 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: LocalRunnerController (LCOM4 10) packages/paperclip-runner/src/mock-core/local-runner.ts:175— LocalRunnerController's methods fall into 10 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 10 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: ChatSdkRuntime (LCOM4 10) server/src/services/chat-sdk-runtime.ts:3178— ChatSdkRuntime's methods fall into 10 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 10 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.
ClassTooLong: IssueDetail ui/src/pages/IssueDetail.tsx:1— ClassTooLong — 4416 significant lines (blank, comment-only and punctuation-only lines excluded), 36 methods. The bar is 400 significant lines; this is 4016 over it, 11.04× 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: DurablePrpCodexTransport packages/paperclip-runner/src/live/runnerd-codex-transport.ts:3487— ClassTooLong — 2835 significant lines (blank, comment-only and punctuation-only lines excluded), 56 methods. The bar is 400 significant lines; this is 2435 over it, 7.09× 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: IssueProperties ui/src/components/issue-properties/IssueProperties.tsx:1— ClassTooLong — 2637 significant lines (blank, comment-only and punctuation-only lines excluded), 3 methods. The bar is 400 significant lines; this is 2237 over it, 6.59× 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: CodexCommandExecutor packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:1503— ClassTooLong — 2467 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 45 methods, 3 blocks, lines 1503-4717. The bar is 400 significant lines; this is 2067 over it, 6.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.
ClassTooLong: TaskChatThread ui/src/components/TaskChatThread.tsx:1— ClassTooLong — 2339 significant lines (blank, comment-only and punctuation-only lines excluded), 20 methods. The bar is 400 significant lines; this is 1939 over it, 5.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: Secrets ui/src/pages/Secrets.tsx:1— ClassTooLong — 2239 significant lines (blank, comment-only and punctuation-only lines excluded), 64 methods. The bar is 400 significant lines; this is 1839 over it, 5.60× 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: DesignGuide REDACTED:1— ClassTooLong — 1884 significant lines (blank, comment-only and punctuation-only lines excluded), 12 methods. The bar is 400 significant lines; this is 1484 over it, 4.71× 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: CodexProvider packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:670— ClassTooLong — 1771 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 55 methods, 2 blocks, lines 670-3251. The bar is 400 significant lines; this is 1371 over it, 4.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: AgentConfigForm ui/src/components/AgentConfigForm.tsx:1— ClassTooLong — 1514 significant lines (blank, comment-only and punctuation-only lines excluded), 22 methods. The bar is 400 significant lines; this is 1114 over it, 3.79× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: CapabilityLiveSession packages/paperclip-runner/src/live/live-session.ts:1181— ClassTooLong — 1489 significant lines (blank, comment-only and punctuation-only lines excluded), 50 methods. The bar is 400 significant lines; this is 1089 over it, 3.72× 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: DurablePrpControlPlane REDACTED:1495— ClassTooLong — 1452 significant lines (blank, comment-only and punctuation-only lines excluded), 37 methods. 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: CapabilityMockControlPlaneAdapter packages/paperclip-runner/src/mock-core/capability-mock-control-plane-adapter.ts:74— ClassTooLong — 1367 significant lines (blank, comment-only and punctuation-only lines excluded), 57 methods. The bar is 400 significant lines; this is 967 over it, 3.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: CompanySkills ui/src/pages/CompanySkills.tsx:1— ClassTooLong — 1342 significant lines (blank, comment-only and punctuation-only lines excluded), 55 methods. The bar is 400 significant lines; this is 942 over it, 3.36× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: GitHubChatPreview ui/storybook/prototypes/github-chat/GitHubChatPreview.tsx:1— ClassTooLong — 1139 significant lines (blank, comment-only and punctuation-only lines excluded), 13 methods. The bar is 400 significant lines; this is 739 over it, 2.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: CompanyEnvironments ui/src/pages/CompanyEnvironments.tsx:1— ClassTooLong — 1110 significant lines (blank, comment-only and punctuation-only lines excluded), 32 methods. The bar is 400 significant lines; this is 710 over it, 2.78× 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: CapabilitySemanticToolRuntime packages/paperclip-runner/src/tools/capability-semantic-tool-runtime.ts:105— ClassTooLong — 1075 significant lines (blank, comment-only and punctuation-only lines excluded), 29 methods. The bar is 400 significant lines; this is 675 over it, 2.69× 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: CompanyImport ui/src/pages/CompanyImport.tsx:1— ClassTooLong — 1056 significant lines (blank, comment-only and punctuation-only lines excluded), 20 methods. The bar is 400 significant lines; this is 656 over it, 2.64× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: TaskChatComposer REDACTED:1— ClassTooLong — 1056 significant lines (blank, comment-only and punctuation-only lines excluded), 9 methods. The bar is 400 significant lines; this is 656 over it, 2.64× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: App packages/paperclip-runner/devtools/issue-thread/src/App.tsx:1— ClassTooLong — 1054 significant lines (blank, comment-only and punctuation-only lines excluded), 15 methods. The bar is 400 significant lines; this is 654 over it, 2.64× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: CodexAcpxSession REDACTED:740— ClassTooLong — 1023 significant lines (blank, comment-only and punctuation-only lines excluded), 33 methods. The bar is 400 significant lines; this is 623 over it, 2.56× 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: NewIssueDialog ui/src/components/NewIssueDialog.tsx:1— ClassTooLong — 1012 significant lines (blank, comment-only and punctuation-only lines excluded), 20 methods. The bar is 400 significant lines; this is 612 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: IssueDocumentsSection ui/src/components/IssueDocumentsSection.tsx:1— ClassTooLong — 980 significant lines (blank, comment-only and punctuation-only lines excluded), 23 methods. The bar is 400 significant lines; this is 580 over it, 2.45× 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: ManagedProviderCommandExecutor packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:697— ClassTooLong — 914 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 20 methods, 3 blocks, lines 697-1859. The bar is 400 significant lines; this is 514 over it, 2.29× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: IssueChatThread ui/src/components/IssueChatThread.tsx:1— ClassTooLong — 895 significant lines (blank, comment-only and punctuation-only lines excluded), 95 methods. The bar is 400 significant lines; this is 495 over it, 2.24× 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: Routines ui/src/pages/Routines.tsx:1— ClassTooLong — 882 significant lines (blank, comment-only and punctuation-only lines excluded), 13 methods. The bar is 400 significant lines; this is 482 over it, 2.21× 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.
MethodTooLong: DurablePrpCodexTransport.#resume packages/paperclip-runner/src/live/runnerd-codex-transport.ts:5146— MethodTooLong — #resume runs 598 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 498 over it, 5.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: CodexProvider.poll packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:2225— MethodTooLong — poll runs 545 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 445 over it, 5.45× 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: CapabilityMockControlPlaneAdapter.#executeCommand packages/paperclip-runner/src/mock-core/capability-mock-control-plane-adapter.ts:698— MethodTooLong — #executeCommand runs 414 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 314 over it, 4.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: CodexCommandExecutor.poll_current_provider packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:4028— MethodTooLong — poll_current_provider runs 405 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 305 over it, 4.05× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AcpxRuntimeHost.open packages/paperclip-runner/src/drivers/acpx/runtime-host.ts:331— MethodTooLong — open runs 341 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 241 over it, 3.41× 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: CodexCommandExecutor.restore_provider_if_needed packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:1805— MethodTooLong — restore_provider_if_needed runs 295 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 195 over it, 2.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: CapabilitySemanticToolRuntime.#invoke packages/paperclip-runner/src/tools/capability-semantic-tool-runtime.ts:284— MethodTooLong — #invoke runs 295 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 195 over it, 2.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: DurablePrpCodexTransport.#pumpEvents packages/paperclip-runner/src/live/runnerd-codex-transport.ts:6300— MethodTooLong — #pumpEvents runs 293 significant lines (blank, comment-only and punctuation-only lines excluded) 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.
MethodTooLong: PaperclipSemanticDispatcher.dispatch packages/paperclip-runner/src/semantic-tools/paperclip-dispatcher.ts:156— MethodTooLong — dispatch runs 287 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 187 over it, 2.87× 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: CodexProvider.start_with_tools_observed packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:903— MethodTooLong — start_with_tools_observed runs 246 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 146 over it, 2.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: DurablePrpCodexTransport.request packages/paperclip-runner/src/live/runnerd-codex-transport.ts:3702— MethodTooLong — request runs 221 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 121 over it, 2.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: DurablePrpControlPlane.#event REDACTED:3112— MethodTooLong — #event runs 198 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 98 over it, 1.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: CapabilityLiveSession.#handleNotification packages/paperclip-runner/src/live/live-session.ts:2768— MethodTooLong — #handleNotification runs 186 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 86 over it, 1.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ChatSdkEndpointRuntime.constructor server/src/services/chat-sdk-runtime.ts:2054— MethodTooLong — constructor runs 184 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 84 over it, 1.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: ChatSdkEndpointRuntime.rehydrateAttachment server/src/services/chat-sdk-runtime.ts:2922— MethodTooLong — rehydrateAttachment runs 175 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 75 over it, 1.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.
MethodTooLong: ClaudeManagedProvider.normalize_remote_event packages/paperclip-runner/runner/crates/runner-core/src/claude_managed_provider.rs:1516— MethodTooLong — normalize_remote_event runs 167 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 67 over it, 1.67× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: HarnessNativeSession.events packages/paperclip-runner/src/backends/harness-driver-backend.ts:512— MethodTooLong — events runs 163 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 63 over it, 1.63× 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: CodexCommandExecutor.start_turn packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2919— MethodTooLong — start_turn runs 162 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 62 over it, 1.62× 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: DurablePrpCodexTransport.#closeOnce packages/paperclip-runner/src/live/runnerd-codex-transport.ts:4524— MethodTooLong — #closeOnce runs 162 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 62 over it, 1.62× 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: ManagedProviderCommandExecutor.project_event packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1547— MethodTooLong — project_event runs 157 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 57 over it, 1.57× 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: DurablePrpCodexTransport.#prepareLaunch packages/paperclip-runner/src/live/runnerd-codex-transport.ts:4805— MethodTooLong — #prepareLaunch runs 156 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 56 over it, 1.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DurablePrpControlPlane.#authResponse REDACTED:2593— MethodTooLong — #authResponse runs 154 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 54 over it, 1.54× 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: AuthenticatedTransport.connect packages/paperclip-runner/runner/crates/runner-core/src/durable/transport.rs:966— MethodTooLong — connect runs 152 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 52 over it, 1.52× 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: CapabilityLiveSession.#connect packages/paperclip-runner/src/live/live-session.ts:2354— MethodTooLong — #connect runs 152 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 52 over it, 1.52× 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: PaperclipRunnerSemanticAuthority.#readBinding server/src/services/native-runtime/runner-semantic-authority.ts:114— MethodTooLong — #readBinding runs 150 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 50 over it, 1.50× 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.
Sync-over-async blocking cli/src/checks/database-check.ts:73— `fs.existsSync` in `databaseCheck` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/checks/database-check.ts:74— `fs.mkdirSync` in `databaseCheck` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:152— `fs.mkdtempSync` in `runGitHubCurl` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:155— `fs.writeFileSync` in `runGitHubCurl` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:158— `fs.rmSync` in `runGitHubCurl` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:176— `fs.existsSync` in `smokePayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:190— `fs.existsSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:195— `fs.mkdirSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:196— `fs.lstatSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:200— `fs.chmodSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:201— `fs.chmodSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:202— `fs.chmodSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:205— `fs.rmSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:207— `fs.writeFileSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:231— `fs.renameSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:234— `fs.rmSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:235— `fs.rmSync` in `installNpmPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:250— `fs.existsSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:251— `fs.readFileSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:256— `fs.mkdirSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:257— `fs.lstatSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:261— `fs.chmodSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:262— `fs.chmodSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:263— `fs.chmodSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking cli/src/commands/install.ts:268— `fs.rmSync` in `installGitPayload` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Boundary violation [package:relative-cross-package] cli/src/commands/client/plugin.ts:4— cli/src/commands/client/plugin.ts:4 reaches into another package with a relative path (../../../../packages/plugins/create-paperclip-plugin/src/index.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] cli/src/config/schema.ts:1— cli/src/config/schema.ts:1 reaches into another package with a relative path (../../../packages/shared/src/config-schema.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] cli/src/telemetry.ts:2— cli/src/telemetry.ts:2 reaches into another package with a relative path (../../packages/shared/src/telemetry/index.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] packages/paperclip-runner/scripts/controlled-evals/manifest.mjs:6— packages/paperclip-runner/scripts/controlled-evals/manifest.mjs:6 reaches into another package with a relative path (../../../../server/package.json) — import the package by name instead.
Boundary violation [package:relative-cross-package] packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:1— packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:1 reaches into another package with a relative path (../../../../tests/runner-e2e/cost-ledger.js) — import the package by name instead.
Boundary violation [package:test-suite-dependency] packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:1— packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:1 imports tests/runner-e2e/cost-ledger.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on.
Boundary violation [package:relative-cross-package] packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:2— packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:2 reaches into another package with a relative path (../../../../tests/runner-e2e/eval-gateway.js) — import the package by name instead.
Boundary violation [package:test-suite-dependency] packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:2— packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:2 imports tests/runner-e2e/eval-gateway.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on.
Boundary violation [package:relative-cross-package] packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:3— packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:3 reaches into another package with a relative path (../../../../tests/runner-e2e/operating-overhead.js) — import the package by name instead.
Boundary violation [package:test-suite-dependency] packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:3— packages/paperclip-runner/scripts/controlled-evals/shared-cost-runtime.ts:3 imports tests/runner-e2e/operating-overhead.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on.
Boundary violation [package:third-party-deep-import] packages/paperclip-runner/scripts/generate-protocol-schema-module.mjs:5— packages/paperclip-runner/scripts/generate-protocol-schema-module.mjs:5 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] packages/paperclip-runner/scripts/generate-protocol-schema-module.mjs:6— packages/paperclip-runner/scripts/generate-protocol-schema-module.mjs:6 imports ajv/dist/standalone/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:relative-cross-package] packages/paperclip-runner/scripts/grok-native-smoke.mjs:27— packages/paperclip-runner/scripts/grok-native-smoke.mjs:27 reaches into another package with a relative path (../../../server/package.json) — import the package by name instead.
Boundary violation [package:third-party-deep-import] packages/paperclip-runner/scripts/lib/capability-inventory.mjs:4— packages/paperclip-runner/scripts/lib/capability-inventory.mjs:4 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] REDACTED:6— REDACTED:6 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:relative-cross-package] packages/paperclip-runner/scripts/run-pr-vitest-lane.mjs:27— packages/paperclip-runner/scripts/run-pr-vitest-lane.mjs:27 reaches into another package with a relative path (../../../scripts/ci-profile/record.mjs) — import the package by name instead.
Boundary violation [package:third-party-deep-import] packages/paperclip-runner/src/drivers/opencode/mcp-bridge.ts:3— packages/paperclip-runner/src/drivers/opencode/mcp-bridge.ts:3 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] packages/paperclip-runner/src/drivers/runner-tool-bridge.ts:10— packages/paperclip-runner/src/drivers/runner-tool-bridge.ts:10 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] packages/paperclip-runner/src/semantic-tools/dispatcher.ts:1— packages/paperclip-runner/src/semantic-tools/dispatcher.ts:1 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] packages/paperclip-runner/src/semantic-tools/paperclip-dispatcher.ts:1— packages/paperclip-runner/src/semantic-tools/paperclip-dispatcher.ts:1 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:relative-cross-package] packages/shared/scripts/generate-runner-skill-frontmatter.ts:5— packages/shared/scripts/generate-runner-skill-frontmatter.ts:5 reaches into another package with a relative path (../../paperclip-runner/package.json) — import the package by name instead.
Boundary violation [package:test-cross-package-internals] scripts/__tests__/grok-public-install-sandbox.test.mjs:13— scripts/__tests__/grok-public-install-sandbox.test.mjs:13 reaches past another workspace package's public entry into its internals with a relative path (../../packages/paperclip-runner/src/live/runner-binary.ts) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/backfill-issue-reference-mentions.ts:1— scripts/backfill-issue-reference-mentions.ts:1 reaches into another package with a relative path (../packages/db/src/index.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/backfill-issue-reference-mentions.ts:2— scripts/backfill-issue-reference-mentions.ts:2 reaches into another package with a relative path (../server/src/config.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/backfill-issue-reference-mentions.ts:3— scripts/backfill-issue-reference-mentions.ts:3 reaches into another package with a relative path (../server/src/services/issue-references.js) — import the package by name instead.
+ 15 more in this group — see findings.md.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×40
Recursive walk over a caller-supplied document has no depth cap ui/src/pages/apps/gateways/gateway-helpers.ts:233— `formatHydratedSnippetConfig` is exported, takes a document from its caller (line 243) and hands it to `replaceSnippetConfigValue`, which calls itself at line 233 (`replaceSnippetConfigValue`) with a piece of `value` (and at line 237) — and nowhere in `replaceSnippetConfigValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `replaceSnippetConfigValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap ui/src/i18n/locale-validation.ts:105— `validateLocaleMessages` is exported, takes a document from its caller (line 110) and hands it to `validateNode`, which calls itself at line 105 (`validateNode`) with a piece of `candidate` — and nowhere in `validateNode` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `validateNode` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap ui/src/components/AgentConfigForm.tsx:211— `overlayValuesEqual` is exported and takes `a: unknown` from its caller, and it calls itself at line 211 (`overlayValuesEqual`) with a piece of `a` (and at line 221) — and nowhere in `overlayValuesEqual` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `overlayValuesEqual` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap REDACTED:309— `validateJsonSchemaForm` is exported and takes `values: Record<string, unknown>` from its caller, and it calls itself at line 309 (`validateJsonSchemaForm`) with a piece of `values` (and at line 325) — and nowhere in `validateJsonSchemaForm` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `validateJsonSchemaForm` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap REDACTED:254— `isDatabaseConnectionUnavailableError` is exported and takes `err: unknown` from its caller, and it calls itself at line 254 (`isDatabaseConnectionUnavailableError`) with a piece of `err` — and nowhere in `isDatabaseConnectionUnavailableError` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `isDatabaseConnectionUnavailableError` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/redaction.ts:763— `sanitizeRecord` is exported, takes a document from its caller (line 899) and hands it to `sanitizeValue`, which calls itself at line 763 (`sanitizeValue`) with a piece of `value` (and at line 799) — and nowhere in `sanitizeValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sanitizeValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/browser-use-client.ts:59— `sanitizeBrowserUse` is exported and takes `value: unknown` from its caller, and it calls itself at line 59 (`sanitizeBrowserUse`) with a piece of `value` (and at line 69) — and nowhere in `sanitizeBrowserUse` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sanitizeBrowserUse` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/decision-signing.ts:147— `signDecisionSpec` is exported, takes a document from its caller (line 155) and hands it to `canonical`, which calls itself at line 147 (`canonical`) with a piece of `value` (and at line 150) — and nowhere in `canonical` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonical` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/feedback-redaction.ts:150— `sanitizeFeedbackValue` is exported and takes `value: unknown` from its caller, and it calls itself at line 150 (`sanitizeFeedbackValue`) with a piece of `value` (and at line 164) — and nowhere in `sanitizeFeedbackValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sanitizeFeedbackValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/feedback-redaction.ts:185— `stableStringify` is exported and takes `value: unknown` from its caller, and it calls itself at line 185 (`stableStringify`) with a piece of `value` (and at line 190) — and nowhere in `stableStringify` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `stableStringify` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/google-chat-tool-policy.ts:60— `googleChatToolInputSchema` is exported, takes a document from its caller (line 77) and hands it to `withoutUnreadFields`, which calls itself at line 60 (`withoutUnreadFields`) with a piece of `value` (and at line 68, line 73) — and nowhere in `withoutUnreadFields` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `withoutUnreadFields` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/json-schema-secret-refs.ts:45— `collectSecretRefPaths` is exported, takes a document from its caller (line 33) and hands it to `walk`, which calls itself at line 45 (`walk`) with a piece of `node` (and at line 57) — and nowhere in `walk` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `walk` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/managed-resource-drift.ts:10— `stableJson` is exported and takes `value: unknown` from its caller, and it calls itself at line 10 (`stableJson`) with a piece of `value` (and at line 14) — and nowhere in `stableJson` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `stableJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/plugin-secrets-handler.ts:114— `extractSecretRefBindingsFromConfig` is exported, takes a document from its caller (line 81) and hands it to `walk`, which calls itself at line 114 (`walk`) with a piece of `value` (and at line 119) — and nowhere in `walk` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `walk` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/provider-profile-qualification.ts:35— `assertProfileMetadataContainsNoSecrets` is exported, takes a document from its caller (line 55) and hands it to `containsSecretShapedValue`, which calls itself at line 35 (`containsSecretShapedValue`) with a piece of `value` (and at line 37) — and nowhere in `containsSecretShapedValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `containsSecretShapedValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/provider-profile-qualification.ts:47— `assertProfileMetadataContainsNoSecrets` is exported, takes a document from its caller (line 55) and hands it to `normalizeKnownPublicValues`, which calls itself at line 47 (`normalizeKnownPublicValues`) with a piece of `value` (and at line 51) — and nowhere in `normalizeKnownPublicValues` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `normalizeKnownPublicValues` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/provider-profile-qualification.ts:146— `computeQualifiedProfileRevision` is exported, takes a document from its caller (line 158) and hands it to `canonicalize`, which calls itself at line 146 (`canonicalize`) with a piece of `value` (and at line 152) — and nowhere in `canonicalize` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonicalize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/receipt-fingerprint.ts:5— `receiptFingerprint` is exported, takes a document from its caller (line 10) and hands it to `canonical`, which calls itself at line 5 (`canonical`) with a piece of `value` (and at line 6) — and nowhere in `canonical` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonical` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap REDACTED:249— `projectConnectionMethodToolArguments` is exported, takes a document from its caller (line 258) and hands it to `mergeManagedToolArguments`, which calls itself at line 249 (`mergeManagedToolArguments`) with a piece of `supplied` — and nowhere in `mergeManagedToolArguments` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `mergeManagedToolArguments` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap REDACTED:284— `projectConnectionMethodToolInputSchema` is exported, takes a document from its caller (line 306) and hands it to `stripManagedToolArgumentSchema`, which calls itself at line 284 (`stripManagedToolArgumentSchema`) with a piece of `schema` — and nowhere in `stripManagedToolArgumentSchema` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `stripManagedToolArgumentSchema` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/native-runtime/canonical.ts:4— `canonicalNativeJson` is exported and takes `value: unknown` from its caller, and it calls itself at line 4 (`canonicalNativeJson`) with a piece of `value` (and at line 10) — and nowhere in `canonicalNativeJson` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonicalNativeJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/native-runtime/remote-provider-pack-verification.ts:6— `canonicalProviderPackJson` is exported and takes `value: unknown` from its caller, and it calls itself at line 6 (`canonicalProviderPackJson`) with a piece of `value` (and at line 8) — and nowhere in `canonicalProviderPackJson` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonicalProviderPackJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/native-runtime/runner-api-catalog.ts:73— `buildRunnerApiCatalog` is exported, takes a document from its caller (line 71) and hands it to `dereference`, which calls itself at line 73 (`dereference`) with a piece of `value` (and at line 79, line 81) — and nowhere in `dereference` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `dereference` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/connectors/vercel/index.ts:52— `vercelClient` is exported, takes a document from its caller (line 23) and hands it to `sanitize`, which calls itself at line 52 (`sanitize`) with a piece of `value` (and at line 53) — and nowhere in `sanitize` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sanitize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap server/src/services/connectors/supabase/index.ts:112— `supabaseClient` is exported, takes a document from its caller (line 84) and hands it to `sanitize`, which calls itself at line 112 (`sanitize`) with a piece of `value` (and at line 113) — and nowhere in `sanitize` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sanitize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
+ 15 more in this group — see findings.md.
X2 · Cancellation propagation· Async function without AbortSignal · ×39
Async function without AbortSignal: queryFn ui/storybook/prototypes/AiTaskConnectionReview.tsx:50— `queryFn` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: importPluginModule ui/src/plugins/slots.tsx:422— `importPluginModule` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: loadManifest ui/src/lib/app-brand-assets.ts:46— `loadManifest` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: prepareOAuthNavigation ui/src/lib/oauthHandoff.ts:118— `prepareOAuthNavigation` awaits `json(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `json(url, { signal })`.
Async function without AbortSignal: fetchAttachmentText ui/src/components/IssueAttachmentsSection.tsx:39— `fetchAttachmentText` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: current ui/src/api/announcements.ts:14— `current` awaits `json(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `json(url, { signal })`.
Async function without AbortSignal: exportAgentActionsCsv ui/src/api/audit.ts:104— `exportAgentActionsCsv` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: authPost ui/src/api/auth.ts:115— `authPost` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: authPatch ui/src/api/auth.ts:138— `authPatch` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: getSession ui/src/api/auth.ts:155— `getSession` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: getProfile ui/src/api/auth.ts:182— `getProfile` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: get ui/src/api/health.ts:55— `get` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: requestDevServerRestart ui/src/api/health.ts:71— `requestDevServerRestart` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: downloadProviderTrace ui/src/api/heartbeats.ts:181— `downloadProviderTrace` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: loadDynamicParser ui/src/adapters/dynamic-loader.ts:218— `loadDynamicParser` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: fetchConfigSchema ui/src/adapters/schema-config-fields.tsx:211— `fetchConfigSchema` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: getDevHealthPayload scripts/dev-runner.ts:682— `getDevHealthPayload` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: getJson scripts/paperclip-commit-metrics.ts:835— `getJson` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: getDevHealthPayload scripts/dev-runner.mjs:433— `getDevHealthPayload` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: fetchArchive scripts/storybook-visual-baseline.mjs:272— `fetchArchive` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: api scripts/smoke/terminal-bench-loop-skill-smoke.mjs:103— `api` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: fetchGitHubTree packages/skills-catalog/src/catalog-builder.ts:611— `fetchGitHubTree` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: fetchReferencedFileBytes packages/skills-catalog/src/catalog-builder.ts:642— `fetchReferencedFileBytes` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: json packages/plugins/sandbox-providers/createos/src/client.ts:72— `json` awaits `json(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `json(url, { signal })`.
Async function without AbortSignal: syncFiles packages/plugins/sandbox-providers/createos/src/file-sync.ts:59— `syncFiles` awaits `upload(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `upload(url, { signal })`.
+ 14 more in this group — see findings.md.
D10 · Test Quality· Fixed-sleep synchronisation · ×37
Fixed-sleep synchronisation: returns no row when the claim row lock holds until after the deadline server/src/services/setup-token-session.test.ts:1503— This test starts work it did not wait for (`lockDb`, still running when the sleep starts) and then orders itself against it with `delay(600)` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: streams with backpressure and waits for an active sink before releasing cancellation server/src/services/workspace-git-operation-scheduler.test.ts:49— This test starts work it did not wait for (`observed`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 30))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: reuses a warm Codex process across run authorities without idle status polling server/src/services/native-runtime/plugin-runner-task.test.ts:326— This test starts work it did not wait for (`owner`, still running when the sleep starts) and then orders itself against it with `new Promise(resolve=>setTimeout(resolve,10))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: waits for an unawaited report's database read and Sentry capture before it resolves server/src/services/__tests__/run-failure-report.test.ts:1357— This test starts work it did not wait for (`drain`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 10))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: holds the account-home secret mutation lock while checking a pre-existing secret's value server/src/__tests__/agent-device-login-routes.test.ts:1110— This test starts work it did not wait for (`lockHolder`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 20))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: inserts no binding when the claim row lock holds until after the deadline server/src/__tests__/agents-claude-oauth-binding.test.ts:523— This test starts work it did not wait for (`lockDb`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 600))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: rejects an inherited claim when a concurrent parent rotation commits while this create waits on the parent row lock server/src/__tests__/agents-claude-oauth-binding.test.ts:973— This test starts work it did not wait for (`lockDb`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 300))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: fails closed when a concurrent document update wins before annotation thread creation commits server/src/__tests__/document-annotations-service.test.ts:108— This test starts work it did not wait for (`concurrentUpdate`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 50))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: rejects branch reconciliation when a runtime service starts before the locked update server/src/__tests__/execution-workspaces-service.test.ts:3761— This test starts work it did not wait for (`blockingTransaction`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 250))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: serializes concurrent preparation of tasks sharing one base server/src/__tests__/git-workspace-expiration.test.ts:1034— This test starts work it did not wait for (`held`, still running when the sleep starts) and then orders itself against it with `new Promise(resolve => setTimeout(resolve, 500))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: revalidates review policy under the issue lock before interaction %s server/src/__tests__/issue-thread-interactions-service.test.ts:2418— This test starts work it did not wait for (`tightenPolicy`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 25))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: serializes two tasks converting against the same shared clone and keeps their branches apart server/src/__tests__/nested-clone-migration.test.ts:378— This test starts work it did not wait for (`held`, still running when the sleep starts) and then orders itself against it with `new Promise(resolve => setTimeout(resolve, 3_000))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: serializes a rename, archive, or disable update against a concurrent account-home mutation lock holder server/src/__tests__/secrets-service.test.ts:1095— This test starts work it did not wait for (`cleanupCall`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 20))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: serializes a secret delete against a concurrent account-home mutation lock holder server/src/__tests__/secrets-service.test.ts:1135— This test starts work it did not wait for (`svc`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 20))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: fails a queued adapter-schema-secret create when an account-home cleanup removes its directory first server/src/__tests__/secrets-service.test.ts:1188— This test starts work it did not wait for (`cleanupCall`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 20))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: serializes delegation creation behind membership removal so reauthorization cannot revive stale consent server/src/__tests__/tool-access-service.test.ts:1750— This test starts work it did not wait for (`removal`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 50))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: keeps an organization audience fail-closed when empty replacement races with member %s server/src/__tests__/tool-access-service.test.ts:2001— This test starts work it did not wait for (`firstReplacement`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 50))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: preserves a live compiler's lock even when its parent has exited scripts/__tests__/ensure-plugin-build-deps.test.mjs:96— This test starts work it did not wait for (`run`, still running when the sleep starts) and then orders itself against it with `sleep(200)` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: rejects partial output from an interrupted direct compiler scripts/__tests__/ensure-plugin-build-deps.test.mjs:178— This test starts work it did not wait for (`f`, still running when the sleep starts) and then orders itself against it with `sleep(20)` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: leaves no leaked session and keeps the sandbox usable after a forced mid-flight disconnect packages/plugins/sandbox-providers/daytona/src/duplex-command-stream.live.test.ts:255— This test starts work it did not wait for (`live`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 4_000))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: manual and automatic compaction retain native progress and usage packages/paperclip-runner/test/pi-acp-package-contract.test.mjs:273— This test starts work it did not wait for (`active`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 25))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: keeps one durable session across turns, an inline answer, reconnect, and stop packages/paperclip-runner/src/live/clean-room-server.test.ts:902— This test starts work it did not wait for (`hanging`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 5))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: passes the common typed-event contract and reports one provider turn terminal packages/paperclip-runner/src/drivers/codex/codex-app-server-driver.lifecycle.test.ts:575— This test starts work it did not wait for (`requestResolution`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 0))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: keeps a prompted MCP tool answerable after rejecting a session-wide decision packages/paperclip-runner/src/drivers/codex/codex-app-server-driver.runtime-requests.test.ts:136— This test starts work it did not wait for (`response`, still running when the sleep starts) and then orders itself against it with `new Promise(resolve => setTimeout(resolve, 0))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: replays the DOT-185 requestUserInput shape as one canonical three-question request packages/paperclip-runner/src/drivers/codex/codex-app-server-driver.runtime-requests.test.ts:282— This test starts work it did not wait for (`nativeResponse`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 0))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Repeated repair: packages/shared/src/types/execution-projection.ts packages/shared/src/types/execution-projection.ts:76— packages/shared/src/types/execution-projection.ts changed 13 times in last 90 days and 11 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is execution-projection.requiresExecutionReconciliation at line 76), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: explain project access denials and add an authorized repair path (#17509)”; “fix: recover saved work and provide reliable task Retry (#16965)”; “fix(recovery): recover retained workspaces before saved messages (#16906)”; “fix(runtime): retain cancelled workspaces before reconstruction (#16700)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- packages/shared/src/types/execution-projection.ts`: 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.
Repeated repair: server/src/services/recovery/stranded-notice.ts server/src/services/recovery/stranded-notice.ts:204— server/src/services/recovery/stranded-notice.ts changed 10 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is stranded-notice.buildStrandedRecoveryEscalationNotice at line 204), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: recover saved work and provide reliable task Retry (#16965)”; “fix: add one-click retry for restricted workspace setup (#16909)”; “fix(workspaces): name the owner action when a shared source is restricted (#16545)”; “fix(heartbeat): wait for a live holder of a reused shared execution workspace (#16371)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/recovery/stranded-notice.ts`: 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.
Repeated repair: packages/paperclip-runner/src/drivers/codex/codex-driver-types.ts packages/paperclip-runner/src/drivers/codex/codex-driver-types.ts:39— packages/paperclip-runner/src/drivers/codex/codex-driver-types.ts changed 11 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is (anonymous) at line 39), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(runner): preserve task context when tool connections change (#14963)”; “fix(runner): preserve stock Codex base instructions (#14920)”; “fix(runner): honor Codex effort selected in composer (#14568)”; “fix: make runner task context ownership explicit (#13753)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- packages/paperclip-runner/src/drivers/codex/codex-driver-types.ts`: 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.
Repeated repair: server/src/modules/wake-queue/application/ports.ts server/src/modules/wake-queue/application/ports.ts:289— server/src/modules/wake-queue/application/ports.ts changed 10 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is TransactionScope.requireTx at line 289), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(chat): keep each chat conversation in its own wake batch (#17054)”; “fix: recover deferred messages and completed unblock waits (#16673)”; “fix: make connection checks and task handoffs reliable (#13404)”; “fix(runner): preserve handoff work and publish requested files (#13355)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/modules/wake-queue/application/ports.ts`: 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.
Repeated repair: ui/src/api/client.ts ui/src/api/client.ts:93— ui/src/api/client.ts changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is client.coalescedGet at line 93), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “test: remove repeated setup and strengthen regression proof (#16022)”; “fix(ui): recover gracefully during server restarts (#14560)”; “fix(ui): recover expired Cloud tenant sessions (#12826)”; “fix(ui): scope the company selection to the signed-in account (#11430)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/src/api/client.ts`: 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.
Repeated repair: server/src/services/chat-github-tools.ts server/src/services/chat-github-tools.ts:236— server/src/services/chat-github-tools.ts changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is chat-github-tools.githubBotToolsForSession at line 236), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: keep GitHub guest provenance from failing tool discovery (#17340)”; “fix: retain channel tools across task continuations (#16806)”; “fix(github): retry and recover review publication (#16284)”; “fix(mcp): deduplicate discovered tool descriptors (#16281)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/chat-github-tools.ts`: 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.
Repeated repair: packages/adapter-utils/src/acpx-engine/constants.ts packages/adapter-utils/src/acpx-engine/constants.ts:71— packages/adapter-utils/src/acpx-engine/constants.ts changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is constants.acpxAgentIdForAdapterType at line 71), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(acpx): end Claude turns whose pending tool call stops receiving updates (#16671)”; “fix(acpx): bound Claude MCP tool calls when runtime MCP servers attach (#16360)”; “fix(acpx): record turn activity at the moment a stop fires (#15962)”; “fix(adapter-utils): fail fast when the sandbox control channel is lost mid-turn (#13158)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- packages/adapter-utils/src/acpx-engine/constants.ts`: 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.
Repeated repair: server/src/services/legacy-controller-lease.ts server/src/services/legacy-controller-lease.ts:163— server/src/services/legacy-controller-lease.ts changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is legacy-controller-lease.watchLegacyControllerLease.assertOwned at line 163), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(heartbeat): renew legacy controller leases on a private pool (#17032)”; “fix(heartbeat): retry a legacy run that lost its lease before dispatch (#16358)”; “fix(server): record legacy controller lease-loss timings (#16359)”; “fix(heartbeat): retry legacy runs a restart stopped before dispatch (#16355)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/legacy-controller-lease.ts`: 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.
Repeated repair: ui/src/lib/sentry.ts ui/src/lib/sentry.ts:191— ui/src/lib/sentry.ts changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is sentry.buildBrowserSentryInitOptions.beforeSend at line 191), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ui): attribute stackless unhandled rejections with event and lifecycle facts (#15940)”; “fix: preserve company context across browser hot reload (#14482)”; “fix(ui): retain bounded context for browser render errors (#13904)”; “fix(sentry): carry the deployment environment to the browser (#13784)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/src/lib/sentry.ts`: 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.
Repeated repair: ui/src/api/auth.ts ui/src/api/auth.ts:48— ui/src/api/auth.ts changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is auth.extractAuthError at line 48), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: always enable keyboard shortcuts (#14643)”; “fix(ui): recover gracefully during server restarts (#14560)”; “fix: make keyboard shortcut enablement a personal preference (#14141)”; “fix(ui): recover expired Cloud tenant sessions (#12826)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/src/api/auth.ts`: 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.
Repeated repair: packages/db/src/schema/issue_thread_interactions.ts packages/db/src/schema/issue_thread_interactions.ts:63— packages/db/src/schema/issue_thread_interactions.ts changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is issue_thread_interactions.issueThreadInteractions at line 63), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(chat): honor dismissal for all composer requests (#17218)”; “fix: make task recovery durable and preserve current requests (#13075)”; “fix(interactions): authorize resolvers consistently (#11376)”; “fix(issues): make DELETE /api/issues/:id succeed for issues with dependents (#11331)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- packages/db/src/schema/issue_thread_interactions.ts`: 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.
Repeated repair: ui/vite.config.ts ui/vite.config.ts:16— ui/vite.config.ts changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is transformIndexHtml at line 16), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ui): retain bounded context for browser render errors (#13904)”; “fix: attribute Sentry errors to the loaded source release (#13719)”; “fix(ui): stamp the service worker with a per-build id so deploys reach parked tabs (#12725)”; “revert(ui): back out onboarding port (#10786) (#11067)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/vite.config.ts`: 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.
Repeated repair: ui/src/components/ActiveAgentsPanel.tsx ui/src/components/ActiveAgentsPanel.tsx:50— ui/src/components/ActiveAgentsPanel.tsx changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is ActiveAgentsPanel.ActiveAgentsPanel at line 50), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: show each task once in dashboard agent cards (#14847)”; “fix: make answered Slack conversations idle (#13809)”; “fix(ui): keep active runner status current and say Working (#13238)”; “fix: make task recovery durable and preserve current requests (#13075)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/src/components/ActiveAgentsPanel.tsx`: 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.
Repeated repair: ui/src/context/CompanyContext.tsx ui/src/context/CompanyContext.tsx:109— ui/src/context/CompanyContext.tsx changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is CompanyContext.CompanyProvider at line 109), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: preserve company context across browser hot reload (#14482)”; “fix(ui): scope the company selection to the signed-in account (#11430)”; “fix(ui): keep the stored company when the company request fails (#11477)”; “fix(ui): stop the selection ping-pong on archived company URLs (#11300)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/src/context/CompanyContext.tsx`: 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.
Repeated repair: cli/src/onboard-service.ts cli/src/onboard-service.ts:227— cli/src/onboard-service.ts changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is onboard-service.handleOnboardService at line 227), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): guard service install against a missing managed shim (#13985)”; “fix(cli): open dashboard after onboarding service starts (#12164)”; “fix(cli): skip the foreground-start prompt after the service starts (#12153)”; “fix(cli): materialize the managed install before the onboarding service install (#12148)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- cli/src/onboard-service.ts`: 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.
Repeated repair: packages/adapter-utils/src/github-launcher.ts packages/adapter-utils/src/github-launcher.ts:120— packages/adapter-utils/src/github-launcher.ts changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is github-launcher.githubBrokerEnvironment at line 120), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(adapter-utils): retry GitHub broker transport failures before falling back (#14856)”; “fix: repair managed Git launchers in sandbox projects (#13588)”; “fix(runner): restore legacy Git access and independent networking (#13094)”; “fix: resolve duplicate connections to the same GitHub account (#13022)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- packages/adapter-utils/src/github-launcher.ts`: 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.
Repeated repair: server/src/modules/run-dispatch/domain/wake-context.ts server/src/modules/run-dispatch/domain/wake-context.ts:112— server/src/modules/run-dispatch/domain/wake-context.ts changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is wake-context.isResolvedInteractionContinuationWakeContext at line 112), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(chat): keep each chat conversation in its own wake batch (#17054)”; “fix(connections): retire requests for already available tools (#15856)”; “fix: resume subscription comment wakes and preserve retry status (#13433)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/modules/run-dispatch/domain/wake-context.ts`: 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.
Repeated repair: ui/src/lib/recent-tasks.ts ui/src/lib/recent-tasks.ts:31— ui/src/lib/recent-tasks.ts changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is recent-tasks.isRecentTaskEntry at line 31), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: make answered Slack conversations idle (#13809)”; “fix(ui): stop Recent Tasks storage feedback across tabs (#13402)”; “fix(ui): debounce recent task ordering (#13007)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/src/lib/recent-tasks.ts`: 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.
Repeated repair: packages/adapter-utils/src/command-redaction.ts packages/adapter-utils/src/command-redaction.ts:37— packages/adapter-utils/src/command-redaction.ts changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is command-redaction.looksLikeCredentialJwt at line 37), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: preserve public identifiers in feedback redaction (#16168)”; “fix(runner): preserve credential content in document saves (#14937)”; “fix(runner): restore local session and task integrity (#12721)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- packages/adapter-utils/src/command-redaction.ts`: 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.
Repeated repair: server/src/routes/auth.ts server/src/routes/auth.ts:38— server/src/routes/auth.ts changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is auth.authRoutes at line 38), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: always enable keyboard shortcuts (#14643)”; “fix: make keyboard shortcut enablement a personal preference (#14141)”; “fix(sentry): carry the deployment environment to the browser (#13784)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/routes/auth.ts`: 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.
Repeated repair: server/src/services/recovery/review-path-recovery.ts server/src/services/recovery/review-path-recovery.ts:54— server/src/services/recovery/review-path-recovery.ts changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is review-path-recovery.isReviewPathRecoveryIdempotencyConflict at line 54), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(recovery): deliver review-path repair instructions to agent prompts (#17353)”; “fix(recovery): surface exhausted review-path repair (#15764)”; “fix: preserve chat message bindings in review recovery (#13818)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/recovery/review-path-recovery.ts`: 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.
Repeated repair: server/src/services/adapter-execution-control.ts server/src/services/adapter-execution-control.ts:71— server/src/services/adapter-execution-control.ts changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is adapter-execution-control.adapterStopTimeoutError at line 71), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(heartbeat): answer an unsettled adapter Stop with a 409 instead of a 500 (#16032)”; “fix: report pending execution phase at Stop timeout (#14990)”; “fix(server): retain context for unconfirmed adapter stops (#14639)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- server/src/services/adapter-execution-control.ts`: 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.
Repeated repair: packages/db/src/test-embedded-postgres.ts packages/db/src/test-embedded-postgres.ts:503— packages/db/src/test-embedded-postgres.ts changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is test-embedded-postgres.buildEmbeddedPostgresTemplate at line 503), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): make embedded-Postgres tests survive runner contention (#12466)”; “fix(db): close test database clients before the embedded Postgres cluster stops (#12335)”; “fix(db): harden embedded Postgres test start with bounded retry (#10540)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- packages/db/src/test-embedded-postgres.ts`: 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.
Repeated repair: packages/adapters/claude-local/src/server/quota.ts packages/adapters/claude-local/src/server/quota.ts:503— packages/adapters/claude-local/src/server/quota.ts changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is quota.captureClaudeCliUsageText at line 503), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: scope quota reports to authorized subscription accounts (#14994)”; “fix(claude-local): read a macOS isolated login from its suffixed Keychain item (#13519)”; “fix(claude-local): skip expired credentials file when reading the Claude token (#13505)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- packages/adapters/claude-local/src/server/quota.ts`: 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.
Repeated repair: ui/storybook/prototypes/composer-model-picker/fixtures.ts ui/storybook/prototypes/composer-model-picker/fixtures.ts:104— ui/storybook/prototypes/composer-model-picker/fixtures.ts changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is fixtures.effortChoices at line 104), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ui): use available space for composer labels (#15050)”; “fix(composer): match effort options to adapter execution (#14576)”; “fix(runner): honor Codex effort selected in composer (#14568)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 09:50:58 -05:00' --until='2026-10-26 09:50:58 -05:00' --full-history --no-merges -- ui/storybook/prototypes/composer-model-picker/fixtures.ts`: 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.
P12 · CI test-gate honesty· Workspace package's tests never run by CI · ×35
Workspace package's tests never run by CI cli/package.json:1— `cli` is a workspace package with 505 test(s) in 67 file(s) (e.g. `cli/src/node-version.test.ts`, `cli/src/__tests__/access-parity.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/adapters/claude-local/package.json:1— `packages/adapters/claude-local` is a workspace package with 317 test(s) in 24 file(s) (e.g. `packages/adapters/claude-local/src/index.test.ts`, `packages/adapters/claude-local/src/server/acp.auth.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/adapters/codex-local/package.json:1— `packages/adapters/codex-local` is a workspace package with 433 test(s) in 31 file(s) (e.g. `REDACTED`, `packages/adapters/codex-local/src/server/acp.cli-version.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/adapters/gemini-local/package.json:1— `packages/adapters/gemini-local` is a workspace package with 59 test(s) in 7 file(s) (e.g. `packages/adapters/gemini-local/src/server/acp.test.ts`, `packages/adapters/gemini-local/src/server/engine-availability.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/adapters/hermes/package.json:95— `packages/adapters/hermes` is a workspace package with 110 test(s) in 10 file(s) (e.g. `packages/adapters/hermes/src/index.test.ts`, `packages/adapters/hermes/src/server/command-resolution.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/adapters/kimi-local/package.json:1— `packages/adapters/kimi-local` is a workspace package with 72 test(s) in 8 file(s) (e.g. `packages/adapters/kimi-local/src/server/acp.test.ts`, `packages/adapters/kimi-local/src/server/engine-availability.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/adapters/openclaw-gateway/package.json:1— `packages/adapters/openclaw-gateway` is a workspace package with 18 test(s) in 3 file(s) (e.g. `packages/adapters/openclaw-gateway/src/server/execute-dispatch.test.ts`, `packages/adapters/openclaw-gateway/src/server/execute.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/adapters/opencode-local/package.json:1— `packages/adapters/opencode-local` is a workspace package with 65 test(s) in 7 file(s) (e.g. `packages/adapters/opencode-local/src/server/execute.remote.test.ts`, `packages/adapters/opencode-local/src/server/execute.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/adapters/pi-local/package.json:1— `packages/adapters/pi-local` is a workspace package with 62 test(s) in 6 file(s) (e.g. `packages/adapters/pi-local/src/server/execute.remote.test.ts`, `packages/adapters/pi-local/src/server/models.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/db/package.json:1— `packages/db` is a workspace package with 241 test(s) in 59 file(s) (e.g. `packages/db/scripts/clean-poisoned-claude-sessions.test.ts`, `packages/db/src/adapter-auth-sessions-schema.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/google-sheets-mcp-server/package.json:45— `packages/google-sheets-mcp-server` is a workspace package with 20 test(s) in 5 file(s) (e.g. `packages/google-sheets-mcp-server/src/config.test.ts`, `packages/google-sheets-mcp-server/src/google-client.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/kv-demo-mcp-server/package.json:44— `packages/kv-demo-mcp-server` is a workspace package with 12 test(s) in 3 file(s) (e.g. `packages/kv-demo-mcp-server/src/http.test.ts`, `packages/kv-demo-mcp-server/src/store.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/mcp-server/package.json:43— `packages/mcp-server` is a workspace package with 14 test(s) in 1 file(s) (e.g. `packages/mcp-server/src/tools.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/plugins/create-paperclip-plugin/package.json:41— `packages/plugins/create-paperclip-plugin` is a workspace package with 2 test(s) in 1 file(s) (e.g. `packages/plugins/create-paperclip-plugin/src/entrypoints.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/plugins/examples/plugin-authoring-smoke-example/package.json:13— `packages/plugins/examples/plugin-authoring-smoke-example` is a workspace package with 2 test(s) in 1 file(s) (e.g. `packages/plugins/examples/plugin-authoring-smoke-example/tests/plugin.spec.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/plugins/examples/plugin-orchestration-smoke-example/package.json:13— `packages/plugins/examples/plugin-orchestration-smoke-example` is a workspace package with 3 test(s) in 1 file(s) (e.g. `packages/plugins/examples/plugin-orchestration-smoke-example/tests/plugin.spec.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/plugins/paperclip-plugin-fake-sandbox/package.json:19— `packages/plugins/paperclip-plugin-fake-sandbox` is a workspace package with 6 test(s) in 1 file(s) (e.g. `packages/plugins/paperclip-plugin-fake-sandbox/src/plugin.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/plugins/plugin-llm-wiki/package.json:21— `packages/plugins/plugin-llm-wiki` is a workspace package with 101 test(s) in 3 file(s) (e.g. `packages/plugins/plugin-llm-wiki/tests/issue-attachments.spec.ts`, `packages/plugins/plugin-llm-wiki/tests/plugin.spec.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/plugins/plugin-workspace-diff/package.json:49— `packages/plugins/plugin-workspace-diff` is a workspace package with 26 test(s) in 5 file(s) (e.g. `packages/plugins/plugin-workspace-diff/tests/contracts.spec.ts`, `packages/plugins/plugin-workspace-diff/tests/diff-model.spec.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/plugins/sandbox-providers/cloudflare/bridge-template/package.json:10— `packages/plugins/sandbox-providers/cloudflare/bridge-template` is a workspace package with 16 test(s) in 4 file(s) (e.g. `packages/plugins/sandbox-providers/cloudflare/bridge-template/src/auth.test.ts`, `packages/plugins/sandbox-providers/cloudflare/bridge-template/src/exec.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/plugins/sandbox-providers/cloudflare/package.json:49— `packages/plugins/sandbox-providers/cloudflare` is a workspace package with 15 test(s) in 2 file(s) (e.g. `packages/plugins/sandbox-providers/cloudflare/src/bridge-client.test.ts`, `packages/plugins/sandbox-providers/cloudflare/src/plugin.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/plugins/sandbox-providers/createos/package.json:48— `packages/plugins/sandbox-providers/createos` is a workspace package with 33 test(s) in 4 file(s) (e.g. `packages/plugins/sandbox-providers/createos/src/file-sync.test.ts`, `packages/plugins/sandbox-providers/createos/src/plugin.live.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/plugins/sandbox-providers/daytona/package.json:48— `packages/plugins/sandbox-providers/daytona` is a workspace package with 356 test(s) in 10 file(s) (e.g. `packages/plugins/sandbox-providers/daytona/src/duplex-command-stream.live.test.ts`, `packages/plugins/sandbox-providers/daytona/src/duplex-command-stream.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/plugins/sandbox-providers/e2b/package.json:48— `packages/plugins/sandbox-providers/e2b` is a workspace package with 19 test(s) in 1 file(s) (e.g. `packages/plugins/sandbox-providers/e2b/src/plugin.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
Workspace package's tests never run by CI packages/plugins/sandbox-providers/exe-dev/package.json:48— `packages/plugins/sandbox-providers/exe-dev` is a workspace package with 38 test(s) in 1 file(s) (e.g. `packages/plugins/sandbox-providers/exe-dev/src/plugin.test.ts`), but no CI command runs them — no step names the package and no workspace-wide command reaches it, so its tests gate nothing. Run its tests in CI, or delete them.
+ 10 more in this group — see findings.md.
X24 · Document value interpolated into markup unescaped· Untrusted text written into markup unescaped · ×34
Untrusted text written into markup unescaped packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:23— `repository` is text this program did not author, and it is written into a URL attribute through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:59— `escape(run.publicUrl)` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
Untrusted text written into markup unescaped packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:70— `escape(destination.publicUrl)` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
Untrusted text written into markup unescaped packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:72— `escape(previous.publicUrl)` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
Untrusted text written into markup unescaped packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:116— `escape(run.publicUrl)` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
Untrusted text written into markup unescaped packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:122— `escape(stylesheetHref)` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
Untrusted text written into markup unescaped server/src/lib/oauth-browser-return.ts:23— `continuePath===undefined?"0":`0;url=${attribute}`` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:243— `theme.cardRadius` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:245— `theme.font` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:246— `theme.font` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:307— `theme.cardRadius` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:308— `theme.cardRadius` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:310— `theme.font` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:311— `theme.font` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:442— `theme.cardRadius` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:443— `theme.font` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:462— `theme.cardShadow` is text this program did not author, and it is written into a quoted attribute value through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:488— `dotFill` is text this program did not author, and it is written into a quoted attribute value through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:494— `theme.cardRadius` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:496— `theme.font` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:497— `theme.font` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:742— `theme.nameColor` is text this program did not author, and it is written into a quoted attribute value through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:745— `theme.roleColor` is text this program did not author, and it is written into a quoted attribute value through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:749— `theme.defs(TARGET_W,TARGET_H)` is text this program did not author, and it is written into the text of an element through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped server/src/routes/org-chart-svg.ts:750— `theme.bgColor` is text this program did not author, and it is written into a quoted attribute value through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
paperclip_runner_core::bin::fake-codex-app-server::run (cognitive 501) packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:595— paperclip_runner_core::bin::fake-codex-app-server::run has cognitive complexity 501 (threshold 15). Drivers by points: if/else 150 (398 pts), boolean chains 70, loops 8 (31 pts), match/switch 1 (2 pts) (nesting depth added 272). 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.
paperclip_runner_core::durable::state::redact_sensitive_text_values (cognitive 187) packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:2106— paperclip_runner_core::durable::state::redact_sensitive_text_values has cognitive complexity 187 (threshold 15). Drivers by points: if/else 41 (86 pts), boolean chains 56, loops 25 (45 pts) (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.
paperclip_runner_core::durable::runner::run_durable_runner (cognitive 186) packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:392— paperclip_runner_core::durable::runner::run_durable_runner has cognitive complexity 186 (threshold 15). Drivers by points: if/else 55 (160 pts), match/switch 4 (12 pts), boolean chains 9, loops 3 (5 pts) (nesting depth added 115). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
paperclip_runner_core::bin::fake-acpx-sidecar::run (cognitive 153) packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-acpx-sidecar.rs:16— paperclip_runner_core::bin::fake-acpx-sidecar::run has cognitive complexity 153 (threshold 15). Drivers by points: if/else 46 (116 pts), boolean chains 16, loops 5 (16 pts), match/switch 2 (5 pts) (nesting depth added 84). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
paperclip_runner_core::stdio_mcp::run_proxy (cognitive 107) packages/paperclip-runner/runner/crates/runner-core/src/stdio_mcp.rs:261— paperclip_runner_core::stdio_mcp::run_proxy has cognitive complexity 107 (threshold 15). Drivers by points: if/else 24 (84 pts), boolean chains 11, match/switch 4 (10 pts), loops 2 (nesting depth added 66). 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.
paperclip_runner_core::claude_managed_provider::stream_remote_events (cognitive 55) packages/paperclip-runner/runner/crates/runner-core/src/claude_managed_provider.rs:1130— paperclip_runner_core::claude_managed_provider::stream_remote_events has cognitive complexity 55 (threshold 15). Drivers by points: if/else 15 (44 pts), match/switch 2 (8 pts), loops 2 (3 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
paperclip_runner_core::durable::state::validate_binding (cognitive 41) packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:1191— paperclip_runner_core::durable::state::validate_binding has cognitive complexity 41 (threshold 15). Drivers by points: boolean chains 25, if/else 8 (11 pts), match/switch 5 (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.
paperclip_runner_core::provider_events::normalize_codex_notification (cognitive 39) packages/paperclip-runner/runner/crates/runner-core/src/provider_events.rs:674— paperclip_runner_core::provider_events::normalize_codex_notification has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (35 pts), match/switch 2 (3 pts), boolean chains 1 (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.
paperclip_runner_core::provider_events::project_acpx_state_event (cognitive 35) packages/paperclip-runner/runner/crates/runner-core/src/provider_events.rs:130— paperclip_runner_core::provider_events::project_acpx_state_event has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 4 (7 pts), boolean chains 4, loops 1 (2 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.
paperclip_runner_core::managed_provider_backend::complete_managed_usage (cognitive 34) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:2048— paperclip_runner_core::managed_provider_backend::complete_managed_usage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (26 pts), loops 3 (5 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.
paperclip_runner_core::replay::reduce_replay_fixture (cognitive 32) packages/paperclip-runner/runner/crates/runner-core/src/replay.rs:90— paperclip_runner_core::replay::reduce_replay_fixture has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (27 pts), loops 2, 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.
paperclip_runner_core::codex_provider::codex_question_response (cognitive 27) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:4032— paperclip_runner_core::codex_provider::codex_question_response has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (23 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.
paperclip_runner_core::acpx_sidecar_transport::parse_frame (cognitive 25) packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs:731— paperclip_runner_core::acpx_sidecar_transport::parse_frame has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (18 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.
paperclip_runner_core::codex_provider::classify_notification_thread (cognitive 24) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3523— paperclip_runner_core::codex_provider::classify_notification_thread has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 11 (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.
paperclip_runner_core::durable::runner::process_command (cognitive 24) packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:1783— paperclip_runner_core::durable::runner::process_command has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, 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.
paperclip_runner_core::question_response::validate_answer (cognitive 24) packages/paperclip-runner/runner/crates/runner-core/src/question_response.rs:87— paperclip_runner_core::question_response::validate_answer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 5, 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.
paperclip_runner_core::acpx_event_payload::sanitize_question_set (cognitive 23) packages/paperclip-runner/runner/crates/runner-core/src/acpx_event_payload.rs:383— paperclip_runner_core::acpx_event_payload::sanitize_question_set has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (6 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.
paperclip_runner_core::claude_managed_provider::bounded_request (cognitive 23) packages/paperclip-runner/runner/crates/runner-core/src/claude_managed_provider.rs:1062— paperclip_runner_core::claude_managed_provider::bounded_request has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, 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.
paperclip_runner_core::process_supervisor::read_bounded_line (cognitive 22) packages/paperclip-runner/runner/crates/runner-core/src/process_supervisor.rs:748— paperclip_runner_core::process_supervisor::read_bounded_line has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (21 pts), 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.
paperclip_runner_core::aws_agentcore_provider::network_loop (cognitive 21) packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:618— paperclip_runner_core::aws_agentcore_provider::network_loop has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 7 (17 pts), loops 2 (4 pts) (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.
paperclip_runner_core::bin::fake-stdio-mcp::main (cognitive 21) packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-stdio-mcp.rs:8— paperclip_runner_core::bin::fake-stdio-mcp::main has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (6 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.
paperclip_runner_core::acpx_provider_backend::runtime_context_session_identity (cognitive 20) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:158— paperclip_runner_core::acpx_provider_backend::runtime_context_session_identity has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 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.
paperclip_runner_core::aws_agentcore_provider::normalize_stream_event (cognitive 20) packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:815— paperclip_runner_core::aws_agentcore_provider::normalize_stream_event has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 3 (6 pts) (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.
paperclip_runner_core::acpx_event_payload::decode_runtime_event (cognitive 19) packages/paperclip-runner/runner/crates/runner-core/src/acpx_event_payload.rs:438— paperclip_runner_core::acpx_event_payload::decode_runtime_event has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 1 (3 pts), match/switch 2 (3 pts) (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.
paperclip_runner_core::codex_provider::codex_question_set (cognitive 19) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3889— paperclip_runner_core::codex_provider::codex_question_set has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, 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.
Focus outline removed inline packages/plugins/plugin-workspace-diff/src/ui/index.tsx:669— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline packages/plugins/plugin-workspace-diff/src/ui/index.tsx:733— <div> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/adapters/schema-config-fields.tsx:137— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/AgentConfigForm.tsx:4072— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/AttentionQueueRow.tsx:179— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/DesignPageAside.tsx:121— <div> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/ExecutionParticipantPicker.tsx:124— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/FrontmatterPanel.tsx:676— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/InlineEditor.tsx:392— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/InlineEntitySelector.tsx:237— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/IssueThreadInteractionCard.tsx:997— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/IssueThreadInteractionCard.tsx:1322— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/IssueWorkspaceCard.tsx:458— <select> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline REDACTED:1363— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/NewGoalDialog.tsx:155— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/PriorityIcon.tsx:54— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/ProjectProperties.tsx:686— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/ProjectProperties.tsx:852— <select> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/ProjectProperties.tsx:909— <select> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/SidebarCompanyMenu.production.tsx:124— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/SidebarCompanyMenu.tsx:128— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/SidebarShell.production.tsx:219— <div> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/SidebarShell.tsx:234— <div> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/StatusIcon.tsx:129— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui/src/components/access/InvitesSection.tsx:251— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Swallowed exception (empty catch) ui/storybook/prototypes/github-chat/GitHubChatPreview.tsx:483— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/storybook/prototypes/github-chat/GitHubChatPreview.tsx:610— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/storybook/prototypes/agent-settings/AgentSettingsPreview.tsx:505— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) REDACTED:928— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/AgentDetail.production.tsx:541— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/AgentDetail.production.tsx:3801— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/AgentDetail.production.tsx:3991— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/AgentDetail.tsx:553— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/AgentDetail.tsx:1522— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) ui/src/pages/AgentDetail.tsx:4090— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/AgentDetail.tsx:4280— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/BoardChat.tsx:260— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/BoardChat.tsx:459— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/BoardChat.tsx:504— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/BoardChat.tsx:609— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/CompanyEnvironments.tsx:522— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/CompanyImport.tsx:1353— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/Dashboard.tsx:108— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/ExecutionWorkspaceDetail.tsx:126— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/IssueDetail.tsx:6844— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/McpConnect.tsx:24— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/ProjectDetail.tsx:665— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/ProjectDetail.tsx:707— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/RoutineDetail.production.tsx:120— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui/src/pages/Routines.production.tsx:117— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/native-runtime/codex-model-fallback.ts:68— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via codex-model-fallback.readRemoteCodexModelCliVersion — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/ai-connection-runtime.ts:83— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via ai-connection-runtime.assertManagedAiProjectAuth — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/environment-execution-target.ts:227— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via environment-execution-target.resolveEnvironmentExecutionTarget — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/copilot-connection-probe.ts:80— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via copilot-connection-probe.probeCopilotExecutionTarget — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/native-runtime/native-runner-execution-driver.ts:13— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via NativeRunnerExecutionDriverInput.target — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/native-runtime/native-runner-execution-driver.ts:44— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via native-runner-execution-driver.resolveRemoteRunnerTransportMode — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/agent-file-checkpoints.ts:70— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via agent-file-checkpoints.captureAgentFileCheckpoint — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/agent-directory-working-copies.ts:243— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via agent-directory-working-copies.agentDirectoryWorkingCopyService.hasChanges — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/agent-directory-working-copies.ts:253— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via agent-directory-working-copies.agentDirectoryWorkingCopyService.adopt — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/agent-directory-working-copies.ts:550— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via agent-directory-working-copies.agentDirectoryWorkingCopyService.checkpointWarm — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/agent-directory-working-copies.ts:551— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via agent-directory-working-copies.agentDirectoryWorkingCopyService.collectStopped — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/agent-instruction-working-copies.ts:104— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via agent-instruction-working-copies.agentInstructionWorkingCopyService.prepare — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/agent-instruction-working-copies.ts:226— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via agent-instruction-working-copies.agentInstructionWorkingCopyService.hasChanges — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/agent-instruction-working-copies.ts:241— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via agent-instruction-working-copies.agentInstructionWorkingCopyService.checkpointWarm — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/agent-instruction-working-copies.ts:280— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via agent-instruction-working-copies.agentInstructionWorkingCopyService.collectStopped — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/native-runtime/remote-warm-session-recovery.ts:16— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via remote-warm-session-recovery.inspectRemoteWarmSessionRecovery — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/native-runtime/native-session-executor.ts:653— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via native-session-executor.reserveWarmNativeInstructionDirectory — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/native-runtime/native-session-executor.ts:7646— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via native-session-executor.executePaperclipNativeSession — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/native-runtime/native-session-executor.ts:10611— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via native-session-executor.stageRemoteRunnerFile — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/native-runtime/native-session-executor.ts:10672— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via native-session-executor.stageRemoteRunnerDirectory — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/native-runtime/native-session-executor.ts:11124— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via native-session-executor.verifyRemoteRunnerReattachment — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/native-runtime/native-session-executor.ts:11302— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via native-session-executor.createRemoteRunnerProcessLauncher — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/native-runtime/native-session-executor.ts:11592— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via native-session-executor.createRunnerdBackend — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/native-runtime/native-session-executor.ts:13755— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via native-session-executor.createRemoteNativeArtifactPreparation — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → server) server/src/services/native-runtime/native-workspace-sync.ts:890— AdapterExecutionTarget (context adapter-utils) is exposed in server's public surface via native-workspace-sync.prepareNativeWorkspaceSync — couples the contexts.
R4 · Test Coverage· No test reaches this file · ×27
No test reaches this file packages/paperclip-runner/devtools/issue-thread/src/App.tsx: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 scripts/paperclip-commit-metrics.ts: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 scripts/generate-org-chart-images.ts: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 packages/paperclip-runner/devtools/browser/src/App.tsx: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 scripts/dev-runner.mjs: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 scripts/codemod-extract-misc.mjs: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 ui/src/pages/tools/connection-dialogs.tsx: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 scripts/codemod-extract-sizes.mjs: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 ui/src/connect-flow-preview-main.tsx: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 packages/paperclip-runner/scripts/check-clean-consumers.mjs: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 packages/paperclip-runner/devtools/browser/src/live/LiveConsole.tsx: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 ui/src/components/OnboardingChat.tsx: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 scripts/codemod-extract-colors.mjs: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 scripts/generate-company-assets.ts: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 packages/paperclip-runner/devtools/browser/src/live/SessionPanel.tsx: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 server/scripts/muse-runner-smoke.ts: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 scripts/check-token-gates.mjs: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 ui/src/components/ArtifactsPanel.tsx: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 packages/paperclip-runner/scripts/run-runner-live-eval-schedule.mjs: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 ui/src/artifact-directions/shot.cjs: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 packages/paperclip-runner/devtools/issue-thread/src/live-client.ts: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 scripts/codemod-extract-type.mjs: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 ui/src/artifact-directions/directions/d3-tactile/kind.ts: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 packages/paperclip-runner/devtools/browser/src/live/Inspector.tsx: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 scripts/generate-org-chart-satori-comparison.ts: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.
paperclip_runner_core::bin::fake-codex-app-server::run (cyclomatic 233) packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:595— paperclip_runner_core::bin::fake-codex-app-server::run has cyclomatic complexity 233 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
paperclip_runner_core::durable::state::redact_sensitive_text_values (cyclomatic 117) packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:2106— paperclip_runner_core::durable::state::redact_sensitive_text_values has cyclomatic complexity 117 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
paperclip_runner_core::durable::runner::run_durable_runner (cyclomatic 76) packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:392— paperclip_runner_core::durable::runner::run_durable_runner has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
paperclip_runner_core::bin::fake-acpx-sidecar::run (cyclomatic 73) packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-acpx-sidecar.rs:16— paperclip_runner_core::bin::fake-acpx-sidecar::run 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.
paperclip_runner_core::stdio_mcp::run_proxy (cyclomatic 45) packages/paperclip-runner/runner/crates/runner-core/src/stdio_mcp.rs:261— paperclip_runner_core::stdio_mcp::run_proxy 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.
paperclip_runner_core::durable::state::validate_binding (cyclomatic 43) packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:1191— paperclip_runner_core::durable::state::validate_binding 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.
paperclip_runner_core::provider_events::project_acpx_state_event (cyclomatic 31) packages/paperclip-runner/runner/crates/runner-core/src/provider_events.rs:130— paperclip_runner_core::provider_events::project_acpx_state_event has cyclomatic complexity 31 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
paperclip_runner_core::provider_events::normalize_codex_notification (cyclomatic 26) packages/paperclip-runner/runner/crates/runner-core/src/provider_events.rs:674— paperclip_runner_core::provider_events::normalize_codex_notification 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.
paperclip_runner_core::codex_provider::classify_notification_thread (cyclomatic 23) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3523— paperclip_runner_core::codex_provider::classify_notification_thread 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.
paperclip_runner_core::durable::runner::process_command (cyclomatic 23) packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:1783— paperclip_runner_core::durable::runner::process_command 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.
paperclip_runner_core::acpx_sidecar_transport::parse_frame (cyclomatic 21) packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs:731— paperclip_runner_core::acpx_sidecar_transport::parse_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. This is NOT this file's highest cyclomatic complexity: paperclip_runner_core::acpx_sidecar_transport::response_error_classification (cyclomatic 60) 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.
paperclip_runner_core::managed_provider_backend::complete_managed_usage (cyclomatic 21) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:2048— paperclip_runner_core::managed_provider_backend::complete_managed_usage 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.
paperclip_runner_core::replay::reduce_replay_fixture (cyclomatic 21) packages/paperclip-runner/runner/crates/runner-core/src/replay.rs:90— paperclip_runner_core::replay::reduce_replay_fixture 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.
paperclip_runner_core::claude_managed_provider::stream_remote_events (cyclomatic 20) packages/paperclip-runner/runner/crates/runner-core/src/claude_managed_provider.rs:1130— paperclip_runner_core::claude_managed_provider::stream_remote_events 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.
paperclip_runner_core::question_response::validate_answer (cyclomatic 20) packages/paperclip-runner/runner/crates/runner-core/src/question_response.rs:87— paperclip_runner_core::question_response::validate_answer 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.
paperclip_runner_core::acpx_event_payload::decode_acpx_event (cyclomatic 19) packages/paperclip-runner/runner/crates/runner-core/src/acpx_event_payload.rs:92— paperclip_runner_core::acpx_event_payload::decode_acpx_event 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.
paperclip_runner_core::acpx_event_payload::decode_runtime_event (cyclomatic 18) packages/paperclip-runner/runner/crates/runner-core/src/acpx_event_payload.rs:438— paperclip_runner_core::acpx_event_payload::decode_runtime_event 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.
paperclip_runner_core::aws_agentcore_provider::restored_usage_snapshot (cyclomatic 18) packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:76— paperclip_runner_core::aws_agentcore_provider::restored_usage_snapshot 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.
paperclip_runner_core::bin::fake-acpx-sidecar::bootstrap_success (cyclomatic 18) packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-acpx-sidecar.rs:835— paperclip_runner_core::bin::fake-acpx-sidecar::bootstrap_success 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.
paperclip_runner_core::fake_harness::run_fake_harness (cyclomatic 17) packages/paperclip-runner/runner/crates/runner-core/src/fake_harness.rs:111— paperclip_runner_core::fake_harness::run_fake_harness 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.
paperclip_runner_core::managed_provider_backend::valid_agentcore_usage_snapshot (cyclomatic 17) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:414— paperclip_runner_core::managed_provider_backend::valid_agentcore_usage_snapshot 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.
paperclip_runner_core::provider_backend::terminal_events (cyclomatic 17) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:637— paperclip_runner_core::provider_backend::terminal_events 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. This is NOT this file's highest cyclomatic complexity: CodexCommandExecutor::execute (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.
paperclip_runner_core::acpx_event_payload::decode_rich_event (cyclomatic 16) packages/paperclip-runner/runner/crates/runner-core/src/acpx_event_payload.rs:275— paperclip_runner_core::acpx_event_payload::decode_rich_event has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. 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: paperclip_runner_core::acpx_event_payload::rich_event_schema (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
paperclip_runner_core::aws_agentcore_provider::normalize_stream_event (cyclomatic 16) packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:815— paperclip_runner_core::aws_agentcore_provider::normalize_stream_event has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Outbound HTTP without resilience packages/adapter-utils/src/local-process-sandbox.ts:262— `http.request(` 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 scripts/benchmark-apps-startup.mjs:14— `fetch(` 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 scripts/dev-runner.mjs:435— `fetch(` 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 scripts/dev-runner.ts:683— `fetch(` 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 scripts/generate-daytona-tools.mjs:131— `fetch(` 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 scripts/generate-unikraft-tools.mjs:124— `fetch(` 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 scripts/ingest-app-definitions.mjs:1048— `superagent` 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 scripts/ingest-app-definitions.mjs:1156— `superagent` 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 scripts/ingest-app-definitions.mjs:1820— `superagent` 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 scripts/paperclip-commit-metrics.ts:837— `fetch(` 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 scripts/repair-pr-prep-workspace-attachment.mjs:49— `fetch(` 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 scripts/repair-pr-prep-workspace-attachment.mjs:68— `fetch(` 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 scripts/smoke/terminal-bench-loop-skill-smoke.mjs:116— `fetch(` 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 scripts/storybook-visual-baseline.mjs:280— `fetch(` 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 scripts/update-arcade-app-catalog.mjs:14— `fetch(` 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 scripts/update-composio-search-catalog.mjs:6— `fetch(` 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 server/src/services/chat-sdk-runtime.ts:2874— `fetcher(` 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 server/src/services/github-commit-details.ts:110— `fetchImpl(` 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 server/src/services/github-external-object-provider.ts:473— `fetchImpl(` 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 server/src/services/github-fetch.ts:21— `fetch(` 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.
No assertions: map sources combine without tracked index edits ui/storybook/map-tooling.test.ts:5— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: calibrates the pidfd helper against reuse and wrong-identity faults tests/runner-e2e/chat-qualification.test.ts:16— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: accepts explicit ISO review timestamps: %s tests/runner-e2e/feedback-dispositions.test.ts:87— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: ${storyById("US-6").id} ${storyById("US-6").title} @mcp-us6 tests/e2e/mcp-user-stories.spec.ts:402— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: ${storyById("US-7").id} ${storyById("US-7").title} @mcp-us7 tests/e2e/mcp-user-stories.spec.ts:406— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: reapplies the Dot-only migration after the merged gateway schema server/src/__tests__/dot-runner.test.ts:339— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: supports destroyLease server/src/__tests__/environment-test-harness.test.ts:161— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: does not resolve accepted export recovery through an ordinary $sourceIssueStatus transition: $cause server/src/__tests__/issue-agent-mutation-ownership-routes.test.ts:2177— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: preserves identities, private credentials, and input receipts across transport failures server/src/__tests__/muse-client-contract.test.ts:18— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: logs session callback failures (async: %s) server/src/__tests__/plugin-idle-rpc.test.ts:88— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: startPeriodicFlush is idempotent server/src/__tests__/telemetry-client-flush.test.ts:94— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: skips relinking when server workspace dependencies already point at the repo server/src/__tests__/workspace-runtime.test.ts:726— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: validatePackageName accepts @paperclipai scoped names scripts/bootstrap-npm-package.test.mjs:38— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: smoke script is executable and parses scripts/docker-onboard-smoke.test.mjs:25— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: smoke script is executable and parses scripts/service-onboard-smoke.test.mjs:18— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: case-insensitive GitHub login matching scripts/__tests__/storybook-deploy.test.mjs:89— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: offline Copilot probe cleans up every injected early failure packages/paperclip-runner/scripts/probe-copilot-acp.test.mjs:5— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: can be reapplied after the schema already exists packages/db/src/status-card-migrations.test.ts:29— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: T1 exits within a bounded time when its session directory disappears with no message ever sent packages/adapter-utils/src/execution-target-stdin-race.test.ts:1384— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
Cross-context type ChatProvider (ui → server) server/src/services/chat-provider-inventory.ts:13— ChatProvider (context ui) is exposed in server's public surface via ChatProviderInventoryResult.provider — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/chat-channels/run-origin.ts:11— ChatProvider (context ui) is exposed in server's public surface via run-origin.chatRunSourceMessageId — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/chat-communication-guidance.ts:20— ChatProvider (context ui) is exposed in server's public surface via chat-communication-guidance.buildChatCommunicationGuidance — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/chat-provider-lifecycle.ts:39— ChatProvider (context ui) is exposed in server's public surface via ParseChatProviderLifecycleInput.provider — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/chat-channels/credentials.ts:104— ChatProvider (context ui) is exposed in server's public surface via credentials.createChatCredentials.verifyCredentials — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/chat-channels/credentials.ts:141— ChatProvider (context ui) is exposed in server's public surface via credentials.createChatCredentials.nativeBotIdentityMatches — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/chat-channels/credentials.ts:244— ChatProvider (context ui) is exposed in server's public surface via credentials.createChatCredentials.nativeBotIdentityConflict — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/chat-channels/message-lifecycle.ts:10— ChatProvider (context ui) is exposed in server's public surface via message-lifecycle.stableExternalPrincipalId — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/chat-channels/message-lifecycle.ts:29— ChatProvider (context ui) is exposed in server's public surface via message-lifecycle.lifecycleActorFromAuthor — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/chat-channels/inbound/surfaces.ts:30— ChatProvider (context ui) is exposed in server's public surface via surfaces.providerResourceType — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/chat-channels/inbound/surfaces.ts:69— ChatProvider (context ui) is exposed in server's public surface via surfaces.canonicalProviderResourceId — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/chat-channels/inbound/surfaces.ts:92— ChatProvider (context ui) is exposed in server's public surface via surfaces.providerResourceLabelFromThread — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/chat-channels/inbound/surfaces.ts:115— ChatProvider (context ui) is exposed in server's public surface via surfaces.chatSurfaceKind — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/chat-channels/inbound/surfaces.ts:163— ChatProvider (context ui) is exposed in server's public surface via surfaces.actionThreadMatchesConversation — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/chat-channels/telegram/messages.ts:190— ChatProvider (context ui) is exposed in server's public surface via messages.telegramDeliveryHasZeroMessageId — couples the contexts.
Cross-context type ChatProvider (ui → server) server/src/services/heartbeat/run-preparation.ts:1970— ChatProvider (context ui) is exposed in server's public surface via run-preparation.resolveExternalChatWakeProvider — couples the contexts.
Change coupling: plugin.ts ↔ plugin.ts packages/shared/src/types/plugin.ts:1— `packages/shared/src/types/plugin.ts` and `packages/shared/src/validators/plugin.ts` change together 100% of the time (15 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `aa0037a1` Support Codex warm plugin task reuse and recovery (#17390); `a708a133` Separate plugin workspace completion from maintenance inspection (#17…; `989ee668` Support provider-owned fresh retry workspaces (#17252) — run `git show` on any of them.
Change coupling: company-portability.ts ↔ company-portability.ts packages/shared/src/types/company-portability.ts:1— `packages/shared/src/types/company-portability.ts` and `packages/shared/src/validators/company-portability.ts` change together 94% of the time (15 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `35aaaa0b` feat(server): preserve task timestamps and hierarchy through company …; `276ae3a7` Harden company import: durable UI, async jobs, integrity guard, batch…; `48704c65` fix(export): strip project env values from company packages — run `git show` on any of them.
Change coupling: postgres.ts ↔ use-cases.ts server/src/modules/wake-queue/adapters/postgres.ts:1— `server/src/modules/wake-queue/adapters/postgres.ts` and `server/src/modules/wake-queue/application/use-cases.ts` change together 90% of the time (9 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `f3af9887` fix(chat): keep each chat conversation in its own wake batch (#17054); `d30648de` Preserve accepted messages for paused recipients (#16679); `391dd15f` fix: recover deferred messages and completed unblock waits (#16673) — run `git show` on any of them.
Change coupling: heartbeat.ts ↔ successful-run-handoff.ts server/src/services/heartbeat.ts:1— `server/src/services/heartbeat.ts` and `server/src/services/recovery/successful-run-handoff.ts` change together 82% of the time (9 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `f572e086` fix(recovery): stop automatic stranded-task takeovers (#11961); `43ab441f` Exempt plugin-managed issues from successful-run-handoff recovery (#9…; `7014e46e` fix(recovery): wake ambiguous successful runs on normal model (#10184) — run `git show` on any of them.
Change coupling: explicit-native-continuation.ts ↔ heartbeat.ts server/src/services/explicit-native-continuation.ts:1— `server/src/services/explicit-native-continuation.ts` and `server/src/services/heartbeat.ts` change together 80% of the time (16 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 16 shared commits counted here, the most recent 3 are `898144f4` fix: stop idle execution-control recovery polling (#17094); `7c7d2d8d` fix(runtime): continue from saved sources after workspace loss (#16690); `f1c44b7b` Preserve remote work when required workspace restore fails (#15479) — run `git show` on any of them.
Change coupling: App.tsx ↔ company-routes.ts ui/src/App.tsx:1— `ui/src/App.tsx` and `ui/src/lib/company-routes.ts` 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 — 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 `f0ed524f` fix(ui): prefix audit board route (#10830); `518fc71c` [codex] Add work timeline page (#8938); `fee514ef` [codex] Improve workspace navigation and runtime UI (#4089) — run `git show` on any of them.
Change coupling: NewAgentDialog.tsx ↔ OnboardingWizard.tsx ui/src/components/NewAgentDialog.tsx:1— `ui/src/components/NewAgentDialog.tsx` and `ui/src/components/OnboardingWizard.tsx` 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 — 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 `1955b0e2` Gate Paperclip Runner setup behind an experimental flag (#12656); `1583a2d6` feat(hermes): upgrade hermes-paperclip-adapter + UI adapter + skills …; `0233525e` Add CEO OpenClaw invite endpoint and update onboarding UX — run `git show` on any of them.
Change coupling: AgentConfigForm.tsx ↔ NewAgent.tsx ui/src/components/AgentConfigForm.tsx:1— `ui/src/components/AgentConfigForm.tsx` and `ui/src/pages/NewAgent.tsx` change together 67% of the time (8 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `1955b0e2` Gate Paperclip Runner setup behind an experimental flag (#12656); `c139d6c0` fix(codex-local): omit default model so codex CLI picks per auth mode…; `bb7d0408` Switch OpenCode to explicit static/local-aware model selection (#5117) — run `git show` on any of them.
Change coupling: fake-codex-app-server.rs ↔ codex_provider.rs packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:1— `packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.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 — 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 `a6448cd0` fix(runner): tolerate Codex account notifications during active turns…; `0f5fafe1` fix(runner): preserve task replies and warm process continuity (#13738); `36dbb7ed` fix: harden agent chat runner tools and recovery (#13678) — run `git show` on any of them.
Change coupling: CommentThread.tsx ↔ IssueDetail.tsx ui/src/components/CommentThread.tsx:1— `ui/src/components/CommentThread.tsx` and `ui/src/pages/IssueDetail.tsx` change together 50% of the time (18 of the 36 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `4a641d09` fix(ui): default human task replies to the latest assigning agent (#1…; `7f70759e` Redact deleted issue comments; `3264f9c1` Fix typing lag in long comment threads (PAPA-63) (#3163) — run `git show` on any of them.
Change coupling: heartbeats.ts ↔ queryKeys.ts ui/src/api/heartbeats.ts:1— `ui/src/api/heartbeats.ts` and `ui/src/lib/queryKeys.ts` change together 50% of the time (9 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `7551b63e` Remove the instance Heartbeats settings page (#12282); `4da13984` Add workspace operation tracking and fix project properties JSX; `32bdcf1d` Add instance heartbeat settings sidebar — run `git show` on any of them.
Change coupling: OnboardingWizard.tsx ↔ NewAgent.tsx ui/src/components/OnboardingWizard.tsx:1— `ui/src/components/OnboardingWizard.tsx` and `ui/src/pages/NewAgent.tsx` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `1955b0e2` Gate Paperclip Runner setup behind an experimental flag (#12656); `c139d6c0` fix(codex-local): omit default model so codex CLI picks per auth mode…; `bb7d0408` Switch OpenCode to explicit static/local-aware model selection (#5117) — run `git show` on any of them.
Change coupling: fake-codex-app-server.rs ↔ provider_backend.rs packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:1— `packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 5 shared commits counted here, the most recent 3 are `7ec6e1a2` fix(runner): explain invalid arguments for assigned tools (#16905); `63f3aa2d` fix(runner): continue restart-interrupted Codex turns (#15297); `6c85fa06` feat(runner): durably reconcile Codex tools (#12384) — run `git show` on any of them.
Change coupling: SwipeToArchive.tsx ↔ inbox.ts ui/src/components/SwipeToArchive.tsx:1— `ui/src/components/SwipeToArchive.tsx` and `ui/src/lib/inbox.ts` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 5 shared commits counted here, the most recent 3 are `fe401b7f` [codex] Polish inbox nested issue UI (#4959); `403aeff7` Refine mine inbox shortcut behavior; `7d81e4cb` Fix mine inbox keyboard selection — run `git show` on any of them.
Change coupling: execute.ts ↔ test.ts packages/adapters/cursor-local/src/server/execute.ts:1— `packages/adapters/cursor-local/src/server/execute.ts` and `packages/adapters/cursor-local/src/server/test.ts` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 5 shared commits counted here, the most recent 3 are `35a4448c` fix(cursor): select failure diagnostics after trace notices (#14636); `9578dc3d` Wire per-adapter sandbox install commands through test and execute pa…; `f9cf1d2f` Add cursor sandbox support and fix SSH workspace sync (#4803) — run `git show` on any of them.
R4 · Test Coverage· This test file cannot be loaded · ×13
This test file cannot be loaded cli/src/__tests__/worktree.test.ts:1687— cli/src/__tests__/worktree.test.ts:1687 imports '../../../packages/db/src/migrations/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded packages/db/src/adapter-auth-sessions-schema.test.ts:34— packages/db/src/adapter-auth-sessions-schema.test.ts:34 imports './migrations/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded packages/db/src/client.test.ts:416— packages/db/src/client.test.ts:416 imports './migrations', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either (1 further unresolvable import(s) in the same file). The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded packages/db/src/migration-snapshot-drift.test.ts:15— packages/db/src/migration-snapshot-drift.test.ts:15 imports './migrations', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded packages/paperclip-runner/src/drivers/acpx/profile-compatibility.test.ts:43— packages/paperclip-runner/src/drivers/acpx/profile-compatibility.test.ts:43 imports '../../../test/fixtures/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded packages/paperclip-runner/src/protocol/replay-contract.test.ts:12— packages/paperclip-runner/src/protocol/replay-contract.test.ts:12 imports '../../protocol/fixtures/replay/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded packages/paperclip-runner/src/reducer/session-reducer.test.ts:17— packages/paperclip-runner/src/reducer/session-reducer.test.ts:17 imports '../../protocol/fixtures/replay/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded packages/paperclip-runner/test-fixtures/untracked-import/consumer.ts:5— packages/paperclip-runner/test-fixtures/untracked-import/consumer.ts:5 imports './absent.js', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded scripts/__tests__/storybook-viewport-config.test.mjs:7— scripts/__tests__/storybook-viewport-config.test.mjs:7 imports '../../ui/storybook/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded server/src/__tests__/agent-commentary-skills.test.ts:33— server/src/__tests__/agent-commentary-skills.test.ts:33 imports '../../../skills', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded server/src/__tests__/browser-use-connection.test.ts:371— server/src/__tests__/browser-use-connection.test.ts:371 imports '../../../skills', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded tests/runner-e2e/catalog.ts:1062— tests/runner-e2e/catalog.ts:1062 imports './fixtures/warm-continuity/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either (1 further unresolvable import(s) in the same file). The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded ui/src/lib/clipboard-usage.test.ts:21— ui/src/lib/clipboard-usage.test.ts:21 imports '../', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either (2 further unresolvable import(s) in the same file). The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
TooManyMethods: CapabilityMockControlPlaneAdapter packages/paperclip-runner/src/mock-core/capability-mock-control-plane-adapter.ts:74— TooManyMethods — 57 methods. The bar is 30 methods; this is 27 over it, 1.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DurablePrpCodexTransport packages/paperclip-runner/src/live/runnerd-codex-transport.ts:3487— TooManyMethods — 56 methods. The bar is 30 methods; this is 26 over it, 1.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.
TooManyMethods: CodexProvider packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:670— TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.83× 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: CapabilityLiveSession packages/paperclip-runner/src/live/live-session.ts:1181— TooManyMethods — 50 methods. The bar is 30 methods; this is 20 over it, 1.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: CodexCommandExecutor packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:1503— TooManyMethods — 45 methods. The bar is 30 methods; this is 15 over it, 1.50× 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: PaperclipRunnerToolAuthority server/src/services/native-runtime/paperclip-runner-tool-authority.ts:241— TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× 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: DurablePrpControlPlane REDACTED:1495— TooManyMethods — 37 methods. The bar is 30 methods; this is 7 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: CodexAcpxSession REDACTED:740— TooManyMethods — 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ChatSdkEndpointRuntime server/src/services/chat-sdk-runtime.ts:2008— TooManyMethods — 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SetupTokenSessionService server/src/services/setup-token-session.ts:742— TooManyMethods — 32 methods. The bar is 30 methods; 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.
TooManyMethods: Client server/src/services/scripts/v9/client.py:239— TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.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: OpenCodeHarnessSession REDACTED:465— TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.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.
IC1 · Incompleteness & stubs· Both branches are identical · ×12
Both branches are identical — the condition decides nothing doc/plans/chat-adapters/generate-wireframes.mjs:264— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing packages/paperclip-runner/src/contracts/provider-trace-file-sink.ts:79— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing packages/paperclip-runner/src/eval/live-workflow-executor.ts:1187— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing packages/plugins/plugin-llm-wiki/src/ui/app.tsx:1024— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing packages/plugins/plugin-llm-wiki/src/ui/app.tsx:2741— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing server/src/routes/agents.ts:2028— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing server/src/services/tool-access/runtime/health.ts:39— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing server/src/services/tool-access/runtime/health.ts:45— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing server/src/services/tool-gateway.ts:1835— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing server/src/services/tool-gateway.ts:11057— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing server/src/services/tool-gateway.ts:11189— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing ui/src/components/RoutineHistoryTab.tsx:514— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Fake-async — async method never awaits cli/src/commands/allowed-hostname.ts:6— `addAllowedHostname` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
Fake-async — async method never awaits cli/src/commands/env.ts:39— `envCommand` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
Fake-async — async method never awaits cli/src/commands/worktree.ts:2882— `worktreeCleanupCommand` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
Fake-async — async method never awaits cli/src/commands/worktree.ts:3018— `worktreeEnvCommand` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
Fake-async — async method never awaits cli/src/commands/worktree.ts:3628— `worktreeListCommand` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
Fake-async — async method never awaits REDACTED:1204— `isPidRunning` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
Fake-async — async method never awaits packages/adapter-utils/src/workspace-checkpoint.ts:8— `writeCheckpointBaseline` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
Fake-async — async method never awaits scripts/ci-profile/authorize.mjs:52— `main` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
Fake-async — async method never awaits scripts/storybook-visual-baseline.mjs:133— `verify` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
Fake-async — async method never awaits scripts/storybook-visual-baseline.mjs:152— `pack` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
Fake-async — async method never awaits scripts/storybook-visual-baseline.mjs:214— `upload` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
IC1 · Incompleteness & stubs· Markup wires an event to an empty handler · ×11
Markup wires an event to an empty handler ui/src/components/ai-connections/AiConnectionCredentialStep.tsx:96— `onConnected` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler ui/src/components/ai-connections/AiConnectionDesignExamples.tsx:52— `onConnect` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler ui/src/components/ai-connections/AiConnectionDesignExamples.tsx:58— `onChange` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler ui/src/components/ai-connections/AiConnectionDesignExamples.tsx:59— `onSubmit` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler ui/src/components/new-agent/AgentProviderConnection.tsx:369— `onStored` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler ui/src/components/new-agent/ExternalAgentInviteDialog.tsx:233— `onSelect` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler ui/src/components/onboarding/ConnectModelPreview.tsx:145— `onBack` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler ui/src/components/onboarding/ConnectModelPreview.tsx:148— `onPrimary` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler ui/src/features/connections/AgentMailApiKeyField.tsx:13— `onConnectionChange` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler ui/src/features/connections/ConnectionSetupFlow.tsx:4619— `onBack` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler ui/src/features/connections/ConnectionSetupFlow.tsx:4619— `onContinue` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
AC4 · Keyboard semantics· Modal dialog does not manage focus · ×10
Modal dialog does not manage focus packages/paperclip-runner/devtools/issue-thread/src/App.tsx:1541— This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus packages/paperclip-runner/devtools/issue-thread/src/EvidencePanel.tsx:237— This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx:37— This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx:255— This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx:305— This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus packages/plugins/plugin-llm-wiki/src/ui/app.tsx:1897— This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus packages/plugins/plugin-llm-wiki/src/ui/app.tsx:2109— This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus packages/plugins/plugin-llm-wiki/src/ui/app.tsx:5156— This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus ui/src/components/DocumentAnnotationPopover.tsx:79— This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus ui/src/pages/apps/gateways/panels/TokensPanel.tsx:398— This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Duplicated block (8 lines × 2) server/src/services/scripts/v7/client.py:431— server/src/services/scripts/v7/client.py:431-438 | server/src/services/scripts/v8/client.py:431-438 — `server/src/services/scripts/v7/client.py` and `server/src/services/scripts/v8/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 31 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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) packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs:40— packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs:40-47 | packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:466-473 — 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) packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:523— packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:523-530 | packages/paperclip-runner/runner/crates/runner-core/src/claude_managed_provider.rs:431-438 — 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) packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-harness.rs:8— packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-harness.rs:8-15 | packages/paperclip-runner/runner/crates/runner-core/src/bin/paperclip-runnerd.rs:136-143 — 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) packages/paperclip-runner/runner/crates/runner-core/src/durable/transport.rs:1667— packages/paperclip-runner/runner/crates/runner-core/src/durable/transport.rs:1667-1674 | packages/paperclip-runner/runner/crates/runner-core/src/durable/transport.rs:1685-1692 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs:818— packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs:818-825 | packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs:1070-1077 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:1317— packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:1317-1327 | packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:1638-1645 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1849— packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1849-1858 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:4678-4685 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1482— packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1482-1489 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:3933-3941 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs:890— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs:890-897 | packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs:927-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.
issues.issueRoutes::classifySourceRecoveryRevalidation (cognitive 31) server/src/routes/issues.ts:4212— issues.issueRoutes::classifySourceRecoveryRevalidation has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 11, ternaries 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. This shape REPEATS in the file: 8 other methods here (issues.issueRoutes::stopRunnerGoalForOwnershipChange, issues.issueRoutes::lookupLowTrustSourceArtifact, issues.issueRoutes::parseAttachmentRangeHeader, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 9 times rather than 9 independent problems. Splitting this body alone leaves the other 8 exactly as they are. Where these are variations on one operation, the change that clears all 9 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.
issues.issueRoutes::lockQueuedCommentState (cognitive 29) server/src/routes/issues.ts:7469— issues.issueRoutes::lockQueuedCommentState has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 9, ternaries 7 (9 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. This shape REPEATS in the file: 8 other methods here (issues.issueRoutes::stopRunnerGoalForOwnershipChange, issues.issueRoutes::lookupLowTrustSourceArtifact, issues.issueRoutes::classifySourceRecoveryRevalidation, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 9 times rather than 9 independent problems. Splitting this body alone leaves the other 8 exactly as they are. Where these are variations on one operation, the change that clears all 9 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.
issues.issueRoutes::lookupLowTrustSourceArtifact (cognitive 26) server/src/routes/issues.ts:4078— issues.issueRoutes::lookupLowTrustSourceArtifact has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 3, loops 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. This shape REPEATS in the file: 8 other methods here (issues.issueRoutes::stopRunnerGoalForOwnershipChange, issues.issueRoutes::classifySourceRecoveryRevalidation, issues.issueRoutes::parseAttachmentRangeHeader, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 9 times rather than 9 independent problems. Splitting this body alone leaves the other 8 exactly as they are. Where these are variations on one operation, the change that clears all 9 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.
issues.issueRoutes::assertInReviewReviewPath (cognitive 26) server/src/routes/issues.ts:4563— issues.issueRoutes::assertInReviewReviewPath has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (14 pts), ternaries 5 (7 pts), boolean chains 5 (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. This shape REPEATS in the file: 8 other methods here (issues.issueRoutes::stopRunnerGoalForOwnershipChange, issues.issueRoutes::lookupLowTrustSourceArtifact, issues.issueRoutes::classifySourceRecoveryRevalidation, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 9 times rather than 9 independent problems. Splitting this body alone leaves the other 8 exactly as they are. Where these are variations on one operation, the change that clears all 9 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.
issues.issueRoutes::assertSuggestedTaskEffectsAllowed (cognitive 26) server/src/routes/issues.ts:6108— issues.issueRoutes::assertSuggestedTaskEffectsAllowed has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 3, error handling 1 (2 pts), ternaries 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. This shape REPEATS in the file: 8 other methods here (issues.issueRoutes::stopRunnerGoalForOwnershipChange, issues.issueRoutes::lookupLowTrustSourceArtifact, issues.issueRoutes::classifySourceRecoveryRevalidation, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 9 times rather than 9 independent problems. Splitting this body alone leaves the other 8 exactly as they are. Where these are variations on one operation, the change that clears all 9 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.
issues.issueRoutes::resolveInboxArchiveTarget (cognitive 25) server/src/routes/issues.ts:12020— issues.issueRoutes::resolveInboxArchiveTarget has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 6 (16 pts), if/else 5 (6 pts), boolean chains 3 (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. This shape REPEATS in the file: 8 other methods here (issues.issueRoutes::stopRunnerGoalForOwnershipChange, issues.issueRoutes::lookupLowTrustSourceArtifact, issues.issueRoutes::classifySourceRecoveryRevalidation, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 9 times rather than 9 independent problems. Splitting this body alone leaves the other 8 exactly as they are. Where these are variations on one operation, the change that clears all 9 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.
issues.issueRoutes::assertAgentIssueMutationAllowed (cognitive 22) server/src/routes/issues.ts:5616— issues.issueRoutes::assertAgentIssueMutationAllowed has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (21 pts), 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. This shape REPEATS in the file: 8 other methods here (issues.issueRoutes::stopRunnerGoalForOwnershipChange, issues.issueRoutes::lookupLowTrustSourceArtifact, issues.issueRoutes::classifySourceRecoveryRevalidation, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 9 times rather than 9 independent problems. Splitting this body alone leaves the other 8 exactly as they are. Where these are variations on one operation, the change that clears all 9 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.
issues.issueRoutes::stopRunnerGoalForOwnershipChange (cognitive 16) server/src/routes/issues.ts:3516— issues.issueRoutes::stopRunnerGoalForOwnershipChange has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (5 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. This shape REPEATS in the file: 8 other methods here (issues.issueRoutes::lookupLowTrustSourceArtifact, issues.issueRoutes::classifySourceRecoveryRevalidation, issues.issueRoutes::parseAttachmentRangeHeader, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 9 times rather than 9 independent problems. Splitting this body alone leaves the other 8 exactly as they are. Where these are variations on one operation, the change that clears all 9 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.
issues.issueRoutes::parseAttachmentRangeHeader (cognitive 16) server/src/routes/issues.ts:4436— issues.issueRoutes::parseAttachmentRangeHeader has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, 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. This shape REPEATS in the file: 8 other methods here (issues.issueRoutes::stopRunnerGoalForOwnershipChange, issues.issueRoutes::lookupLowTrustSourceArtifact, issues.issueRoutes::classifySourceRecoveryRevalidation, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 9 times rather than 9 independent problems. Splitting this body alone leaves the other 8 exactly as they are. Where these are variations on one operation, the change that clears all 9 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.
Client.detector_cleanup (cognitive 17) server/src/services/scripts/v1/client.py:159— Client.detector_cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (6 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.
Client.detector_cleanup (cognitive 17) server/src/services/scripts/v2/client.py:200— Client.detector_cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (6 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.
Client.detector_cleanup (cognitive 17) server/src/services/scripts/v3/client.py:218— Client.detector_cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (6 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.
Client.detector_cleanup (cognitive 17) server/src/services/scripts/v4/client.py:258— Client.detector_cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (6 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.
Client.detector_cleanup (cognitive 17) server/src/services/scripts/v5/client.py:258— Client.detector_cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (6 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.
Client.detector_cleanup (cognitive 17) server/src/services/scripts/v6/client.py:260— Client.detector_cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (6 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.
Client.detector_cleanup (cognitive 17) server/src/services/scripts/v7/client.py:337— Client.detector_cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (6 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.
Client.detector_cleanup (cognitive 17) server/src/services/scripts/v8/client.py:337— Client.detector_cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (6 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.
Client.detector_cleanup (cognitive 17) server/src/services/scripts/v9/client.py:369— Client.detector_cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (6 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.
Swallowed exception (caught, then discarded) ui/src/pages/AgentDetail.production.tsx:4070— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) ui/src/pages/AgentDetail.tsx:4359— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) ui/src/pages/CompanySkills.production.tsx:4870— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) ui/src/pages/CompanySkills.production.tsx:4884— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) ui/src/pages/CompanySkills.production.tsx:4900— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) ui/src/pages/CompanySkills.tsx:4834— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) ui/src/pages/CompanySkills.tsx:4848— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) ui/src/pages/CompanySkills.tsx:4864— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) ui/src/pages/InviteLanding.tsx:416— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
AC1 · Text alternatives· <video> without a captions track · ×8
<video> without a captions track ui/src/artifact-directions/directions/d1-solid/PanelLead.tsx:23— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
<video> without a captions track ui/src/artifact-directions/directions/d2-tint/PanelLead.tsx:45— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
<video> without a captions track ui/src/artifact-directions/directions/d3-tactile/objects/Print.tsx:60— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
<video> without a captions track ui/src/artifact-directions/directions/d4-hybrid/PanelLead.tsx:136— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
<video> without a captions track ui/src/components/FileViewerSheet.tsx:318— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
<video> without a captions track ui/src/components/ImageGalleryModal.tsx:143— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
<video> without a captions track ui/src/components/artifacts/RichArtifactCards.tsx:605— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
<video> without a captions track ui/src/components/issue-output/OutputVideoPlayer.tsx:22— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×8
Animation without a prefers-reduced-motion guard packages/plugins/plugin-llm-wiki/src/ui/app.tsx:434— <span> moves — its inline style sets `animation: tone.pulse` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard packages/plugins/plugin-llm-wiki/src/ui/app.tsx:3588— <span> moves — its inline style sets `transition: transform 120ms ease` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard packages/skills-catalog/catalog/bundled/product/wireframe/assets/site-template.html:106— `.toc .toc-summary .chevron` moves (`transition: transform 120ms ease`) 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.
Animation without a prefers-reduced-motion guard packages/skills-catalog/catalog/bundled/product/wireframe/assets/site-template.html:145— `.wire` moves (`transition: transform 80ms ease, box-shadow 80ms ease`) 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.
Animation without a prefers-reduced-motion guard ui/src/components/ActivityFeed.tsx:701— <span> moves — its `animate-ping` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard ui/src/components/ArtifactsPanel.tsx:197— <span> moves — its `animate-ping` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard ui/src/components/OnboardingChat.tsx:326— <span> moves — its `animate-ping` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard ui/src/components/OnboardingChat.tsx:471— <span> moves — its `animate-ping` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
TodoComment ui/src/pages/AgentDetail.production.tsx:1093— // } else if (activeView === "skills") { // TODO: bring back later — 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 ui/src/components/transcript/useLiveRunTranscripts.ts:20— // TODO(perf): this whole hook polls the log/runs endpoints on an interval. 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 ui/src/adapters/runtime-json-fields.tsx:5— // TODO(issue-worktree-support): re-enable this UI once the workflow is ready to ship. — 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 packages/plugins/sandbox-providers/kubernetes/src/plugin.ts:74— // TODO: future versions could thread companyName through AcquireLeaseParams — 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 packages/plugins/sandbox-providers/kubernetes/src/plugin.ts:81— // TODO: tighten once the agent runtime shim (companion images PR) lands its — 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 packages/plugins/sandbox-providers/kubernetes/src/plugin.ts:353— // TODO: use params.runId as stand-in for agentId in labels; future — 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 packages/plugins/sandbox-providers/kubernetes/src/sandbox-orchestrator.ts:64— // TODO: requires custom in-cluster controller for k8s — kubelet does not — 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 cli/src/commands/client/company.ts:399— // TODO: replace this temporary claude_local fallback with adapter selection in the import TUI. — 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.
Cross-context type Platform (ui → paperclip-runner) packages/paperclip-runner/src/drivers/acpx/verified-runtime-executable.ts:18— Platform (context ui) is exposed in paperclip-runner's public surface via verified-runtime-executable.verifiedRuntimeExecutable — couples the contexts.
Cross-context type Platform (ui → paperclip-runner) packages/paperclip-runner/src/drivers/acpx/verified-runtime-executable.ts:56— Platform (context ui) is exposed in paperclip-runner's public surface via verified-runtime-executable.verifiedRuntimeExecutableHandoff — couples the contexts.
Cross-context type Platform (ui → paperclip-runner) packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts:559— Platform (context ui) is exposed in paperclip-runner's public surface via installation-integrity.assertVerifiedAcpxProviderPlatform — couples the contexts.
Cross-context type Platform (ui → paperclip-runner) packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts:1297— Platform (context ui) is exposed in paperclip-runner's public surface via installation-integrity.verifiedExecutableOpenFlags — couples the contexts.
Cross-context type Platform (ui → paperclip-runner) packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts:2048— Platform (context ui) is exposed in paperclip-runner's public surface via installation-integrity.guardSnapshotModuleLookup — couples the contexts.
Cross-context type Platform (ui → paperclip-runner) packages/paperclip-runner/src/drivers/acpx/cursor-launch-policy.ts:28— Platform (context ui) is exposed in paperclip-runner's public surface via cursor-launch-policy.assertCursorWorkspacePolicy — couples the contexts.
Cross-context type Platform (ui → paperclip-runner) packages/paperclip-runner/src/drivers/acpx/cursor-installation.ts:14— Platform (context ui) is exposed in paperclip-runner's public surface via cursor-installation.cursorNativeDistributionSpec — couples the contexts.
Cross-context type Platform (ui → paperclip-runner) packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts:154— Platform (context ui) is exposed in paperclip-runner's public surface via QualifiedAcpxRuntimeDependencies.platform — couples the contexts.
Off the main sequence: @paperclipai/hermes-paperclip-adapter — @paperclipai/hermes-paperclip-adapter: abstractness 0.00, instability 0.20, distance 0.80 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
Off the main sequence: @paperclipai/adapter-cursor-cloud — @paperclipai/adapter-cursor-cloud: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: @paperclipai/adapter-cursor-local — @paperclipai/adapter-cursor-local: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: @paperclipai/adapter-gemini-local — @paperclipai/adapter-gemini-local: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: @paperclipai/adapter-kimi-local — @paperclipai/adapter-kimi-local: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: @paperclipai/adapter-openclaw-gateway — @paperclipai/adapter-openclaw-gateway: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: @paperclipai/adapter-opencode-local — @paperclipai/adapter-opencode-local: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: @paperclipai/adapter-pi-local — @paperclipai/adapter-pi-local: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
execute.execute::toAdapterResult (cyclomatic 93) packages/adapters/claude-local/src/server/execute.ts:993— execute.execute::toAdapterResult has cyclomatic complexity 93 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: one other method here (execute.execute) 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.
execute.execute::toResult (cyclomatic 46) packages/adapters/codex-local/src/server/execute.ts:1450— execute.execute::toResult 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. This shape REPEATS in the file: 2 other methods here (execute.execute, execute.execute::runAttempt) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
execute.execute::toResult (cyclomatic 28) packages/adapters/opencode-local/src/server/execute.ts:709— execute.execute::toResult 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. This shape REPEATS in the file: one other method here (execute.execute) 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.
execute.execute::toResult (cyclomatic 27) packages/adapters/gemini-local/src/server/execute.ts:670— execute.execute::toResult 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. This shape REPEATS in the file: one other method here (execute.execute) 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.
execute.execute::toResult (cyclomatic 26) packages/adapters/kimi-local/src/server/execute.ts:625— execute.execute::toResult 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. This shape REPEATS in the file: one other method here (execute.execute) 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.
execute.execute::toResult (cyclomatic 23) packages/adapters/cursor-local/src/server/execute.ts:698— execute.execute::toResult 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. This shape REPEATS in the file: one other method here (execute.execute) 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.
execute.execute::runAttempt (cyclomatic 20) packages/adapters/codex-local/src/server/execute.ts:1189— execute.execute::runAttempt 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. This shape REPEATS in the file: 2 other methods here (execute.execute, execute.execute::toResult) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
CodexProvider::poll (cognitive 180) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:2225— CodexProvider::poll has cognitive complexity 180 (threshold 15). Drivers by points: if/else 71 (153 pts), boolean chains 17, match/switch 4 (10 pts) (nesting depth added 88). 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.
CodexProvider::start_with_tools_observed (cognitive 39) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:903— CodexProvider::start_with_tools_observed has cognitive complexity 39 (threshold 15). Drivers by points: if/else 28 (33 pts), boolean chains 5, match/switch 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
CodexProvider::request_classified (cognitive 29) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3092— CodexProvider::request_classified has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (25 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.
CodexProvider::set_goal (cognitive 23) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:1646— CodexProvider::set_goal has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4, 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.
CodexProvider::start_turn_with_options_and_effort (cognitive 21) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:1750— CodexProvider::start_turn_with_options_and_effort has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 4, match/switch 2, 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.
CodexProvider::drain_completed_turn_tail_for_warm_attachment (cognitive 20) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:1311— CodexProvider::drain_completed_turn_tail_for_warm_attachment has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 1 (2 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.
CodexProvider::read_thread (cognitive 17) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:1997— CodexProvider::read_thread has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 1, 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.
execute.execute::toAdapterResult (cognitive 144) packages/adapters/claude-local/src/server/execute.ts:993— execute.execute::toAdapterResult has cognitive complexity 144 (threshold 15). Drivers by points: ternaries 53 (118 pts), boolean chains 24, if/else 2 (nesting depth added 65). 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. This shape REPEATS in the file: one other method here (execute.execute) 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.
execute.execute::toResult (cognitive 54) packages/adapters/codex-local/src/server/execute.ts:1450— execute.execute::toResult has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 25 (43 pts), boolean chains 9, if/else 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. This shape REPEATS in the file: 2 other methods here (execute.execute, execute.execute::runAttempt) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
execute.execute::toResult (cognitive 36) packages/adapters/gemini-local/src/server/execute.ts:670— execute.execute::toResult has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 15 (28 pts), boolean chains 7, if/else 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. This shape REPEATS in the file: one other method here (execute.execute) 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.
execute.execute::toResult (cognitive 31) packages/adapters/kimi-local/src/server/execute.ts:625— execute.execute::toResult has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 13 (23 pts), boolean chains 7, if/else 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. This shape REPEATS in the file: one other method here (execute.execute) 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.
execute.execute::toResult (cognitive 30) packages/adapters/opencode-local/src/server/execute.ts:709— execute.execute::toResult has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 12 (18 pts), boolean chains 11, if/else 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. This shape REPEATS in the file: one other method here (execute.execute) 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.
execute.execute::toResult (cognitive 24) packages/adapters/cursor-local/src/server/execute.ts:698— execute.execute::toResult has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (17 pts), boolean chains 6, if/else 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. This shape REPEATS in the file: one other method here (execute.execute) 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.
execute.execute::runAttempt (cognitive 19) packages/adapters/codex-local/src/server/execute.ts:1189— execute.execute::runAttempt has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9, if/else 7, boolean chains 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. This shape REPEATS in the file: 2 other methods here (execute.execute, execute.execute::toResult) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
agents.agentRoutes::handleWakeupRoute (cognitive 96) server/src/routes/agents.ts:5993— agents.agentRoutes::handleWakeupRoute has cognitive complexity 96 (threshold 15). Drivers by points: if/else 28 (62 pts), ternaries 11 (16 pts), boolean chains 15, error handling 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. This shape REPEATS in the file: 7 other methods here (agents.agentRoutes, agents.agentRoutes::assertSelectableAdapterType, agents.agentRoutes::assertAgentDefaultEnvironmentSelection, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 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.
agents.agentRoutes::validateManagedAgentBinding (cognitive 44) server/src/routes/agents.ts:3131— agents.agentRoutes::validateManagedAgentBinding has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 9, error handling 2 (6 pts), ternaries 3 (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. This shape REPEATS in the file: 7 other methods here (agents.agentRoutes, agents.agentRoutes::assertSelectableAdapterType, agents.agentRoutes::assertAgentDefaultEnvironmentSelection, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 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.
agents.agentRoutes::handleAgentHire (cognitive 43) server/src/routes/agents.ts:4336— agents.agentRoutes::handleAgentHire has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 9, ternaries 3 (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. This shape REPEATS in the file: 7 other methods here (agents.agentRoutes, agents.agentRoutes::assertSelectableAdapterType, agents.agentRoutes::assertAgentDefaultEnvironmentSelection, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 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.
agents.agentRoutes::handleAgentHire::performHire (cognitive 35) server/src/routes/agents.ts:4520— agents.agentRoutes::handleAgentHire::performHire has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 14 (21 pts), if/else 7 (11 pts), boolean chains 3 (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. This shape REPEATS in the file: 7 other methods here (agents.agentRoutes, agents.agentRoutes::assertSelectableAdapterType, agents.agentRoutes::assertAgentDefaultEnvironmentSelection, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 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.
agents.agentRoutes::applyHiringAgentAuthInheritance (cognitive 20) server/src/routes/agents.ts:2308— agents.agentRoutes::applyHiringAgentAuthInheritance has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5, 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. This shape REPEATS in the file: 7 other methods here (agents.agentRoutes, agents.agentRoutes::assertSelectableAdapterType, agents.agentRoutes::assertAgentDefaultEnvironmentSelection, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 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.
agents.agentRoutes::assertSelectableAdapterType (cognitive 18) server/src/routes/agents.ts:1878— agents.agentRoutes::assertSelectableAdapterType has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 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. This shape REPEATS in the file: 7 other methods here (agents.agentRoutes, agents.agentRoutes::assertAgentDefaultEnvironmentSelection, agents.agentRoutes::applyHiringAgentAuthInheritance, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 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.
agents.agentRoutes::assertAgentDefaultEnvironmentSelection (cognitive 18) server/src/routes/agents.ts:1988— agents.agentRoutes::assertAgentDefaultEnvironmentSelection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, ternaries 2 (4 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. This shape REPEATS in the file: 7 other methods here (agents.agentRoutes, agents.agentRoutes::assertSelectableAdapterType, agents.agentRoutes::applyHiringAgentAuthInheritance, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 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.
Duplicated block (6 lines × 2) server/src/services/scripts/v1/client.py:224— server/src/services/scripts/v1/client.py:224-229 | server/src/services/scripts/v2/client.py:264-269 — `server/src/services/scripts/v1/client.py` and `server/src/services/scripts/v2/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 67 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `server/src/services/scripts/v1/client.py: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. 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 (6 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:593— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:593-598 | packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:624-629 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs:546— packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs:546-551 | packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3203-3208 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:221— packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:221-226 | packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:366-371 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:623— packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:623-628 | packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:630-635 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/question_response.rs:233— packages/paperclip-runner/runner/crates/runner-core/src/question_response.rs:233-238 | packages/paperclip-runner/runner/crates/runner-core/src/question_response.rs:318-323 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:1464— packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:1464-1469 | packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:1858-1863 — both copies are in the same file, so extract the block into 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) server/src/services/scripts/v2/client.py:113— server/src/services/scripts/v2/client.py:113-117 | server/src/services/scripts/v3/client.py:131-135 — `server/src/services/scripts/v2/client.py` and `server/src/services/scripts/v3/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 17 separate duplicated blocks between them, totalling at least 122 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (5 lines × 2) server/src/services/scripts/v2/client.py:138— server/src/services/scripts/v2/client.py:138-142 | server/src/services/scripts/v3/client.py:156-160 — `server/src/services/scripts/v2/client.py` and `server/src/services/scripts/v3/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 17 separate duplicated blocks between them, totalling at least 122 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (5 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:517— packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:517-521 | packages/paperclip-runner/runner/crates/runner-core/src/claude_managed_provider.rs:425-429 — 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) packages/paperclip-runner/runner/crates/runner-core/src/durable/mod.rs:276— packages/paperclip-runner/runner/crates/runner-core/src/durable/mod.rs:276-281 | packages/paperclip-runner/runner/crates/runner-core/src/durable/mod.rs:306-310 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:1995— packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:1995-1999 | packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:2038-2042 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1995— packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1995-1999 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:709-713 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/question_response.rs:59— packages/paperclip-runner/runner/crates/runner-core/src/question_response.rs:59-64 | packages/paperclip-runner/runner/crates/runner-core/src/question_response.rs:289-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.
agents.agentRoutes::handleWakeupRoute (cyclomatic 62) server/src/routes/agents.ts:5993— agents.agentRoutes::handleWakeupRoute 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. This shape REPEATS in the file: 6 other methods here (agents.agentRoutes, agents.agentRoutes::assertSelectableAdapterType, agents.agentRoutes::applyHiringAgentAuthInheritance, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 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.
agents.agentRoutes::validateManagedAgentBinding (cyclomatic 31) server/src/routes/agents.ts:3131— agents.agentRoutes::validateManagedAgentBinding 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. This shape REPEATS in the file: 6 other methods here (agents.agentRoutes, agents.agentRoutes::assertSelectableAdapterType, agents.agentRoutes::applyHiringAgentAuthInheritance, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 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.
agents.agentRoutes::handleAgentHire (cyclomatic 30) server/src/routes/agents.ts:4336— agents.agentRoutes::handleAgentHire 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. This shape REPEATS in the file: 6 other methods here (agents.agentRoutes, agents.agentRoutes::assertSelectableAdapterType, agents.agentRoutes::applyHiringAgentAuthInheritance, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 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.
agents.agentRoutes::handleAgentHire::performHire (cyclomatic 29) server/src/routes/agents.ts:4520— agents.agentRoutes::handleAgentHire::performHire 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. This shape REPEATS in the file: 6 other methods here (agents.agentRoutes, agents.agentRoutes::assertSelectableAdapterType, agents.agentRoutes::applyHiringAgentAuthInheritance, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 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.
agents.agentRoutes::applyHiringAgentAuthInheritance (cyclomatic 20) server/src/routes/agents.ts:2308— agents.agentRoutes::applyHiringAgentAuthInheritance 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. This shape REPEATS in the file: 6 other methods here (agents.agentRoutes, agents.agentRoutes::assertSelectableAdapterType, agents.agentRoutes::validateManagedAgentBinding, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 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.
agents.agentRoutes::assertSelectableAdapterType (cyclomatic 18) server/src/routes/agents.ts:1878— agents.agentRoutes::assertSelectableAdapterType 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. This shape REPEATS in the file: 6 other methods here (agents.agentRoutes, agents.agentRoutes::applyHiringAgentAuthInheritance, agents.agentRoutes::validateManagedAgentBinding, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 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.
issues.issueRoutes::classifySourceRecoveryRevalidation (cyclomatic 37) server/src/routes/issues.ts:4212— issues.issueRoutes::classifySourceRecoveryRevalidation has cyclomatic complexity 37 (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. This shape REPEATS in the file: 5 other methods here (issues.issueRoutes::parseAttachmentRangeHeader, issues.issueRoutes::assertInReviewReviewPath, issues.issueRoutes::assertAgentIssueMutationAllowed, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
issues.issueRoutes::lockQueuedCommentState (cyclomatic 27) server/src/routes/issues.ts:7469— issues.issueRoutes::lockQueuedCommentState 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. This shape REPEATS in the file: 5 other methods here (issues.issueRoutes::classifySourceRecoveryRevalidation, issues.issueRoutes::parseAttachmentRangeHeader, issues.issueRoutes::assertInReviewReviewPath, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
issues.issueRoutes::assertInReviewReviewPath (cyclomatic 24) server/src/routes/issues.ts:4563— issues.issueRoutes::assertInReviewReviewPath 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. This shape REPEATS in the file: 5 other methods here (issues.issueRoutes::classifySourceRecoveryRevalidation, issues.issueRoutes::parseAttachmentRangeHeader, issues.issueRoutes::assertAgentIssueMutationAllowed, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
issues.issueRoutes::assertAgentIssueMutationAllowed (cyclomatic 20) server/src/routes/issues.ts:5616— issues.issueRoutes::assertAgentIssueMutationAllowed 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. This shape REPEATS in the file: 5 other methods here (issues.issueRoutes::classifySourceRecoveryRevalidation, issues.issueRoutes::parseAttachmentRangeHeader, issues.issueRoutes::assertInReviewReviewPath, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
issues.issueRoutes::parseAttachmentRangeHeader (cyclomatic 17) server/src/routes/issues.ts:4436— issues.issueRoutes::parseAttachmentRangeHeader 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. This shape REPEATS in the file: 5 other methods here (issues.issueRoutes::classifySourceRecoveryRevalidation, issues.issueRoutes::assertInReviewReviewPath, issues.issueRoutes::assertAgentIssueMutationAllowed, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
issues.issueRoutes::resolveWorkProductCreatedByRunId (cyclomatic 16) server/src/routes/issues.ts:6787— issues.issueRoutes::resolveWorkProductCreatedByRunId 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 shape REPEATS in the file: 5 other methods here (issues.issueRoutes::classifySourceRecoveryRevalidation, issues.issueRoutes::parseAttachmentRangeHeader, issues.issueRoutes::assertInReviewReviewPath, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
client.main (cyclomatic 20) server/src/services/scripts/v4/client.py:301— client.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.
client.main (cyclomatic 20) server/src/services/scripts/v5/client.py:301— client.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.
client.main (cyclomatic 20) server/src/services/scripts/v6/client.py:303— client.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.
client.main (cyclomatic 20) server/src/services/scripts/v7/client.py:464— client.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.
client.main (cyclomatic 20) server/src/services/scripts/v8/client.py:464— client.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.
client.main (cyclomatic 20) server/src/services/scripts/v9/client.py:565— client.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.
D4 · Code Duplication· Members sharing a duplicated core (9 members, 50+ identical tokens) · ×6
Members sharing a duplicated core (9 members, 50+ identical tokens) server/src/services/scripts/v1/client.py:60— server/src/services/scripts/v1/client.py:60-76 | server/src/services/scripts/v2/client.py:90-101 | server/src/services/scripts/v3/client.py:108-119 | server/src/services/scripts/v4/client.py:132-143 | server/src/services/scripts/v5/client.py:132-143 | server/src/services/scripts/v6/client.py:132-143 | server/src/services/scripts/v7/client.py:209-220 | server/src/services/scripts/v8/client.py:209-220 | server/src/services/scripts/v9/client.py:241-252 — These 9 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 9 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 9 times.
Members sharing a duplicated core (9 members, 50+ identical tokens) server/src/services/scripts/v1/client.py:113— server/src/services/scripts/v1/client.py:113-121 | server/src/services/scripts/v2/client.py:152-160 | server/src/services/scripts/v3/client.py:170-178 | server/src/services/scripts/v4/client.py:207-215 | server/src/services/scripts/v5/client.py:207-215 | server/src/services/scripts/v6/client.py:209-217 | server/src/services/scripts/v7/client.py:286-294 | server/src/services/scripts/v8/client.py:286-294 | server/src/services/scripts/v9/client.py:318-326 — These 9 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 9 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 9 times.
Members sharing a duplicated core (9 members, 50+ identical tokens) server/src/services/scripts/v1/client.py:123— server/src/services/scripts/v1/client.py:123-133 | server/src/services/scripts/v2/client.py:162-173 | server/src/services/scripts/v3/client.py:180-191 | server/src/services/scripts/v4/client.py:217-228 | server/src/services/scripts/v5/client.py:217-228 | server/src/services/scripts/v6/client.py:219-230 | server/src/services/scripts/v7/client.py:296-307 | server/src/services/scripts/v8/client.py:296-307 | server/src/services/scripts/v9/client.py:328-339 — These 9 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 9 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 9 times.
Members sharing a duplicated core (9 members, 50+ identical tokens) server/src/services/scripts/v1/client.py:135— server/src/services/scripts/v1/client.py:135-138 | server/src/services/scripts/v2/client.py:175-179 | server/src/services/scripts/v3/client.py:193-197 | server/src/services/scripts/v4/client.py:230-237 | server/src/services/scripts/v5/client.py:230-237 | server/src/services/scripts/v6/client.py:232-239 | server/src/services/scripts/v7/client.py:309-316 | server/src/services/scripts/v8/client.py:309-316 | server/src/services/scripts/v9/client.py:341-348 — These 9 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 9 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 9 times.
Members sharing a duplicated core (9 members, 50+ identical tokens) server/src/services/scripts/v1/client.py:161— server/src/services/scripts/v1/client.py:161-181 | server/src/services/scripts/v2/client.py:202-222 | server/src/services/scripts/v3/client.py:220-240 | server/src/services/scripts/v4/client.py:260-280 | server/src/services/scripts/v5/client.py:260-280 | server/src/services/scripts/v6/client.py:262-282 | server/src/services/scripts/v7/client.py:339-359 | server/src/services/scripts/v8/client.py:339-359 | server/src/services/scripts/v9/client.py:371-391 — These 9 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 9 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 9 times.
Members sharing a duplicated core (9 members, 50+ identical tokens) server/src/services/scripts/v1/client.py:201— server/src/services/scripts/v1/client.py:201-242 | server/src/services/scripts/v2/client.py:244-281 | server/src/services/scripts/v3/client.py:262-301 | server/src/services/scripts/v4/client.py:302-342 | server/src/services/scripts/v5/client.py:302-342 | server/src/services/scripts/v6/client.py:304-344 | server/src/services/scripts/v7/client.py:465-505 | server/src/services/scripts/v8/client.py:465-505 | server/src/services/scripts/v9/client.py:566-606 — These 9 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 9 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 9 times.
Duplicated block (7 lines × 2) server/src/services/scripts/v7/client.py:423— server/src/services/scripts/v7/client.py:423-429 | server/src/services/scripts/v8/client.py:423-429 — `server/src/services/scripts/v7/client.py` and `server/src/services/scripts/v8/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 31 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 (7 lines × 2) server/src/services/scripts/v2/client.py:244— server/src/services/scripts/v2/client.py:244-250 | server/src/services/scripts/v3/client.py:262-268 — `server/src/services/scripts/v2/client.py` and `server/src/services/scripts/v3/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 17 separate duplicated blocks between them, totalling at least 122 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `server/src/services/scripts/v3/client.py:269` calls `add_parser` and `server/src/services/scripts/v2/client.py:251` 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) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3349— packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3349-3355 | packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3414-3420 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_checkpoint.rs:336— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_checkpoint.rs:336-342 | packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs:1552-1558 — 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) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:832— packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:832-841 | packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1186-1192 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3834— packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3834-3840 | packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3850-3856 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:1634— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:1634-1643 | packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1316-1325 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1585— packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1585-1594 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:4218-4227 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:1857— packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:1857-1866 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2339-2348 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs:470— packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs:470-479 | packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs:490-499 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:1405— packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:1405-1415 | packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:1494-1503 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:1131— packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:1131-1140 | packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:1198-1207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
AC2 · Forms & labels· <TextInput> field component without a label · ×5
<TextInput> field component without a label packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4112— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4116— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4510— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label packages/plugins/plugin-llm-wiki/src/ui/app.tsx:5256— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6565— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
AC3 · Page structure· Page without a main landmark · ×5
Page without a main landmark scripts/generate-org-chart-satori-comparison.ts:158— 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 ui/index.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 ui/storybook/public/browser-viewer.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 ui/storybook/public/project-skills-evidence/index.html:1— 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 ui/storybook/support/html-artifacts/report.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
CodexProvider::poll (cyclomatic 87) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:2225— CodexProvider::poll has cyclomatic complexity 87 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CodexProvider::start_with_tools_observed (cyclomatic 28) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:903— CodexProvider::start_with_tools_observed 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.
CodexProvider::start_turn_with_options_and_effort (cyclomatic 21) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:1750— CodexProvider::start_turn_with_options_and_effort 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.
CodexProvider::set_goal (cyclomatic 17) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:1646— CodexProvider::set_goal 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.
CodexProvider::drain_completed_turn_tail_for_warm_attachment (cyclomatic 16) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:1311— CodexProvider::drain_completed_turn_tail_for_warm_attachment 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.
NewAgentSetup.Setup::buildConfig (cyclomatic 47) ui/src/components/new-agent/NewAgentSetup.tsx:422— NewAgentSetup.Setup::buildConfig 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. This shape REPEATS in the file: 5 other methods here (NewAgentSetup.Setup, NewAgentSetup.Setup::preparedConfig, NewAgentSetup.Setup::saveDraft, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
NewAgentSetup.Setup::finish (cyclomatic 26) ui/src/components/new-agent/NewAgentSetup.tsx:709— NewAgentSetup.Setup::finish has cyclomatic complexity 26 (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. This shape REPEATS in the file: 5 other methods here (NewAgentSetup.Setup, NewAgentSetup.Setup::buildConfig, NewAgentSetup.Setup::preparedConfig, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
NewAgentSetup.Setup::saveDraft (cyclomatic 21) ui/src/components/new-agent/NewAgentSetup.tsx:607— NewAgentSetup.Setup::saveDraft 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. This shape REPEATS in the file: 5 other methods here (NewAgentSetup.Setup, NewAgentSetup.Setup::buildConfig, NewAgentSetup.Setup::preparedConfig, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
NewAgentSetup.Setup::preparedConfig (cyclomatic 19) ui/src/components/new-agent/NewAgentSetup.tsx:507— NewAgentSetup.Setup::preparedConfig 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. This shape REPEATS in the file: 5 other methods here (NewAgentSetup.Setup, NewAgentSetup.Setup::buildConfig, NewAgentSetup.Setup::saveDraft, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
NewAgentSetup.Setup::runTest (cyclomatic 19) ui/src/components/new-agent/NewAgentSetup.tsx:657— NewAgentSetup.Setup::runTest 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. This shape REPEATS in the file: 5 other methods here (NewAgentSetup.Setup, NewAgentSetup.Setup::buildConfig, NewAgentSetup.Setup::preparedConfig, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
OnboardingWizard.OnboardingWizardInner::handleGiveHeartbeat (cognitive 94) ui/src/components/OnboardingWizard.tsx:2350— OnboardingWizard.OnboardingWizardInner::handleGiveHeartbeat has cognitive complexity 94 (threshold 15). Drivers by points: if/else 35 (49 pts), ternaries 13 (22 pts), boolean chains 20, error handling 2 (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. This shape REPEATS in the file: 5 other methods here (OnboardingWizard.OnboardingWizardInner, OnboardingWizard.OnboardingWizardInner::managedBindingForStep, OnboardingWizard.OnboardingWizardInner::handleLaunchToDashboard, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
OnboardingWizard.OnboardingWizardInner::runAdapterEnvironmentTest (cognitive 57) ui/src/components/OnboardingWizard.tsx:2159— OnboardingWizard.OnboardingWizardInner::runAdapterEnvironmentTest has cognitive complexity 57 (threshold 15). Drivers by points: if/else 19 (33 pts), boolean chains 12, ternaries 6 (10 pts), error handling 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. This shape REPEATS in the file: 5 other methods here (OnboardingWizard.OnboardingWizardInner, OnboardingWizard.OnboardingWizardInner::managedBindingForStep, OnboardingWizard.OnboardingWizardInner::handleLaunchToDashboard, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
OnboardingWizard.OnboardingWizardInner::buildAdapterConfig (cognitive 45) ui/src/components/OnboardingWizard.tsx:2045— OnboardingWizard.OnboardingWizardInner::buildAdapterConfig has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 11 (20 pts), boolean chains 17, if/else 6 (8 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. This shape REPEATS in the file: 5 other methods here (OnboardingWizard.OnboardingWizardInner, OnboardingWizard.OnboardingWizardInner::managedBindingForStep, OnboardingWizard.OnboardingWizardInner::handleLaunchToDashboard, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
OnboardingWizard.OnboardingWizardInner::handleLaunchToDashboard (cognitive 19) ui/src/components/OnboardingWizard.tsx:1923— OnboardingWizard.OnboardingWizardInner::handleLaunchToDashboard has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 2 (3 pts), boolean chains 1, error handling 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. This shape REPEATS in the file: 5 other methods here (OnboardingWizard.OnboardingWizardInner, OnboardingWizard.OnboardingWizardInner::managedBindingForStep, OnboardingWizard.OnboardingWizardInner::buildAdapterConfig, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
OnboardingWizard.OnboardingWizardInner::managedBindingForStep (cognitive 17) ui/src/components/OnboardingWizard.tsx:796— OnboardingWizard.OnboardingWizardInner::managedBindingForStep has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, ternaries 2 (3 pts) (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. This shape REPEATS in the file: 5 other methods here (OnboardingWizard.OnboardingWizardInner, OnboardingWizard.OnboardingWizardInner::handleLaunchToDashboard, OnboardingWizard.OnboardingWizardInner::buildAdapterConfig, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
NewAgentSetup.Setup::buildConfig (cognitive 59) ui/src/components/new-agent/NewAgentSetup.tsx:422— NewAgentSetup.Setup::buildConfig has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 16 (28 pts), if/else 12 (18 pts), boolean chains 9, loops 2 (4 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. This shape REPEATS in the file: 5 other methods here (NewAgentSetup.Setup, NewAgentSetup.Setup::preparedConfig, NewAgentSetup.Setup::saveDraft, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
NewAgentSetup.Setup::saveDraft (cognitive 27) ui/src/components/new-agent/NewAgentSetup.tsx:607— NewAgentSetup.Setup::saveDraft has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 4 (8 pts), boolean chains 6, error handling 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. This shape REPEATS in the file: 5 other methods here (NewAgentSetup.Setup, NewAgentSetup.Setup::buildConfig, NewAgentSetup.Setup::preparedConfig, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
NewAgentSetup.Setup::preparedConfig (cognitive 20) ui/src/components/new-agent/NewAgentSetup.tsx:507— NewAgentSetup.Setup::preparedConfig has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, error handling 1 (2 pts), ternaries 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. This shape REPEATS in the file: 5 other methods here (NewAgentSetup.Setup, NewAgentSetup.Setup::buildConfig, NewAgentSetup.Setup::saveDraft, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
NewAgentSetup.Setup::runTest (cognitive 20) ui/src/components/new-agent/NewAgentSetup.tsx:657— NewAgentSetup.Setup::runTest has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (7 pts), boolean chains 6, if/else 5 (6 pts), 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. This shape REPEATS in the file: 5 other methods here (NewAgentSetup.Setup, NewAgentSetup.Setup::buildConfig, NewAgentSetup.Setup::preparedConfig, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
NewAgentSetup.Setup::finish (cognitive 19) ui/src/components/new-agent/NewAgentSetup.tsx:709— NewAgentSetup.Setup::finish has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 7, if/else 3, 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. This shape REPEATS in the file: 5 other methods here (NewAgentSetup.Setup, NewAgentSetup.Setup::buildConfig, NewAgentSetup.Setup::preparedConfig, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
Cross-context type AdapterExecutionTarget (adapter-utils → claude-local) packages/adapters/claude-local/src/server/claude-config.ts:236— AdapterExecutionTarget (context adapter-utils) is exposed in claude-local's public surface via claude-config.materializeRemoteClaudeConfig — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → claude-local) packages/adapters/claude-local/src/server/claude-config.ts:271— AdapterExecutionTarget (context adapter-utils) is exposed in claude-local's public surface via claude-config.prepareSandboxClaudeProbeRuntime — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → claude-local) packages/adapters/claude-local/src/server/acp.ts:629— AdapterExecutionTarget (context adapter-utils) is exposed in claude-local's public surface via acp.probeClaudeAcpSandboxLogin — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → claude-local) packages/adapters/claude-local/src/server/cli-capabilities.ts:98— AdapterExecutionTarget (context adapter-utils) is exposed in claude-local's public surface via cli-capabilities.readClaudeCommandVersion — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → claude-local) packages/adapters/claude-local/src/server/cli-capabilities.ts:143— AdapterExecutionTarget (context adapter-utils) is exposed in claude-local's public surface via cli-capabilities.claudeCommandSupportsEffortFlag — couples the contexts.
Cross-context type Json (paperclip-runner → server) server/src/services/native-runtime/runner-api-catalog.ts:15— Json (context paperclip-runner) is exposed in server's public surface via RunnerApiOperation.parameters — couples the contexts.
Cross-context type Json (paperclip-runner → server) server/src/services/native-runtime/runner-api-catalog.ts:16— Json (context paperclip-runner) is exposed in server's public surface via RunnerApiOperation.requestBody — couples the contexts.
Cross-context type Json (paperclip-runner → server) server/src/services/native-runtime/runner-api-catalog.ts:17— Json (context paperclip-runner) is exposed in server's public surface via RunnerApiOperation.responses — couples the contexts.
Cross-context type Json (paperclip-runner → server) server/src/services/native-runtime/runner-api-catalog.ts:18— Json (context paperclip-runner) is exposed in server's public surface via RunnerApiOperation.authorization — couples the contexts.
Cross-context type Json (paperclip-runner → server) server/src/services/native-runtime/runner-api-catalog.ts:71— Json (context paperclip-runner) is exposed in server's public surface via runner-api-catalog.buildRunnerApiCatalog — couples the contexts.
Cross-context type ChatProvider (ui → shared) packages/shared/src/types/chat-channels.ts:263— ChatProvider (context ui) is exposed in shared's public surface via ChatEndpoint.provider — couples the contexts.
Cross-context type ChatProvider (ui → shared) packages/shared/src/types/chat-channels.ts:322— ChatProvider (context ui) is exposed in shared's public surface via ChatExternalPrincipal.provider — couples the contexts.
Cross-context type ChatProvider (ui → shared) packages/shared/src/types/chat-channels.ts:515— ChatProvider (context ui) is exposed in shared's public surface via ExternalChannelBindingSummary.provider — couples the contexts.
Cross-context type ChatProvider (ui → shared) packages/shared/src/types/chat-channels.ts:525— ChatProvider (context ui) is exposed in shared's public surface via CreateChatEndpointInput.provider — couples the contexts.
Cross-context type ChatProvider (ui → shared) packages/shared/src/types/issue.ts:1168— ChatProvider (context ui) is exposed in shared's public surface via IssueCommentMetadata.sourceChannel — couples the contexts.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×5
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
IC1 · Incompleteness & stubs· Guard cannot change the result · ×5
Guard cannot change the result — returns what the code already falls through to REDACTED:898— The guard above `return appliedFromHashes;` also returns `appliedFromHashes`, so no input can make it matter. Implement the distinction that was intended, or delete the guard.
Guard cannot change the result — returns what the code already falls through to packages/paperclip-runner/src/drivers/codex/codex-thread-normalization.ts:180— The guard above `return false;` also returns `false`, so no input can make it matter. Implement the distinction that was intended, or delete the guard.
Guard cannot change the result — returns what the code already falls through to scripts/generate-company-assets.ts:119— The guard above `return "engineer";` also returns `"engineer"`, so no input can make it matter. Implement the distinction that was intended, or delete the guard.
Guard cannot change the result — returns what the code already falls through to server/src/services/agent-instructions.ts:113— The guard above `return "text";` also returns `"text"`, so no input can make it matter. Implement the distinction that was intended, or delete the guard.
Guard cannot change the result — returns what the code already falls through to server/src/services/heartbeat/recovery.ts:287— The guard above `return false;` also returns `false`, so no input can make it matter. Implement the distinction that was intended, or delete the guard.
OnboardingWizard.OnboardingWizardInner::handleGiveHeartbeat (cyclomatic 84) ui/src/components/OnboardingWizard.tsx:2350— OnboardingWizard.OnboardingWizardInner::handleGiveHeartbeat 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. This shape REPEATS in the file: 4 other methods here (OnboardingWizard.OnboardingWizardInner, OnboardingWizard.OnboardingWizardInner::managedBindingForStep, OnboardingWizard.OnboardingWizardInner::buildAdapterConfig, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
OnboardingWizard.OnboardingWizardInner::runAdapterEnvironmentTest (cyclomatic 54) ui/src/components/OnboardingWizard.tsx:2159— OnboardingWizard.OnboardingWizardInner::runAdapterEnvironmentTest has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: 4 other methods here (OnboardingWizard.OnboardingWizardInner, OnboardingWizard.OnboardingWizardInner::managedBindingForStep, OnboardingWizard.OnboardingWizardInner::buildAdapterConfig, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
OnboardingWizard.OnboardingWizardInner::buildAdapterConfig (cyclomatic 42) ui/src/components/OnboardingWizard.tsx:2045— OnboardingWizard.OnboardingWizardInner::buildAdapterConfig 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. This shape REPEATS in the file: 4 other methods here (OnboardingWizard.OnboardingWizardInner, OnboardingWizard.OnboardingWizardInner::managedBindingForStep, OnboardingWizard.OnboardingWizardInner::runAdapterEnvironmentTest, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
OnboardingWizard.OnboardingWizardInner::managedBindingForStep (cyclomatic 21) ui/src/components/OnboardingWizard.tsx:796— OnboardingWizard.OnboardingWizardInner::managedBindingForStep 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. This shape REPEATS in the file: 4 other methods here (OnboardingWizard.OnboardingWizardInner, OnboardingWizard.OnboardingWizardInner::buildAdapterConfig, OnboardingWizard.OnboardingWizardInner::runAdapterEnvironmentTest, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
execute.execute (cyclomatic 73) packages/adapters/gemini-local/src/server/execute.ts:210— execute.execute 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. This shape REPEATS in the file: one other method here (execute.execute::toResult) 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.
execute.execute (cyclomatic 73) packages/adapters/hermes/src/server/execute.ts:345— execute.execute has cyclomatic complexity 73 (threshold 15). Of this number, 66 points are the body's own statements and 7 belong to one function item inside it that branches. 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.
execute.execute (cyclomatic 73) packages/adapters/kimi-local/src/server/execute.ts:189— execute.execute has cyclomatic complexity 73 (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 shape REPEATS in the file: one other method here (execute.execute::toResult) 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.
execute.execute (cyclomatic 73) packages/adapters/opencode-local/src/server/execute.ts:227— execute.execute has cyclomatic complexity 73 (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 shape REPEATS in the file: one other method here (execute.execute::toResult) 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.
CodexCommandExecutor::poll_current_provider (cyclomatic 51) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:4028— CodexCommandExecutor::poll_current_provider 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.
CodexCommandExecutor::restore_provider_if_needed (cyclomatic 37) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:1805— CodexCommandExecutor::restore_provider_if_needed 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.
CodexCommandExecutor::attach_run (cyclomatic 21) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2445— CodexCommandExecutor::attach_run 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.
CodexCommandExecutor::start_turn (cyclomatic 18) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2919— CodexCommandExecutor::start_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. This is NOT this file's highest cyclomatic complexity: CodexCommandExecutor::execute (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.
CodexCommandExecutor::poll_current_provider (cognitive 142) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:4028— CodexCommandExecutor::poll_current_provider has cognitive complexity 142 (threshold 15). Drivers by points: if/else 46 (120 pts), loops 3 (10 pts), boolean chains 6, match/switch 2 (6 pts) (nesting depth added 85). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CodexCommandExecutor::restore_provider_if_needed (cognitive 60) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:1805— CodexCommandExecutor::restore_provider_if_needed has cognitive complexity 60 (threshold 15). Drivers by points: if/else 27 (41 pts), boolean chains 15, loops 1 (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.
CodexCommandExecutor::attach_run (cognitive 29) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2445— CodexCommandExecutor::attach_run has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 7 (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.
CodexCommandExecutor::start_turn (cognitive 20) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2919— CodexCommandExecutor::start_turn has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), match/switch 2 (4 pts), boolean chains 3, 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.
ManagedProviderCommandExecutor::project_event (cognitive 34) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1547— ManagedProviderCommandExecutor::project_event has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 3 (7 pts), match/switch 1 (nesting depth added 19). 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.
ManagedProviderCommandExecutor::attach (cognitive 25) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:992— ManagedProviderCommandExecutor::attach has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (24 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.
ManagedProviderCommandExecutor::restore_provider_if_needed (cognitive 16) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:774— ManagedProviderCommandExecutor::restore_provider_if_needed has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), loops 1 (2 pts), boolean chains 1, match/switch 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.
ManagedProviderCommandExecutor::open_session (cognitive 16) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1138— ManagedProviderCommandExecutor::open_session has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 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.
plugin-worker-manager.createPluginWorkerHandle::handleWorkerNotification (cognitive 33) server/src/services/plugin-worker-manager.ts:2806— plugin-worker-manager.createPluginWorkerHandle::handleWorkerNotification has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (24 pts), ternaries 1 (4 pts), error handling 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. This shape REPEATS in the file: 4 other methods here (plugin-worker-manager.createPluginWorkerHandle, plugin-worker-manager.createPluginWorkerHandle::routeExecuteLogNotification, plugin-worker-manager.createPluginWorkerHandle::openDuplexChannel, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
plugin-worker-manager.createPluginWorkerHandle::routeExecuteLogNotification (cognitive 21) server/src/services/plugin-worker-manager.ts:1280— plugin-worker-manager.createPluginWorkerHandle::routeExecuteLogNotification has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, loops 2 (3 pts), ternaries 2 (3 pts), 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. This shape REPEATS in the file: 4 other methods here (plugin-worker-manager.createPluginWorkerHandle, plugin-worker-manager.createPluginWorkerHandle::openDuplexChannel, plugin-worker-manager.createPluginWorkerHandle::handleWorkerNotification, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
plugin-worker-manager.createPluginWorkerHandle::openDuplexChannel (cognitive 16) server/src/services/plugin-worker-manager.ts:2470— plugin-worker-manager.createPluginWorkerHandle::openDuplexChannel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, boolean chains 3, ternaries 2 (3 pts), loops 1 (2 pts), error handling 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. This shape REPEATS in the file: 4 other methods here (plugin-worker-manager.createPluginWorkerHandle, plugin-worker-manager.createPluginWorkerHandle::routeExecuteLogNotification, plugin-worker-manager.createPluginWorkerHandle::handleWorkerNotification, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
plugin-worker-manager.createPluginWorkerHandle::handleProcessExit (cognitive 16) server/src/services/plugin-worker-manager.ts:2997— plugin-worker-manager.createPluginWorkerHandle::handleProcessExit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, boolean chains 3, error handling 1 (3 pts), loops 2 (3 pts) (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. This shape REPEATS in the file: 4 other methods here (plugin-worker-manager.createPluginWorkerHandle, plugin-worker-manager.createPluginWorkerHandle::routeExecuteLogNotification, plugin-worker-manager.createPluginWorkerHandle::openDuplexChannel, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
Cross-context type RunState (paperclip-runner → server) server/src/services/heartbeat/session-preparation.ts:67— RunState (context paperclip-runner) is exposed in server's public surface via HeartbeatSessionPreparationInput.getLatestAgentConfigRevision — couples the contexts.
Cross-context type RunState (paperclip-runner → server) server/src/services/heartbeat/session-preparation.ts:245— RunState (context paperclip-runner) is exposed in server's public surface via HeartbeatAdapterSessionInput.evaluateSessionCompaction — couples the contexts.
Cross-context type RunState (paperclip-runner → server) server/src/services/heartbeat/runtime-execution.ts:180— RunState (context paperclip-runner) is exposed in server's public surface via HeartbeatRuntimeExecutionInput.services — couples the contexts.
Cross-context type RunState (paperclip-runner → server) server/src/services/heartbeat/run-completion.ts:115— RunState (context paperclip-runner) is exposed in server's public surface via CompleteHeartbeatRunInput.sessionCompaction — couples the contexts.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×4
Members sharing a duplicated core (6 members, 50+ identical tokens) server/src/services/scripts/v1/client.py:183— server/src/services/scripts/v1/client.py:183-192 | server/src/services/scripts/v2/client.py:224-234 | server/src/services/scripts/v3/client.py:242-252 | server/src/services/scripts/v4/client.py:282-292 | server/src/services/scripts/v5/client.py:282-292 | server/src/services/scripts/v6/client.py:284-294 — These 6 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 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) server/src/services/scripts/v4/client.py:50— server/src/services/scripts/v4/client.py:50-60 | server/src/services/scripts/v5/client.py:50-60 | server/src/services/scripts/v6/client.py:50-60 | server/src/services/scripts/v7/client.py:50-60 | server/src/services/scripts/v8/client.py:50-60 | server/src/services/scripts/v9/client.py:50-60 — These 6 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 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) server/src/services/scripts/v4/client.py:156— server/src/services/scripts/v4/client.py:156-163 | server/src/services/scripts/v5/client.py:156-163 | server/src/services/scripts/v6/client.py:156-163 | server/src/services/scripts/v7/client.py:233-240 | server/src/services/scripts/v8/client.py:233-240 | server/src/services/scripts/v9/client.py:265-272 — These 6 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 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) server/src/services/scripts/v4/client.py:191— server/src/services/scripts/v4/client.py:191-197 | server/src/services/scripts/v5/client.py:191-197 | server/src/services/scripts/v6/client.py:193-199 | server/src/services/scripts/v7/client.py:270-276 | server/src/services/scripts/v8/client.py:270-276 | server/src/services/scripts/v9/client.py:302-308 — These 6 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 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Duplicated block (11 lines × 3) server/src/services/scripts/v7/client.py:194— server/src/services/scripts/v7/client.py:194-204 | server/src/services/scripts/v8/client.py:194-204 | server/src/services/scripts/v9/client.py:226-236 — `server/src/services/scripts/v7/client.py` and `server/src/services/scripts/v8/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 31 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 × 3) server/src/services/scripts/v7/client.py:364— server/src/services/scripts/v7/client.py:364-374 | server/src/services/scripts/v8/client.py:364-374 | server/src/services/scripts/v9/client.py:402-412 — `server/src/services/scripts/v7/client.py` and `server/src/services/scripts/v8/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 31 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 (11 lines × 3) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2545— packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2545-2555 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2772-2782 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:3231-3241 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:4238— packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:4238-4248 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:4301-4311 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:4344-4354 — 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.
Weak hash algorithm packages/paperclip-runner/src/cli/codex-app-server-unix-proxy.ts:39— 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+ (`createHash("sha256")`) 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 REDACTED:2072— 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+ (`createHash("sha256")`) 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 packages/plugins/plugin-llm-wiki/src/wiki/core.ts:495— 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+ (`createHash("sha256")`) 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 REDACTED:174— 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+ (`createHash("sha256")`) 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.
AC2 · Forms & labels· <Textarea> field component without a label · ×3
<Textarea> field component without a label ui/src/components/AgentBubbleActionRow.tsx:291— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Textarea> field component without a label ui/src/components/AttentionQueueRow.tsx:856— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Textarea> field component without a label ui/src/components/DocumentAnnotationPanel.tsx:262— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
Client.prepared_consume (cyclomatic 19) server/src/services/scripts/v7/client.py:379— Client.prepared_consume 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.
Client.prepared_consume (cyclomatic 19) server/src/services/scripts/v8/client.py:379— Client.prepared_consume 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.
Client.prepared_consume (cyclomatic 19) server/src/services/scripts/v9/client.py:417— Client.prepared_consume 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.
ClaudeManagedProvider::fetch_final_usage (cognitive 29) packages/paperclip-runner/runner/crates/runner-core/src/claude_managed_provider.rs:1970— ClaudeManagedProvider::fetch_final_usage has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 5, 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.
ClaudeManagedProvider::start_with_worker (cognitive 19) packages/paperclip-runner/runner/crates/runner-core/src/claude_managed_provider.rs:1338— ClaudeManagedProvider::start_with_worker has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (13 pts), if/else 5 (6 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.
ClaudeManagedProvider::normalize_remote_event (cognitive 17) packages/paperclip-runner/runner/crates/runner-core/src/claude_managed_provider.rs:1516— ClaudeManagedProvider::normalize_remote_event has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 3 (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.
ProviderToolBridge::validate_recovered (cognitive 26) packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs:388— ProviderToolBridge::validate_recovered has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 6, loops 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.
ProviderToolBridge::begin_call (cognitive 20) packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs:651— ProviderToolBridge::begin_call has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 2 (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.
ProviderToolBridge::apply_result (cognitive 19) packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs:786— ProviderToolBridge::apply_result has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (19 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.
Client.prepared_consume (cognitive 20) server/src/services/scripts/v7/client.py:379— Client.prepared_consume has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 8, ternaries 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.
Client.prepared_consume (cognitive 20) server/src/services/scripts/v8/client.py:379— Client.prepared_consume has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 8, ternaries 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.
Client.prepared_consume (cognitive 20) server/src/services/scripts/v9/client.py:417— Client.prepared_consume has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 8, ternaries 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.
client.input_response_valid (cognitive 20) server/src/services/scripts/v7/client.py:193— client.input_response_valid has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 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.
client.input_response_valid (cognitive 20) server/src/services/scripts/v8/client.py:193— client.input_response_valid has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 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.
client.input_response_valid (cognitive 20) server/src/services/scripts/v9/client.py:225— client.input_response_valid has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 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.
muse.createMuseBroker::authorizeAssignment (cognitive 18) server/src/modules/external-agents/muse.ts:88— muse.createMuseBroker::authorizeAssignment has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 12, if/else 4, ternaries 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. This shape REPEATS in the file: 3 other methods here (muse.createMuseBroker, muse.createMuseBroker::detectorEvidence, muse.createMuseBroker::requestWork) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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.
muse.createMuseBroker::requestWork (cognitive 17) server/src/modules/external-agents/muse.ts:564— muse.createMuseBroker::requestWork has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, loops 1 (2 pts), error handling 1, 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. This shape REPEATS in the file: 3 other methods here (muse.createMuseBroker, muse.createMuseBroker::authorizeAssignment, muse.createMuseBroker::detectorEvidence) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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.
muse.createMuseBroker::detectorEvidence (cognitive 16) server/src/modules/external-agents/muse.ts:139— muse.createMuseBroker::detectorEvidence has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 2 (3 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. This shape REPEATS in the file: 3 other methods here (muse.createMuseBroker, muse.createMuseBroker::authorizeAssignment, muse.createMuseBroker::requestWork) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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.
Cross-context type Provider (ui → server) server/src/services/native-rest-client.ts:28— Provider (context ui) is exposed in server's public surface via native-rest-client.nativeRestSender — couples the contexts.
Cross-context type Provider (ui → server) server/src/services/project-workspace-provider.ts:26— Provider (context ui) is exposed in server's public surface via project-workspace-provider.resolveProjectWorkspaceProvider — couples the contexts.
Cross-context type Provider (ui → server) server/src/modules/external-agents/native-broker.ts:45— Provider (context ui) is exposed in server's public surface via native-broker.createNativeExternalBroker — couples the contexts.
Cross-context type Section (cli → ui) ui/src/artifact-directions/directions/d2-tint/PanelSection.tsx:18— Section (context cli) is exposed in ui's public surface via PanelSection.PanelSection — couples the contexts.
Cross-context type Section (cli → ui) ui/src/artifact-directions/directions/d4-hybrid/PanelSection.tsx:18— Section (context cli) is exposed in ui's public surface via PanelSection.PanelSection — couples the contexts.
Cross-context type Section (cli → ui) ui/storybook/prototypes/github-chat/GitHubChatPreview.tsx:446— Section (context cli) is exposed in ui's public surface via PreviewProps.section — couples the contexts.
D4 · Code Duplication· Members sharing a duplicated core (8 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (8 members, 50+ identical tokens) server/src/services/scripts/v2/client.py:42— server/src/services/scripts/v2/client.py:42-51 | server/src/services/scripts/v3/client.py:43-52 | server/src/services/scripts/v4/client.py:67-76 | server/src/services/scripts/v5/client.py:67-76 | server/src/services/scripts/v6/client.py:67-76 | server/src/services/scripts/v7/client.py:67-76 | server/src/services/scripts/v8/client.py:67-76 | server/src/services/scripts/v9/client.py:67-76 — These 8 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 8 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 8 times.
Members sharing a duplicated core (8 members, 50+ identical tokens) server/src/services/scripts/v2/client.py:61— server/src/services/scripts/v2/client.py:61-87 | server/src/services/scripts/v3/client.py:62-79 | server/src/services/scripts/v4/client.py:86-103 | server/src/services/scripts/v5/client.py:86-103 | server/src/services/scripts/v6/client.py:86-103 | server/src/services/scripts/v7/client.py:86-103 | server/src/services/scripts/v8/client.py:86-103 | server/src/services/scripts/v9/client.py:86-103 — These 8 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 8 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 8 times.
Members sharing a duplicated core (8 members, 50+ identical tokens) server/src/services/scripts/v2/client.py:124— server/src/services/scripts/v2/client.py:124-136 | server/src/services/scripts/v3/client.py:142-154 | server/src/services/scripts/v4/client.py:169-182 | server/src/services/scripts/v5/client.py:169-182 | server/src/services/scripts/v6/client.py:171-184 | server/src/services/scripts/v7/client.py:248-261 | server/src/services/scripts/v8/client.py:248-261 | server/src/services/scripts/v9/client.py:280-293 — These 8 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 8 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 8 times.
Duplicated block (13 lines × 2) server/src/services/scripts/v7/client.py:146— server/src/services/scripts/v7/client.py:146-158 | server/src/services/scripts/v8/client.py:146-158 — `server/src/services/scripts/v7/client.py` and `server/src/services/scripts/v8/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 31 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (13 lines × 2) server/src/services/scripts/v7/client.py:405— server/src/services/scripts/v7/client.py:405-417 | server/src/services/scripts/v8/client.py:405-417 — `server/src/services/scripts/v7/client.py` and `server/src/services/scripts/v8/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 31 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (13 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2770— packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2770-2782 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:3229-3241 — both copies are in the same file, so extract the block into 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 × 3) server/src/services/scripts/v7/client.py:389— server/src/services/scripts/v7/client.py:389-396 | server/src/services/scripts/v8/client.py:389-396 | server/src/services/scripts/v9/client.py:427-434 — `server/src/services/scripts/v7/client.py` and `server/src/services/scripts/v8/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 31 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `server/src/services/scripts/v7/client.py:389` 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) server/src/services/scripts/v7/client.py:440— server/src/services/scripts/v7/client.py:440-447 | server/src/services/scripts/v8/client.py:440-447 | server/src/services/scripts/v9/client.py:540-547 — `server/src/services/scripts/v7/client.py` and `server/src/services/scripts/v8/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 31 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (8 lines × 3) packages/paperclip-runner/runner/crates/runner-core/src/acpx_event_payload.rs:609— packages/paperclip-runner/runner/crates/runner-core/src/acpx_event_payload.rs:609-616 | packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3819-3826 | packages/paperclip-runner/runner/crates/runner-core/src/question_response.rs:27-34 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (5 lines × 9) server/src/services/scripts/v1/client.py:113— server/src/services/scripts/v1/client.py:113-117 | server/src/services/scripts/v2/client.py:152-156 | server/src/services/scripts/v3/client.py:170-174 | server/src/services/scripts/v4/client.py:207-211 | server/src/services/scripts/v5/client.py:207-211 | server/src/services/scripts/v6/client.py:209-213 | server/src/services/scripts/v7/client.py:286-290 | server/src/services/scripts/v8/client.py:286-290 | server/src/services/scripts/v9/client.py:318-322 — `server/src/services/scripts/v1/client.py` and `server/src/services/scripts/v2/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 67 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (5 lines × 9) server/src/services/scripts/v1/client.py:143— server/src/services/scripts/v1/client.py:143-147 | server/src/services/scripts/v2/client.py:184-188 | server/src/services/scripts/v3/client.py:202-206 | server/src/services/scripts/v4/client.py:242-246 | server/src/services/scripts/v5/client.py:242-246 | server/src/services/scripts/v6/client.py:244-248 | server/src/services/scripts/v7/client.py:321-325 | server/src/services/scripts/v8/client.py:321-325 | server/src/services/scripts/v9/client.py:353-357 — `server/src/services/scripts/v1/client.py` and `server/src/services/scripts/v2/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 67 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (5 lines × 9) server/src/services/scripts/v1/client.py:151— server/src/services/scripts/v1/client.py:151-155 | server/src/services/scripts/v2/client.py:192-196 | server/src/services/scripts/v3/client.py:210-214 | server/src/services/scripts/v4/client.py:250-254 | server/src/services/scripts/v5/client.py:250-254 | server/src/services/scripts/v6/client.py:252-256 | server/src/services/scripts/v7/client.py:329-333 | server/src/services/scripts/v8/client.py:329-333 | server/src/services/scripts/v9/client.py:361-365 — `server/src/services/scripts/v1/client.py` and `server/src/services/scripts/v2/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 67 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs:687— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs:687-695 | packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs:701-709 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/durable/transport.rs:295— packages/paperclip-runner/runner/crates/runner-core/src/durable/transport.rs:295-303 | packages/paperclip-runner/runner/crates/runner-core/src/durable/transport.rs:360-368 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:902— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:902-910 | packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:755-763 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
AC2 · Forms & labels· <TextArea> field component without a label · ×2
<TextArea> field component without a label packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4120— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextArea> field component without a label packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4519— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
AC2 · Forms & labels· <fieldset> without a <legend> · ×2
<fieldset> without a <legend> packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6274— A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
<fieldset> without a <legend> packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6382— A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
cursor-usage-notice.cursorUsageNotice (cyclomatic 70) packages/paperclip-runner/src/drivers/acpx/cursor-usage-notice.ts:24— cursor-usage-notice.cursorUsageNotice has cyclomatic complexity 70 (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.
cursor-usage-notice.cursorUsageNotice (cyclomatic 70) packages/paperclip-runner/src/live/cursor-usage-notice.ts:24— cursor-usage-notice.cursorUsageNotice has cyclomatic complexity 70 (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.
execute.executeTurn::executeTurn (cyclomatic 57) packages/adapters/grok-local/src/server/execute.ts:311— execute.executeTurn::executeTurn has cyclomatic complexity 57 (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. This shape REPEATS in the file: one other method here (execute.executeTurn::executeTurn::toResult) 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.
execute.executeTurn::executeTurn::toResult (cyclomatic 19) packages/adapters/grok-local/src/server/execute.ts:639— execute.executeTurn::executeTurn::toResult 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. This shape REPEATS in the file: one other method here (execute.executeTurn::executeTurn) 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.
chat-telegram-rich-intake.normalizeTelegramRichMessage::block (cyclomatic 48) server/src/services/chat-telegram-rich-intake.ts:218— chat-telegram-rich-intake.normalizeTelegramRichMessage::block 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. This shape REPEATS in the file: one other method here (chat-telegram-rich-intake.normalizeTelegramRichMessage::media) 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.
chat-telegram-rich-intake.normalizeTelegramRichMessage::media (cyclomatic 30) server/src/services/chat-telegram-rich-intake.ts:151— chat-telegram-rich-intake.normalizeTelegramRichMessage::media 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. This shape REPEATS in the file: one other method here (chat-telegram-rich-intake.normalizeTelegramRichMessage::block) 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.
muse.createMuseBroker::authorizeAssignment (cyclomatic 37) server/src/modules/external-agents/muse.ts:88— muse.createMuseBroker::authorizeAssignment has cyclomatic complexity 37 (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. This shape REPEATS in the file: 2 other methods here (muse.createMuseBroker, muse.createMuseBroker::detectorEvidence) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
muse.createMuseBroker::detectorEvidence (cyclomatic 20) server/src/modules/external-agents/muse.ts:139— muse.createMuseBroker::detectorEvidence 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 shape REPEATS in the file: 2 other methods here (muse.createMuseBroker, muse.createMuseBroker::authorizeAssignment) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
ExternalCommandExecutor::operation (cyclomatic 34) packages/paperclip-runner/runner/crates/runner-core/src/external_provider_backend.rs:538— ExternalCommandExecutor::operation 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.
ExternalCommandExecutor::execute_inner (cyclomatic 20) packages/paperclip-runner/runner/crates/runner-core/src/external_provider_backend.rs:861— ExternalCommandExecutor::execute_inner has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
AcpxProviderSession::poll_event (cyclomatic 30) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs:604— AcpxProviderSession::poll_event 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.
AcpxProviderSession::start_turn (cyclomatic 19) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs:415— AcpxProviderSession::start_turn 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.
AcpxProviderState::accept_runtime_event (cyclomatic 26) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_state.rs:498— AcpxProviderState::accept_runtime_event 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.
AcpxProviderState::accept_event (cyclomatic 20) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_state.rs:232— AcpxProviderState::accept_event 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.
ClaudeManagedProvider::normalize_remote_event (cyclomatic 26) packages/paperclip-runner/runner/crates/runner-core/src/claude_managed_provider.rs:1516— ClaudeManagedProvider::normalize_remote_event 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.
ClaudeManagedProvider::fetch_final_usage (cyclomatic 17) packages/paperclip-runner/runner/crates/runner-core/src/claude_managed_provider.rs:1970— ClaudeManagedProvider::fetch_final_usage 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.
AcpxCommandExecutor::poll_provider (cyclomatic 25) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:1973— AcpxCommandExecutor::poll_provider 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.
AcpxCommandExecutor::execute (cyclomatic 22) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:2160— AcpxCommandExecutor::execute 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.
plugin-worker-manager.createPluginWorkerHandle::handleWorkerNotification (cyclomatic 22) server/src/services/plugin-worker-manager.ts:2806— plugin-worker-manager.createPluginWorkerHandle::handleWorkerNotification 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 shape REPEATS in the file: 2 other methods here (plugin-worker-manager.createPluginWorkerHandle, plugin-worker-manager.createPluginWorkerHandle::routeExecuteLogNotification) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
plugin-worker-manager.createPluginWorkerHandle::routeExecuteLogNotification (cyclomatic 20) server/src/services/plugin-worker-manager.ts:1280— plugin-worker-manager.createPluginWorkerHandle::routeExecuteLogNotification 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. This shape REPEATS in the file: 2 other methods here (plugin-worker-manager.createPluginWorkerHandle, plugin-worker-manager.createPluginWorkerHandle::handleWorkerNotification) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
plugin-loader.pluginLoader::activatePlugin (cyclomatic 22) REDACTED:2220— plugin-loader.pluginLoader::activatePlugin 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 shape REPEATS in the file: 2 other methods here (plugin-loader.pluginLoader, plugin-loader.pluginLoader::fetchAndValidate) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
plugin-loader.pluginLoader::fetchAndValidate (cyclomatic 21) REDACTED:1208— plugin-loader.pluginLoader::fetchAndValidate 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. This shape REPEATS in the file: 2 other methods here (plugin-loader.pluginLoader, plugin-loader.pluginLoader::activatePlugin) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
removal.createConnectionRemoval::removeConnectionUnlocked (cyclomatic 21) server/src/services/tool-access/connections/removal.ts:245— removal.createConnectionRemoval::removeConnectionUnlocked 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. This shape REPEATS in the file: one other method here (removal.createConnectionRemoval::classifyConnectionSecrets) 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.
removal.createConnectionRemoval::classifyConnectionSecrets (cyclomatic 19) server/src/services/tool-access/connections/removal.ts:104— removal.createConnectionRemoval::classifyConnectionSecrets 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. This shape REPEATS in the file: one other method here (removal.createConnectionRemoval::removeConnectionUnlocked) 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.
ProviderToolBridge::validate_recovered (cyclomatic 21) packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs:388— ProviderToolBridge::validate_recovered 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.
ProviderToolBridge::begin_call (cyclomatic 19) packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs:651— ProviderToolBridge::begin_call 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.
heartbeat-run.heartbeatRun::printAdapterInvoke (cyclomatic 19) cli/src/commands/heartbeat-run.ts:116— heartbeat-run.heartbeatRun::printAdapterInvoke 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. This shape REPEATS in the file: 2 other methods here (heartbeat-run.heartbeatRun, heartbeat-run.heartbeatRun::handleEvent) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
heartbeat-run.heartbeatRun::handleEvent (cyclomatic 17) cli/src/commands/heartbeat-run.ts:177— heartbeat-run.heartbeatRun::handleEvent 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 shape REPEATS in the file: 2 other methods here (heartbeat-run.heartbeatRun, heartbeat-run.heartbeatRun::printAdapterInvoke) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
transcript-model.buildTranscript (cyclomatic 19) packages/paperclip-runner/devtools/browser/src/live/transcript-model.ts:186— transcript-model.buildTranscript has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal 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.
transcript-model.buildTranscript (cyclomatic 19) packages/paperclip-runner/src/browser/transcript-model.ts:231— transcript-model.buildTranscript has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal 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.
excerpt.documentExcerpt (cyclomatic 17) ui/src/artifact-directions/directions/d2-tint/excerpt.ts:32— excerpt.documentExcerpt 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.
excerpt.documentExcerpt (cyclomatic 17) ui/src/artifact-directions/directions/d4-hybrid/excerpt.ts:32— excerpt.documentExcerpt 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.
capability-issue-thread-server.createCapabilityIssueThreadMiddleware::middleware (cognitive 80) packages/paperclip-runner/scripts/capability-issue-thread-server.mjs:761— capability-issue-thread-server.createCapabilityIssueThreadMiddleware::middleware has cognitive complexity 80 (threshold 15). Drivers by points: if/else 34 (54 pts), ternaries 9 (13 pts), boolean chains 8, error handling 2 (3 pts), loops 1 (2 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. This shape REPEATS in the file: one other method here (capability-issue-thread-server.createCapabilityIssueThreadMiddleware::liveView) 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.
capability-issue-thread-server.createCapabilityIssueThreadMiddleware::liveView (cognitive 23) packages/paperclip-runner/scripts/capability-issue-thread-server.mjs:430— capability-issue-thread-server.createCapabilityIssueThreadMiddleware::liveView has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 6 (21 pts), boolean chains 1, if/else 1 (nesting depth added 15). 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. This shape REPEATS in the file: one other method here (capability-issue-thread-server.createCapabilityIssueThreadMiddleware::middleware) 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.
AcpxProviderSession::poll_event (cognitive 68) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs:604— AcpxProviderSession::poll_event has cognitive complexity 68 (threshold 15). Drivers by points: if/else 21 (60 pts), match/switch 3 (4 pts), boolean chains 3, loops 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.
AcpxProviderSession::start_turn (cognitive 23) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs:415— AcpxProviderSession::start_turn has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19 (21 pts), match/switch 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AcpxCommandExecutor::poll_provider (cognitive 57) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:1973— AcpxCommandExecutor::poll_provider has cognitive complexity 57 (threshold 15). Drivers by points: if/else 12 (36 pts), loops 4 (10 pts), match/switch 2 (6 pts), boolean chains 5 (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.
AcpxCommandExecutor::attach_run (cognitive 17) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:1140— AcpxCommandExecutor::attach_run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, 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.
chat-telegram-rich-intake.normalizeTelegramRichMessage::block (cognitive 47) server/src/services/chat-telegram-rich-intake.ts:218— chat-telegram-rich-intake.normalizeTelegramRichMessage::block has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 7 (25 pts), if/else 5 (10 pts), loops 4 (9 pts), boolean chains 2, match/switch 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. This shape REPEATS in the file: one other method here (chat-telegram-rich-intake.normalizeTelegramRichMessage::media) 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.
chat-telegram-rich-intake.normalizeTelegramRichMessage::media (cognitive 25) server/src/services/chat-telegram-rich-intake.ts:151— chat-telegram-rich-intake.normalizeTelegramRichMessage::media has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 10, ternaries 6 (9 pts), if/else 5 (6 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. This shape REPEATS in the file: one other method here (chat-telegram-rich-intake.normalizeTelegramRichMessage::block) 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.
execute.executeTurn::executeTurn (cognitive 46) packages/adapters/grok-local/src/server/execute.ts:311— execute.executeTurn::executeTurn has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 17, ternaries 8 (9 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. This shape REPEATS in the file: one other method here (execute.executeTurn::executeTurn::toResult) 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.
execute.executeTurn::executeTurn::toResult (cognitive 21) packages/adapters/grok-local/src/server/execute.ts:639— execute.executeTurn::executeTurn::toResult has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 11 (16 pts), boolean chains 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. This shape REPEATS in the file: one other method here (execute.executeTurn::executeTurn) 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.
cursor-usage-notice.cursorUsageNotice (cognitive 44) packages/paperclip-runner/src/drivers/acpx/cursor-usage-notice.ts:24— cursor-usage-notice.cursorUsageNotice has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 12, loops 4 (7 pts), error handling 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.
cursor-usage-notice.cursorUsageNotice (cognitive 44) packages/paperclip-runner/src/live/cursor-usage-notice.ts:24— cursor-usage-notice.cursorUsageNotice has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 12, loops 4 (7 pts), error handling 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.
AcpxProviderState::accept_runtime_event (cognitive 41) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_state.rs:498— AcpxProviderState::accept_runtime_event has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 8, match/switch 2 (6 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.
AcpxProviderState::accept_event (cognitive 20) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_state.rs:232— AcpxProviderState::accept_event has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 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.
plugin-loader.pluginLoader::activatePlugin (cognitive 40) REDACTED:2220— plugin-loader.pluginLoader::activatePlugin has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 6 (16 pts), if/else 9 (12 pts), error handling 5 (10 pts), boolean chains 1, 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. This shape REPEATS in the file: 2 other methods here (plugin-loader.pluginLoader, plugin-loader.pluginLoader::fetchAndValidate) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
plugin-loader.pluginLoader::fetchAndValidate (cognitive 28) REDACTED:1208— plugin-loader.pluginLoader::fetchAndValidate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (18 pts), ternaries 3 (5 pts), boolean chains 3, error handling 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. This shape REPEATS in the file: 2 other methods here (plugin-loader.pluginLoader, plugin-loader.pluginLoader::activatePlugin) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
native-session-executor.createRemoteNativeArtifactPreparation.prepare::prepareRunner (cognitive 40) server/src/services/native-runtime/native-session-executor.ts:13886— native-session-executor.createRemoteNativeArtifactPreparation.prepare::prepareRunner has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 4 (14 pts), boolean chains 8, error handling 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. This shape REPEATS in the file: one other method here (native-session-executor.createRemoteNativeArtifactPreparation.prepare::prepareHarness) 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.
native-session-executor.createRemoteNativeArtifactPreparation.prepare::prepareHarness (cognitive 21) server/src/services/native-runtime/native-session-executor.ts:13985— native-session-executor.createRemoteNativeArtifactPreparation.prepare::prepareHarness has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, error handling 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. This shape REPEATS in the file: one other method here (native-session-executor.createRemoteNativeArtifactPreparation.prepare::prepareRunner) 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.
IssueChatThread.IssueChatComposer::submitComment (cognitive 39) ui/src/components/IssueChatThread.tsx:4995— IssueChatThread.IssueChatComposer::submitComment has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (19 pts), ternaries 8 (12 pts), boolean chains 7, error handling 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. This shape REPEATS in the file: 2 other methods here (IssueChatThread.IssueChatComposer, IssueChatThread.IssueChatComposer::attachFile) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
IssueChatThread.IssueChatComposer::attachFile (cognitive 16) ui/src/components/IssueChatThread.tsx:5113— IssueChatThread.IssueChatComposer::attachFile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, error handling 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. This shape REPEATS in the file: 2 other methods here (IssueChatThread.IssueChatComposer, IssueChatThread.IssueChatComposer::submitComment) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
removal.createConnectionRemoval::removeConnectionUnlocked (cognitive 38) server/src/services/tool-access/connections/removal.ts:245— removal.createConnectionRemoval::removeConnectionUnlocked has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (24 pts), error handling 2 (5 pts), loops 3 (4 pts), ternaries 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. This shape REPEATS in the file: one other method here (removal.createConnectionRemoval::classifyConnectionSecrets) 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.
removal.createConnectionRemoval::classifyConnectionSecrets (cognitive 24) server/src/services/tool-access/connections/removal.ts:104— removal.createConnectionRemoval::classifyConnectionSecrets has cognitive complexity 24 (threshold 15). Drivers by points: loops 7 (10 pts), if/else 4 (6 pts), boolean chains 4, ternaries 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. This shape REPEATS in the file: one other method here (removal.createConnectionRemoval::removeConnectionUnlocked) 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.
issues.issueService::enrichCommentsWithDerivedAgentAttribution (cognitive 37) server/src/services/issues.ts:7023— issues.issueService::enrichCommentsWithDerivedAgentAttribution has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 4 (11 pts), boolean chains 4, ternaries 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. This shape REPEATS in the file: one other method here (issues.issueService::getIssueRelationSummaryMap) 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.
issues.issueService::getIssueRelationSummaryMap (cognitive 17) server/src/services/issues.ts:7371— issues.issueService::getIssueRelationSummaryMap has cognitive complexity 17 (threshold 15). Drivers by points: loops 9 (12 pts), if/else 2 (4 pts), boolean chains 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. This shape REPEATS in the file: one other method here (issues.issueService::enrichCommentsWithDerivedAgentAttribution) 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.
transcript-model.buildTranscript (cognitive 35) packages/paperclip-runner/devtools/browser/src/live/transcript-model.ts:186— transcript-model.buildTranscript has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 6 (18 pts), if/else 6 (12 pts), boolean chains 4, loops 1 (nesting depth added 18). Of this number, 34 points are the body's own statements and 1 belongs to one function literal 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.
transcript-model.buildTranscript (cognitive 35) packages/paperclip-runner/src/browser/transcript-model.ts:231— transcript-model.buildTranscript has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 6 (18 pts), if/else 6 (12 pts), boolean chains 4, loops 1 (nesting depth added 18). Of this number, 34 points are the body's own statements and 1 belongs to one function literal 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.
workspace-checkpoint.checkpointMain::walk (cognitive 23) packages/adapter-utils/src/workspace-checkpoint.ts:48— workspace-checkpoint.checkpointMain::walk has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (3 pts), ternaries 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. This shape REPEATS in the file: one other method here (workspace-checkpoint.checkpointMain::walk::capture) 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.
workspace-checkpoint.checkpointMain::walk::capture (cognitive 19) packages/adapter-utils/src/workspace-checkpoint.ts:56— workspace-checkpoint.checkpointMain::walk::capture has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 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. This shape REPEATS in the file: one other method here (workspace-checkpoint.checkpointMain::walk) 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.
heartbeat-run.heartbeatRun::handleEvent (cognitive 22) cli/src/commands/heartbeat-run.ts:177— heartbeat-run.heartbeatRun::handleEvent has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 5 (9 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. This shape REPEATS in the file: 2 other methods here (heartbeat-run.heartbeatRun, heartbeat-run.heartbeatRun::printAdapterInvoke) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
heartbeat-run.heartbeatRun::printAdapterInvoke (cognitive 17) cli/src/commands/heartbeat-run.ts:116— heartbeat-run.heartbeatRun::printAdapterInvoke has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (9 pts), if/else 5, 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. This shape REPEATS in the file: 2 other methods here (heartbeat-run.heartbeatRun, heartbeat-run.heartbeatRun::handleEvent) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
gallery-model.stackFaces (cognitive 20) ui/src/artifact-directions/directions/d2-tint/gallery-model.ts:34— gallery-model.stackFaces has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (5 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 7). Of this number, 15 points are the body's own statements and 5 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.
gallery-model.stackFaces (cognitive 20) ui/src/artifact-directions/directions/d4-hybrid/gallery-model.ts:34— gallery-model.stackFaces has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (5 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 7). Of this number, 15 points are the body's own statements and 5 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.
issue-graph-liveness.classifyIssueGraphLiveness::firstBlockedChainFinding (cognitive 18) server/src/services/recovery/issue-graph-liveness.ts:694— issue-graph-liveness.classifyIssueGraphLiveness::firstBlockedChainFinding has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 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. This shape REPEATS in the file: 2 other methods here (issue-graph-liveness.classifyIssueGraphLiveness, issue-graph-liveness.classifyIssueGraphLiveness::blockedFindingForLeaf) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
issue-graph-liveness.classifyIssueGraphLiveness::blockedFindingForLeaf (cognitive 16) server/src/services/recovery/issue-graph-liveness.ts:608— issue-graph-liveness.classifyIssueGraphLiveness::blockedFindingForLeaf has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, ternaries 3 (6 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. This shape REPEATS in the file: 2 other methods here (issue-graph-liveness.classifyIssueGraphLiveness, issue-graph-liveness.classifyIssueGraphLiveness::firstBlockedChainFinding) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
environment-runtime.createSandboxEnvironmentDriver::releasePluginBackedSandboxLease (cognitive 18) server/src/services/environment-runtime.ts:3323— environment-runtime.createSandboxEnvironmentDriver::releasePluginBackedSandboxLease has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (7 pts), if/else 4 (5 pts), boolean chains 4, error handling 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. This shape REPEATS in the file: 2 other methods here (environment-runtime.createSandboxEnvironmentDriver, environment-runtime.createSandboxEnvironmentDriver::destroyReusableSandboxLease) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
environment-runtime.createSandboxEnvironmentDriver::destroyReusableSandboxLease (cognitive 18) server/src/services/environment-runtime.ts:3393— environment-runtime.createSandboxEnvironmentDriver::destroyReusableSandboxLease has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (5 pts), boolean chains 3, 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, 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. This shape REPEATS in the file: 2 other methods here (environment-runtime.createSandboxEnvironmentDriver, environment-runtime.createSandboxEnvironmentDriver::releasePluginBackedSandboxLease) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
skill-source-github-access.skillSourceGitHubReader::headers (cognitive 18) server/src/services/skill-source-github-access.ts:22— skill-source-github-access.skillSourceGitHubReader::headers 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. This shape REPEATS in the file: one other method here (skill-source-github-access.skillSourceGitHubReader::authorized) 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.
skill-source-github-access.skillSourceGitHubReader::authorized (cognitive 18) server/src/services/skill-source-github-access.ts:56— skill-source-github-access.skillSourceGitHubReader::authorized has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (8 pts), error handling 3 (5 pts), boolean chains 4, 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. This shape REPEATS in the file: one other method here (skill-source-github-access.skillSourceGitHubReader::headers) 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.
excerpt.documentExcerpt (cognitive 18) ui/src/artifact-directions/directions/d2-tint/excerpt.ts:32— excerpt.documentExcerpt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 6, 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.
excerpt.documentExcerpt (cognitive 18) ui/src/artifact-directions/directions/d4-hybrid/excerpt.ts:32— excerpt.documentExcerpt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 6, 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.
Client.input_receipts (cognitive 18) server/src/services/scripts/v7/client.py:404— Client.input_receipts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 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.
Client.input_receipts (cognitive 18) server/src/services/scripts/v8/client.py:404— Client.input_receipts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 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.
Cross-context type AdapterExecutionTarget (adapter-utils → codex-local) REDACTED:21— AdapterExecutionTarget (context adapter-utils) is exposed in codex-local's public surface via cli-version.readCodexCommandVersion — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → codex-local) REDACTED:60— AdapterExecutionTarget (context adapter-utils) is exposed in codex-local's public surface via cli-version.checkCodexCliVersionForModel — couples the contexts.
Cross-context type WorkspaceInboundMode (adapter-utils → server) server/src/services/native-runtime/native-workspace-sync.ts:96— WorkspaceInboundMode (context adapter-utils) is exposed in server's public surface via PreparedNativeWorkspaceSync.mode — couples the contexts.
Cross-context type WorkspaceInboundMode (adapter-utils → server) server/src/services/native-runtime/native-workspace-sync.ts:115— WorkspaceInboundMode (context adapter-utils) is exposed in server's public surface via native-workspace-sync.classifyNativeWorkspaceInbound — couples the contexts.
Cross-context type ToolAuditOutcome (ui → shared) packages/shared/src/types/tool-access.ts:1355— ToolAuditOutcome (context ui) is exposed in shared's public surface via ToolCallEvent.outcome — couples the contexts.
Cross-context type ToolAuditOutcome (ui → shared) packages/shared/src/types/tool-access.ts:1377— ToolAuditOutcome (context ui) is exposed in shared's public surface via ToolRunDecision.outcome — couples the contexts.
Cross-context type CatalogSkillFileKind (skills-catalog → shared) packages/shared/src/types/company-skill.ts:650— CatalogSkillFileKind (context skills-catalog) is exposed in shared's public surface via CatalogSkillFile.kind — couples the contexts.
Cross-context type CatalogSkillFileKind (skills-catalog → shared) packages/shared/src/types/company-skill.ts:700— CatalogSkillFileKind (context skills-catalog) is exposed in shared's public surface via CatalogSkillFileDetail.kind — couples the contexts.
Cross-context type WakeupTriggerDetail (server → shared) packages/shared/src/types/heartbeat.ts:166— WakeupTriggerDetail (context server) is exposed in shared's public surface via HeartbeatRun.triggerDetail — couples the contexts.
Cross-context type WakeupTriggerDetail (server → shared) packages/shared/src/types/heartbeat.ts:353— WakeupTriggerDetail (context server) is exposed in shared's public surface via AgentWakeupRequest.triggerDetail — couples the contexts.
TooManyFields: CodexProvider packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:670— TooManyFields — 40 stored fields beside 55 methods. The bar is 30 stored fields; this is 10 over it, 1.33× 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: CodexProviderState packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:970— TooManyFields — 32 stored fields beside 16 methods. The bar is 30 stored fields; this is 2 over it, 1.07× 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.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (7 members, 50+ identical tokens) server/src/services/scripts/v3/client.py:83— server/src/services/scripts/v3/client.py:83-97 | server/src/services/scripts/v4/client.py:107-121 | server/src/services/scripts/v5/client.py:107-121 | server/src/services/scripts/v6/client.py:107-121 | server/src/services/scripts/v7/client.py:107-121 | server/src/services/scripts/v8/client.py:107-121 | server/src/services/scripts/v9/client.py:107-121 — 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.
Members sharing a duplicated core (7 members, 50+ identical tokens) server/src/services/scripts/v3/client.py:99— server/src/services/scripts/v3/client.py:99-104 | server/src/services/scripts/v4/client.py:123-128 | server/src/services/scripts/v5/client.py:123-128 | server/src/services/scripts/v6/client.py:123-128 | server/src/services/scripts/v7/client.py:123-128 | server/src/services/scripts/v8/client.py:123-128 | server/src/services/scripts/v9/client.py:123-128 — 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.
Duplicated block (6 lines × 9) server/src/services/scripts/v1/client.py:61— server/src/services/scripts/v1/client.py:61-66 | server/src/services/scripts/v2/client.py:91-96 | server/src/services/scripts/v3/client.py:109-114 | server/src/services/scripts/v4/client.py:133-138 | server/src/services/scripts/v5/client.py:133-138 | server/src/services/scripts/v6/client.py:133-138 | server/src/services/scripts/v7/client.py:210-215 | server/src/services/scripts/v8/client.py:210-215 | server/src/services/scripts/v9/client.py:242-247 — `server/src/services/scripts/v1/client.py` and `server/src/services/scripts/v2/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 67 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (6 lines × 9) server/src/services/scripts/v1/client.py:125— server/src/services/scripts/v1/client.py:125-130 | server/src/services/scripts/v2/client.py:165-170 | server/src/services/scripts/v3/client.py:183-188 | server/src/services/scripts/v4/client.py:220-225 | server/src/services/scripts/v5/client.py:220-225 | server/src/services/scripts/v6/client.py:222-227 | server/src/services/scripts/v7/client.py:299-304 | server/src/services/scripts/v8/client.py:299-304 | server/src/services/scripts/v9/client.py:331-336 — `server/src/services/scripts/v1/client.py` and `server/src/services/scripts/v2/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 67 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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, `server/src/services/scripts/v2/client.py:162` calls `generation` and `server/src/services/scripts/v1/client.py:122` 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) packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:659— packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:659-675 | packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:915-931 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:711— packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:711-727 | packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:972-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.
Duplicated block (15 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:677— packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:677-691 | packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:932-946 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:2001— packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:2001-2015 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:715-729 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:2410— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:2410-2423 | packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:2237-2250 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_checkpoint.rs:117— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_checkpoint.rs:117-130 | packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs:1449-1462 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:1283— packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:1283-1294 | packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:1348-1362 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/acpx_event_payload.rs:618— packages/paperclip-runner/runner/crates/runner-core/src/acpx_event_payload.rs:618-629 | packages/paperclip-runner/runner/crates/runner-core/src/acpx_event_payload.rs:643-654 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:2314— packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:2314-2324 | packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3127-3137 — both copies are in the same file, so extract the block into 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) packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:1574— packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:1574-1584 | packages/paperclip-runner/runner/crates/runner-core/src/claude_managed_provider.rs:1764-1774 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9 lines × 3) packages/paperclip-runner/runner/crates/runner-core/src/external_provider_backend.rs:477— packages/paperclip-runner/runner/crates/runner-core/src/external_provider_backend.rs:477-485 | packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:968-976 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2214-2222 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:1330— packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:1330-1338 | packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:1408-1416 | packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs:1496-1504 — 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) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:1084— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:1084-1090 | packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:973-979 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2219-2225 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 3) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:2408— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:2408-2414 | packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_checkpoint.rs:306-312 | packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:2235-2241 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:886— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:886-891 | packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:739-744 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:1764-1769 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:1065— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:1065-1070 | packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:956-963 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2202-2209 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
R10 · Code Duplication· Duplicated block with local edits (247 matched lines × 2 locations) · ×2
Duplicated block with local edits (247 matched lines × 2 locations) packages/adapters/cursor-local/src/server/execute.ts:401— packages/adapters/cursor-local/src/server/execute.ts:401 · packages/adapters/opencode-local/src/server/execute.ts:458 — the two spans are one implementation copied and then locally edited — 1440 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block with local edits (247 matched lines × 2 locations) packages/adapters/gemini-local/src/server/acp.ts:37— packages/adapters/gemini-local/src/server/acp.ts:37 · packages/adapters/kimi-local/src/server/acp.ts:31 — the two spans are one implementation copied and then locally edited — 1663 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (131 matched lines × 2 locations) · ×2
Duplicated block with local edits (131 matched lines × 2 locations) server/src/services/chat-github-registration.ts:94— server/src/services/chat-github-registration.ts:94 · server/src/services/chat-github-wizard.ts:134 — the two spans are one implementation copied and then locally edited — 646 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block with local edits (131 matched lines × 2 locations) server/src/services/managed-agent-profiles.ts:83— server/src/services/managed-agent-profiles.ts:83 · server/src/services/remote-agent-profiles.ts:132 — the two spans are one implementation copied and then locally edited — 707 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Dead file (~204 LoC) ui/src/artifact-directions/directions/d1-solid/ExcerptSheet.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 2 in-repo import(s) from 2 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/GalleryPreview.tsx, ui/src/artifact-directions/directions/d1-solid/PanelCard.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~204 LoC) ui/src/artifact-directions/directions/today/adapters.ts— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 4 in-repo import(s) from 4 other file(s) do name it (ui/src/artifact-directions/directions/today/Gallery.tsx, ui/src/artifact-directions/directions/today/ThreadAttachments.tsx, ui/src/artifact-directions/directions/today/ThreadWorkProduct.tsx and 1 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~116 LoC) ui/src/artifact-directions/directions/d3-tactile/GalleryItem.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/GalleryStack.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~116 LoC) ui/src/artifact-directions/directions/d3-tactile/objects/Things.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/objects/ArtifactObject.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~102 LoC) ui/src/artifact-directions/directions/d1-solid/ThreadAttachments.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/index.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~102 LoC) ui/src/components/StageSecretsPanel.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~100 LoC) ui/src/artifact-directions/directions/d1-solid/ThreadWorkProduct.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/index.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~100 LoC) ui/src/artifact-directions/directions/d3-tactile/objects/Folder.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 2 in-repo import(s) from 2 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/GalleryStack.tsx, ui/src/artifact-directions/directions/d3-tactile/GalleryStacks.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~99 LoC) packages/db/scripts/create-auth-bootstrap-invite.ts— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~99 LoC) ui/src/artifact-directions/directions/d2-tint/PanelIndex.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d2-tint/PanelBody.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
AC3 · Page structure· Heading level jumps from h1 to h3 · ×1
Heading level jumps from h1 to h3 ui/src/pages/CompanyAccess.tsx:320— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
IssueDetail.TaskDetailSurface (cyclomatic 767) ui/src/pages/IssueDetail.tsx:3146— IssueDetail.TaskDetailSurface has cyclomatic complexity 767 (threshold 15). Of this number, 304 points are the body's own statements and 463 belong to 194 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.
TaskChatThread.TaskChatThread (cyclomatic 683) ui/src/components/TaskChatThread.tsx:497— TaskChatThread.TaskChatThread has cyclomatic complexity 683 (threshold 15). Of this number, 171 points are the body's own statements and 512 belong to 89 function literals 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.
ConnectionSetupFlow.StandardConnectionSetupFlow (cyclomatic 559) ui/src/features/connections/ConnectionSetupFlow.tsx:634— ConnectionSetupFlow.StandardConnectionSetupFlow has cyclomatic complexity 559 (threshold 15). Of this number, 243 points are the body's own statements and 316 belong to 71 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.
AgentConfigForm.AgentConfigForm (cyclomatic 519) ui/src/components/AgentConfigForm.tsx:345— AgentConfigForm.AgentConfigForm has cyclomatic complexity 519 (threshold 15). Of this number, 342 points are the body's own statements and 177 belong to 62 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.
IssueProperties.IssueProperties (cyclomatic 475) ui/src/components/issue-properties/IssueProperties.tsx:233— IssueProperties.IssueProperties has cyclomatic complexity 475 (threshold 15). Of this number, 301 points are the body's own statements and 174 belong to 85 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.
native-session-executor.executePaperclipNativeSessionWithinScope (cyclomatic 422) server/src/services/native-runtime/native-session-executor.ts:7907— native-session-executor.executePaperclipNativeSessionWithinScope has cyclomatic complexity 422 (threshold 15). Of this number, 219 points are the body's own statements and 203 belong to 27 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.
Inbox.StreamlinedInbox (cyclomatic 399) ui/src/pages/Inbox.tsx:835— Inbox.StreamlinedInbox has cyclomatic complexity 399 (threshold 15). Of this number, 107 points are the body's own statements and 292 belong to 79 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.
OnboardingWizard.OnboardingWizardInner (cyclomatic 398) ui/src/components/OnboardingWizard.tsx:490— OnboardingWizard.OnboardingWizardInner has cyclomatic complexity 398 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: 4 other methods here (OnboardingWizard.OnboardingWizardInner::managedBindingForStep, OnboardingWizard.OnboardingWizardInner::buildAdapterConfig, OnboardingWizard.OnboardingWizardInner::runAdapterEnvironmentTest, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
IssuesList.StreamlinedIssuesList (cyclomatic 358) ui/src/components/IssuesList.tsx:720— IssuesList.StreamlinedIssuesList has cyclomatic complexity 358 (threshold 15). Of this number, 75 points are the body's own statements and 283 belong to 76 function literals 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.
LegacyInbox.Inbox (cyclomatic 357) ui/src/pages/LegacyInbox.tsx:692— LegacyInbox.Inbox has cyclomatic complexity 357 (threshold 15). Of this number, 90 points are the body's own statements and 267 belong to 76 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.
heartbeat.heartbeatService.executeRunAttempt (cyclomatic 348) server/src/services/heartbeat.ts:1764— heartbeat.heartbeatService.executeRunAttempt has cyclomatic complexity 348 (threshold 15). Of this number, 314 points are the body's own statements and 34 belong to 12 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.
Secrets.Secrets (cyclomatic 342) ui/src/pages/Secrets.tsx:652— Secrets.Secrets has cyclomatic complexity 342 (threshold 15). Of this number, 152 points are the body's own statements and 190 belong to 82 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.
plugins.pluginRoutes (cyclomatic 333) REDACTED:533— plugins.pluginRoutes has cyclomatic complexity 333 (threshold 15). Most of this is not in the body itself: 1 of the 333 points is its own statement and the rest belongs to 54 function items inside it that branch (a function literal at line 1870, a function literal at line 1049, a function literal at line 1178, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
index.startServerWithDatabaseTeardown (cyclomatic 332) REDACTED:245— index.startServerWithDatabaseTeardown has cyclomatic complexity 332 (threshold 15). Of this number, 88 points are the body's own statements and 244 belong to 77 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.
LegacyIssuesList.IssuesList (cyclomatic 331) ui/src/components/LegacyIssuesList.tsx:672— LegacyIssuesList.IssuesList has cyclomatic complexity 331 (threshold 15). Of this number, 69 points are the body's own statements and 262 belong to 77 function literals 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.
testing.createTestHarness (cyclomatic 328) packages/plugins/sdk/src/testing.ts:491— testing.createTestHarness has cyclomatic complexity 328 (threshold 15). Of this number, 255 points are the body's own statements and 73 belong to 35 function items inside it that branch. 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.
access.accessRoutes (cyclomatic 313) REDACTED:2632— access.accessRoutes has cyclomatic complexity 313 (threshold 15). Most of this is not in the body itself: 2 of the 313 points are its own statements and the rest belongs to 46 function items inside it that branch (a function literal at line 3616, a function literal at line 2809, a function literal at line 3433, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
execute.createAcpxEngineExecutor (cyclomatic 292) packages/adapter-utils/src/acpx-engine/execute.ts:4033— execute.createAcpxEngineExecutor has cyclomatic complexity 292 (threshold 15). Most of this is not in the body itself: 1 of the 292 points is its own statement and the rest belongs to 30 function literals inside it that branch (lines 5256, 4371, 5654, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tool-access.toolAccessService.connectGalleryApp (cyclomatic 292) server/src/services/tool-access.ts:1592— tool-access.toolAccessService.connectGalleryApp has cyclomatic complexity 292 (threshold 15). Of this number, 274 points are the body's own statements and 18 belong to 6 function literals 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.
CompanySkills.CompanySkills (cyclomatic 287) ui/src/pages/CompanySkills.tsx:3923— CompanySkills.CompanySkills has cyclomatic complexity 287 (threshold 15). Of this number, 95 points are the body's own statements and 192 belong to 91 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.
company-portability.companyPortabilityService.importBundle (cyclomatic 271) server/src/services/company-portability.ts:5255— company-portability.companyPortabilityService.importBundle has cyclomatic complexity 271 (threshold 15). Of this number, 258 points are the body's own statements and 13 belong to 6 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.
native-session-executor.createRunnerdBackendWithinSessionClaim (cyclomatic 254) server/src/services/native-runtime/native-session-executor.ts:11789— native-session-executor.createRunnerdBackendWithinSessionClaim has cyclomatic complexity 254 (threshold 15). Of this number, 196 points are the body's own statements and 58 belong to 11 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.
IssueDetail.IssueDetailChatTab (cyclomatic 254) ui/src/pages/IssueDetail.tsx:1372— IssueDetail.IssueDetailChatTab has cyclomatic complexity 254 (threshold 15). Of this number, 77 points are the body's own statements and 177 belong to 31 function literals 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.
CompanySkills.production.CompanySkills (cyclomatic 253) ui/src/pages/CompanySkills.production.tsx:4001— CompanySkills.production.CompanySkills has cyclomatic complexity 253 (threshold 15). Of this number, 83 points are the body's own statements and 170 belong to 86 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.
IssueDocumentsSection.IssueDocumentsSection (cyclomatic 244) ui/src/components/IssueDocumentsSection.tsx:245— IssueDocumentsSection.IssueDocumentsSection has cyclomatic complexity 244 (threshold 15). Of this number, 17 points are the body's own statements and 227 belong to 69 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.
environment-task-runtime.executeEnvironmentTask (cyclomatic 239) server/src/services/environment-task-runtime.ts:32— environment-task-runtime.executeEnvironmentTask has cyclomatic complexity 239 (threshold 15). Of this number, 230 points are the body's own statements and 9 belong to 3 function items inside it that branch. 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.
native-session-runtime.executeNativeSession (cyclomatic 237) packages/paperclip-runner/src/native-session-runtime.ts:1923— native-session-runtime.executeNativeSession has cyclomatic complexity 237 (threshold 15). Of this number, 155 points are the body's own statements and 82 belong to 18 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.
CompanyEnvironments.CompanyEnvironments (cyclomatic 236) ui/src/pages/CompanyEnvironments.tsx:1294— CompanyEnvironments.CompanyEnvironments has cyclomatic complexity 236 (threshold 15). Of this number, 120 points are the body's own statements and 116 belong to 42 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.
environment-runtime.createSandboxEnvironmentDriver (cyclomatic 233) server/src/services/environment-runtime.ts:1307— environment-runtime.createSandboxEnvironmentDriver has cyclomatic complexity 233 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: one other method here (environment-runtime.createSandboxEnvironmentDriver::releasePluginBackedSandboxLease) 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.
server-utils.renderPaperclipWakePromptBody (cyclomatic 232) REDACTED:2264— server-utils.renderPaperclipWakePromptBody has cyclomatic complexity 232 (threshold 15). Of this number, 185 points are the body's own statements and 47 belong to 14 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.
external-chat-question-response.resolveQuestionResponseChain (cyclomatic 228) server/src/services/native-runtime/external-chat-question-response.ts:206— external-chat-question-response.resolveQuestionResponseChain has cyclomatic complexity 228 (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.
NewAgentSetup.Setup (cyclomatic 225) ui/src/components/new-agent/NewAgentSetup.tsx:109— NewAgentSetup.Setup has cyclomatic complexity 225 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: 5 other methods here (NewAgentSetup.Setup::buildConfig, NewAgentSetup.Setup::preparedConfig, NewAgentSetup.Setup::saveDraft, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
company-portability.companyPortabilityService.exportBundle (cyclomatic 218) server/src/services/company-portability.ts:3877— company-portability.companyPortabilityService.exportBundle has cyclomatic complexity 218 (threshold 15). Of this number, 188 points are the body's own statements and 30 belong to 12 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.
authorization.createAuthorizationService.decideBase (cyclomatic 212) server/src/services/authorization.ts:1741— authorization.createAuthorizationService.decideBase has cyclomatic complexity 212 (threshold 15). Of this number, 184 points are the body's own statements and 28 belong to 7 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.
explicit-native-continuation.admitExplicitNativeContinuation (cyclomatic 210) server/src/services/explicit-native-continuation.ts:80— explicit-native-continuation.admitExplicitNativeContinuation has cyclomatic complexity 210 (threshold 15). Of this number, 205 points are the body's own statements and 5 belong to 3 function literals 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.
DurablePrpCodexTransport.#resume (cyclomatic 198) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:5146— DurablePrpCodexTransport.#resume has cyclomatic complexity 198 (threshold 15). Of this number, 193 points are the body's own statements and 5 belong to 4 function literals 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.
Costs.Costs (cyclomatic 198) ui/src/pages/Costs.tsx:173— Costs.Costs has cyclomatic complexity 198 (threshold 15). Of this number, 121 points are the body's own statements and 77 belong to 33 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.
MarkdownEditor.MarkdownEditor (cyclomatic 193) REDACTED:730— MarkdownEditor.MarkdownEditor has cyclomatic complexity 193 (threshold 15). Of this number, 35 points are the body's own statements and 158 belong to 47 function literals inside it that branch. 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.
service.recoveryService.reconcileStrandedAssignedIssues (cyclomatic 191) REDACTED:4513— service.recoveryService.reconcileStrandedAssignedIssues has cyclomatic complexity 191 (threshold 15). To reduce it, separate the cases: extract each independent 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.App (cyclomatic 190) packages/paperclip-runner/devtools/issue-thread/src/App.tsx:298— App.App has cyclomatic complexity 190 (threshold 15). Of this number, 74 points are the body's own statements and 116 belong to 58 function literals 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.
PaperclipRunnerToolAuthority.execute (cyclomatic 188) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:334— PaperclipRunnerToolAuthority.execute has cyclomatic complexity 188 (threshold 15). Of this number, 169 points are the body's own statements and 19 belong to 9 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.
queue.createHeartbeatQueue.enqueueWakeup (cyclomatic 184) server/src/services/heartbeat/queue.ts:2145— queue.createHeartbeatQueue.enqueueWakeup has cyclomatic complexity 184 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: one other method here (queue.createHeartbeatQueue.enqueueWakeup::existingDurableReceipt) 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.
native-execution.parseNativeExecutionInput (cyclomatic 183) packages/paperclip-runner/src/contracts/native-execution.ts:414— native-execution.parseNativeExecutionInput has cyclomatic complexity 183 (threshold 15). Of this number, 180 points are the body's own statements and 3 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.
ChatEndpointSetup.ChatSdkEndpointSetup (cyclomatic 183) ui/src/pages/apps/chat/ChatEndpointSetup.tsx:177— ChatEndpointSetup.ChatSdkEndpointSetup has cyclomatic complexity 183 (threshold 15). Of this number, 101 points are the body's own statements and 82 belong to 25 function items inside it that branch. 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.
native-session-executor.reconcileRetainedNativeSessionCleanup (cyclomatic 182) server/src/services/native-runtime/native-session-executor.ts:3014— native-session-executor.reconcileRetainedNativeSessionCleanup has cyclomatic complexity 182 (threshold 15). Of this number, 54 points are the body's own statements and 128 belong to 9 function items inside it that branch. 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.
status-decision-committer.commitNativeStatusDecision (cyclomatic 178) server/src/services/native-runtime/status-decision-committer.ts:1550— status-decision-committer.commitNativeStatusDecision has cyclomatic complexity 178 (threshold 15). Most of this is not in the body itself: 8 of the 178 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1592, 1866, 2113). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
plugin-host-services.buildHostServices (cyclomatic 174) server/src/services/plugin-host-services.ts:707— plugin-host-services.buildHostServices has cyclomatic complexity 174 (threshold 15). Of this number, 154 points are the body's own statements and 20 belong to 8 function items inside it that branch. 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.
AgentDetail.PromptsTab (cyclomatic 174) ui/src/pages/AgentDetail.tsx:2231— AgentDetail.PromptsTab has cyclomatic complexity 174 (threshold 15). Of this number, 94 points are the body's own statements and 80 belong to 37 function literals 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.
sandbox-managed-runtime.prepareSandboxManagedRuntime (cyclomatic 173) packages/adapter-utils/src/sandbox-managed-runtime.ts:1212— sandbox-managed-runtime.prepareSandboxManagedRuntime has cyclomatic complexity 173 (threshold 15). Of this number, 61 points are the body's own statements and 112 belong to 24 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.
EmailEndpointSetup.EmailEndpointSetupForm (cyclomatic 171) ui/src/pages/apps/chat/EmailEndpointSetup.tsx:92— EmailEndpointSetup.EmailEndpointSetupForm has cyclomatic complexity 171 (threshold 15). Of this number, 118 points are the body's own statements and 53 belong to 22 function items inside it that branch. 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.
workspace-preparation.prepareHeartbeatWorkspaceLocked (cyclomatic 169) server/src/services/heartbeat/workspace-preparation.ts:168— workspace-preparation.prepareHeartbeatWorkspaceLocked has cyclomatic complexity 169 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: one other method here (workspace-preparation.prepareHeartbeatWorkspaceLocked::bindIssueToPersistedExecutionWorkspace) 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.
execution-workspaces.executionWorkspaceService.sweepTerminalWorkspaces (cyclomatic 168) server/src/services/execution-workspaces.ts:3319— execution-workspaces.executionWorkspaceService.sweepTerminalWorkspaces has cyclomatic complexity 168 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: one other method here (execution-workspaces.executionWorkspaceService.sweepTerminalWorkspaces::expireTaskDirectory) 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.
ChatEndpointSetup.ProviderConnectStep (cyclomatic 163) ui/src/pages/apps/chat/ChatEndpointSetup.tsx:708— ChatEndpointSetup.ProviderConnectStep has cyclomatic complexity 163 (threshold 15). Of this number, 144 points are the body's own statements and 19 belong to 12 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.
tool-gateway.createToolGatewayService.executeTool (cyclomatic 161) server/src/services/tool-gateway.ts:10134— tool-gateway.createToolGatewayService.executeTool has cyclomatic complexity 161 (threshold 15). Of this number, 160 points are the body's own statements and 1 belongs to one function literal 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.
RunnerInspector.RunnerInspector (cyclomatic 160) ui/src/components/RunnerInspector.tsx:644— RunnerInspector.RunnerInspector has cyclomatic complexity 160 (threshold 15). Of this number, 60 points are the body's own statements and 100 belong to 26 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.
callbacks.createChatInteractionCallbacks.handleAction (cyclomatic 156) server/src/services/chat-channels/interactions/callbacks.ts:552— callbacks.createChatInteractionCallbacks.handleAction has cyclomatic complexity 156 (threshold 15). Of this number, 131 points are the body's own statements and 25 belong to 8 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.
runtime-execution.executeHeartbeatRuntime (cyclomatic 155) server/src/services/heartbeat/runtime-execution.ts:229— runtime-execution.executeHeartbeatRuntime has cyclomatic complexity 155 (threshold 15). Of this number, 84 points are the body's own statements and 71 belong to 13 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.
AgentDetail.production.AgentDetail (cyclomatic 153) ui/src/pages/AgentDetail.production.tsx:760— AgentDetail.production.AgentDetail has cyclomatic complexity 153 (threshold 15). Of this number, 78 points are the body's own statements and 75 belong to 28 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.
Browse.Browse (cyclomatic 152) ui/src/pages/apps/Browse.tsx:358— Browse.Browse has cyclomatic complexity 152 (threshold 15). Of this number, 54 points are the body's own statements and 98 belong to 32 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.
runtime-selection.selectHeartbeatRuntime (cyclomatic 151) server/src/services/heartbeat/runtime-selection.ts:258— runtime-selection.selectHeartbeatRuntime has cyclomatic complexity 151 (threshold 15). Of this number, 96 points are the body's own statements and 55 belong to 9 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.
AgentChatPrototype.AgentChatPrototype (cyclomatic 149) ui/storybook/prototypes/agent-chat/AgentChatPrototype.tsx:221— AgentChatPrototype.AgentChatPrototype has cyclomatic complexity 149 (threshold 15). Most of this is not in the body itself: 7 of the 149 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 237, 350, 599, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WorkspaceFileBrowser.WorkspaceFileBrowser (cyclomatic 148) ui/src/components/WorkspaceFileBrowser.tsx:496— WorkspaceFileBrowser.WorkspaceFileBrowser has cyclomatic complexity 148 (threshold 15). Of this number, 61 points are the body's own statements and 87 belong to 34 function items inside it that branch. 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.
chat-channels.chatChannelService.processMessage (cyclomatic 147) server/src/services/chat-channels.ts:1384— chat-channels.chatChannelService.processMessage has cyclomatic complexity 147 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: one other method here (chat-channels.chatChannelService.processMessage::persistTaskMutation) 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.
AgentDetail.AgentDetail (cyclomatic 146) ui/src/pages/AgentDetail.tsx:772— AgentDetail.AgentDetail has cyclomatic complexity 146 (threshold 15). Of this number, 91 points are the body's own statements and 55 belong to 25 function literals 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-session-notifications.mapNotificationBody (cyclomatic 144) packages/paperclip-runner/src/drivers/codex/codex-session-notifications.ts:107— codex-session-notifications.mapNotificationBody has cyclomatic complexity 144 (threshold 15). Of this number, 142 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.
tool-gateway.toolGatewayRoutes (cyclomatic 144) REDACTED:350— tool-gateway.toolGatewayRoutes has cyclomatic complexity 144 (threshold 15). Most of this is not in the body itself: 1 of the 144 points is its own statement and the rest belongs to 23 function items inside it that branch (a function literal at line 731, a function literal at line 957, assertBoardMutationAccess, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AppDetail.StandardAppDetail (cyclomatic 142) ui/src/pages/apps/AppDetail.tsx:88— AppDetail.StandardAppDetail has cyclomatic complexity 142 (threshold 15). Of this number, 100 points are the body's own statements and 42 belong to 22 function items inside it that branch. 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.
runnerd-codex-transport.settleRetainedRunnerdSessionOwned (cyclomatic 141) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:2351— runnerd-codex-transport.settleRetainedRunnerdSessionOwned has cyclomatic complexity 141 (threshold 15). Of this number, 116 points are the body's own statements and 25 belong to 7 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.
native-run-finalizer.finalizeNativeRun (cyclomatic 141) server/src/services/native-runtime/native-run-finalizer.ts:1140— native-run-finalizer.finalizeNativeRun has cyclomatic complexity 141 (threshold 15). Of this number, 137 points are the body's own statements and 4 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.
config-fields.CodexLocalConfigFields (cyclomatic 141) ui/src/adapters/codex-local/config-fields.tsx:70— config-fields.CodexLocalConfigFields has cyclomatic complexity 141 (threshold 15). Of this number, 98 points are the body's own statements and 43 belong to 16 function items inside it that branch. 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.
TaskSidePanel.TaskSidePanel (cyclomatic 141) ui/src/components/task-side-panel/TaskSidePanel.tsx:240— TaskSidePanel.TaskSidePanel has cyclomatic complexity 141 (threshold 15). Of this number, 48 points are the body's own statements and 93 belong to 25 function items inside it that branch. 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.
Layout.Layout (cyclomatic 140) ui/src/components/Layout.tsx:83— Layout.Layout has cyclomatic complexity 140 (threshold 15). Of this number, 94 points are the body's own statements and 46 belong to 20 function literals 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.
companies.companyRoutes (cyclomatic 138) server/src/routes/companies.ts:278— companies.companyRoutes has cyclomatic complexity 138 (threshold 15). Most of this is not in the body itself: 1 of the 138 points is its own statement and the rest belongs to 35 function items inside it that branch (a function literal at line 1245, resolveImportTransferBody, a function literal at line 850, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentDetail.LogViewer (cyclomatic 136) ui/src/pages/AgentDetail.tsx:4022— AgentDetail.LogViewer has cyclomatic complexity 136 (threshold 15). Of this number, 32 points are the body's own statements and 104 belong to 27 function items inside it that branch. 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.
AgentDetail.production.LogViewer (cyclomatic 136) ui/src/pages/AgentDetail.production.tsx:3733— AgentDetail.production.LogViewer has cyclomatic complexity 136 (threshold 15). Of this number, 32 points are the body's own statements and 104 belong to 27 function items inside it that branch. 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.
IssueChatThread.IssueChatThread (cyclomatic 135) ui/src/components/IssueChatThread.tsx:5760— IssueChatThread.IssueChatThread has cyclomatic complexity 135 (threshold 15). Of this number, 30 points are the body's own statements and 105 belong to 27 function items inside it that branch. 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.
GitHubChatPreview.GitHubChatPreview (cyclomatic 135) ui/storybook/prototypes/github-chat/GitHubChatPreview.tsx:452— GitHubChatPreview.GitHubChatPreview has cyclomatic complexity 135 (threshold 15). Of this number, 96 points are the body's own statements and 39 belong to 12 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.
failed-run-retry.createChatFailedRunRetry.failedChatRetrySource (cyclomatic 134) server/src/services/chat-channels/failed-run-retry.ts:643— failed-run-retry.createChatFailedRunRetry.failedChatRetrySource has cyclomatic complexity 134 (threshold 15). Of this number, 129 points are the body's own statements and 5 belong to 3 function literals inside it that branch. 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.
TaskChatComposer.TaskChatComposer (cyclomatic 134) REDACTED:378— TaskChatComposer.TaskChatComposer has cyclomatic complexity 134 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: one other method here (TaskChatComposer.TaskChatComposer::submit) 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.
execute.execute (cyclomatic 133) packages/adapters/pi-local/src/server/execute.ts:227— execute.execute has cyclomatic complexity 133 (threshold 15). Of this number, 93 points are the body's own statements and 40 belong to 10 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.
GitHubChatSetup.GitHubChatSetup (cyclomatic 133) ui/src/pages/apps/chat/GitHubChatSetup.tsx:75— GitHubChatSetup.GitHubChatSetup has cyclomatic complexity 133 (threshold 15). Of this number, 92 points are the body's own statements and 41 belong to 16 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.
native-run-events.nativeRunEventsToTranscript (cyclomatic 132) ui/src/components/transcript/native-run-events.ts:585— native-run-events.nativeRunEventsToTranscript has cyclomatic complexity 132 (threshold 15). Of this number, 124 points are the body's own statements and 8 belong to 3 function literals 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.
execute.execute (cyclomatic 131) packages/adapters/codex-local/src/server/execute.ts:578— execute.execute has cyclomatic complexity 131 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: 2 other methods here (execute.execute::runAttempt, execute.execute::toResult) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
attention.attentionService.list (cyclomatic 131) server/src/services/attention.ts:1167— attention.attentionService.list has cyclomatic complexity 131 (threshold 15). Of this number, 113 points are the body's own statements and 18 belong to 5 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.
AgentConfigForm.SubmittedBrowserCodeLoginPanel (cyclomatic 131) ui/src/components/AgentConfigForm.tsx:3063— AgentConfigForm.SubmittedBrowserCodeLoginPanel has cyclomatic complexity 131 (threshold 15). Of this number, 58 points are the body's own statements and 73 belong to 24 function items inside it that branch. 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.
RoutineDetail.RoutineDetail (cyclomatic 131) ui/src/pages/RoutineDetail.tsx:124— RoutineDetail.RoutineDetail has cyclomatic complexity 131 (threshold 15). Of this number, 57 points are the body's own statements and 74 belong to 31 function literals inside it that branch. 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.
company-skills.companySkillRoutes (cyclomatic 130) REDACTED:101— company-skills.companySkillRoutes has cyclomatic complexity 130 (threshold 15). Most of this is not in the body itself: 1 of the 130 points is its own statement and the rest belongs to 48 function items inside it that branch (assertCanMutateCompanySkills, a function literal at line 372, skillPolicyResource, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ExecutionWorkspaceDetail.ExecutionWorkspaceDetail (cyclomatic 130) ui/src/pages/ExecutionWorkspaceDetail.tsx:776— ExecutionWorkspaceDetail.ExecutionWorkspaceDetail has cyclomatic complexity 130 (threshold 15). Of this number, 78 points are the body's own statements and 52 belong to 30 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.
live-session.assertCapabilityLiveSessionSnapshot (cyclomatic 128) packages/paperclip-runner/src/live/live-session.ts:588— live-session.assertCapabilityLiveSessionSnapshot has cyclomatic complexity 128 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InviteLanding.InviteLandingPage (cyclomatic 128) ui/src/pages/InviteLanding.tsx:209— InviteLanding.InviteLandingPage has cyclomatic complexity 128 (threshold 15). Of this number, 92 points are the body's own statements and 36 belong to 13 function literals 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.
ExternallyConnectedTaskBanner.ConnectedTaskComposer (cyclomatic 128) ui/src/components/chat/ExternallyConnectedTaskBanner.tsx:149— ExternallyConnectedTaskBanner.ConnectedTaskComposer has cyclomatic complexity 128 (threshold 15). Of this number, 82 points are the body's own statements and 46 belong to 14 function items inside it that branch. 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.
ConnectionIntentInteractionBody.ConnectionIntentInteractionBody (cyclomatic 127) ui/src/features/connections/ConnectionIntentInteractionBody.tsx:44— ConnectionIntentInteractionBody.ConnectionIntentInteractionBody has cyclomatic complexity 127 (threshold 15). Of this number, 102 points are the body's own statements and 25 belong to 8 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.
native-session-runtime.consumeTurn (cyclomatic 125) packages/paperclip-runner/src/native-session-runtime.ts:862— native-session-runtime.consumeTurn has cyclomatic complexity 125 (threshold 15). Of this number, 22 points are the body's own statements and 103 belong to 10 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.
recovery.createHeartbeatRecovery.reapOrphanedRuns (cyclomatic 125) server/src/services/heartbeat/recovery.ts:1919— recovery.createHeartbeatRecovery.reapOrphanedRuns has cyclomatic complexity 125 (threshold 15). Of this number, 116 points are the body's own statements and 9 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.
environments.environmentRoutes (cyclomatic 125) server/src/routes/environments.ts:329— environments.environmentRoutes has cyclomatic complexity 125 (threshold 15). Most of this is not in the body itself: 1 of the 125 points is its own statement and the rest belongs to 31 function items inside it that branch (a function literal at line 1133, resolveEnvironmentSecretContextCompanyId, a function literal at line 1269, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
case-handoffs.caseHandoffService.handoff (cyclomatic 124) server/src/services/case-handoffs.ts:337— case-handoffs.caseHandoffService.handoff has cyclomatic complexity 124 (threshold 15). Most of this is not in the body itself: 2 of the 124 points are its own statements and the rest belongs to one function literal inside it that branches (line 346). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-plan-wait.planWaitFromFacts (cyclomatic 123) server/src/services/native-runtime/native-plan-wait.ts:66— native-plan-wait.planWaitFromFacts has cyclomatic complexity 123 (threshold 15). Of this number, 118 points are the body's own statements and 5 belong to 3 function literals inside it that branch. 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.
ChatEndpointDetail.Activity (cyclomatic 123) ui/src/pages/apps/chat/ChatEndpointDetail.tsx:877— ChatEndpointDetail.Activity has cyclomatic complexity 123 (threshold 15). Of this number, 80 points are the body's own statements and 43 belong to 16 function literals 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.
agent-runner-selection.resolveAgentRunner (cyclomatic 122) server/src/services/agent-runner-selection.ts:147— agent-runner-selection.resolveAgentRunner has cyclomatic complexity 122 (threshold 15). Of this number, 117 points are the body's own statements and 5 belong to one function literal 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.
chat-interaction-publications.enqueueIssueInteractionChatPublications (cyclomatic 121) server/src/services/chat-interaction-publications.ts:250— chat-interaction-publications.enqueueIssueInteractionChatPublications has cyclomatic complexity 121 (threshold 15). Of this number, 88 points are the body's own statements and 33 belong to 7 function literals 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.
DurablePrpCodexTransport.#pumpEvents (cyclomatic 120) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:6300— DurablePrpCodexTransport.#pumpEvents has cyclomatic complexity 120 (threshold 15). Of this number, 110 points are the body's own statements and 10 belong to 2 function literals 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.
cases.caseRoutes (cyclomatic 120) REDACTED:574— cases.caseRoutes has cyclomatic complexity 120 (threshold 15). Most of this is not in the body itself: 1 of the 120 points is its own statement and the rest belongs to 27 function items inside it that branch (a function literal at line 759, a function literal at line 1009, a function literal at line 1576, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
codex-runtime-adapter.openQualifiedAcpxRuntime (cyclomatic 119) packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts:165— codex-runtime-adapter.openQualifiedAcpxRuntime has cyclomatic complexity 119 (threshold 15). Of this number, 50 points are the body's own statements and 69 belong to 17 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.
Routines.production.Routines (cyclomatic 119) ui/src/pages/Routines.production.tsx:319— Routines.production.Routines has cyclomatic complexity 119 (threshold 15). Of this number, 43 points are the body's own statements and 76 belong to 41 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.
native-session-executor.verifyWarmTransitionRestart (cyclomatic 118) server/src/services/native-runtime/native-session-executor.ts:4538— native-session-executor.verifyWarmTransitionRestart has cyclomatic complexity 118 (threshold 15). Most of this is not in the body itself: 7 of the 118 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 4565, 4859, 4839). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentDetail.RunDetail (cyclomatic 118) ui/src/pages/AgentDetail.tsx:3456— AgentDetail.RunDetail has cyclomatic complexity 118 (threshold 15). Of this number, 82 points are the body's own statements and 36 belong to 14 function literals inside it that branch. 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.
configuration.createChatConfiguration.configureWithCredentialLease (cyclomatic 117) server/src/services/chat-channels/configuration.ts:155— configuration.createChatConfiguration.configureWithCredentialLease has cyclomatic complexity 117 (threshold 15). Of this number, 91 points are the body's own statements and 26 belong to 5 function literals 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.
Routines.Routines (cyclomatic 117) ui/src/pages/Routines.tsx:311— Routines.Routines has cyclomatic complexity 117 (threshold 15). Of this number, 48 points are the body's own statements and 69 belong to 39 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.
execute.buildRuntime (cyclomatic 116) packages/adapter-utils/src/acpx-engine/execute.ts:1824— execute.buildRuntime has cyclomatic complexity 116 (threshold 15). Of this number, 111 points are the body's own statements and 5 belong to 5 function literals inside it that branch. 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.
AgentProviderConnection.AgentProviderConnection (cyclomatic 116) ui/src/components/new-agent/AgentProviderConnection.tsx:37— AgentProviderConnection.AgentProviderConnection has cyclomatic complexity 116 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: one other method here (AgentProviderConnection.AgentProviderConnection::connect) 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.
ProjectDetail.ProjectDetail (cyclomatic 115) ui/src/pages/ProjectDetail.tsx:327— ProjectDetail.ProjectDetail has cyclomatic complexity 115 (threshold 15). Of this number, 69 points are the body's own statements and 46 belong to 21 function items inside it that branch. 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.
github-skill-source.scanRepository (cyclomatic 114) server/src/services/github-skill-source.ts:65— github-skill-source.scanRepository has cyclomatic complexity 114 (threshold 15). Of this number, 88 points are the body's own statements and 26 belong to 15 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.
chat-control-recovery-stop.readChatControlRecoveryStop (cyclomatic 113) server/src/services/chat-control-recovery-stop.ts:175— chat-control-recovery-stop.readChatControlRecoveryStop has cyclomatic complexity 113 (threshold 15). Of this number, 108 points are the body's own statements and 5 belong to one function literal 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.
IssueRecoveryActionCard.IssueRecoveryActionCard (cyclomatic 113) ui/src/components/IssueRecoveryActionCard.tsx:986— IssueRecoveryActionCard.IssueRecoveryActionCard has cyclomatic complexity 113 (threshold 15). Of this number, 93 points are the body's own statements and 20 belong to 4 function literals 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.
CapabilityMockControlPlaneAdapter.#executeCommand (cyclomatic 112) packages/paperclip-runner/src/mock-core/capability-mock-control-plane-adapter.ts:698— CapabilityMockControlPlaneAdapter.#executeCommand has cyclomatic complexity 112 (threshold 15). Of this number, 107 points are the body's own statements and 5 belong to 5 function literals 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.
LiveUpdatesProvider.invalidateActivityQueries (cyclomatic 112) ui/src/context/LiveUpdatesProvider.tsx:1335— LiveUpdatesProvider.invalidateActivityQueries has cyclomatic complexity 112 (threshold 15). Of this number, 109 points are the body's own statements and 3 belong to one function literal 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.
transcript-adapter.transcriptToTaskChatItems (cyclomatic 112) ui/src/components/task-chat/transcript-adapter.ts:625— transcript-adapter.transcriptToTaskChatItems has cyclomatic complexity 112 (threshold 15). Of this number, 109 points are the body's own statements and 3 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.
NewAgentWizard.NewAgentWizard (cyclomatic 112) ui/storybook/prototypes/NewAgentWizard.tsx:97— NewAgentWizard.NewAgentWizard has cyclomatic complexity 112 (threshold 15). Of this number, 77 points are the body's own statements and 35 belong to 11 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.
chat-channels.chatChannelRoutes (cyclomatic 111) server/src/routes/chat-channels.ts:93— chat-channels.chatChannelRoutes has cyclomatic complexity 111 (threshold 15). Most of this is not in the body itself: 1 of the 111 points is its own statement and the rest belongs to 60 function items inside it that branch (a function literal at line 517, a function literal at line 211, a function literal at line 250, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
RoutineDetail.production.RoutineDetail (cyclomatic 111) ui/src/pages/RoutineDetail.production.tsx:158— RoutineDetail.production.RoutineDetail has cyclomatic complexity 111 (threshold 15). Of this number, 41 points are the body's own statements and 70 belong to 30 function literals inside it that branch. 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.
IssueRow.IssueRow (cyclomatic 109) ui/src/components/IssueRow.tsx:131— IssueRow.IssueRow has cyclomatic complexity 109 (threshold 15). Of this number, 101 points are the body's own statements and 8 belong to 4 function literals 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.
execute.execute (cyclomatic 108) packages/adapters/claude-local/src/server/execute.ts:409— execute.execute has cyclomatic complexity 108 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: one other method here (execute.execute::toAdapterResult) 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.
native-session-executor.verifyStoppedNativeSessionForReplacement (cyclomatic 108) server/src/services/native-runtime/native-session-executor.ts:2891— native-session-executor.verifyStoppedNativeSessionForReplacement has cyclomatic complexity 108 (threshold 15). Of this number, 76 points are the body's own statements and 32 belong to 9 function items inside it that branch. 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.
ProjectProperties.ProjectProperties (cyclomatic 108) ui/src/components/ProjectProperties.tsx:216— ProjectProperties.ProjectProperties has cyclomatic complexity 108 (threshold 15). Of this number, 59 points are the body's own statements and 49 belong to 25 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.
AgentBulkSettingsSheet.AgentBulkSettingsSheet (cyclomatic 108) ui/src/components/agents/AgentBulkSettingsSheet.tsx:21— AgentBulkSettingsSheet.AgentBulkSettingsSheet has cyclomatic complexity 108 (threshold 15). Of this number, 53 points are the body's own statements and 55 belong to 15 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.
AgentDetail.production.PromptsTab (cyclomatic 108) ui/src/pages/AgentDetail.production.tsx:2305— AgentDetail.production.PromptsTab has cyclomatic complexity 108 (threshold 15). Of this number, 56 points are the body's own statements and 52 belong to 25 function literals inside it that branch. 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.
ExternalAgentInviteContent.ExternalAgentInviteContent (cyclomatic 107) ui/src/components/new-agent/ExternalAgentInviteContent.tsx:136— ExternalAgentInviteContent.ExternalAgentInviteContent has cyclomatic complexity 107 (threshold 15). Of this number, 104 points are the body's own statements and 3 belong to 2 function literals 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.
BoardChat.BoardChat (cyclomatic 107) ui/src/pages/BoardChat.tsx:90— BoardChat.BoardChat has cyclomatic complexity 107 (threshold 15). Of this number, 27 points are the body's own statements and 80 belong to 28 function literals inside it that branch. 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.
native-restart-recovery.claimNativeRestartRecoveries (cyclomatic 105) server/src/services/native-runtime/native-restart-recovery.ts:462— native-restart-recovery.claimNativeRestartRecoveries has cyclomatic complexity 105 (threshold 15). Most of this is not in the body itself: 5 of the 105 points are its own statements and the rest belongs to one function literal inside it that branches (line 521). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
run-control.createHeartbeatRunControl.cancelRun (cyclomatic 105) server/src/services/heartbeat/run-control.ts:1107— run-control.createHeartbeatRunControl.cancelRun has cyclomatic complexity 105 (threshold 15). Of this number, 46 points are the body's own statements and 59 belong to 3 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.
ComposerRunSettingsPicker.ComposerRunSettingsPicker (cyclomatic 105) ui/src/components/task-chat/ComposerRunSettingsPicker.tsx:85— ComposerRunSettingsPicker.ComposerRunSettingsPicker has cyclomatic complexity 105 (threshold 15). Of this number, 69 points are the body's own statements and 36 belong to 17 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.
status-arbiter.arbitrateNativeStatus (cyclomatic 104) server/src/services/native-runtime/status-arbiter.ts:95— status-arbiter.arbitrateNativeStatus has cyclomatic complexity 104 (threshold 15). Of this number, 102 points are the body's own statements and 2 belong to one function literal 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.
run-completion.createHeartbeatRunCompletion.completeRun (cyclomatic 104) server/src/services/heartbeat/run-completion.ts:386— run-completion.createHeartbeatRunCompletion.completeRun has cyclomatic complexity 104 (threshold 15). Of this number, 97 points are the body's own statements and 7 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.
run-preparation.buildPaperclipWakePayload (cyclomatic 103) server/src/services/heartbeat/run-preparation.ts:2244— run-preparation.buildPaperclipWakePayload has cyclomatic complexity 103 (threshold 15). Of this number, 95 points are the body's own statements and 8 belong to 3 function literals 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.
worktree-merge-history-lib.buildWorktreeMergePlan (cyclomatic 102) cli/src/commands/worktree-merge-history-lib.ts:340— worktree-merge-history-lib.buildWorktreeMergePlan has cyclomatic complexity 102 (threshold 15). Of this number, 96 points are the body's own statements and 6 belong to 4 function literals 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.
ExternalAgentInviteDialog.ExternalAgentInviteDialog (cyclomatic 102) ui/src/components/new-agent/ExternalAgentInviteDialog.tsx:22— ExternalAgentInviteDialog.ExternalAgentInviteDialog has cyclomatic complexity 102 (threshold 15). Of this number, 76 points are the body's own statements and 26 belong to 8 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.
webhook-ingress.createGitHubWebhookIngress.processFailedGitHubWebhookDeliveries (cyclomatic 101) server/src/services/chat-channels/github/webhook-ingress.ts:1097— webhook-ingress.createGitHubWebhookIngress.processFailedGitHubWebhookDeliveries has cyclomatic complexity 101 (threshold 15). Of this number, 87 points are the body's own statements and 14 belong to 3 function literals 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.
events.createPhotonEvents.processPhotonResponse (cyclomatic 101) server/src/services/chat-channels/imessage-photon/events.ts:130— events.createPhotonEvents.processPhotonResponse has cyclomatic complexity 101 (threshold 15). Of this number, 91 points are the body's own statements and 10 belong to 7 function literals 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.
muse.createMuseBroker (cyclomatic 101) server/src/modules/external-agents/muse.ts:42— muse.createMuseBroker has cyclomatic complexity 101 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: 2 other methods here (muse.createMuseBroker::authorizeAssignment, muse.createMuseBroker::detectorEvidence) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
run-failure-diagnostics.collectRunFailureDiagnostics (cyclomatic 101) REDACTED:225— run-failure-diagnostics.collectRunFailureDiagnostics has cyclomatic complexity 101 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
retries.createHeartbeatRetries.scheduleBoundedRetryForRun (cyclomatic 101) server/src/services/heartbeat/retries.ts:397— retries.createHeartbeatRetries.scheduleBoundedRetryForRun has cyclomatic complexity 101 (threshold 15). Of this number, 53 points are the body's own statements and 48 belong to one function literal 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.
AgentDetail.production.RunDetail (cyclomatic 101) ui/src/pages/AgentDetail.production.tsx:3249— AgentDetail.production.RunDetail has cyclomatic complexity 101 (threshold 15). Of this number, 75 points are the body's own statements and 26 belong to 10 function literals inside it that branch. 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.
runner-api-client.executeRunnerApi (cyclomatic 99) server/src/services/native-runtime/runner-api-client.ts:124— runner-api-client.executeRunnerApi has cyclomatic complexity 99 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
native-finalization-reconciler.reconcileNativeFinalizationsPass (cyclomatic 99) server/src/services/native-runtime/native-finalization-reconciler.ts:706— native-finalization-reconciler.reconcileNativeFinalizationsPass has cyclomatic complexity 99 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
native-completion-feedback.nativeCompletionFeedback (cyclomatic 98) server/src/services/native-runtime/native-completion-feedback.ts:48— native-completion-feedback.nativeCompletionFeedback has cyclomatic complexity 98 (threshold 15). Of this number, 94 points are the body's own statements and 4 belong to 3 function literals 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.
environment-selection.selectHeartbeatEnvironment (cyclomatic 98) server/src/services/heartbeat/environment-selection.ts:85— environment-selection.selectHeartbeatEnvironment has cyclomatic complexity 98 (threshold 15). Of this number, 96 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.
company-portability.buildManifestFromPackageFiles (cyclomatic 98) server/src/services/company-portability.ts:3100— company-portability.buildManifestFromPackageFiles has cyclomatic complexity 98 (threshold 15). Of this number, 82 points are the body's own statements and 16 belong to 11 function literals 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.
company-portability.companyPortabilityService.buildPreview (cyclomatic 98) server/src/services/company-portability.ts:4862— company-portability.companyPortabilityService.buildPreview has cyclomatic complexity 98 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConnectionSetupFlow.KeyStep (cyclomatic 98) ui/src/features/connections/ConnectionSetupFlow.tsx:3581— ConnectionSetupFlow.KeyStep has cyclomatic complexity 98 (threshold 15). Of this number, 79 points are the body's own statements and 19 belong to 10 function literals 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.
company.registerCompanyCommands (cyclomatic 95) cli/src/commands/client/company.ts:1346— company.registerCompanyCommands has cyclomatic complexity 95 (threshold 15). Most of this is not in the body itself: 1 of the 95 points is its own statement and the rest belongs to 13 function literals inside it that branch (lines 1657, 1930, 1600, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
DurablePrpCodexTransport.request (cyclomatic 95) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:3702— DurablePrpCodexTransport.request has cyclomatic complexity 95 (threshold 15). Of this number, 91 points are the body's own statements and 4 belong to 2 function literals 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-runtime-adapter.runtimePort (cyclomatic 94) packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts:1075— codex-runtime-adapter.runtimePort has cyclomatic complexity 94 (threshold 15). Of this number, 32 points are the body's own statements and 62 belong to 15 function items inside it that branch. 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.
workspace-runtime.spawnLocalRuntimeService (cyclomatic 93) server/src/services/workspace-runtime.ts:6181— workspace-runtime.spawnLocalRuntimeService has cyclomatic complexity 93 (threshold 15). Of this number, 77 points are the body's own statements and 16 belong to one function literal 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.
inbound-attachments.createInboundAttachments.ingestAttachments (cyclomatic 93) server/src/services/chat-channels/inbound-attachments.ts:85— inbound-attachments.createInboundAttachments.ingestAttachments has cyclomatic complexity 93 (threshold 15). Of this number, 56 points are the body's own statements and 37 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.
admission.createInboundAdmission.admitInboundMessage (cyclomatic 93) server/src/services/chat-channels/inbound/admission.ts:74— admission.createInboundAdmission.admitInboundMessage has cyclomatic complexity 93 (threshold 15). Most of this is not in the body itself: 1 of the 93 points is its own statement and the rest belongs to one function literal inside it that branches (line 77). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
CompanyExport.CompanyExport (cyclomatic 92) ui/src/pages/CompanyExport.tsx:628— CompanyExport.CompanyExport has cyclomatic complexity 92 (threshold 15). Of this number, 29 points are the body's own statements and 63 belong to 27 function items inside it that branch. 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.
plugin.pluginManifestV1Schema (cyclomatic 91) packages/shared/src/validators/plugin.ts:829— plugin.pluginManifestV1Schema has cyclomatic complexity 91 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RichWorkProductCard.RichWorkProductCard (cyclomatic 91) ui/src/components/task-chat/RichWorkProductCard.tsx:136— RichWorkProductCard.RichWorkProductCard has cyclomatic complexity 91 (threshold 15). Of this number, 89 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.
provider-events.canonicalProviderEventsFromCodex (cyclomatic 89) packages/paperclip-runner/src/provider-events.ts:621— provider-events.canonicalProviderEventsFromCodex has cyclomatic complexity 89 (threshold 15). Of this number, 87 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.
posthog-live.runSmoke (cyclomatic 89) scripts/smoke/posthog-live.mjs:530— posthog-live.runSmoke has cyclomatic complexity 89 (threshold 15). Of this number, 72 points are the body's own statements and 17 belong to 10 function literals inside it that branch. 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.
AuditFeed.AuditFeed (cyclomatic 89) ui/src/pages/audit/AuditFeed.tsx:307— AuditFeed.AuditFeed has cyclomatic complexity 89 (threshold 15). Of this number, 73 points are the body's own statements and 16 belong to 9 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.
execution-continuation.buildExecutionContinuation (cyclomatic 88) server/src/services/execution-continuation.ts:145— execution-continuation.buildExecutionContinuation has cyclomatic complexity 88 (threshold 15). Of this number, 47 points are the body's own statements and 41 belong to 9 function literals inside it that branch. 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.
failed-run-retry.createChatFailedRunRetry.failedNativeRetryCoordinator (cyclomatic 88) server/src/services/chat-channels/failed-run-retry.ts:278— failed-run-retry.createChatFailedRunRetry.failedNativeRetryCoordinator has cyclomatic complexity 88 (threshold 15). Of this number, 83 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
native-session-executor.cancelNativeSession (cyclomatic 88) server/src/services/native-runtime/native-session-executor.ts:6981— native-session-executor.cancelNativeSession has cyclomatic complexity 88 (threshold 15). Of this number, 38 points are the body's own statements and 50 belong to 2 function literals 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.
notion-generic-live.runSmoke (cyclomatic 88) scripts/smoke/notion-generic-live.mjs:545— notion-generic-live.runSmoke has cyclomatic complexity 88 (threshold 15). Of this number, 68 points are the body's own statements and 20 belong to 12 function literals inside it that branch. 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.
SkillSources.SourceDialog (cyclomatic 88) ui/src/pages/SkillSources.tsx:242— SkillSources.SourceDialog has cyclomatic complexity 88 (threshold 15). Of this number, 65 points are the body's own statements and 23 belong to 10 function literals inside it that branch. 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.
issue.registerIssueCommands (cyclomatic 87) cli/src/commands/client/issue.ts:172— issue.registerIssueCommands has cyclomatic complexity 87 (threshold 15). Most of this is not in the body itself: 3 of the 87 points are its own statements and the rest belongs to 54 function literals inside it that branch (lines 184, 404, 868, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
QuestionForm.QuestionFormForRequest (cyclomatic 87) ui/src/components/task-chat/QuestionForm.tsx:239— QuestionForm.QuestionFormForRequest has cyclomatic complexity 87 (threshold 15). Of this number, 39 points are the body's own statements and 48 belong to 14 function items inside it that branch. 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.
AiConnectionPoolConnector.PoolConnector (cyclomatic 87) ui/src/components/ai-connections/AiConnectionPoolConnector.tsx:42— AiConnectionPoolConnector.PoolConnector has cyclomatic complexity 87 (threshold 15). Of this number, 48 points are the body's own statements and 39 belong to 19 function items inside it that branch. 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.
chat-github-receipt-reactions.applyGitHubReceiptReaction (cyclomatic 86) server/src/services/chat-github-receipt-reactions.ts:66— chat-github-receipt-reactions.applyGitHubReceiptReaction has cyclomatic complexity 86 (threshold 15). Of this number, 72 points are the body's own statements and 14 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.
native-session-executor.retainedNativeCleanupJournalMatches (cyclomatic 86) server/src/services/native-runtime/native-session-executor.ts:2238— native-session-executor.retainedNativeCleanupJournalMatches has cyclomatic complexity 86 (threshold 15). Of this number, 45 points are the body's own statements and 41 belong to 10 function items inside it that branch. 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.
Layout.production.Layout (cyclomatic 86) ui/src/components/Layout.production.tsx:117— Layout.production.Layout has cyclomatic complexity 86 (threshold 15). Of this number, 46 points are the body's own statements and 40 belong to 18 function literals 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.
issues.resolveChatOriginPublicationBindings (cyclomatic 84) server/src/services/issues.ts:1146— issues.resolveChatOriginPublicationBindings 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.
AiProviderSetup.AiProviderSetup (cyclomatic 84) ui/src/components/ai-connections/AiProviderSetup.tsx:68— AiProviderSetup.AiProviderSetup has cyclomatic complexity 84 (threshold 15). Of this number, 68 points are the body's own statements and 16 belong to 8 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.
PiRpcMessageDeltas.normalize (cyclomatic 83) packages/paperclip-runner/src/drivers/acpx/pi-acp-runtime.ts:45— PiRpcMessageDeltas.normalize has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tool-gateway.createToolGatewayService.executeRemoteHttpTool (cyclomatic 83) server/src/services/tool-gateway.ts:6081— tool-gateway.createToolGatewayService.executeRemoteHttpTool has cyclomatic complexity 83 (threshold 15). Of this number, 71 points are the body's own statements and 12 belong to 7 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.
native-maintenance-no-launch.verifyRetainedMaintenanceNoLaunch (cyclomatic 83) server/src/services/native-runtime/native-maintenance-no-launch.ts:116— native-maintenance-no-launch.verifyRetainedMaintenanceNoLaunch has cyclomatic complexity 83 (threshold 15). Of this number, 70 points are the body's own statements and 13 belong to 2 function items inside it that branch. 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.
routines.routineRoutes (cyclomatic 83) server/src/routes/routines.ts:22— routines.routineRoutes has cyclomatic complexity 83 (threshold 15). Most of this is not in the body itself: 1 of the 83 points is its own statement and the rest belongs to 25 function items inside it that branch (a function literal at line 363, a function literal at line 500, assertCanManageExistingRoutine, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
useLiveRunTranscripts.useLiveRunTranscripts (cyclomatic 83) ui/src/components/transcript/useLiveRunTranscripts.ts:99— useLiveRunTranscripts.useLiveRunTranscripts has cyclomatic complexity 83 (threshold 15). Most of this is not in the body itself: 1 of the 83 points is its own statement and the rest belongs to 18 function literals inside it that branch (lines 208, 312, 463, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
StatusCardDetailDrawer.StatusCardDetailDrawer (cyclomatic 83) ui/src/pages/StatusCards/StatusCardDetailDrawer.tsx:42— StatusCardDetailDrawer.StatusCardDetailDrawer has cyclomatic complexity 83 (threshold 15). Of this number, 60 points are the body's own statements and 23 belong to 12 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.
backup-lib.runDatabaseBackup (cyclomatic 81) packages/db/src/backup-lib.ts:531— backup-lib.runDatabaseBackup has cyclomatic complexity 81 (threshold 15). Of this number, 72 points are the body's own statements and 9 belong to 6 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.
issue-execution-policy.applyIssueExecutionStageTransition (cyclomatic 81) server/src/services/issue-execution-policy.ts:659— issue-execution-policy.applyIssueExecutionStageTransition 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.
commands.createDiscordCommands.handleDiscordNativeCommand (cyclomatic 81) server/src/services/chat-channels/discord/commands.ts:250— commands.createDiscordCommands.handleDiscordNativeCommand has cyclomatic complexity 81 (threshold 15). Most of this is not in the body itself: 11 of the 81 points are its own statements and the rest belongs to one function literal inside it that branches (line 293). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-interaction-bridge.materializeNativeInteractionResponses (cyclomatic 81) server/src/services/native-runtime/native-interaction-bridge.ts:155— native-interaction-bridge.materializeNativeInteractionResponses has cyclomatic complexity 81 (threshold 15). Of this number, 79 points are the body's own statements and 2 belong to one function literal 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.
AgentObservabilitySettings.AgentObservabilitySettingsView (cyclomatic 81) ui/src/components/observability/AgentObservabilitySettings.tsx:40— AgentObservabilitySettings.AgentObservabilitySettingsView has cyclomatic complexity 81 (threshold 15). Of this number, 56 points are the body's own statements and 25 belong to 8 function items inside it that branch. 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.
browser-use.browserUseService.reconcile (cyclomatic 80) server/src/services/browser-use.ts:1078— browser-use.browserUseService.reconcile has cyclomatic complexity 80 (threshold 15). Of this number, 68 points are the body's own statements and 12 belong to 2 function literals 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.
callbacks.createChatInteractionCallbacks.handleModalSubmit (cyclomatic 80) server/src/services/chat-channels/interactions/callbacks.ts:1425— callbacks.createChatInteractionCallbacks.handleModalSubmit has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TaskChatComposer.TaskChatComposer::submit (cyclomatic 80) REDACTED:888— TaskChatComposer.TaskChatComposer::submit has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: one other method here (TaskChatComposer.TaskChatComposer) 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.
ExternalAgentInviteDialog.MuseInvitationController (cyclomatic 80) ui/src/components/new-agent/ExternalAgentInviteDialog.tsx:152— ExternalAgentInviteDialog.MuseInvitationController has cyclomatic complexity 80 (threshold 15). Of this number, 48 points are the body's own statements and 32 belong to 9 function items inside it that branch. 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.
SkillSources.SkillSources (cyclomatic 80) ui/src/pages/SkillSources.tsx:34— SkillSources.SkillSources has cyclomatic complexity 80 (threshold 15). Of this number, 23 points are the body's own statements and 57 belong to 5 function literals inside it that branch. 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.
projectRepositorySkills.installProjectSkillFixtures (cyclomatic 80) ui/storybook/support/projectRepositorySkills.ts:28— projectRepositorySkills.installProjectSkillFixtures has cyclomatic complexity 80 (threshold 15). Most of this is not in the body itself: 15 of the 80 points are its own statements and the rest belongs to 36 function items inside it that branch (a function literal at line 86, a function literal at line 114, a function literal at line 131, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
issue-thread-interactions.issueThreadInteractionService.create (cyclomatic 79) server/src/services/issue-thread-interactions.ts:3390— issue-thread-interactions.issueThreadInteractionService.create has cyclomatic complexity 79 (threshold 15). Of this number, 46 points are the body's own statements and 33 belong to 2 function literals 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.
TriggerWizard.RoutineTriggerWizard (cyclomatic 79) ui/src/components/routine-triggers/TriggerWizard.tsx:104— TriggerWizard.RoutineTriggerWizard has cyclomatic complexity 79 (threshold 15). Of this number, 63 points are the body's own statements and 16 belong to 6 function literals 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.
onboard.onboard (cyclomatic 78) cli/src/commands/onboard.ts:383— onboard.onboard 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.
slack.executeSlackTool (cyclomatic 78) server/src/services/connectors/slack.ts:134— slack.executeSlackTool has cyclomatic complexity 78 (threshold 15). Of this number, 70 points are the body's own statements and 8 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.
authorization-start.createOAuthAuthorizationStart::startOAuth (cyclomatic 78) server/src/services/tool-access/oauth/authorization-start.ts:41— authorization-start.createOAuthAuthorizationStart::startOAuth 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.
native-safe-replacement.reconcileSafeNativeReplacements (cyclomatic 78) server/src/services/native-runtime/native-safe-replacement.ts:53— native-safe-replacement.reconcileSafeNativeReplacements has cyclomatic complexity 78 (threshold 15). Of this number, 23 points are the body's own statements and 55 belong to 5 function literals 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.
DocumentAnnotationLayer.DocumentAnnotationLayer (cyclomatic 78) ui/src/components/DocumentAnnotationLayer.tsx:239— DocumentAnnotationLayer.DocumentAnnotationLayer has cyclomatic complexity 78 (threshold 15). Most of this is not in the body itself: 6 of the 78 points are its own statements and the rest belongs to 18 function items inside it that branch (a function literal at line 370, a function literal at line 274, a function literal at line 432, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
Search.Search (cyclomatic 78) ui/src/pages/Search.tsx:133— Search.Search has cyclomatic complexity 78 (threshold 15). Of this number, 26 points are the body's own statements and 52 belong to 23 function items inside it that branch. 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.
TeamCatalog.TeamInstallerDialog (cyclomatic 78) ui/src/pages/TeamCatalog.tsx:1065— TeamCatalog.TeamInstallerDialog has cyclomatic complexity 78 (threshold 15). Of this number, 41 points are the body's own statements and 37 belong to 16 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.
execute.execute (cyclomatic 77) packages/adapters/openclaw-gateway/src/server/execute.ts:1048— execute.execute has cyclomatic complexity 77 (threshold 15). Of this number, 55 points are the body's own statements and 22 belong to 3 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.
OpenCodeHarnessSession.#mapProviderEventValue (cyclomatic 77) REDACTED:1562— OpenCodeHarnessSession.#mapProviderEventValue has cyclomatic complexity 77 (threshold 15). Of this number, 76 points are the body's own statements and 1 belongs to one function literal 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.
execution-blocker.getExecutionBlocker (cyclomatic 77) server/src/services/execution-blocker.ts:108— execution-blocker.getExecutionBlocker has cyclomatic complexity 77 (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.
slack-writes.executeSlackWrite (cyclomatic 77) server/src/services/connectors/slack-writes.ts:43— slack-writes.executeSlackWrite has cyclomatic complexity 77 (threshold 15). Of this number, 73 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
native-session-executor.recoverQuiescentRunnerdState (cyclomatic 77) server/src/services/native-runtime/native-session-executor.ts:5073— native-session-executor.recoverQuiescentRunnerdState has cyclomatic complexity 77 (threshold 15). Of this number, 74 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
native-workspace-sync.readDescriptor (cyclomatic 77) server/src/services/native-runtime/native-workspace-sync.ts:451— native-workspace-sync.readDescriptor has cyclomatic complexity 77 (threshold 15). Of this number, 76 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
Row.EnvironmentVariableRow (cyclomatic 77) ui/src/components/environment-variables-editor/Row.tsx:70— Row.EnvironmentVariableRow has cyclomatic complexity 77 (threshold 15). Of this number, 50 points are the body's own statements and 27 belong to 13 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.
AgentConfigForm.DisplayedCodeLoginPanel (cyclomatic 77) ui/src/components/AgentConfigForm.tsx:2564— AgentConfigForm.DisplayedCodeLoginPanel has cyclomatic complexity 77 (threshold 15). Of this number, 30 points are the body's own statements and 47 belong to 15 function literals inside it that branch. 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.
RunTranscriptView.normalizeTranscript (cyclomatic 77) ui/src/components/transcript/RunTranscriptView.tsx:552— RunTranscriptView.normalizeTranscript has cyclomatic complexity 77 (threshold 15). Of this number, 75 points are the body's own statements and 2 belong to one function literal 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.
native-session-executor.verifyStoppedNativeSessionForContinuation (cyclomatic 76) server/src/services/native-runtime/native-session-executor.ts:2783— native-session-executor.verifyStoppedNativeSessionForContinuation has cyclomatic complexity 76 (threshold 15). Of this number, 66 points are the body's own statements and 10 belong to 5 function items inside it that branch. 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.
public-mcp.publicMcpIngressRoutes (cyclomatic 76) REDACTED:40— public-mcp.publicMcpIngressRoutes has cyclomatic complexity 76 (threshold 15). Most of this is not in the body itself: 7 of the 76 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 96, 112, 142, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
IssueThreadInteractionCard.IssueThreadInteractionCard (cyclomatic 76) ui/src/components/IssueThreadInteractionCard.tsx:3611— IssueThreadInteractionCard.IssueThreadInteractionCard has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Cases.Cases (cyclomatic 76) ui/src/pages/Cases.tsx:41— Cases.Cases has cyclomatic complexity 76 (threshold 15). Of this number, 57 points are the body's own statements and 19 belong to 11 function literals 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.
DecisionCard.DecisionCard (cyclomatic 76) ui/src/components/DecisionCard.tsx:227— DecisionCard.DecisionCard has cyclomatic complexity 76 (threshold 15). Of this number, 57 points are the body's own statements and 19 belong to 8 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.
CompanyAccess.CompanyAccess (cyclomatic 76) ui/src/pages/CompanyAccess.tsx:41— CompanyAccess.CompanyAccess has cyclomatic complexity 76 (threshold 15). Of this number, 41 points are the body's own statements and 35 belong to 17 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.
RemoteMcpConnectionSetup.RemoteMcpConnectionSetup (cyclomatic 76) ui/src/features/connections/remote-mcp/RemoteMcpConnectionSetup.tsx:40— RemoteMcpConnectionSetup.RemoteMcpConnectionSetup has cyclomatic complexity 76 (threshold 15). Of this number, 62 points are the body's own statements and 14 belong to 9 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.
durable-prp-control-plane.warmTransitionRecoveryProof (cyclomatic 75) REDACTED:780— durable-prp-control-plane.warmTransitionRecoveryProof has cyclomatic complexity 75 (threshold 15). Of this number, 69 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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.
copilot-tool-evidence.createCopilotToolEvidence (cyclomatic 75) packages/paperclip-runner/src/drivers/acpx/copilot-tool-evidence.ts:27— copilot-tool-evidence.createCopilotToolEvidence has cyclomatic complexity 75 (threshold 15). Of this number, 73 points are the body's own statements and 2 belong to one function literal 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.
connection-intents.connectionIntentService.requestWithContext (cyclomatic 75) server/src/services/connection-intents.ts:701— connection-intents.connectionIntentService.requestWithContext has cyclomatic complexity 75 (threshold 15). Of this number, 60 points are the body's own statements and 15 belong to 5 function literals 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.
lifecycle.createChatMessageLifecycle.processLifecycleDelivery (cyclomatic 75) server/src/services/chat-channels/inbound/lifecycle.ts:355— lifecycle.createChatMessageLifecycle.processLifecycleDelivery has cyclomatic complexity 75 (threshold 15). Most of this is not in the body itself: 5 of the 75 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 400, 733, 987, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
session-stop.createSlackSessionStop.processSlackSessionStop (cyclomatic 75) server/src/services/chat-channels/slack/session-stop.ts:317— session-stop.createSlackSessionStop.processSlackSessionStop has cyclomatic complexity 75 (threshold 15). Of this number, 18 points are the body's own statements and 57 belong to 4 function literals inside it that branch. 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.
PaperclipRunnerToolAuthority.#reassignTask (cyclomatic 75) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:1637— PaperclipRunnerToolAuthority.#reassignTask has cyclomatic complexity 75 (threshold 15). Of this number, 23 points are the body's own statements and 52 belong to 7 function items inside it that branch. 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.
IssueChatThread.IssueChatAssistantMessage (cyclomatic 75) ui/src/components/IssueChatThread.tsx:2293— IssueChatThread.IssueChatAssistantMessage has cyclomatic complexity 75 (threshold 15). Of this number, 67 points are the body's own statements and 8 belong to 6 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.
FileViewerSheet.FileViewerSheet (cyclomatic 75) ui/src/components/FileViewerSheet.tsx:494— FileViewerSheet.FileViewerSheet has cyclomatic complexity 75 (threshold 15). Of this number, 51 points are the body's own statements and 24 belong to 16 function literals inside it that branch. 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-admission.createAcpxConfigAdmission (cyclomatic 74) packages/paperclip-runner/src/drivers/acpx/config-admission.ts:5— config-admission.createAcpxConfigAdmission has cyclomatic complexity 74 (threshold 15). Most of this is not in the body itself: 3 of the 74 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 29, readMode, assertReady, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ai-connections.aiConnectionService.save (cyclomatic 74) server/src/services/ai-connections.ts:568— ai-connections.aiConnectionService.save has cyclomatic complexity 74 (threshold 15). Of this number, 21 points are the body's own statements and 53 belong to one function literal 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.
chat-sdk-runtime.scopeMicrosoftTeamsEgress (cyclomatic 74) server/src/services/chat-sdk-runtime.ts:1024— chat-sdk-runtime.scopeMicrosoftTeamsEgress has cyclomatic complexity 74 (threshold 15). Of this number, 29 points are the body's own statements and 45 belong to 6 function items inside it that branch. 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.
git-workspace-expiration.expireReconstructableGitWorkspace (cyclomatic 74) server/src/services/git-workspace-expiration.ts:274— git-workspace-expiration.expireReconstructableGitWorkspace has cyclomatic complexity 74 (threshold 15). Most of this is not in the body itself: 4 of the 74 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 286, 407, 362). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
worker.createChatPublicationWorker.processSelectedPublication (cyclomatic 74) server/src/services/chat-channels/publications/worker.ts:351— worker.createChatPublicationWorker.processSelectedPublication has cyclomatic complexity 74 (threshold 15). Most of this is not in the body itself: 8 of the 74 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 416, 667, 857, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
skill-version-retention.skillVersionRetentionService.pruneCompanyPage (cyclomatic 74) server/src/services/skill-version-retention.ts:243— skill-version-retention.skillVersionRetentionService.pruneCompanyPage has cyclomatic complexity 74 (threshold 15). Of this number, 48 points are the body's own statements and 26 belong to 6 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.
trace.buildTrace (cyclomatic 74) scripts/ci-profile/trace.mjs:8— trace.buildTrace has cyclomatic complexity 74 (threshold 15). Of this number, 62 points are the body's own statements and 12 belong to 5 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.
McpConnect.McpConnectRequest (cyclomatic 74) ui/src/pages/McpConnect.tsx:48— McpConnect.McpConnectRequest has cyclomatic complexity 74 (threshold 15). Of this number, 56 points are the body's own statements and 18 belong to 7 function literals inside it that branch. 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.
InlineEditor.InlineEditor (cyclomatic 74) ui/src/components/InlineEditor.tsx:58— InlineEditor.InlineEditor has cyclomatic complexity 74 (threshold 15). Of this number, 21 points are the body's own statements and 53 belong to 19 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.
TaskChatBubble.TaskChatBubbleContent (cyclomatic 74) ui/src/components/task-chat/TaskChatBubble.tsx:136— TaskChatBubble.TaskChatBubbleContent has cyclomatic complexity 74 (threshold 15). Of this number, 50 points are the body's own statements and 24 belong to 9 function literals 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.
IssueBlockedNotice.IssueBlockedNotice (cyclomatic 74) ui/src/components/IssueBlockedNotice.tsx:401— IssueBlockedNotice.IssueBlockedNotice has cyclomatic complexity 74 (threshold 15). Of this number, 56 points are the body's own statements and 18 belong to 5 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.
DurablePrpControlPlane.#event (cyclomatic 73) REDACTED:3112— DurablePrpControlPlane.#event has cyclomatic complexity 73 (threshold 15). Of this number, 63 points are the body's own statements and 10 belong to 3 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.
report.summarizeControlledCampaign (cyclomatic 73) packages/paperclip-runner/scripts/controlled-evals/report.mjs:7— report.summarizeControlledCampaign has cyclomatic complexity 73 (threshold 15). Of this number, 67 points are the body's own statements and 6 belong to 3 function items inside it that branch. 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.
plugin-loader.pluginLoader (cyclomatic 73) REDACTED:1147— plugin-loader.pluginLoader 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. This shape REPEATS in the file: 2 other methods here (plugin-loader.pluginLoader::fetchAndValidate, plugin-loader.pluginLoader::activatePlugin) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
service.createConnectionTokenBroker.mintConnectionTokenForAgent (cyclomatic 73) server/src/services/tool-access/token-broker/service.ts:46— service.createConnectionTokenBroker.mintConnectionTokenForAgent has cyclomatic complexity 73 (threshold 15). Of this number, 68 points are the body's own statements and 5 belong to 5 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.
environment-probe.probeEnvironment (cyclomatic 73) server/src/services/environment-probe.ts:70— environment-probe.probeEnvironment 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.
task-markdown.buildPaperclipTaskMarkdown (cyclomatic 73) server/src/services/heartbeat/task-markdown.ts:7— task-markdown.buildPaperclipTaskMarkdown has cyclomatic complexity 73 (threshold 15). Of this number, 68 points are the body's own statements and 5 belong to 3 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.
ComposerModelPickerPreview.ComposerModelPickerPreview (cyclomatic 73) ui/storybook/prototypes/composer-model-picker/ComposerModelPickerPreview.tsx:66— ComposerModelPickerPreview.ComposerModelPickerPreview has cyclomatic complexity 73 (threshold 15). Of this number, 47 points are the body's own statements and 26 belong to 12 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.
webhook-ingress.createGitHubWebhookIngress.stageGitHubWebhookIngress (cyclomatic 72) server/src/services/chat-channels/github/webhook-ingress.ts:245— webhook-ingress.createGitHubWebhookIngress.stageGitHubWebhookIngress has cyclomatic complexity 72 (threshold 15). Of this number, 24 points are the body's own statements and 48 belong to 2 function literals 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.
app.SettingsBody (cyclomatic 72) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:5788— app.SettingsBody has cyclomatic complexity 72 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: one other method here (app.SettingsBody::fixAllConfigurationErrors) 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.
IssueDocumentAnnotations.IssueDocumentAnnotations (cyclomatic 72) ui/src/components/IssueDocumentAnnotations.tsx:60— IssueDocumentAnnotations.IssueDocumentAnnotations has cyclomatic complexity 72 (threshold 15). Of this number, 41 points are the body's own statements and 31 belong to 14 function literals inside it that branch. 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.
CompanySkills.DiscoveryGrid (cyclomatic 72) ui/src/pages/CompanySkills.tsx:1029— CompanySkills.DiscoveryGrid has cyclomatic complexity 72 (threshold 15). Of this number, 58 points are the body's own statements and 14 belong to 7 function literals 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.
ImportFromVaultDialog.ImportFromVaultDialog (cyclomatic 72) ui/src/pages/secrets/ImportFromVaultDialog.tsx:331— ImportFromVaultDialog.ImportFromVaultDialog has cyclomatic complexity 72 (threshold 15). Of this number, 16 points are the body's own statements and 56 belong to 23 function items inside it that branch. 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.
capability-mock-control-plane-adapter.isSemanticToolRuntimeSnapshot (cyclomatic 71) packages/paperclip-runner/src/mock-core/capability-mock-control-plane-adapter.ts:1897— capability-mock-control-plane-adapter.isSemanticToolRuntimeSnapshot has cyclomatic complexity 71 (threshold 15). Most of this is not in the body itself: 13 of the 71 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1923, 2032, 2026). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
manifest.validateManifest (cyclomatic 71) packages/paperclip-runner/scripts/controlled-evals/manifest.mjs:35— manifest.validateManifest has cyclomatic complexity 71 (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.
plugin-workspaces.preparePluginWorkspace (cyclomatic 71) server/src/services/plugin-workspaces.ts:165— plugin-workspaces.preparePluginWorkspace has cyclomatic complexity 71 (threshold 15). Of this number, 42 points are the body's own statements and 29 belong to 3 function items inside it that branch. 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.
skill-sources.skillSourceService.refresh (cyclomatic 71) server/src/services/skill-sources.ts:224— skill-sources.skillSourceService.refresh has cyclomatic complexity 71 (threshold 15). Of this number, 45 points are the body's own statements and 26 belong to 6 function literals 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.
SummarySlotCard.SummarySlotCard (cyclomatic 71) ui/src/components/SummarySlotCard.tsx:135— SummarySlotCard.SummarySlotCard has cyclomatic complexity 71 (threshold 15). Of this number, 64 points are the body's own statements and 7 belong to 6 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.
execute.execute (cyclomatic 70) packages/adapters/cursor-local/src/server/execute.ts:194— execute.execute has cyclomatic complexity 70 (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 shape REPEATS in the file: one other method here (execute.execute::toResult) 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.
browser-use.browserUseService.execute::admissionCheck (cyclomatic 70) server/src/services/browser-use.ts:430— browser-use.browserUseService.execute::admissionCheck has cyclomatic complexity 70 (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. This shape REPEATS in the file: one other method here (browser-use.browserUseService.execute) 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.
runner-goals.applyRunnerGoalPrpEvent (cyclomatic 70) server/src/services/runner-goals.ts:632— runner-goals.applyRunnerGoalPrpEvent has cyclomatic complexity 70 (threshold 15). Most of this is not in the body itself: 4 of the 70 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 660, 695). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-execution-input.buildNativeExecutionInput (cyclomatic 70) server/src/services/native-runtime/native-execution-input.ts:142— native-execution-input.buildNativeExecutionInput has cyclomatic complexity 70 (threshold 15). Of this number, 65 points are the body's own statements and 5 belong to 3 function literals 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.
execution-configuration.prepareHeartbeatExecutionConfiguration (cyclomatic 70) server/src/services/heartbeat/execution-configuration.ts:87— execution-configuration.prepareHeartbeatExecutionConfiguration has cyclomatic complexity 70 (threshold 15). Of this number, 51 points are the body's own statements and 19 belong to 6 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.
customer-success-inspection.readCustomerSuccessResource (cyclomatic 70) server/src/services/customer-success-inspection.ts:134— customer-success-inspection.readCustomerSuccessResource has cyclomatic complexity 70 (threshold 15). Most of this is not in the body itself: 1 of the 70 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 140, 216). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AiConnectionField.AiConnectionField (cyclomatic 70) ui/src/components/ai-connections/AiConnectionField.tsx:44— AiConnectionField.AiConnectionField has cyclomatic complexity 70 (threshold 15). Of this number, 56 points are the body's own statements and 14 belong to 9 function items inside it that branch. 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.
index.parsePrpEvent (cyclomatic 70) ui/src/adapters/paperclip-runner/index.ts:685— index.parsePrpEvent 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.
WhatNeedsMe.WhatNeedsMe (cyclomatic 70) ui/src/pages/WhatNeedsMe.tsx:87— WhatNeedsMe.WhatNeedsMe has cyclomatic complexity 70 (threshold 15). Most of this is not in the body itself: 15 of the 70 points are its own statements and the rest belongs to 26 function items inside it that branch (a function literal at line 467, a function literal at line 563, a function literal at line 361, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CapabilityLiveSession.#handleNotification (cyclomatic 69) packages/paperclip-runner/src/live/live-session.ts:2768— CapabilityLiveSession.#handleNotification has cyclomatic complexity 69 (threshold 15). Of this number, 59 points are the body's own statements and 10 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.
question-response-delivery.questionResponseDeliveryService.deliver (cyclomatic 69) server/src/services/question-response-delivery.ts:740— question-response-delivery.questionResponseDeliveryService.deliver has cyclomatic complexity 69 (threshold 15). Of this number, 65 points are the body's own statements and 4 belong to 3 function literals 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.
execution-workspace-repositories.executionWorkspaceRepositoryService.prepareForAdmission (cyclomatic 69) server/src/services/execution-workspace-repositories.ts:321— execution-workspace-repositories.executionWorkspaceRepositoryService.prepareForAdmission has cyclomatic complexity 69 (threshold 15). Most of this is not in the body itself: 9 of the 69 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 378, 336, 379, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-runtime.ensurePersistedExecutionWorkspaceAvailable (cyclomatic 69) server/src/services/workspace-runtime.ts:3783— workspace-runtime.ensurePersistedExecutionWorkspaceAvailable has cyclomatic complexity 69 (threshold 15). Of this number, 48 points are the body's own statements and 21 belong to 5 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.
ai-connection-runtime.prepareManagedAiRuntime (cyclomatic 69) server/src/services/ai-connection-runtime.ts:225— ai-connection-runtime.prepareManagedAiRuntime has cyclomatic complexity 69 (threshold 15). Of this number, 45 points are the body's own statements and 24 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.
native-continuation.buildNativeContinuationPrompt (cyclomatic 69) server/src/services/native-runtime/native-continuation.ts:8— native-continuation.buildNativeContinuationPrompt has cyclomatic complexity 69 (threshold 15). Of this number, 63 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
adapters.adapterRoutes (cyclomatic 69) server/src/routes/adapters.ts:264— adapters.adapterRoutes has cyclomatic complexity 69 (threshold 15). Most of this is not in the body itself: 1 of the 69 points is its own statement and the rest belongs to 10 function literals inside it that branch (lines 324, 278, 669, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ProjectWorkspaceDetail.ProjectWorkspaceDetail (cyclomatic 69) ui/src/pages/ProjectWorkspaceDetail.tsx:248— ProjectWorkspaceDetail.ProjectWorkspaceDetail has cyclomatic complexity 69 (threshold 15). Of this number, 37 points are the body's own statements and 32 belong to 26 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.
CompanyImport.CompanyImport (cyclomatic 69) ui/src/pages/CompanyImport.tsx:921— CompanyImport.CompanyImport 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. This shape REPEATS in the file: one other method here (CompanyImport.CompanyImport::buildFinalAdapterOverrides) 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.
chat-control-chronology.readChatControlChronology (cyclomatic 68) server/src/services/chat-control-chronology.ts:76— chat-control-chronology.readChatControlChronology has cyclomatic complexity 68 (threshold 15). Of this number, 61 points are the body's own statements and 7 belong to 3 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.
chat-github-wizard.githubChatWizardService.advanceOnce (cyclomatic 68) server/src/services/chat-github-wizard.ts:685— chat-github-wizard.githubChatWizardService.advanceOnce has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
issue-graph-liveness.classifyIssueGraphLiveness (cyclomatic 68) server/src/services/recovery/issue-graph-liveness.ts:487— issue-graph-liveness.classifyIssueGraphLiveness has cyclomatic complexity 68 (threshold 15). Of this number, 22 points are the body's own statements and 46 belong to 6 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.
issues.listIssueBlockedInboxAttentionMap (cyclomatic 68) server/src/services/issues.ts:5621— issues.listIssueBlockedInboxAttentionMap has cyclomatic complexity 68 (threshold 15). Of this number, 54 points are the body's own statements and 14 belong to 6 function literals 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.
NewIssueDialog.NewIssueDialog (cyclomatic 68) ui/src/components/NewIssueDialog.tsx:279— NewIssueDialog.NewIssueDialog has cyclomatic complexity 68 (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 shape REPEATS in the file: one other method here (NewIssueDialog.NewIssueDialog::handleSubmit) 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.
AsciiArtAnimation.AsciiArtAnimation (cyclomatic 68) ui/src/components/AsciiArtAnimation.tsx:62— AsciiArtAnimation.AsciiArtAnimation has cyclomatic complexity 68 (threshold 15). Most of this is not in the body itself: 1 of the 68 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 208, 114, 277, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AuditFeed.production.AuditFeed (cyclomatic 68) ui/src/pages/audit/AuditFeed.production.tsx:260— AuditFeed.production.AuditFeed has cyclomatic complexity 68 (threshold 15). Of this number, 55 points are the body's own statements and 13 belong to 6 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.
question-set.parsePaperclipQuestionSet.questions (cyclomatic 67) REDACTED:143— question-set.parsePaperclipQuestionSet.questions has cyclomatic complexity 67 (threshold 15). Of this number, 62 points are the body's own statements and 5 belong to one function literal 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.
DurablePrpControlPlane.#authorizeHello (cyclomatic 67) REDACTED:2310— DurablePrpControlPlane.#authorizeHello has cyclomatic complexity 67 (threshold 15). Of this number, 66 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
acpx-runtime-sidecar.dispatch (cyclomatic 67) packages/paperclip-runner/src/cli/acpx-runtime-sidecar.ts:251— acpx-runtime-sidecar.dispatch has cyclomatic complexity 67 (threshold 15). Of this number, 64 points are the body's own statements and 3 belong to 3 function literals 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.
live-workflow-executor.executeLiveRunnerWorkflow (cyclomatic 67) packages/paperclip-runner/src/eval/live-workflow-executor.ts:765— live-workflow-executor.executeLiveRunnerWorkflow has cyclomatic complexity 67 (threshold 15). Of this number, 58 points are the body's own statements and 9 belong to 4 function items inside it that branch. 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.
postgres.changeLockedAgent (cyclomatic 67) server/src/modules/agent-lifecycle/adapters/postgres.ts:17— postgres.changeLockedAgent has cyclomatic complexity 67 (threshold 15). Of this number, 65 points are the body's own statements and 2 belong to 2 function literals 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.
chat-publication-errors.classifyChatPublicationError (cyclomatic 67) server/src/services/chat-publication-errors.ts:145— chat-publication-errors.classifyChatPublicationError has cyclomatic complexity 67 (threshold 15). Of this number, 65 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
connection-intents.connectionIntentService.search (cyclomatic 67) server/src/services/connection-intents.ts:416— connection-intents.connectionIntentService.search has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (connection-intents.connectionIntentService.search::aggregatorAlternatives) 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.
publication.createToolCatalogPublication::refreshCatalog (cyclomatic 67) server/src/services/tool-access/catalog/publication.ts:49— publication.createToolCatalogPublication::refreshCatalog has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
IssueFiltersPopover.IssueFiltersPopover (cyclomatic 67) ui/src/components/IssueFiltersPopover.tsx:104— IssueFiltersPopover.IssueFiltersPopover has cyclomatic complexity 67 (threshold 15). Of this number, 47 points are the body's own statements and 20 belong to 9 function literals 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.
ChatEndpointDetail.ChatEndpointDetail (cyclomatic 67) ui/src/pages/apps/chat/ChatEndpointDetail.tsx:245— ChatEndpointDetail.ChatEndpointDetail has cyclomatic complexity 67 (threshold 15). Of this number, 63 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
ConnectionSetupFlow.AccessStepContent (cyclomatic 67) ui/src/features/connections/ConnectionSetupFlow.tsx:4235— ConnectionSetupFlow.AccessStepContent has cyclomatic complexity 67 (threshold 15). Of this number, 63 points are the body's own statements and 4 belong to 2 function literals 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.
PrimaryAgentStory.installFixtures (cyclomatic 67) ui/storybook/support/primary-agent/PrimaryAgentStory.tsx:73— PrimaryAgentStory.installFixtures has cyclomatic complexity 67 (threshold 15). Most of this is not in the body itself: 15 of the 67 points are its own statements and the rest belongs to one function literal inside it that branches (line 75). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
build-config.buildPaperclipRunnerConfig (cyclomatic 66) packages/adapters/codex-local/src/ui/build-config.ts:76— build-config.buildPaperclipRunnerConfig has cyclomatic complexity 66 (threshold 15). Of this number, 59 points are the body's own statements and 7 belong to one function item inside it that branches. 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.
runnerd-codex-transport.probeNativeRunnerEnvironment (cyclomatic 66) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:7222— runnerd-codex-transport.probeNativeRunnerEnvironment has cyclomatic complexity 66 (threshold 15). Of this number, 38 points are the body's own statements and 28 belong to 3 function literals 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.
built-in-agents.builtInAgentService.materializeInstructions (cyclomatic 66) server/src/services/built-in-agents.ts:965— built-in-agents.builtInAgentService.materializeInstructions has cyclomatic complexity 66 (threshold 15). Of this number, 29 points are the body's own statements and 37 belong to 2 function literals 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.
status-decision-committer.materializeDecisionEffect (cyclomatic 66) server/src/services/native-runtime/status-decision-committer.ts:532— status-decision-committer.materializeDecisionEffect 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.
ChatSdkEndpointRuntime.rehydrateAttachment (cyclomatic 65) server/src/services/chat-sdk-runtime.ts:2922— ChatSdkEndpointRuntime.rehydrateAttachment has cyclomatic complexity 65 (threshold 15). Of this number, 58 points are the body's own statements and 7 belong to one function item inside it that branches. 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.
chat-sdk-runtime.installDiscordNativeCommands (cyclomatic 65) server/src/services/chat-sdk-runtime.ts:710— chat-sdk-runtime.installDiscordNativeCommands has cyclomatic complexity 65 (threshold 15). Of this number, 22 points are the body's own statements and 43 belong to 2 function items inside it that branch. 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.
chat-teams-file-publication.projectTeamsFilePublication (cyclomatic 65) server/src/services/chat-teams-file-publication.ts:93— chat-teams-file-publication.projectTeamsFilePublication 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.
issue-tree-control.issueTreeControlRoutes (cyclomatic 65) server/src/routes/issue-tree-control.ts:49— issue-tree-control.issueTreeControlRoutes has cyclomatic complexity 65 (threshold 15). Most of this is not in the body itself: 1 of the 65 points is its own statement and the rest belongs to 8 function items inside it that branch (a function literal at line 123, a function literal at line 416, a function literal at line 374, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentActionButtons.AgentActionButtons (cyclomatic 65) ui/src/components/AgentActionButtons.tsx:158— AgentActionButtons.AgentActionButtons has cyclomatic complexity 65 (threshold 15). Of this number, 26 points are the body's own statements and 39 belong to 15 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.
protocol-contract.assertQuestionAdapterFixture (cyclomatic 64) REDACTED:209— protocol-contract.assertQuestionAdapterFixture has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AcpxRuntimeHost.open (cyclomatic 64) packages/paperclip-runner/src/drivers/acpx/runtime-host.ts:331— AcpxRuntimeHost.open has cyclomatic complexity 64 (threshold 15). Of this number, 44 points are the body's own statements and 20 belong to 7 function items inside it that branch. 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.
index.vercelClient.invoke (cyclomatic 64) server/src/services/connectors/vercel/index.ts:119— index.vercelClient.invoke has cyclomatic complexity 64 (threshold 15). Of this number, 62 points are the body's own statements and 2 belong to 2 function literals 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.
connection-intents.connectionIntentService.complete (cyclomatic 64) server/src/services/connection-intents.ts:966— connection-intents.connectionIntentService.complete has cyclomatic complexity 64 (threshold 15). Most of this is not in the body itself: 6 of the 64 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 988, 1092, 1115, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
envelope.createInboundEnvelope.prepareInboundEnvelope (cyclomatic 64) server/src/services/chat-channels/inbound/envelope.ts:86— envelope.createInboundEnvelope.prepareInboundEnvelope has cyclomatic complexity 64 (threshold 15). Of this number, 59 points are the body's own statements and 5 belong to 2 function literals 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.
queue.createHeartbeatQueue.claimQueuedRun (cyclomatic 64) server/src/services/heartbeat/queue.ts:944— queue.createHeartbeatQueue.claimQueuedRun has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (queue.createHeartbeatQueue.claimQueuedRun::lockIssueExecutionClaim) 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.
company-artifacts.companyArtifactsService.list (cyclomatic 64) server/src/services/company-artifacts.ts:321— company-artifacts.companyArtifactsService.list has cyclomatic complexity 64 (threshold 15). Of this number, 58 points are the body's own statements and 6 belong to one function literal 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.
skill-source-github-access.skillSourceGitHubReader (cyclomatic 64) server/src/services/skill-source-github-access.ts:18— skill-source-github-access.skillSourceGitHubReader has cyclomatic complexity 64 (threshold 15). Most of this is not in the body itself: 4 of the 64 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 94, authorized, headers, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
MuseRunnerConnection.MuseConnectionDetails (cyclomatic 64) ui/src/components/MuseRunnerConnection.tsx:31— MuseRunnerConnection.MuseConnectionDetails has cyclomatic complexity 64 (threshold 15). Of this number, 60 points are the body's own statements and 4 belong to 4 function items inside it that branch. 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.
RoutineRunVariablesDialog.RoutineRunVariablesDialog (cyclomatic 64) ui/src/components/RoutineRunVariablesDialog.tsx:186— RoutineRunVariablesDialog.RoutineRunVariablesDialog has cyclomatic complexity 64 (threshold 15). Of this number, 19 points are the body's own statements and 45 belong to 18 function literals 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.
BulkAgentSettingsProposal.BulkEditor (cyclomatic 64) ui/storybook/support/design-proposals/BulkAgentSettingsProposal.tsx:33— BulkAgentSettingsProposal.BulkEditor has cyclomatic complexity 64 (threshold 15). Of this number, 46 points are the body's own statements and 18 belong to 5 function items inside it that branch. 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.
CodexAppServerDriver.recoverSession (cyclomatic 63) packages/paperclip-runner/src/drivers/codex/codex-app-server-driver-impl.ts:367— CodexAppServerDriver.recoverSession has cyclomatic complexity 63 (threshold 15). Of this number, 62 points are the body's own statements and 1 belongs to one function literal 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.
chat-github-reviews.githubChatReviewService.processPublication (cyclomatic 63) server/src/services/chat-github-reviews.ts:1009— chat-github-reviews.githubChatReviewService.processPublication has cyclomatic complexity 63 (threshold 15). Most of this is not in the body itself: 5 of the 63 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 1064, 1478, 1083, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-session-executor.readRemoteProviderPackIdentity (cyclomatic 63) server/src/services/native-runtime/native-session-executor.ts:10406— native-session-executor.readRemoteProviderPackIdentity 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.
health.healthRoutes (cyclomatic 63) server/src/routes/health.ts:120— health.healthRoutes has cyclomatic complexity 63 (threshold 15). Most of this is not in the body itself: 1 of the 63 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 233, 140). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentConfigForm.ModelDropdown (cyclomatic 63) ui/src/components/AgentConfigForm.tsx:3903— AgentConfigForm.ModelDropdown has cyclomatic complexity 63 (threshold 15). Of this number, 41 points are the body's own statements and 22 belong to 11 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.
TaskBrowserPanel.TaskBrowserPanel (cyclomatic 63) ui/src/components/task-side-panel/TaskBrowserPanel.tsx:10— TaskBrowserPanel.TaskBrowserPanel has cyclomatic complexity 63 (threshold 15). Of this number, 40 points are the body's own statements and 23 belong to 7 function literals 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.
ManagedSlackSetup.ManagedSlackSetup (cyclomatic 63) ui/src/pages/apps/chat/slack/ManagedSlackSetup.tsx:14— ManagedSlackSetup.ManagedSlackSetup has cyclomatic complexity 63 (threshold 15). Of this number, 40 points are the body's own statements and 23 belong to 5 function items inside it that branch. 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.
chat-channels.chatChannelService.runtimeFor (cyclomatic 62) server/src/services/chat-channels.ts:893— chat-channels.chatChannelService.runtimeFor has cyclomatic complexity 62 (threshold 15). Of this number, 29 points are the body's own statements and 33 belong to one function literal 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.
native-run-finalizer.recordRetryableFailure (cyclomatic 62) server/src/services/native-runtime/native-run-finalizer.ts:240— native-run-finalizer.recordRetryableFailure has cyclomatic complexity 62 (threshold 15). Most of this is not in the body itself: 4 of the 62 points are its own statements and the rest belongs to one function literal inside it that branches (line 263). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
app.PageDetail (cyclomatic 62) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:3236— app.PageDetail has cyclomatic complexity 62 (threshold 15). Of this number, 39 points are the body's own statements and 23 belong to 7 function literals 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.
prepare-bundled-package.stageBundledProviderOptionalDependencies (cyclomatic 62) scripts/prepare-bundled-package.mjs:95— prepare-bundled-package.stageBundledProviderOptionalDependencies has cyclomatic complexity 62 (threshold 15). Of this number, 54 points are the body's own statements and 8 belong to 3 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.
muse-qualification-report.qualificationReport (cyclomatic 62) scripts/smoke/muse-qualification-report.mjs:19— muse-qualification-report.qualificationReport has cyclomatic complexity 62 (threshold 15). Of this number, 61 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
IssueWorkspaceCard.IssueWorkspaceCard (cyclomatic 62) ui/src/components/IssueWorkspaceCard.tsx:187— IssueWorkspaceCard.IssueWorkspaceCard has cyclomatic complexity 62 (threshold 15). Of this number, 52 points are the body's own statements and 10 belong to 6 function literals inside it that branch. 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.
GitHubBotConfiguration.GitHubAccessEditor (cyclomatic 62) ui/src/pages/apps/chat/GitHubBotConfiguration.tsx:574— GitHubBotConfiguration.GitHubAccessEditor has cyclomatic complexity 62 (threshold 15). Of this number, 31 points are the body's own statements and 31 belong to 13 function items inside it that branch. 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.
WorkTimelineChart.WorkTimelineChart (cyclomatic 62) ui/src/components/timeline/WorkTimelineChart.tsx:252— WorkTimelineChart.WorkTimelineChart has cyclomatic complexity 62 (threshold 15). Most of this is not in the body itself: 8 of the 62 points are its own statements and the rest belongs to 18 function items inside it that branch (a function literal at line 591, a function literal at line 301, a function literal at line 339, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
RemoteMcpConnectionReview.RemoteMcpConnectionReview (cyclomatic 62) ui/storybook/prototypes/RemoteMcpConnectionReview.tsx:14— RemoteMcpConnectionReview.RemoteMcpConnectionReview has cyclomatic complexity 62 (threshold 15). Most of this is not in the body itself: 11 of the 62 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 54, a function literal at line 95, a function literal at line 37, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
capability-issue-thread-server.harnessConfiguration (cyclomatic 61) packages/paperclip-runner/scripts/capability-issue-thread-server.mjs:206— capability-issue-thread-server.harnessConfiguration 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.
codex-acpx-driver.validateRecoverySnapshot (cyclomatic 61) REDACTED:2129— codex-acpx-driver.validateRecoverySnapshot has cyclomatic complexity 61 (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.
native-workspace-reconstruction.validateNativeWorkspaceReconstruction (cyclomatic 61) server/src/services/native-runtime/native-workspace-reconstruction.ts:38— native-workspace-reconstruction.validateNativeWorkspaceReconstruction has cyclomatic complexity 61 (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.
receipt-reactions.createReceiptReactions.processReceiptReactionWithCredentialLease (cyclomatic 61) server/src/services/chat-channels/receipt-reactions.ts:193— receipt-reactions.createReceiptReactions.processReceiptReactionWithCredentialLease has cyclomatic complexity 61 (threshold 15). Of this number, 43 points are the body's own statements and 18 belong to 6 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.
transport.createChatPublicationTransport.postSafePublication (cyclomatic 61) server/src/services/chat-channels/publications/transport.ts:193— transport.createChatPublicationTransport.postSafePublication has cyclomatic complexity 61 (threshold 15). Of this number, 53 points are the body's own statements and 8 belong to 7 function literals 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.
activity.createChatActivity.listActivity (cyclomatic 61) server/src/services/chat-channels/activity.ts:164— activity.createChatActivity.listActivity has cyclomatic complexity 61 (threshold 15). Most of this is not in the body itself: 8 of the 61 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 336, a function literal at line 468, a function literal at line 412, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
environment-execution-target.resolveEnvironmentExecutionTarget (cyclomatic 61) server/src/services/environment-execution-target.ts:227— environment-execution-target.resolveEnvironmentExecutionTarget has cyclomatic complexity 61 (threshold 15). Of this number, 46 points are the body's own statements and 15 belong to 3 function literals 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.
agent-auth-jwt.verifyLocalAgentJwt (cyclomatic 61) server/src/agent-auth-jwt.ts:166— agent-auth-jwt.verifyLocalAgentJwt 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.createApp (cyclomatic 61) REDACTED:504— app.createApp has cyclomatic complexity 61 (threshold 15). Of this number, 30 points are the body's own statements and 31 belong to 20 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.
GrokBotSetupContent.GrokBotSetupContent (cyclomatic 61) ui/src/components/new-agent/GrokBotSetupContent.tsx:27— GrokBotSetupContent.GrokBotSetupContent has cyclomatic complexity 61 (threshold 15). Of this number, 56 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
CloudAccessGate.CloudAccessGate (cyclomatic 61) ui/src/components/CloudAccessGate.tsx:68— CloudAccessGate.CloudAccessGate has cyclomatic complexity 61 (threshold 15). Of this number, 41 points are the body's own statements and 20 belong to 8 function literals 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.
CompanySkills.production.DiscoveryGrid (cyclomatic 61) ui/src/pages/CompanySkills.production.tsx:1022— CompanySkills.production.DiscoveryGrid has cyclomatic complexity 61 (threshold 15). Of this number, 50 points are the body's own statements and 11 belong to 6 function literals 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.
cursor-mode.createCursorModeAdmission (cyclomatic 60) packages/paperclip-runner/src/drivers/acpx/cursor-mode.ts:15— cursor-mode.createCursorModeAdmission has cyclomatic complexity 60 (threshold 15). Most of this is not in the body itself: 2 of the 60 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 38, readMode, assertReady, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
fast-responses.fastResponseService.process (cyclomatic 60) server/src/services/fast-responses.ts:664— fast-responses.fastResponseService.process has cyclomatic complexity 60 (threshold 15). Of this number, 31 points are the body's own statements and 29 belong to 3 function literals 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.
postgres.createPostgresWakeQueueAdapter.withIssueExecutionLock (cyclomatic 60) server/src/modules/wake-queue/adapters/postgres.ts:1051— postgres.createPostgresWakeQueueAdapter.withIssueExecutionLock has cyclomatic complexity 60 (threshold 15). Most of this is not in the body itself: 1 of the 60 points is its own statement and the rest belongs to one function literal inside it that branches (line 1052). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
worker-rpc-host.startWorkerRpcHost.dispatchMethod (cyclomatic 60) packages/plugins/sdk/src/worker-rpc-host.ts:1629— worker-rpc-host.startWorkerRpcHost.dispatchMethod has cyclomatic complexity 60 (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.
secrets.secretRoutes (cyclomatic 60) server/src/routes/secrets.ts:109— secrets.secretRoutes has cyclomatic complexity 60 (threshold 15). Most of this is not in the body itself: 1 of the 60 points is its own statement and the rest belongs to 25 function items inside it that branch (agentSecretContext, boardProposalView, a function literal at line 1032, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TaskChatProtocolCard.RuntimeRequestCard (cyclomatic 60) ui/src/components/task-chat/TaskChatProtocolCard.tsx:686— TaskChatProtocolCard.RuntimeRequestCard has cyclomatic complexity 60 (threshold 15). Of this number, 39 points are the body's own statements and 21 belong to 10 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.
IssueThreadInteractionCard.AskUserQuestionsCard (cyclomatic 60) ui/src/components/IssueThreadInteractionCard.tsx:1034— IssueThreadInteractionCard.AskUserQuestionsCard has cyclomatic complexity 60 (threshold 15). Of this number, 26 points are the body's own statements and 34 belong to 13 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.
format-event.printClaudeStreamEvent (cyclomatic 59) packages/adapters/claude-local/src/cli/format-event.ts:42— format-event.printClaudeStreamEvent 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.
capability-issue-thread-server.createCapabilityIssueThreadMiddleware::middleware (cyclomatic 59) packages/paperclip-runner/scripts/capability-issue-thread-server.mjs:761— capability-issue-thread-server.createCapabilityIssueThreadMiddleware::middleware 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.
runner-tool-bridge.handleRequest (cyclomatic 59) packages/paperclip-runner/src/drivers/runner-tool-bridge.ts:206— runner-tool-bridge.handleRequest has cyclomatic complexity 59 (threshold 15). Of this number, 42 points are the body's own statements and 17 belong to 6 function items inside it that branch. 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.
provider-profile.resolvePaperclipRunnerNativeProviderInput (cyclomatic 59) server/src/services/native-runtime/provider-profile.ts:591— provider-profile.resolvePaperclipRunnerNativeProviderInput has cyclomatic complexity 59 (threshold 15). Of this number, 58 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.
discovery.createToolCatalogDiscovery.remoteTools (cyclomatic 59) server/src/services/tool-access/catalog/discovery.ts:66— discovery.createToolCatalogDiscovery.remoteTools has cyclomatic complexity 59 (threshold 15). Of this number, 57 points are the body's own statements and 2 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.
issues.freshChatSourceAfterPublishedControl (cyclomatic 59) server/src/services/issues.ts:772— issues.freshChatSourceAfterPublishedControl has cyclomatic complexity 59 (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.
WorkspaceBaseRefRecovery.WorkspaceBaseRefRecoveryProvider (cyclomatic 59) ui/src/components/WorkspaceBaseRefRecovery.tsx:35— WorkspaceBaseRefRecovery.WorkspaceBaseRefRecoveryProvider has cyclomatic complexity 59 (threshold 15). Of this number, 56 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
DesignSandboxTaskThread.PreviewCase (cyclomatic 59) ui/src/components/design-sandbox/DesignSandboxTaskThread.tsx:82— DesignSandboxTaskThread.PreviewCase has cyclomatic complexity 59 (threshold 15). Of this number, 38 points are the body's own statements and 21 belong to 6 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.
connect-flow-preview-main.ConnectFlowPreview (cyclomatic 59) ui/src/connect-flow-preview-main.tsx:117— connect-flow-preview-main.ConnectFlowPreview has cyclomatic complexity 59 (threshold 15). Of this number, 37 points are the body's own statements and 22 belong to 8 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.
installation-integrity.verifyQualifiedAcpxInstallation (cyclomatic 58) packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts:650— installation-integrity.verifyQualifiedAcpxInstallation 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.
eval-session-contract.parseEvalSessionRequest (cyclomatic 58) packages/paperclip-runner/src/cli/eval-session-contract.ts:225— eval-session-contract.parseEvalSessionRequest 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.
ai-connection-usage.claude (cyclomatic 58) server/src/services/ai-connection-usage.ts:171— ai-connection-usage.claude has cyclomatic complexity 58 (threshold 15). Of this number, 25 points are the body's own statements and 33 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.
native-workspace-finalization-ownership.withNativeWorkspaceFinalizationOwnership (cyclomatic 58) server/src/services/native-runtime/native-workspace-finalization-ownership.ts:65— native-workspace-finalization-ownership.withNativeWorkspaceFinalizationOwnership has cyclomatic complexity 58 (threshold 15). Most of this is not in the body itself: 5 of the 58 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 85, 94, 127, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
environment-run-orchestrator.environmentRunOrchestrator.realizeForRun (cyclomatic 58) server/src/services/environment-run-orchestrator.ts:398— environment-run-orchestrator.environmentRunOrchestrator.realizeForRun has cyclomatic complexity 58 (threshold 15). Of this number, 55 points are the body's own statements and 3 belong to one function literal 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.
task-context.prepareHeartbeatTaskContext (cyclomatic 58) server/src/services/heartbeat/task-context.ts:53— task-context.prepareHeartbeatTaskContext has cyclomatic complexity 58 (threshold 15). Of this number, 55 points are the body's own statements and 3 belong to 2 function items inside it that branch. 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.
execute.execute (cyclomatic 58) packages/plugins/sandbox-providers/createos/src/execute.ts:92— execute.execute 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.
company-portability.buildLegacyRoutineTriggerFromRecurrence (cyclomatic 58) server/src/services/company-portability.ts:1642— company-portability.buildLegacyRoutineTriggerFromRecurrence has cyclomatic complexity 58 (threshold 15). Of this number, 50 points are the body's own statements and 8 belong to 4 function literals 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.
live-events-ws.setupLiveEventsWebSocketServer (cyclomatic 58) server/src/realtime/live-events-ws.ts:242— live-events-ws.setupLiveEventsWebSocketServer has cyclomatic complexity 58 (threshold 15). Most of this is not in the body itself: 1 of the 58 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 279, 355, 399, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
config-fields.OpenClawGatewayConfigFields (cyclomatic 58) ui/src/adapters/openclaw-gateway/config-fields.tsx:104— config-fields.OpenClawGatewayConfigFields has cyclomatic complexity 58 (threshold 15). Of this number, 27 points are the body's own statements and 31 belong to 15 function items inside it that branch. 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.
index.EnvironmentVariablesEditor (cyclomatic 58) ui/src/components/environment-variables-editor/index.tsx:150— index.EnvironmentVariablesEditor has cyclomatic complexity 58 (threshold 15). Most of this is not in the body itself: 13 of the 58 points are its own statements and the rest belongs to 20 function items inside it that branch (a function literal at line 313, bindRecentSecret, a function literal at line 211, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
IssueThreadInteractionCard.RequestItemVerdictsCard (cyclomatic 58) ui/src/components/IssueThreadInteractionCard.tsx:3248— IssueThreadInteractionCard.RequestItemVerdictsCard has cyclomatic complexity 58 (threshold 15). Of this number, 25 points are the body's own statements and 33 belong to 9 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.
Dashboard.Dashboard (cyclomatic 58) ui/src/pages/Dashboard.tsx:76— Dashboard.Dashboard has cyclomatic complexity 58 (threshold 15). Of this number, 31 points are the body's own statements and 27 belong to 14 function items inside it that branch. 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.
CompanySkills.SkillDetailPage (cyclomatic 58) ui/src/pages/CompanySkills.tsx:2755— CompanySkills.SkillDetailPage 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. This shape REPEATS in the file: one other method here (CompanySkills.SkillDetailPage::renderFilesBody) 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.
CompanySkills.production.SkillDetailPage (cyclomatic 58) ui/src/pages/CompanySkills.production.tsx:2845— CompanySkills.production.SkillDetailPage 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. This shape REPEATS in the file: one other method here (CompanySkills.production.SkillDetailPage::renderFilesBody) 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.
durable-prp-control-plane.isStoredCoreState (cyclomatic 57) REDACTED:636— durable-prp-control-plane.isStoredCoreState has cyclomatic complexity 57 (threshold 15). Of this number, 36 points are the body's own statements and 21 belong to 3 function literals inside it that branch. 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.
execution-projection.projectExecution (cyclomatic 57) server/src/services/execution-projection.ts:213— execution-projection.projectExecution has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
native-session-executor.providerSessionIdentityFromDurableProviderState (cyclomatic 57) server/src/services/native-runtime/native-session-executor.ts:5735— native-session-executor.providerSessionIdentityFromDurableProviderState has cyclomatic complexity 57 (threshold 15). Of this number, 54 points are the body's own statements and 3 belong to 3 function items inside it that branch. 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.
native-finalization-reconciler.claimNativeSessionResumptions (cyclomatic 57) server/src/services/native-runtime/native-finalization-reconciler.ts:346— native-finalization-reconciler.claimNativeSessionResumptions has cyclomatic complexity 57 (threshold 15). Most of this is not in the body itself: 5 of the 57 points are its own statements and the rest belongs to one function literal inside it that branches (line 390). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
approvals.approvalRoutes (cyclomatic 57) server/src/routes/approvals.ts:44— approvals.approvalRoutes has cyclomatic complexity 57 (threshold 15). Most of this is not in the body itself: 1 of the 57 points is its own statement and the rest belongs to 15 function items inside it that branch (a function literal at line 296, a function literal at line 232, queueAdditionalApprovalReviewPathWakes, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
BudgetPolicyCard.BudgetPolicyCard (cyclomatic 57) ui/src/components/BudgetPolicyCard.tsx:32— BudgetPolicyCard.BudgetPolicyCard has cyclomatic complexity 57 (threshold 15). Of this number, 53 points are the body's own statements and 4 belong to 3 function literals 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.
RemoteMcpProductionSetup.RemoteMcpProductionSetup::submit (cyclomatic 57) ui/src/features/connections/remote-mcp/RemoteMcpProductionSetup.tsx:128— RemoteMcpProductionSetup.RemoteMcpProductionSetup::submit has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (RemoteMcpProductionSetup.RemoteMcpProductionSetup) 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.
execute.buildClaudeRuntimeConfig (cyclomatic 56) packages/adapters/claude-local/src/server/execute.ts:177— execute.buildClaudeRuntimeConfig has cyclomatic complexity 56 (threshold 15). Of this number, 51 points are the body's own statements and 5 belong to 5 function literals inside it that branch. 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.runControlledEval (cyclomatic 56) packages/paperclip-runner/scripts/controlled-evals/run.mjs:64— run.runControlledEval has cyclomatic complexity 56 (threshold 15). Of this number, 53 points are the body's own statements and 3 belong to 3 function literals inside it that branch. 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.
CapabilitySemanticToolRuntime.#invoke (cyclomatic 56) packages/paperclip-runner/src/tools/capability-semantic-tool-runtime.ts:284— CapabilitySemanticToolRuntime.#invoke 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.
pi-runtime-extension.installPiRuntimeExtension (cyclomatic 56) packages/paperclip-runner/src/drivers/acpx/pi-runtime-extension.ts:308— pi-runtime-extension.installPiRuntimeExtension has cyclomatic complexity 56 (threshold 15). Of this number, 33 points are the body's own statements and 23 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.
access.accessService.sweepMemberConnectionAccess (cyclomatic 56) server/src/services/access.ts:51— access.accessService.sweepMemberConnectionAccess has cyclomatic complexity 56 (threshold 15). Of this number, 50 points are the body's own statements and 6 belong to 3 function literals 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.
descriptors.classifyRisk (cyclomatic 56) REDACTED:105— descriptors.classifyRisk 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.
git-credentials.resolveManagedGitHubIdentitySelection (cyclomatic 56) server/src/services/git-credentials.ts:310— git-credentials.resolveManagedGitHubIdentitySelection has cyclomatic complexity 56 (threshold 15). Of this number, 22 points are the body's own statements and 34 belong to 11 function items inside it that branch. 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.
skill-sources.skillSourceService.publish (cyclomatic 56) server/src/services/skill-sources.ts:101— skill-sources.skillSourceService.publish 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.
assets.assetRoutes (cyclomatic 56) server/src/routes/assets.ts:91— assets.assetRoutes has cyclomatic complexity 56 (threshold 15). Most of this is not in the body itself: 1 of the 56 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 327, 116, 225, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TaskChatInteractionCard.TaskChatInteractionCard (cyclomatic 56) ui/src/components/task-chat/TaskChatInteractionCard.tsx:38— TaskChatInteractionCard.TaskChatInteractionCard has cyclomatic complexity 56 (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.
parse-stdout.parsePiStdoutLine (cyclomatic 55) packages/adapters/pi-local/src/ui/parse-stdout.ts:46— parse-stdout.parsePiStdoutLine 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.
copilot-policy.createCopilotProtocolGuard (cyclomatic 55) packages/paperclip-runner/src/drivers/acpx/copilot-policy.ts:84— copilot-policy.createCopilotProtocolGuard has cyclomatic complexity 55 (threshold 15). Most of this is not in the body itself: 1 of the 55 points is its own statement and the rest belongs to 2 function items inside it that branch (a function literal at line 93, modelFrom). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
workspaces.createHeartbeatWorkspaceResolver.resolveAnchorWorkspaceForRun (cyclomatic 55) server/src/services/heartbeat/workspaces.ts:3425— workspaces.createHeartbeatWorkspaceResolver.resolveAnchorWorkspaceForRun 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.
confirmation-actions.createChatConfirmationActions.settleTerminalConfirmationAction (cyclomatic 55) server/src/services/chat-channels/interactions/confirmation-actions.ts:275— confirmation-actions.createChatConfirmationActions.settleTerminalConfirmationAction has cyclomatic complexity 55 (threshold 15). Of this number, 46 points are the body's own statements and 9 belong to one function literal inside it that branches. 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.
company-skills.companySkillService.scanProjectWorkspaces (cyclomatic 55) server/src/services/company-skills.ts:5156— company-skills.companySkillService.scanProjectWorkspaces has cyclomatic complexity 55 (threshold 15). Of this number, 52 points are the body's own statements and 3 belong to 3 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.
activity.activityRoutes (cyclomatic 55) server/src/routes/activity.ts:122— activity.activityRoutes has cyclomatic complexity 55 (threshold 15). Most of this is not in the body itself: 1 of the 55 points is its own statement and the rest belongs to 13 function items inside it that branch (hasAttributionFilters, a function literal at line 285, a function literal at line 247, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SidebarAgents.SidebarAgents (cyclomatic 55) ui/src/components/SidebarAgents.tsx:297— SidebarAgents.SidebarAgents has cyclomatic complexity 55 (threshold 15). Most of this is not in the body itself: 10 of the 55 points are its own statements and the rest belongs to 22 function items inside it that branch (a function literal at line 481, a function literal at line 327, a function literal at line 409, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
GrokBotConnection.GrokBotConnection (cyclomatic 55) ui/src/components/GrokBotConnection.tsx:13— GrokBotConnection.GrokBotConnection has cyclomatic complexity 55 (threshold 15). Of this number, 49 points are the body's own statements and 6 belong to 5 function items inside it that branch. 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.
SidebarAgents.production.SidebarAgents (cyclomatic 55) ui/src/components/SidebarAgents.production.tsx:297— SidebarAgents.production.SidebarAgents has cyclomatic complexity 55 (threshold 15). Most of this is not in the body itself: 10 of the 55 points are its own statements and the rest belongs to 22 function items inside it that branch (a function literal at line 481, a function literal at line 327, a function literal at line 409, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
IssueRunLedger.IssueRunLedgerContent (cyclomatic 55) ui/src/components/IssueRunLedger.tsx:592— IssueRunLedger.IssueRunLedgerContent has cyclomatic complexity 55 (threshold 15). Of this number, 22 points are the body's own statements and 33 belong to 6 function literals 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.
TaskChatTurn.TaskChatTurn (cyclomatic 55) ui/src/components/task-chat/TaskChatTurn.tsx:72— TaskChatTurn.TaskChatTurn has cyclomatic complexity 55 (threshold 15). Of this number, 53 points are the body's own statements and 2 belong to 2 function literals 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.
CommentThread.CommentThread (cyclomatic 55) ui/src/components/CommentThread.tsx:718— CommentThread.CommentThread has cyclomatic complexity 55 (threshold 15). Most of this is not in the body itself: 13 of the 55 points are its own statements and the rest belongs to 16 function items inside it that branch (handleSubmit, a function literal at line 869, handleAttachFile, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TeamCatalog.TeamCatalog (cyclomatic 55) ui/src/pages/TeamCatalog.tsx:2260— TeamCatalog.TeamCatalog has cyclomatic complexity 55 (threshold 15). Of this number, 34 points are the body's own statements and 21 belong to 9 function literals 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.
ProviderConnectionPreview.ProviderConnectionPreview (cyclomatic 55) ui/storybook/prototypes/ProviderConnectionPreview.tsx:16— ProviderConnectionPreview.ProviderConnectionPreview has cyclomatic complexity 55 (threshold 15). Of this number, 38 points are the body's own statements and 17 belong to 7 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.
heartbeat-run.heartbeatRun (cyclomatic 54) cli/src/commands/heartbeat-run.ts:58— heartbeat-run.heartbeatRun has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: 2 other methods here (heartbeat-run.heartbeatRun::printAdapterInvoke, heartbeat-run.heartbeatRun::handleEvent) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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-question-adapter.normalizeCodexQuestionSet (cyclomatic 54) packages/paperclip-runner/src/drivers/codex/codex-question-adapter.ts:270— codex-question-adapter.normalizeCodexQuestionSet has cyclomatic complexity 54 (threshold 15). Of this number, 16 points are the body's own statements and 38 belong to 3 function literals 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.
InteractionCard.InteractionCard (cyclomatic 54) packages/paperclip-runner/devtools/issue-thread/src/InteractionCard.tsx:57— InteractionCard.InteractionCard has cyclomatic complexity 54 (threshold 15). Of this number, 19 points are the body's own statements and 35 belong to 18 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.
config.loadConfig (cyclomatic 54) server/src/config.ts:150— config.loadConfig has cyclomatic complexity 54 (threshold 15). Of this number, 49 points are the body's own statements and 5 belong to 3 function items inside it that branch. 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.
task-start.createSlackTaskStart.processSlackTaskStart (cyclomatic 54) server/src/services/chat-channels/slack/task-start.ts:527— task-start.createSlackTaskStart.processSlackTaskStart has cyclomatic complexity 54 (threshold 15). Of this number, 24 points are the body's own statements and 30 belong to 4 function literals 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.
stopped-codex-turn.stoppedCodexTurnIsTextOnly (cyclomatic 54) server/src/services/native-runtime/stopped-codex-turn.ts:62— stopped-codex-turn.stoppedCodexTurnIsTextOnly has cyclomatic complexity 54 (threshold 15). Of this number, 51 points are the body's own statements and 3 belong to one function literal 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.
board-chat.boardChatRoutes (cyclomatic 54) REDACTED:67— board-chat.boardChatRoutes has cyclomatic complexity 54 (threshold 15). Most of this is not in the body itself: 1 of the 54 points is its own statement and the rest belongs to 11 function items inside it that branch (a function literal at line 315, a function literal at line 99, a function literal at line 294, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
access.normalizeAgentDefaultsForJoin (cyclomatic 54) REDACTED:736— access.normalizeAgentDefaultsForJoin has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MarkdownBody.MarkdownBodyImpl (cyclomatic 54) REDACTED:781— MarkdownBody.MarkdownBodyImpl has cyclomatic complexity 54 (threshold 15). Most of this is not in the body itself: 3 of the 54 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 891, 845, 826, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PropertiesPanel.ResizablePropertiesPanel (cyclomatic 54) ui/src/components/PropertiesPanel.tsx:172— PropertiesPanel.ResizablePropertiesPanel has cyclomatic complexity 54 (threshold 15). Of this number, 26 points are the body's own statements and 28 belong to 16 function literals inside it that branch. 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.
OrgChart.OrgChart (cyclomatic 54) ui/src/pages/OrgChart.tsx:208— OrgChart.OrgChart has cyclomatic complexity 54 (threshold 15). Of this number, 16 points are the body's own statements and 38 belong to 17 function literals inside it that branch. 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.
AgentSkillsTab.AgentSkillsTab (cyclomatic 54) ui/src/pages/agent-skills/AgentSkillsTab.tsx:61— AgentSkillsTab.AgentSkillsTab has cyclomatic complexity 54 (threshold 15). Of this number, 22 points are the body's own statements and 32 belong to 11 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.
Connections.Connections (cyclomatic 54) ui/src/pages/apps/Connections.tsx:113— Connections.Connections has cyclomatic complexity 54 (threshold 15). Of this number, 18 points are the body's own statements and 36 belong to 15 function literals 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.
agent.registerAgentCommands (cyclomatic 53) cli/src/commands/client/agent.ts:225— agent.registerAgentCommands has cyclomatic complexity 53 (threshold 15). Most of this is not in the body itself: 2 of the 53 points are its own statements and the rest belongs to 28 function literals inside it that branch (lines 788, 247, 296, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
acp.testClaudeAcpEnvironment (cyclomatic 53) packages/adapters/claude-local/src/server/acp.ts:739— acp.testClaudeAcpEnvironment 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.
DurablePrpCodexTransport.#closeOnce (cyclomatic 53) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:4524— DurablePrpCodexTransport.#closeOnce has cyclomatic complexity 53 (threshold 15). Of this number, 51 points are the body's own statements and 2 belong to one function literal 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.
managed-config.parseManagedConfigEnv (cyclomatic 53) server/src/services/managed-config.ts:141— managed-config.parseManagedConfigEnv 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.
task-workspace-access.assertTaskWorkspaceExecutionAccess (cyclomatic 53) server/src/services/task-workspace-access.ts:111— task-workspace-access.assertTaskWorkspaceExecutionAccess has cyclomatic complexity 53 (threshold 15). Most of this is not in the body itself: 1 of the 53 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 117, 186). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-telegram-media-intake.bindTelegramRichAttachment (cyclomatic 53) server/src/services/chat-telegram-media-intake.ts:131— chat-telegram-media-intake.bindTelegramRichAttachment has cyclomatic complexity 53 (threshold 15). Of this number, 52 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
chat-github-response-comments.writeGitHubResponseComment (cyclomatic 53) server/src/services/chat-github-response-comments.ts:86— chat-github-response-comments.writeGitHubResponseComment has cyclomatic complexity 53 (threshold 15). Of this number, 50 points are the body's own statements and 3 belong to one function literal 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.
chat-github-reviews.githubChatReviewService.execute (cyclomatic 53) server/src/services/chat-github-reviews.ts:570— chat-github-reviews.githubChatReviewService.execute has cyclomatic complexity 53 (threshold 15). Of this number, 46 points are the body's own statements and 7 belong to 4 function literals 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.
nested-clone-migration.migrateNestedRepositoryClone (cyclomatic 53) server/src/services/nested-clone-migration.ts:396— nested-clone-migration.migrateNestedRepositoryClone has cyclomatic complexity 53 (threshold 15). Most of this is not in the body itself: 7 of the 53 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 441, 402, 483). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
execution-workspaces.executionWorkspaceService.getCloseReadiness (cyclomatic 53) server/src/services/execution-workspaces.ts:3046— execution-workspaces.executionWorkspaceService.getCloseReadiness 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.
file-receipts.createSlackFileReceipts.processPendingSlackFileUploadReceipts (cyclomatic 53) server/src/services/chat-channels/slack/file-receipts.ts:486— file-receipts.createSlackFileReceipts.processPendingSlackFileUploadReceipts has cyclomatic complexity 53 (threshold 15). Most of this is not in the body itself: 8 of the 53 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 556, 725, 555, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
confirmation-actions.createChatConfirmationActions.handleChatConfirmation (cyclomatic 53) server/src/services/chat-channels/interactions/confirmation-actions.ts:65— confirmation-actions.createChatConfirmationActions.handleChatConfirmation has cyclomatic complexity 53 (threshold 15). Of this number, 51 points are the body's own statements and 2 belong to one function literal 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.
continuations.createChatInteractionContinuations.processPendingInteractionWakeups (cyclomatic 53) server/src/services/chat-channels/interactions/continuations.ts:43— continuations.createChatInteractionContinuations.processPendingInteractionWakeups 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.
issues.listIssueBlockerAttentionMap (cyclomatic 53) server/src/services/issues.ts:3778— issues.listIssueBlockerAttentionMap 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. This shape REPEATS in the file: one other method here (issues.listIssueBlockerAttentionMap::classifyPath) 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.
auth.actorMiddleware::authenticate (cyclomatic 53) server/src/middleware/auth.ts:243— auth.actorMiddleware::authenticate 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.
native-workspace-export-retry.retryNativeWorkspaceExport::inspect (cyclomatic 53) server/src/services/native-runtime/native-workspace-export-retry.ts:24— native-workspace-export-retry.retryNativeWorkspaceExport::inspect has cyclomatic complexity 53 (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.
SidePanelTab.SidePanelTab (cyclomatic 53) ui/src/components/side-panel/SidePanelTab.tsx:26— SidePanelTab.SidePanelTab has cyclomatic complexity 53 (threshold 15). Of this number, 43 points are the body's own statements and 10 belong to 5 function literals inside it that branch. 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.
update.updateCommand (cyclomatic 52) cli/src/commands/update.ts:167— update.updateCommand has cyclomatic complexity 52 (threshold 15). Of this number, 50 points are the body's own statements and 2 belong to 2 function literals 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.
format-event.printGeminiStreamEvent (cyclomatic 52) packages/adapters/gemini-local/src/cli/format-event.ts:110— format-event.printGeminiStreamEvent 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.
parse.createPiJsonlParser (cyclomatic 52) packages/adapters/pi-local/src/server/parse.ts:37— parse.createPiJsonlParser has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 1 of the 52 points is its own statement and the rest belongs to 2 function items inside it that branch (a function literal at line 60, addCost). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
response-capture.installDatabaseResponseCapture (cyclomatic 52) packages/db/src/response-capture.ts:179— response-capture.installDatabaseResponseCapture has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 4 of the 52 points are its own statements and the rest belongs to 20 function items inside it that branch (a function literal at line 274, sqlMetadata, client, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
question-set.parsePaperclipQuestionResponse (cyclomatic 52) REDACTED:294— question-set.parsePaperclipQuestionResponse 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-turn-diff.parseCodexTurnDiff (cyclomatic 52) packages/paperclip-runner/src/drivers/codex/codex-turn-diff.ts:73— codex-turn-diff.parseCodexTurnDiff 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. This shape REPEATS in the file: one other method here (codex-turn-diff.parseCodexTurnDiff::finish) 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.
provider-profile.resolvePaperclipRunnerProviderProfile (cyclomatic 52) server/src/services/native-runtime/provider-profile.ts:407— provider-profile.resolvePaperclipRunnerProviderProfile has cyclomatic complexity 52 (threshold 15). Of this number, 51 points are the body's own statements and 1 belongs to one function literal 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.
attachments.downloadPhotonAttachment (cyclomatic 52) server/src/services/photon/attachments.ts:70— attachments.downloadPhotonAttachment 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.
tool-access-policy.toolAccessPolicyService.loadContext (cyclomatic 52) server/src/services/tool-access-policy.ts:973— tool-access-policy.toolAccessPolicyService.loadContext 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.
webhook-authentication.createGitHubWebhookAuthentication.authenticateGitHubWebhook (cyclomatic 52) server/src/services/chat-channels/github/webhook-authentication.ts:56— webhook-authentication.createGitHubWebhookAuthentication.authenticateGitHubWebhook has cyclomatic complexity 52 (threshold 15). Of this number, 19 points are the body's own statements and 33 belong to 2 function literals 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.
chat-channels.chatChannelService.authorizeRetainedChatSourcePublication (cyclomatic 52) server/src/services/chat-channels.ts:1226— chat-channels.chatChannelService.authorizeRetainedChatSourcePublication has cyclomatic complexity 52 (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.
routines.routineService.dispatchRoutineRun (cyclomatic 52) server/src/services/routines.ts:1697— routines.routineService.dispatchRoutineRun has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 15 of the 52 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1774, 1750). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PaperclipRunnerToolAuthority.#createTask (cyclomatic 52) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:1434— PaperclipRunnerToolAuthority.#createTask has cyclomatic complexity 52 (threshold 15). Of this number, 23 points are the body's own statements and 29 belong to 2 function items inside it that branch. 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.
native-session-executor.nativeFailedRunRetryStateIsSafe (cyclomatic 52) server/src/services/native-runtime/native-session-executor.ts:4125— native-session-executor.nativeFailedRunRetryStateIsSafe 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.
app.QueryTab (cyclomatic 52) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4349— app.QueryTab has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 13 of the 52 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 4482, a function literal at line 4385, fileAnswer, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
index.ChangesTab (cyclomatic 52) packages/plugins/plugin-workspace-diff/src/ui/index.tsx:414— index.ChangesTab has cyclomatic complexity 52 (threshold 15). Of this number, 16 points are the body's own statements and 36 belong to 17 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.
customer-success.parseInspectionQuery (cyclomatic 52) packages/shared/src/customer-success.ts:132— customer-success.parseInspectionQuery has cyclomatic complexity 52 (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.
idle-issue-schedule.readIdleIssueSchedule (cyclomatic 52) server/src/services/idle-issue-schedule.ts:16— idle-issue-schedule.readIdleIssueSchedule has cyclomatic complexity 52 (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.
plugin-ui-static.pluginUiStaticRoutes (cyclomatic 52) REDACTED:210— plugin-ui-static.pluginUiStaticRoutes has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 1 of the 52 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 230, 495). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ChatComposer.ChatComposer (cyclomatic 52) ui/src/components/ChatComposer.tsx:111— ChatComposer.ChatComposer has cyclomatic complexity 52 (threshold 15). Of this number, 20 points are the body's own statements and 32 belong to 11 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.
SecretBindingPicker.SecretBindingPicker (cyclomatic 52) ui/src/components/SecretBindingPicker.tsx:86— SecretBindingPicker.SecretBindingPicker has cyclomatic complexity 52 (threshold 15). Of this number, 42 points are the body's own statements and 10 belong to 8 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.
cursor-usage-receipt.parseCursorPromptUsage (cyclomatic 51) packages/paperclip-runner/src/drivers/acpx/cursor-usage-receipt.ts:17— cursor-usage-receipt.parseCursorPromptUsage has cyclomatic complexity 51 (threshold 15). Of this number, 46 points are the body's own statements and 5 belong to 4 function items inside it that branch. 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.
usage-accounting.parseCursorPromptUsage (cyclomatic 51) packages/paperclip-runner/src/drivers/acpx/usage-accounting.ts:109— usage-accounting.parseCursorPromptUsage has cyclomatic complexity 51 (threshold 15). Of this number, 46 points are the body's own statements and 5 belong to 4 function items inside it that branch. 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.
native-execution.parsePaperclipNativeExecution (cyclomatic 51) packages/paperclip-runner/src/evals/native-execution.ts:203— native-execution.parsePaperclipNativeExecution 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.
cancelled-native-startup.isCancelledNativeStartup (cyclomatic 51) server/src/services/cancelled-native-startup.ts:33— cancelled-native-startup.isCancelledNativeStartup has cyclomatic complexity 51 (threshold 15). Of this number, 49 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
chat-github-attachments.githubPublicAttachmentsFromMessage (cyclomatic 51) REDACTED:288— chat-github-attachments.githubPublicAttachmentsFromMessage has cyclomatic complexity 51 (threshold 15). Of this number, 45 points are the body's own statements and 6 belong to 2 function items inside it that branch. 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.
persisted-workspace-source.resolvePersistedGitWorkspaceSource (cyclomatic 51) server/src/services/persisted-workspace-source.ts:102— persisted-workspace-source.resolvePersistedGitWorkspaceSource has cyclomatic complexity 51 (threshold 15). Of this number, 44 points are the body's own statements and 7 belong to 3 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.
tool-access.toolAccessService.finishGalleryAppConnection (cyclomatic 51) server/src/services/tool-access.ts:3120— tool-access.toolAccessService.finishGalleryAppConnection has cyclomatic complexity 51 (threshold 15). Most of this is not in the body itself: 14 of the 51 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 3231, 3404, 3409, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
run-cost-accounting.accountRunCost (cyclomatic 51) server/src/services/run-cost-accounting.ts:20— run-cost-accounting.accountRunCost has cyclomatic complexity 51 (threshold 15). Most of this is not in the body itself: 9 of the 51 points are its own statements and the rest belongs to one function literal inside it that branches (line 31). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
runner-api-catalog.dedicatedTools (cyclomatic 51) server/src/services/native-runtime/runner-api-catalog.ts:43— runner-api-catalog.dedicatedTools 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.
agent-execution-stop.agentExecutionsHaveStopped (cyclomatic 51) server/src/services/agent-execution-stop.ts:10— agent-execution-stop.agentExecutionsHaveStopped has cyclomatic complexity 51 (threshold 15). Of this number, 47 points are the body's own statements and 4 belong to 3 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.
confirmation-comment-resolution.resolveConfirmationFromComment (cyclomatic 51) server/src/services/confirmation-comment-resolution.ts:18— confirmation-comment-resolution.resolveConfirmationFromComment has cyclomatic complexity 51 (threshold 15). Most of this is not in the body itself: 3 of the 51 points are its own statements and the rest belongs to one function literal inside it that branches (line 28). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
transcript-adapter.phaseSummary (cyclomatic 51) ui/src/components/task-chat/transcript-adapter.ts:1463— transcript-adapter.phaseSummary has cyclomatic complexity 51 (threshold 15). Of this number, 44 points are the body's own statements and 7 belong to 5 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.
Artifacts.Artifacts (cyclomatic 51) ui/src/pages/Artifacts.tsx:39— Artifacts.Artifacts has cyclomatic complexity 51 (threshold 15). Of this number, 28 points are the body's own statements and 23 belong to 14 function literals 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.
ActivityFeed.ActivityFeed (cyclomatic 51) ui/src/components/ActivityFeed.tsx:323— ActivityFeed.ActivityFeed has cyclomatic complexity 51 (threshold 15). Most of this is not in the body itself: 8 of the 51 points are its own statements and the rest belongs to 15 function items inside it that branch (renderItem, a function literal at line 450, a function literal at line 419, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CompanyEnvironments.EnvironmentCustomImageBrowserTerminal (cyclomatic 51) ui/src/pages/CompanyEnvironments.tsx:465— CompanyEnvironments.EnvironmentCustomImageBrowserTerminal has cyclomatic complexity 51 (threshold 15). Most of this is not in the body itself: 5 of the 51 points are its own statements and the rest belongs to 17 function literals inside it that branch (lines 670, 500, 551, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ChatEndpointSetup.TryStep (cyclomatic 51) ui/src/pages/apps/chat/ChatEndpointSetup.tsx:1765— ChatEndpointSetup.TryStep 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.
workspace-access-state.resolveWorkspaceAccessState (cyclomatic 51) ui/src/lib/workspace-access-state.ts:134— workspace-access-state.resolveWorkspaceAccessState has cyclomatic complexity 51 (threshold 15). Of this number, 47 points are the body's own statements and 4 belong to 3 function literals 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.
TaskChatCompactInteractionCard.ItemVerdictsCard (cyclomatic 51) ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx:1561— TaskChatCompactInteractionCard.ItemVerdictsCard has cyclomatic complexity 51 (threshold 15). Of this number, 28 points are the body's own statements and 23 belong to 11 function items inside it that branch. 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.
AgentSetup.AgentRoutingFields (cyclomatic 51) ui/storybook/prototypes/provider-routing/AgentSetup.tsx:94— AgentSetup.AgentRoutingFields has cyclomatic complexity 51 (threshold 15). Of this number, 48 points are the body's own statements and 3 belong to 3 function literals inside it that branch. 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.
qualify-copilot-acp.runProbe (cyclomatic 50) packages/paperclip-runner/scripts/qualify-copilot-acp.mjs:43— qualify-copilot-acp.runProbe has cyclomatic complexity 50 (threshold 15). Of this number, 18 points are the body's own statements and 32 belong to 6 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.
qualify-cursor-denial.runDenial (cyclomatic 50) packages/paperclip-runner/scripts/qualify-cursor-denial.mjs:63— qualify-cursor-denial.runDenial has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 15 of the 50 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 151, groupAlive, killGroup, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
runner-protocol-eval-campaign.aggregateProtocolEvalCampaign (cyclomatic 50) packages/paperclip-runner/scripts/runner-protocol-eval-campaign.mjs:392— runner-protocol-eval-campaign.aggregateProtocolEvalCampaign has cyclomatic complexity 50 (threshold 15). Of this number, 42 points are the body's own statements and 8 belong to 4 function literals 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.
task-repository-acquisition.assertSelectedWorkspaceTrust (cyclomatic 50) server/src/services/task-repository-acquisition.ts:59— task-repository-acquisition.assertSelectedWorkspaceTrust has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ChatSdkEndpointRuntime.constructor (cyclomatic 50) server/src/services/chat-sdk-runtime.ts:2054— ChatSdkEndpointRuntime.constructor has cyclomatic complexity 50 (threshold 15). Of this number, 32 points are the body's own statements and 18 belong to 7 function literals inside it that branch. 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.
voice-session-store.voiceSessionStore.authorizeGuestTask (cyclomatic 50) server/src/services/voice/voice-session-store.ts:103— voice-session-store.voiceSessionStore.authorizeGuestTask has cyclomatic complexity 50 (threshold 15). Of this number, 49 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
chat-github-checks.githubReviewCheckService.dispatch (cyclomatic 50) server/src/services/chat-github-checks.ts:64— chat-github-checks.githubReviewCheckService.dispatch has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 3 of the 50 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 86, 324, 355, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-discord-command-registration.reconcileDiscordCommandRegistration (cyclomatic 50) server/src/services/chat-discord-command-registration.ts:412— chat-discord-command-registration.reconcileDiscordCommandRegistration has cyclomatic complexity 50 (threshold 15). Of this number, 46 points are the body's own statements and 4 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.
file-transfer-authority.createTeamsFileAuthority.teamsFileCurrentScope (cyclomatic 50) server/src/services/chat-channels/microsoft-teams/file-transfer-authority.ts:122— file-transfer-authority.createTeamsFileAuthority.teamsFileCurrentScope has cyclomatic complexity 50 (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.
conversation-queue.createChatConversationDeliveryQueue.messageFromDelivery (cyclomatic 50) server/src/services/chat-channels/inbound/conversation-queue.ts:196— conversation-queue.createChatConversationDeliveryQueue.messageFromDelivery has cyclomatic complexity 50 (threshold 15). Of this number, 22 points are the body's own statements and 28 belong to one function literal inside it that branches. 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.
legacy-execution-recovery.terminalizeLegacyExecution (cyclomatic 50) server/src/services/legacy-execution-recovery.ts:89— legacy-execution-recovery.terminalizeLegacyExecution has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 2 of the 50 points are its own statements and the rest belongs to one function literal inside it that branches (line 108). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-run-finalizer.repairCommittedNativeChatResponse (cyclomatic 50) server/src/services/native-runtime/native-run-finalizer.ts:827— native-run-finalizer.repairCommittedNativeChatResponse has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 13 of the 50 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 834, 1003). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
run-preparation.resolveExecutionRunAdapterConfig (cyclomatic 50) server/src/services/heartbeat/run-preparation.ts:301— run-preparation.resolveExecutionRunAdapterConfig has cyclomatic complexity 50 (threshold 15). Of this number, 44 points are the body's own statements and 6 belong to 2 function literals 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.
error-handler.errorHandler (cyclomatic 50) server/src/middleware/error-handler.ts:138— error-handler.errorHandler has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
execution-workspaces.executionWorkspaceRoutes::handleExecutionWorkspaceRuntimeCommand (cyclomatic 50) server/src/routes/execution-workspaces.ts:286— execution-workspaces.executionWorkspaceRoutes::handleExecutionWorkspaceRuntimeCommand has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tool-taxonomy.actionCopy (cyclomatic 50) ui/src/components/task-chat/tool-taxonomy.ts:310— tool-taxonomy.actionCopy has cyclomatic complexity 50 (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.
IssueDetail.IssueDetailActivityTab (cyclomatic 50) ui/src/pages/IssueDetail.tsx:2799— IssueDetail.IssueDetailActivityTab has cyclomatic complexity 50 (threshold 15). Of this number, 32 points are the body's own statements and 18 belong to 5 function literals inside it that branch. 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.
AttentionQueueRow.AttentionQueueRow (cyclomatic 50) ui/src/components/AttentionQueueRow.tsx:109— AttentionQueueRow.AttentionQueueRow has cyclomatic complexity 50 (threshold 15). Of this number, 37 points are the body's own statements and 13 belong to 3 function items inside it that branch. 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.
env.collectDeploymentEnvRows (cyclomatic 49) cli/src/commands/env.ts:112— env.collectDeploymentEnvRows 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.
native-distribution-integrity.createNativeAcpxDistributionSnapshot (cyclomatic 49) packages/paperclip-runner/src/drivers/acpx/native-distribution-integrity.ts:84— native-distribution-integrity.createNativeAcpxDistributionSnapshot has cyclomatic complexity 49 (threshold 15). Of this number, 33 points are the body's own statements and 16 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.
authorization.createAuthorizationService.decideLowTrustAccess (cyclomatic 49) server/src/services/authorization.ts:1256— authorization.createAuthorizationService.decideLowTrustAccess 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.
email-channels.emailChannelService.setup (cyclomatic 49) server/src/services/email-channels.ts:625— email-channels.emailChannelService.setup has cyclomatic complexity 49 (threshold 15). Of this number, 22 points are the body's own statements and 27 belong to 3 function literals inside it that branch. 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.
email-channels.emailChannelService.processDelivery (cyclomatic 49) server/src/services/email-channels.ts:1182— email-channels.emailChannelService.processDelivery has cyclomatic complexity 49 (threshold 15). Most of this is not in the body itself: 10 of the 49 points are its own statements and the rest belongs to one function literal inside it that branches (line 1224). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
publication-policy.createGitHubPublicationPolicy.githubCurrentOmissionPreparedText (cyclomatic 49) server/src/services/chat-channels/github/publication-policy.ts:74— publication-policy.createGitHubPublicationPolicy.githubCurrentOmissionPreparedText has cyclomatic complexity 49 (threshold 15). Of this number, 47 points are the body's own statements and 2 belong to one function literal 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.
case-handoff-authority.restoreCaseHandoffActor (cyclomatic 49) server/src/services/case-handoff-authority.ts:57— case-handoff-authority.restoreCaseHandoffActor 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.
environment-runtime.environmentRuntimeService.releaseRunLeases (cyclomatic 49) server/src/services/environment-runtime.ts:4195— environment-runtime.environmentRuntimeService.releaseRunLeases 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.
native-failed-workspace-recovery.preserveNativeFailedWorkspace (cyclomatic 49) server/src/services/native-runtime/native-failed-workspace-recovery.ts:13— native-failed-workspace-recovery.preserveNativeFailedWorkspace has cyclomatic complexity 49 (threshold 15). Most of this is not in the body itself: 3 of the 49 points are its own statements and the rest belongs to one function literal inside it that branches (line 17). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
agent-directory-working-copies.agentDirectoryWorkingCopyService.prepareCopy (cyclomatic 49) server/src/services/agent-directory-working-copies.ts:93— agent-directory-working-copies.agentDirectoryWorkingCopyService.prepareCopy has cyclomatic complexity 49 (threshold 15). Of this number, 37 points are the body's own statements and 12 belong to 3 function literals 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.
events.createPublicMcpEvents.enqueue (cyclomatic 49) server/src/services/public-mcp/events.ts:223— events.createPublicMcpEvents.enqueue has cyclomatic complexity 49 (threshold 15). Of this number, 44 points are the body's own statements and 5 belong to one function literal 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.
GrokBotSetup.GrokBotSetup (cyclomatic 49) ui/src/components/new-agent/GrokBotSetup.tsx:9— GrokBotSetup.GrokBotSetup has cyclomatic complexity 49 (threshold 15). Most of this is not in the body itself: 10 of the 49 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 46, next, a function literal at line 25, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
IssueChatThread.IssueChatComposer (cyclomatic 49) ui/src/components/IssueChatThread.tsx:4649— IssueChatThread.IssueChatComposer 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. This shape REPEATS in the file: one other method here (IssueChatThread.IssueChatComposer::submitComment) 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.
CompanyEnvironments.EnvironmentImageTemplatePanel (cyclomatic 49) ui/src/pages/CompanyEnvironments.tsx:856— CompanyEnvironments.EnvironmentImageTemplatePanel has cyclomatic complexity 49 (threshold 15). Of this number, 37 points are the body's own statements and 12 belong to 7 function literals 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.
server-utils.normalizePaperclipWakePayload (cyclomatic 48) REDACTED:1704— server-utils.normalizePaperclipWakePayload has cyclomatic complexity 48 (threshold 15). Of this number, 43 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
execute.execute (cyclomatic 48) packages/adapters/cursor-cloud/src/server/execute.ts:350— execute.execute 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.
copilot-events.normalizeCopilotSessionEvent (cyclomatic 48) packages/paperclip-runner/src/drivers/acpx/copilot-events.ts:43— copilot-events.normalizeCopilotSessionEvent has cyclomatic complexity 48 (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-runner.runCodexCodexTracer (cyclomatic 48) packages/paperclip-runner/src/mock-core/codex-runner.ts:334— codex-runner.runCodexCodexTracer has cyclomatic complexity 48 (threshold 15). Of this number, 39 points are the body's own statements and 9 belong to 5 function items inside it that branch. 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.
LiveConsoleDemoServer.#handle (cyclomatic 48) REDACTED:589— LiveConsoleDemoServer.#handle 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.
native-review-participant.validateNativeReviewAssignmentFacts (cyclomatic 48) server/src/services/native-runtime/native-review-participant.ts:84— native-review-participant.validateNativeReviewAssignmentFacts 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.
authorization.createChatPublicationAuthorization.claimPublicationTransportAuthorization (cyclomatic 48) server/src/services/chat-channels/publications/authorization.ts:58— authorization.createChatPublicationAuthorization.claimPublicationTransportAuthorization has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 1 of the 48 points is its own statement and the rest belongs to one function literal inside it that branches (line 69). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
status-cards.statusCardRoutes (cyclomatic 48) server/src/routes/status-cards.ts:19— status-cards.statusCardRoutes has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 1 of the 48 points is its own statement and the rest belongs to 17 function items inside it that branch (a function literal at line 181, enqueueRefresh, enqueueCompile, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TaskMessageScroller.TaskMessageScroller (cyclomatic 48) ui/src/components/task-chat/TaskMessageScroller.tsx:47— TaskMessageScroller.TaskMessageScroller has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 5 of the 48 points are its own statements and the rest belongs to 16 function literals inside it that branch (lines 244, 101, 127, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Browse.ConnectorCard (cyclomatic 48) ui/src/pages/apps/Browse.tsx:1053— Browse.ConnectorCard has cyclomatic complexity 48 (threshold 15). Of this number, 21 points are the body's own statements and 27 belong to 11 function literals 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.
useRecentTasks.useRecentTasks (cyclomatic 48) ui/src/hooks/useRecentTasks.ts:24— useRecentTasks.useRecentTasks has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 8 of the 48 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 122, 102, 135, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-question-forms.buildChatQuestionFormModal (cyclomatic 47) server/src/services/chat-question-forms.ts:538— chat-question-forms.buildChatQuestionFormModal has cyclomatic complexity 47 (threshold 15). Of this number, 41 points are the body's own statements and 6 belong to 3 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.
chat-github-attachments.resolveCanonicalAttachmentTargetOrThrow (cyclomatic 47) REDACTED:560— chat-github-attachments.resolveCanonicalAttachmentTargetOrThrow has cyclomatic complexity 47 (threshold 15). Of this number, 40 points are the body's own statements and 7 belong to 3 function items inside it that branch. 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.
remote-mcp-pending.extractRemoteMcpPending (cyclomatic 47) server/src/services/remote-mcp-pending.ts:10— remote-mcp-pending.extractRemoteMcpPending has cyclomatic complexity 47 (threshold 15). Of this number, 32 points are the body's own statements and 15 belong to 3 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.
workspace-runtime.realizeExecutionWorkspace (cyclomatic 47) server/src/services/workspace-runtime.ts:3323— workspace-runtime.realizeExecutionWorkspace has cyclomatic complexity 47 (threshold 15). Of this number, 36 points are the body's own statements and 11 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.
workspace-runtime.reconcilePersistedRuntimeServicesOnStartup (cyclomatic 47) server/src/services/workspace-runtime.ts:8540— workspace-runtime.reconcilePersistedRuntimeServicesOnStartup 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.
subscriptions.subscriptionService.register (cyclomatic 47) server/src/services/subscriptions.ts:99— subscriptions.subscriptionService.register has cyclomatic complexity 47 (threshold 15). Most of this is not in the body itself: 4 of the 47 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 105, 129). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-recovery-source.inspectWorkspaceRecoverySource (cyclomatic 47) server/src/services/workspace-recovery-source.ts:33— workspace-recovery-source.inspectWorkspaceRecoverySource has cyclomatic complexity 47 (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.
file-transfer-authority.createTeamsFileAuthority.deriveTeamsFileTransferAuthority (cyclomatic 47) server/src/services/chat-channels/microsoft-teams/file-transfer-authority.ts:784— file-transfer-authority.createTeamsFileAuthority.deriveTeamsFileTransferAuthority has cyclomatic complexity 47 (threshold 15). Of this number, 44 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
chat-telegram-photo.supportedJpeg (cyclomatic 47) server/src/services/chat-telegram-photo.ts:103— chat-telegram-photo.supportedJpeg 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.
wakeup-authorization.createInboundWakeAuthority.authorizeInboundWakeup (cyclomatic 47) server/src/services/chat-channels/inbound/wakeup-authorization.ts:41— wakeup-authorization.createInboundWakeAuthority.authorizeInboundWakeup has cyclomatic complexity 47 (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.
worker-rpc-host.startWorkerRpcHost.buildContext (cyclomatic 47) packages/plugins/sdk/src/worker-rpc-host.ts:481— worker-rpc-host.startWorkerRpcHost.buildContext has cyclomatic complexity 47 (threshold 15). Of this number, 45 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
company-search.companySearchService.search::fetchIssueSearchData (cyclomatic 47) server/src/services/company-search.ts:610— company-search.companySearchService.search::fetchIssueSearchData 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.
SidebarNavItem.SidebarNavItem (cyclomatic 47) ui/src/components/SidebarNavItem.tsx:71— SidebarNavItem.SidebarNavItem has cyclomatic complexity 47 (threshold 15). Of this number, 45 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
ProviderQuotaCard.ProviderQuotaCard (cyclomatic 47) ui/src/components/ProviderQuotaCard.tsx:45— ProviderQuotaCard.ProviderQuotaCard has cyclomatic complexity 47 (threshold 15). Of this number, 33 points are the body's own statements and 14 belong to 4 function literals inside it that branch. 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.
connection-dialogs.AddConnectionDialog (cyclomatic 47) ui/src/pages/tools/connection-dialogs.tsx:129— connection-dialogs.AddConnectionDialog has cyclomatic complexity 47 (threshold 15). Of this number, 34 points are the body's own statements and 13 belong to 11 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.
ProjectAccessProposal.Proposal (cyclomatic 47) ui/storybook/support/design-proposals/ProjectAccessProposal.tsx:33— ProjectAccessProposal.Proposal has cyclomatic complexity 47 (threshold 15). Of this number, 33 points are the body's own statements and 14 belong to 6 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.
opencode-server-driver.startRuntime (cyclomatic 46) REDACTED:2263— opencode-server-driver.startRuntime has cyclomatic complexity 46 (threshold 15). Of this number, 28 points are the body's own statements and 18 belong to 4 function items inside it that branch. 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.
HarnessNativeSession.events (cyclomatic 46) packages/paperclip-runner/src/backends/harness-driver-backend.ts:512— HarnessNativeSession.events 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.
RunnerdExternalSession.open (cyclomatic 46) packages/paperclip-runner/src/drivers/external/runnerd-external-driver.ts:166— RunnerdExternalSession.open has cyclomatic complexity 46 (threshold 15). Of this number, 26 points are the body's own statements and 20 belong to 5 function literals inside it that branch. 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.
eval-session.runEvalSessionCli (cyclomatic 46) packages/paperclip-runner/src/cli/eval-session.ts:369— eval-session.runEvalSessionCli 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.
execution-recovery-resolution.settleUnrecoverableExecutions (cyclomatic 46) server/src/services/execution-recovery-resolution.ts:415— execution-recovery-resolution.settleUnrecoverableExecutions has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 5 of the 46 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 460, 423). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-interaction-presentation.chatInteractionPresentation (cyclomatic 46) server/src/services/chat-interaction-presentation.ts:3— chat-interaction-presentation.chatInteractionPresentation has cyclomatic complexity 46 (threshold 15). Of this number, 45 points are the body's own statements and 1 belongs to one function literal 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.
chat-telegram-media-intake.normalizeTelegramMediaAttachments (cyclomatic 46) server/src/services/chat-telegram-media-intake.ts:243— chat-telegram-media-intake.normalizeTelegramMediaAttachments has cyclomatic complexity 46 (threshold 15). Of this number, 40 points are the body's own statements and 6 belong to 4 function items inside it that branch. 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.
chat-github-events.githubExplicitMentionEvent (cyclomatic 46) server/src/services/chat-github-events.ts:90— chat-github-events.githubExplicitMentionEvent 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.
isolated-task-directory-retention.inspectTaskDirectoryFolder (cyclomatic 46) server/src/services/isolated-task-directory-retention.ts:457— isolated-task-directory-retention.inspectTaskDirectoryFolder has cyclomatic complexity 46 (threshold 15). Of this number, 31 points are the body's own statements and 15 belong to 3 function items inside it that branch. 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.
isolated-repository-rehome.rehomeIsolatedRepositoryWorkspace (cyclomatic 46) server/src/services/isolated-repository-rehome.ts:382— isolated-repository-rehome.rehomeIsolatedRepositoryWorkspace has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 5 of the 46 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 389, 475, 459). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-runtime.cleanupExecutionWorkspaceArtifacts (cyclomatic 46) server/src/services/workspace-runtime.ts:4251— workspace-runtime.cleanupExecutionWorkspaceArtifacts has cyclomatic complexity 46 (threshold 15). Of this number, 45 points are the body's own statements and 1 belongs to one function literal 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.
projects.projectService.updateWorkspace (cyclomatic 46) server/src/services/projects.ts:1198— projects.projectService.updateWorkspace has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 1 of the 46 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 1202, 1274). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-publication-text-parts.splitNativePublicationText (cyclomatic 46) server/src/services/chat-publication-text-parts.ts:198— chat-publication-text-parts.splitNativePublicationText has cyclomatic complexity 46 (threshold 15). Of this number, 33 points are the body's own statements and 13 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.
failures.createChatPublicationFailures.finalizePublicationFailure (cyclomatic 46) server/src/services/chat-channels/publications/failures.ts:52— failures.createChatPublicationFailures.finalizePublicationFailure has cyclomatic complexity 46 (threshold 15). Of this number, 16 points are the body's own statements and 30 belong to one function literal 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.
native-deliverable-feedback.hasCurrentPublicationReceipt (cyclomatic 46) server/src/services/native-runtime/native-deliverable-feedback.ts:19— native-deliverable-feedback.hasCurrentPublicationReceipt has cyclomatic complexity 46 (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-preparation.buildPaperclipRuntimeMcpServers (cyclomatic 46) server/src/services/heartbeat/run-preparation.ts:935— run-preparation.buildPaperclipRuntimeMcpServers has cyclomatic complexity 46 (threshold 15). Of this number, 22 points are the body's own statements and 24 belong to 5 function literals inside it that branch. 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.
plugin.createPlugin (cyclomatic 46) packages/plugins/sandbox-providers/createos/src/plugin.ts:55— plugin.createPlugin has cyclomatic complexity 46 (threshold 15). Of this number, 25 points are the body's own statements and 21 belong to 3 function items inside it that branch. 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.
decisions.decisionService.executeEffect (cyclomatic 46) server/src/services/decisions.ts:392— decisions.decisionService.executeEffect has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 5 of the 46 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 413, 395, 461). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
events.createPublicMcpEvents.subscribe (cyclomatic 46) server/src/services/public-mcp/events.ts:100— events.createPublicMcpEvents.subscribe has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 11 of the 46 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 157, 113). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
file-resources.fileResourceRoutes (cyclomatic 46) server/src/routes/file-resources.ts:351— file-resources.fileResourceRoutes has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 1 of the 46 points is its own statement and the rest belongs to 5 function items inside it that branch (a function literal at line 529, a function literal at line 774, a function literal at line 661, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
IssueChatThread.IssueChatUserMessage (cyclomatic 46) ui/src/components/IssueChatThread.tsx:1995— IssueChatThread.IssueChatUserMessage has cyclomatic complexity 46 (threshold 15). Of this number, 43 points are the body's own statements and 3 belong to 3 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.
ConnectedAggregatorApps.ConnectedAggregatorApps (cyclomatic 46) ui/src/pages/apps/app-detail/ConnectedAggregatorApps.tsx:15— ConnectedAggregatorApps.ConnectedAggregatorApps has cyclomatic complexity 46 (threshold 15). Of this number, 30 points are the body's own statements and 16 belong to 4 function literals 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.
ImportSkillsFromProjectDialog.ImportSkillsFromProjectDialog (cyclomatic 46) ui/src/pages/skills/ImportSkillsFromProjectDialog.tsx:278— ImportSkillsFromProjectDialog.ImportSkillsFromProjectDialog has cyclomatic complexity 46 (threshold 15). Of this number, 21 points are the body's own statements and 25 belong to 14 function items inside it that branch. 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.
SkillImportProgress.SkillImportProgress (cyclomatic 46) ui/src/pages/skills/SkillImportProgress.tsx:7— SkillImportProgress.SkillImportProgress has cyclomatic complexity 46 (threshold 15). Of this number, 38 points are the body's own statements and 8 belong to 2 function literals 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.
AiConnectionsReview.AgentConnectionReview (cyclomatic 46) ui/storybook/prototypes/AiConnectionsReview.tsx:49— AiConnectionsReview.AgentConnectionReview has cyclomatic complexity 46 (threshold 15). Of this number, 38 points are the body's own statements and 8 belong to 5 function items inside it that branch. 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.
ConnectionSetup.ConnectionSetup (cyclomatic 46) ui/storybook/prototypes/provider-routing/ConnectionSetup.tsx:38— ConnectionSetup.ConnectionSetup 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. This shape REPEATS in the file: one other method here (ConnectionSetup.ConnectionSetup::connect) 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.
cases-read-only-api.installReadOnlyCaseFixtures (cyclomatic 46) ui/storybook/support/cases-read-only-api.ts:80— cases-read-only-api.installReadOnlyCaseFixtures has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 2 of the 46 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 113, 107, 121, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
parse-stdout.parseCursorStdoutLine (cyclomatic 45) packages/adapters/cursor-local/src/ui/parse-stdout.ts:249— parse-stdout.parseCursorStdoutLine 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.
CapabilityLiveSession.sendMessage (cyclomatic 45) packages/paperclip-runner/src/live/live-session.ts:1514— CapabilityLiveSession.sendMessage has cyclomatic complexity 45 (threshold 15). Of this number, 44 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
stage-release-runner-binaries.main (cyclomatic 45) packages/paperclip-runner/scripts/stage-release-runner-binaries.mjs:87— stage-release-runner-binaries.main has cyclomatic complexity 45 (threshold 15). Of this number, 40 points are the body's own statements and 5 belong to one function literal 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.
logger.createHttpLogger (cyclomatic 45) server/src/middleware/logger.ts:86— logger.createHttpLogger 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.
plugin-worker-manager.createPluginWorkerHandle (cyclomatic 45) server/src/services/plugin-worker-manager.ts:879— plugin-worker-manager.createPluginWorkerHandle has cyclomatic complexity 45 (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 shape REPEATS in the file: 2 other methods here (plugin-worker-manager.createPluginWorkerHandle::routeExecuteLogNotification, plugin-worker-manager.createPluginWorkerHandle::handleWorkerNotification) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
execution-recovery-resolution.validateExecutionReconciliation (cyclomatic 45) server/src/services/execution-recovery-resolution.ts:33— execution-recovery-resolution.validateExecutionReconciliation has cyclomatic complexity 45 (threshold 15). Of this number, 43 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
native-chat-review-presentation.reviewPresentationEvidence (cyclomatic 45) server/src/services/native-runtime/native-chat-review-presentation.ts:69— native-chat-review-presentation.reviewPresentationEvidence has cyclomatic complexity 45 (threshold 15). Of this number, 42 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
chat-teams-inline-images.gif (cyclomatic 45) server/src/services/chat-teams-inline-images.ts:201— chat-teams-inline-images.gif has cyclomatic complexity 45 (threshold 15). Of this number, 41 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.
email-channels.emailChannelService.processSend (cyclomatic 45) server/src/services/email-channels.ts:1671— email-channels.emailChannelService.processSend has cyclomatic complexity 45 (threshold 15). Of this number, 41 points are the body's own statements and 4 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.
wakeups.createInboundWakeups.processInboundWakeup (cyclomatic 45) server/src/services/chat-channels/inbound/wakeups.ts:203— wakeups.createInboundWakeups.processInboundWakeup has cyclomatic complexity 45 (threshold 15). Of this number, 36 points are the body's own statements and 9 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.
setup-readiness.testNativeRunnerAuthentication (cyclomatic 45) server/src/services/native-runtime/setup-readiness.ts:189— setup-readiness.testNativeRunnerAuthentication has cyclomatic complexity 45 (threshold 15). Of this number, 40 points are the body's own statements and 5 belong to 3 function literals 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.
asset-content-access.canActorReadAssetContent (cyclomatic 45) server/src/services/asset-content-access.ts:21— asset-content-access.canActorReadAssetContent has cyclomatic complexity 45 (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.
routines.routineService.firePublicTrigger (cyclomatic 45) server/src/services/routines.ts:2945— routines.routineService.firePublicTrigger has cyclomatic complexity 45 (threshold 15). Most of this is not in the body itself: 12 of the 45 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 2957, 2970). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-recovery.recoverRetainedWorkspace::runAttempt (cyclomatic 45) server/src/services/workspace-recovery.ts:76— workspace-recovery.recoverRetainedWorkspace::runAttempt 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.
queue.createHeartbeatQueue.withChatControlRecoveryGate (cyclomatic 45) server/src/services/heartbeat/queue.ts:695— queue.createHeartbeatQueue.withChatControlRecoveryGate has cyclomatic complexity 45 (threshold 15). Of this number, 18 points are the body's own statements and 27 belong to one function literal 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.
worker-rpc-host.startWorkerRpcHost.handleInitialize (cyclomatic 45) packages/plugins/sdk/src/worker-rpc-host.ts:1799— worker-rpc-host.startWorkerRpcHost.handleInitialize has cyclomatic complexity 45 (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.
generate-daytona-tools.generateDaytonaCatalog (cyclomatic 45) scripts/generate-daytona-tools.mjs:46— generate-daytona-tools.generateDaytonaCatalog 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.
slack-native-search.fetchTransientSlackSearch (cyclomatic 45) server/src/services/connectors/slack-native-search.ts:19— slack-native-search.fetchTransientSlackSearch 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.
AgentChats.AgentChatsContent (cyclomatic 45) ui/src/pages/AgentChats.tsx:20— AgentChats.AgentChatsContent has cyclomatic complexity 45 (threshold 15). Of this number, 34 points are the body's own statements and 11 belong to 5 function literals inside it that branch. 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.
issue-thread-interactions.buildIssueThreadInteractionSummary (cyclomatic 45) ui/src/lib/issue-thread-interactions.ts:220— issue-thread-interactions.buildIssueThreadInteractionSummary 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.
StatusCardTile.StatusCardTile (cyclomatic 45) ui/src/pages/StatusCards/StatusCardTile.tsx:51— StatusCardTile.StatusCardTile has cyclomatic complexity 45 (threshold 15). Of this number, 40 points are the body's own statements and 5 belong to 2 function literals 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.
ProfileWizard.ProfileWizard (cyclomatic 45) ui/src/pages/tools/profiles/ProfileWizard.tsx:46— ProfileWizard.ProfileWizard has cyclomatic complexity 45 (threshold 15). Of this number, 20 points are the body's own statements and 25 belong to 9 function items inside it that branch. 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.
CompanySkills.SkillPane (cyclomatic 45) ui/src/pages/CompanySkills.tsx:3605— CompanySkills.SkillPane 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.
CompanySkills.production.SkillPane (cyclomatic 45) ui/src/pages/CompanySkills.production.tsx:3683— CompanySkills.production.SkillPane 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.
JsonSchemaForm.validateField (cyclomatic 45) REDACTED:191— JsonSchemaForm.validateField 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.
ConnectionPoolConnectorHost.ConnectionPoolConnectorHost (cyclomatic 45) ui/storybook/prototypes/ConnectionPoolConnectorHost.tsx:22— ConnectionPoolConnectorHost.ConnectionPoolConnectorHost has cyclomatic complexity 45 (threshold 15). Most of this is not in the body itself: 2 of the 45 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 33, 26, 61, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentSettingsPreview.SettingsPage (cyclomatic 45) ui/storybook/prototypes/agent-settings/AgentSettingsPreview.tsx:162— AgentSettingsPreview.SettingsPage has cyclomatic complexity 45 (threshold 15). Of this number, 39 points are the body's own statements and 6 belong to 3 function items inside it that branch. 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.
OriginatingTasks.TaskPageData (cyclomatic 45) ui/storybook/prototypes/originating-tasks/OriginatingTasks.tsx:139— OriginatingTasks.TaskPageData has cyclomatic complexity 45 (threshold 15). Most of this is not in the body itself: 1 of the 45 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 175, 141, 215, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
skills.registerSkillsCommands (cyclomatic 44) cli/src/commands/client/skills.ts:92— skills.registerSkillsCommands has cyclomatic complexity 44 (threshold 15). Most of this is not in the body itself: 1 of the 44 points is its own statement and the rest belongs to 15 function literals inside it that branch (lines 379, 235, 405, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
parse-stdout.parseClaudeStdoutLine (cyclomatic 44) packages/adapters/claude-local/src/ui/parse-stdout.ts:38— parse-stdout.parseClaudeStdoutLine 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.
LiveConsole.LiveConsole (cyclomatic 44) packages/paperclip-runner/devtools/browser/src/live/LiveConsole.tsx:65— LiveConsole.LiveConsole has cyclomatic complexity 44 (threshold 15). Of this number, 20 points are the body's own statements and 24 belong to 9 function items inside it that branch. 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-session-server-requests.handleServerRequestBody (cyclomatic 44) packages/paperclip-runner/src/drivers/codex/codex-session-server-requests.ts:82— codex-session-server-requests.handleServerRequestBody 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.
runner-console-app.RunnerConsoleApp (cyclomatic 44) packages/paperclip-runner/src/react/runner-console-app.tsx:43— runner-console-app.RunnerConsoleApp has cyclomatic complexity 44 (threshold 15). Of this number, 24 points are the body's own statements and 20 belong to 10 function items inside it that branch. 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.
issue-recovery-actions.issueRecoveryActionService.upsertSourceScopedUnlocked (cyclomatic 44) server/src/services/issue-recovery-actions.ts:358— issue-recovery-actions.issueRecoveryActionService.upsertSourceScopedUnlocked has cyclomatic complexity 44 (threshold 15). Of this number, 21 points are the body's own statements and 23 belong to 2 function literals 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.
evidence-classifier.classifyNativeEvidence (cyclomatic 44) server/src/services/native-runtime/evidence-classifier.ts:248— evidence-classifier.classifyNativeEvidence has cyclomatic complexity 44 (threshold 15). Of this number, 26 points are the body's own statements and 18 belong to 3 function literals inside it that branch. 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.
voice-session-store.voiceSessionStore.runTool (cyclomatic 44) server/src/services/voice/voice-session-store.ts:321— voice-session-store.voiceSessionStore.runTool has cyclomatic complexity 44 (threshold 15). Most of this is not in the body itself: 1 of the 44 points is its own statement and the rest belongs to one function literal inside it that branches (line 326). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
daytona.daytonaClient.execute (cyclomatic 44) server/src/services/daytona.ts:60— daytona.daytonaClient.execute 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.
git-workspace-contents.validateGitWorkspaceContents (cyclomatic 44) server/src/services/git-workspace-contents.ts:98— git-workspace-contents.validateGitWorkspaceContents has cyclomatic complexity 44 (threshold 15). Of this number, 40 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
workspaces.assertGitSensitiveAdapterWorkspaceValid (cyclomatic 44) server/src/services/heartbeat/workspaces.ts:1097— workspaces.assertGitSensitiveAdapterWorkspaceValid has cyclomatic complexity 44 (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.
chat-teams-inline-images.jpeg (cyclomatic 44) server/src/services/chat-teams-inline-images.ts:110— chat-teams-inline-images.jpeg has cyclomatic complexity 44 (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.
conversation-queue.createChatConversationDeliveryQueue.drainConversationDeliveries (cyclomatic 44) server/src/services/chat-channels/inbound/conversation-queue.ts:391— conversation-queue.createChatConversationDeliveryQueue.drainConversationDeliveries has cyclomatic complexity 44 (threshold 15). Of this number, 32 points are the body's own statements and 12 belong to 4 function literals 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.
agent-directory-working-copies.agentDirectoryWorkingCopyService.release (cyclomatic 44) server/src/services/agent-directory-working-copies.ts:414— agent-directory-working-copies.agentDirectoryWorkingCopyService.release has cyclomatic complexity 44 (threshold 15). Of this number, 43 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
built-in-agents.builtInAgentService.ensure (cyclomatic 44) server/src/services/built-in-agents.ts:1728— built-in-agents.builtInAgentService.ensure 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.
native-runner-file-handoff.readVerifiedWorkspaceFile (cyclomatic 44) server/src/services/native-runtime/native-runner-file-handoff.ts:301— native-runner-file-handoff.readVerifiedWorkspaceFile has cyclomatic complexity 44 (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.
idle-sleep-safety.readIdleSleepSafety (cyclomatic 44) server/src/services/idle-sleep-safety.ts:251— idle-sleep-safety.readIdleSleepSafety has cyclomatic complexity 44 (threshold 15). Of this number, 28 points are the body's own statements and 16 belong to 2 function literals 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.
CommandPalette.CommandPalette (cyclomatic 44) ui/src/components/CommandPalette.tsx:92— CommandPalette.CommandPalette has cyclomatic complexity 44 (threshold 15). Of this number, 24 points are the body's own statements and 20 belong to 12 function items inside it that branch. 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.
AiConnectionSelect.AiConnectionSelect (cyclomatic 44) ui/src/components/ai-connections/AiConnectionSelect.tsx:31— AiConnectionSelect.AiConnectionSelect has cyclomatic complexity 44 (threshold 15). Of this number, 32 points are the body's own statements and 12 belong to 6 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.
IssueChatThread.IssueChatSystemMessage (cyclomatic 44) ui/src/components/IssueChatThread.tsx:3722— IssueChatThread.IssueChatSystemMessage 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.
FileViewerSheet.FileContentViewer (cyclomatic 44) ui/src/components/FileViewerSheet.tsx:248— FileViewerSheet.FileContentViewer has cyclomatic complexity 44 (threshold 15). Of this number, 32 points are the body's own statements and 12 belong to 5 function literals inside it that branch. 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.
AgentToolsTab.AgentToolsTab (cyclomatic 44) ui/src/pages/AgentToolsTab.tsx:335— AgentToolsTab.AgentToolsTab has cyclomatic complexity 44 (threshold 15). Of this number, 17 points are the body's own statements and 27 belong to 15 function literals 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.
SkillSourceTree.SkillSourceTree (cyclomatic 44) ui/src/pages/skills/SkillSourceTree.tsx:55— SkillSourceTree.SkillSourceTree has cyclomatic complexity 44 (threshold 15). Most of this is not in the body itself: 10 of the 44 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 138, toggleCheck, a function literal at line 122, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
OrgChart.production.OrgChart (cyclomatic 44) ui/src/pages/OrgChart.production.tsx:176— OrgChart.production.OrgChart has cyclomatic complexity 44 (threshold 15). Most of this is not in the body itself: 9 of the 44 points are its own statements and the rest belongs to 16 function literals inside it that branch (lines 369, 254, 341, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
OnboardingChat.OnboardingChat (cyclomatic 44) ui/src/components/OnboardingChat.tsx:82— OnboardingChat.OnboardingChat has cyclomatic complexity 44 (threshold 15). Most of this is not in the body itself: 15 of the 44 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 143, 226, 276, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ConnectionSetupFlow.GalleryStep (cyclomatic 44) ui/src/features/connections/ConnectionSetupFlow.tsx:3001— ConnectionSetupFlow.GalleryStep has cyclomatic complexity 44 (threshold 15). Of this number, 29 points are the body's own statements and 15 belong to 8 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.
stdio-mcp.stdioMcpLaunchBindings (cyclomatic 43) packages/paperclip-runner/src/drivers/stdio-mcp.ts:16— stdio-mcp.stdioMcpLaunchBindings has cyclomatic complexity 43 (threshold 15). Most of this is not in the body itself: 6 of the 43 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 25, 39, 36). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
eval-observability-runtime.prepareEvalObservabilityRuntime (cyclomatic 43) packages/paperclip-runner/src/cli/eval-observability-runtime.ts:48— eval-observability-runtime.prepareEvalObservabilityRuntime 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.
chat-telegram-ephemeral.sendTelegramCallbackNotice (cyclomatic 43) server/src/services/chat-telegram-ephemeral.ts:239— chat-telegram-ephemeral.sendTelegramCallbackNotice 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.
voice-inbound-service.voiceInboundService.lifecycle (cyclomatic 43) server/src/services/voice/voice-inbound-service.ts:93— voice-inbound-service.voiceInboundService.lifecycle has cyclomatic complexity 43 (threshold 15). Of this number, 26 points are the body's own statements and 17 belong to 2 function literals 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.
tool-access-policy.toolAccessPolicyService.decideInternal (cyclomatic 43) server/src/services/tool-access-policy.ts:1405— tool-access-policy.toolAccessPolicyService.decideInternal has cyclomatic complexity 43 (threshold 15). Of this number, 39 points are the body's own statements and 4 belong to 3 function literals 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.
workspace-runtime.ensureGitWorktreeBranchCoherent (cyclomatic 43) server/src/services/workspace-runtime.ts:2123— workspace-runtime.ensureGitWorktreeBranchCoherent 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.
task-start-resolution.createSlackTaskStartResolution.resolveSlackTaskStart (cyclomatic 43) server/src/services/chat-channels/slack/task-start-resolution.ts:15— task-start-resolution.createSlackTaskStartResolution.resolveSlackTaskStart has cyclomatic complexity 43 (threshold 15). Most of this is not in the body itself: 5 of the 43 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 133, 278, 37). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-channels.chatChannelService.processMessage::persistTaskMutation (cyclomatic 43) server/src/services/chat-channels.ts:2082— chat-channels.chatChannelService.processMessage::persistTaskMutation 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. This shape REPEATS in the file: one other method here (chat-channels.chatChannelService.processMessage) 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.
access-finalization.createOAuthAccessFinalization::finalizeOAuthAccess (cyclomatic 43) server/src/services/tool-access/oauth/access-finalization.ts:34— access-finalization.createOAuthAccessFinalization::finalizeOAuthAccess 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.
file-transfers.createPublicMcpTransfers (cyclomatic 43) server/src/services/public-mcp/file-transfers.ts:32— file-transfers.createPublicMcpTransfers has cyclomatic complexity 43 (threshold 15). Most of this is not in the body itself: 1 of the 43 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 133, 178, 128). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-session-executor.migrateRunnerdStateRootForExecution (cyclomatic 43) server/src/services/native-runtime/native-session-executor.ts:4897— native-session-executor.migrateRunnerdStateRootForExecution 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.
use-cases.runReleaseRecoveryTail (cyclomatic 43) server/src/modules/wake-queue/application/use-cases.ts:494— use-cases.runReleaseRecoveryTail 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.
issues.queueResolvedInteractionContinuationWakeup (cyclomatic 43) server/src/routes/issues.ts:2438— issues.queueResolvedInteractionContinuationWakeup 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.
muse-qualification.collect (cyclomatic 43) scripts/smoke/muse-qualification.ts:81— muse-qualification.collect 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.
NewIssueDialog.NewIssueDialog::handleSubmit (cyclomatic 43) ui/src/components/NewIssueDialog.tsx:792— NewIssueDialog.NewIssueDialog::handleSubmit 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. This shape REPEATS in the file: one other method here (NewIssueDialog.NewIssueDialog) 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.
AgentSetupPrompt.AgentSetupPrompt (cyclomatic 43) ui/src/components/AgentSetupPrompt.tsx:67— AgentSetupPrompt.AgentSetupPrompt has cyclomatic complexity 43 (threshold 15). Of this number, 19 points are the body's own statements and 24 belong to 11 function items inside it that branch. 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.
FeedCard.formatVerb (cyclomatic 43) ui/src/components/FeedCard.tsx:39— FeedCard.formatVerb has cyclomatic complexity 43 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
GatewaysTab.GatewaysTab (cyclomatic 43) ui/src/pages/tools/GatewaysTab.tsx:115— GatewaysTab.GatewaysTab has cyclomatic complexity 43 (threshold 15). Most of this is not in the body itself: 13 of the 43 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 345, a function literal at line 533, copyText, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AppsConnect.AppsConnect (cyclomatic 43) ui/src/pages/apps/AppsConnect.tsx:20— AppsConnect.AppsConnect has cyclomatic complexity 43 (threshold 15). Of this number, 37 points are the body's own statements and 6 belong to 3 function items inside it that branch. 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.
execution-target.startAdapterExecutionTargetPaperclipBridge (cyclomatic 42) REDACTED:4328— execution-target.startAdapterExecutionTargetPaperclipBridge has cyclomatic complexity 42 (threshold 15). Of this number, 37 points are the body's own statements and 5 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.
pi-provider-config.piProviderConfiguration (cyclomatic 42) packages/paperclip-runner/src/drivers/acpx/pi-provider-config.ts:71— pi-provider-config.piProviderConfiguration has cyclomatic complexity 42 (threshold 15). Of this number, 24 points are the body's own statements and 18 belong to 3 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.
copilot-inner-distribution.readCopilotInnerTar (cyclomatic 42) packages/paperclip-runner/scripts/copilot-inner-distribution.mjs:45— copilot-inner-distribution.readCopilotInnerTar has cyclomatic complexity 42 (threshold 15). Of this number, 33 points are the body's own statements and 9 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.
public-eval-viewer.validatePublicChatPayload (cyclomatic 42) packages/paperclip-runner/scripts/public-eval-viewer.mjs:59— public-eval-viewer.validatePublicChatPayload has cyclomatic complexity 42 (threshold 15). Of this number, 28 points are the body's own statements and 14 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.
native-session-resume.rebindNativeSessionCheckpoint (cyclomatic 42) server/src/services/native-runtime/native-session-resume.ts:468— native-session-resume.rebindNativeSessionCheckpoint has cyclomatic complexity 42 (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.
ai-connections.aiConnectionService.select (cyclomatic 42) server/src/services/ai-connections.ts:248— ai-connections.aiConnectionService.select has cyclomatic complexity 42 (threshold 15). Of this number, 40 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
interactions.publishPhotonPrompt (cyclomatic 42) server/src/services/photon/interactions.ts:145— interactions.publishPhotonPrompt has cyclomatic complexity 42 (threshold 15). Of this number, 36 points are the body's own statements and 6 belong to 4 function literals 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.
chat-interaction-publications.terminalNativeInteractionCopy (cyclomatic 42) server/src/services/chat-interaction-publications.ts:41— chat-interaction-publications.terminalNativeInteractionCopy has cyclomatic complexity 42 (threshold 15). Of this number, 40 points are the body's own statements and 2 belong to 2 function literals 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.
chat-github-response-comments.githubResponseCommentService.acknowledge (cyclomatic 42) server/src/services/chat-github-response-comments.ts:188— chat-github-response-comments.githubResponseCommentService.acknowledge has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 1 of the 42 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 194, 195). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tool-access-policy.evaluatePolicyConditions (cyclomatic 42) server/src/services/tool-access-policy.ts:510— tool-access-policy.evaluatePolicyConditions 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.
tool-action-review.commitToolActionReview (cyclomatic 42) server/src/services/tool-action-review.ts:22— tool-action-review.commitToolActionReview has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 11 of the 42 points are its own statements and the rest belongs to one function literal inside it that branches (line 52). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
git-restore-point-storage.validateGitRestorePointRef (cyclomatic 42) server/src/services/git-restore-point-storage.ts:57— git-restore-point-storage.validateGitRestorePointRef has cyclomatic complexity 42 (threshold 15). Of this number, 37 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
git-workspace-contents.restoreGitWorkspaceContents (cyclomatic 42) server/src/services/git-workspace-contents.ts:203— git-workspace-contents.restoreGitWorkspaceContents has cyclomatic complexity 42 (threshold 15). Of this number, 35 points are the body's own statements and 7 belong to 3 function literals 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.
fast-response-provider.runFastResponseProvider (cyclomatic 42) server/src/services/fast-response-provider.ts:161— fast-response-provider.runFastResponseProvider 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.
workspace-file-resources.workspaceFileResourceService.availability (cyclomatic 42) server/src/services/workspace-file-resources.ts:1292— workspace-file-resources.workspaceFileResourceService.availability has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 9 of the 42 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1330, 1307). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-session-executor.createRunnerdBackendWithinSessionClaim.ensureRemoteRunner (cyclomatic 42) server/src/services/native-runtime/native-session-executor.ts:12704— native-session-executor.createRunnerdBackendWithinSessionClaim.ensureRemoteRunner has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 1 of the 42 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 12732, 12708, 12879, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-workspace-finalizer.resumeNativeWorkspaceFinalization (cyclomatic 42) server/src/services/native-runtime/native-workspace-finalizer.ts:52— native-workspace-finalizer.resumeNativeWorkspaceFinalization has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 5 of the 42 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 153, 82). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
run-control.createHeartbeatRunControl.resumeRemoteStopComments (cyclomatic 42) server/src/services/heartbeat/run-control.ts:513— run-control.createHeartbeatRunControl.resumeRemoteStopComments 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.
run-control.createHeartbeatRunControl.resumeSavedLegacyComments (cyclomatic 42) server/src/services/heartbeat/run-control.ts:620— run-control.createHeartbeatRunControl.resumeSavedLegacyComments has cyclomatic complexity 42 (threshold 15). Of this number, 25 points are the body's own statements and 17 belong to one function literal 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-definition.connectionMethodDefSchema (cyclomatic 42) packages/shared/src/validators/app-definition.ts:11— app-definition.connectionMethodDefSchema 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.
quota-windows.fetchCompanyQuotaWindows (cyclomatic 42) server/src/services/quota-windows.ts:18— quota-windows.fetchCompanyQuotaWindows has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 2 of the 42 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 57, a function literal at line 43, readAccount, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SidebarAgents.SidebarAgentItem (cyclomatic 42) ui/src/components/SidebarAgents.tsx:109— SidebarAgents.SidebarAgentItem has cyclomatic complexity 42 (threshold 15). Of this number, 37 points are the body's own statements and 5 belong to 4 function literals inside it that branch. 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.
schema-config-fields.SchemaConfigFields (cyclomatic 42) ui/src/adapters/schema-config-fields.tsx:323— schema-config-fields.SchemaConfigFields has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 3 of the 42 points are its own statements and the rest belongs to 10 function items inside it that branch (writeValue, a function literal at line 337, a function literal at line 417, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentSecretAccessEditor.AgentSecretAccessEditor (cyclomatic 42) ui/src/components/AgentSecretAccessEditor.tsx:194— AgentSecretAccessEditor.AgentSecretAccessEditor has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 6 of the 42 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 340, 352, 224, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SidebarAgents.production.SidebarAgentItem (cyclomatic 42) ui/src/components/SidebarAgents.production.tsx:109— SidebarAgents.production.SidebarAgentItem has cyclomatic complexity 42 (threshold 15). Of this number, 37 points are the body's own statements and 5 belong to 4 function literals inside it that branch. 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.
ConfigureBuiltInAgentModal.ConfigureBuiltInAgentModal (cyclomatic 42) ui/src/components/ConfigureBuiltInAgentModal.tsx:60— ConfigureBuiltInAgentModal.ConfigureBuiltInAgentModal has cyclomatic complexity 42 (threshold 15). Of this number, 20 points are the body's own statements and 22 belong to 8 function literals inside it that branch. 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.
InstanceGeneralSettings.InstanceGeneralSettings (cyclomatic 42) ui/src/pages/InstanceGeneralSettings.tsx:23— InstanceGeneralSettings.InstanceGeneralSettings has cyclomatic complexity 42 (threshold 15). Of this number, 34 points are the body's own statements and 8 belong to 6 function literals inside it that branch. 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.
DecisionModelSettings.DecisionModelSettingsView (cyclomatic 42) ui/src/components/decision-models/DecisionModelSettings.tsx:24— DecisionModelSettings.DecisionModelSettingsView has cyclomatic complexity 42 (threshold 15). Of this number, 31 points are the body's own statements and 11 belong to 5 function literals inside it that branch. 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.
ProfilesTab.ProfilesTab (cyclomatic 42) ui/src/pages/tools/ProfilesTab.tsx:639— ProfilesTab.ProfilesTab has cyclomatic complexity 42 (threshold 15). Of this number, 16 points are the body's own statements and 26 belong to 14 function items inside it that branch. 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.
PluginManager.PluginManager (cyclomatic 42) ui/src/pages/PluginManager.tsx:88— PluginManager.PluginManager has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 13 of the 42 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 273, 373, 457, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ConnectionSetupFlow.ConnectionSetupFlow (cyclomatic 42) ui/src/features/connections/ConnectionSetupFlow.tsx:584— ConnectionSetupFlow.ConnectionSetupFlow has cyclomatic complexity 42 (threshold 15). Of this number, 39 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
useBrowserViewport.useBrowserViewport (cyclomatic 42) ui/src/hooks/useBrowserViewport.ts:34— useBrowserViewport.useBrowserViewport has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 1 of the 42 points is its own statement and the rest belongs to 12 function literals inside it that branch (lines 108, 113, 162, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
public-view.publicProviderPayload (cyclomatic 41) packages/paperclip-runner/src/issue-thread/public-view.ts:175— public-view.publicProviderPayload has cyclomatic complexity 41 (threshold 15). Of this number, 25 points are the body's own statements and 16 belong to 6 function literals 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.
environments.environmentService.ensureManagedSandboxEnvironment (cyclomatic 41) REDACTED:349— environments.environmentService.ensureManagedSandboxEnvironment has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 7 of the 41 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 369, 408, 571). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-interaction-publications.enqueueTerminalIssueInteractionChatPublications (cyclomatic 41) server/src/services/chat-interaction-publications.ts:556— chat-interaction-publications.enqueueTerminalIssueInteractionChatPublications has cyclomatic complexity 41 (threshold 15). Of this number, 38 points are the body's own statements and 3 belong to 2 function literals 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.
tool-gateway.createToolGatewayService.approveActionRequest (cyclomatic 41) server/src/services/tool-gateway.ts:9837— tool-gateway.createToolGatewayService.approveActionRequest 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.
maintenance.createTelegramMaintenance.processTelegramMaintenance (cyclomatic 41) server/src/services/chat-channels/telegram/maintenance.ts:212— maintenance.createTelegramMaintenance.processTelegramMaintenance has cyclomatic complexity 41 (threshold 15). Of this number, 38 points are the body's own statements and 3 belong to 3 function literals 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.
setup-probes.createSetupProbes.test (cyclomatic 41) server/src/services/chat-channels/setup-probes.ts:97— setup-probes.createSetupProbes.test has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 2 of the 41 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 102, 291, 243). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
git-workspace-restoration.assertReproducibleGitFiles (cyclomatic 41) server/src/services/git-workspace-restoration.ts:488— git-workspace-restoration.assertReproducibleGitFiles has cyclomatic complexity 41 (threshold 15). Of this number, 31 points are the body's own statements and 10 belong to 5 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.
postgres.createPostgresRunDispatchAdapter.dispatchResolvedInteractionIfCurrent (cyclomatic 41) server/src/modules/run-dispatch/adapters/postgres.ts:1153— postgres.createPostgresRunDispatchAdapter.dispatchResolvedInteractionIfCurrent has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 2 of the 41 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 1243, dispatchLockedRun, a function literal at line 1174). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
installation-lifecycle.createGitHubInstallationLifecycle.applyGitHubInstallationLifecycle (cyclomatic 41) server/src/services/chat-channels/github/installation-lifecycle.ts:81— installation-lifecycle.createGitHubInstallationLifecycle.applyGitHubInstallationLifecycle has cyclomatic complexity 41 (threshold 15). Of this number, 31 points are the body's own statements and 10 belong to 3 function literals 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.
native-harness-backup-stamp.verifyNativeHarnessBackupStamp (cyclomatic 41) server/src/services/native-runtime/native-harness-backup-stamp.ts:145— native-harness-backup-stamp.verifyNativeHarnessBackupStamp has cyclomatic complexity 41 (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.
runner-goals.runnerGoalService.act (cyclomatic 41) server/src/services/runner-goals.ts:351— runner-goals.runnerGoalService.act has cyclomatic complexity 41 (threshold 15). Of this number, 22 points are the body's own statements and 19 belong to 2 function literals 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.
native-permission-decline.hasCompletedNativePermissionDecline (cyclomatic 41) server/src/services/native-runtime/native-permission-decline.ts:19— native-permission-decline.hasCompletedNativePermissionDecline has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 7 of the 41 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 23, 33, 30, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
agent-instruction-working-copies.agentInstructionWorkingCopyService.prepare (cyclomatic 41) server/src/services/agent-instruction-working-copies.ts:104— agent-instruction-working-copies.agentInstructionWorkingCopyService.prepare has cyclomatic complexity 41 (threshold 15). Of this number, 39 points are the body's own statements and 2 belong to one function literal 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.
sentry-links.addSentryRunLinks (cyclomatic 41) REDACTED:32— sentry-links.addSentryRunLinks has cyclomatic complexity 41 (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.
remote-warm-session-recovery.inspectRemoteWarmSessionRecovery (cyclomatic 41) server/src/services/native-runtime/remote-warm-session-recovery.ts:16— remote-warm-session-recovery.inspectRemoteWarmSessionRecovery has cyclomatic complexity 41 (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.
decision-models.decisionModelService.resolve (cyclomatic 41) server/src/services/decision-models.ts:86— decision-models.decisionModelService.resolve 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.
InlineEntitySelector.InlineEntitySelector (cyclomatic 41) ui/src/components/InlineEntitySelector.tsx:71— InlineEntitySelector.InlineEntitySelector has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 5 of the 41 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 245, a function literal at line 287, a function literal at line 134, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SidebarNavItem.production.SidebarNavItem (cyclomatic 41) ui/src/components/SidebarNavItem.production.tsx:72— SidebarNavItem.production.SidebarNavItem has cyclomatic complexity 41 (threshold 15). Of this number, 39 points are the body's own statements and 2 belong to 2 function literals 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.
WorkspaceBaseRefRecoveryNotice.WorkspaceBaseRefRecoveryNotice (cyclomatic 41) ui/src/components/WorkspaceBaseRefRecoveryNotice.tsx:26— WorkspaceBaseRefRecoveryNotice.WorkspaceBaseRefRecoveryNotice has cyclomatic complexity 41 (threshold 15). Of this number, 33 points are the body's own statements and 8 belong to one function item inside it that branches. 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.
IssueChatThread.IssueChatProviderActivity (cyclomatic 41) ui/src/components/IssueChatThread.tsx:1726— IssueChatThread.IssueChatProviderActivity has cyclomatic complexity 41 (threshold 15). Of this number, 29 points are the body's own statements and 12 belong to 3 function literals 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.
ApprovalDetail.ApprovalDetail (cyclomatic 41) ui/src/pages/ApprovalDetail.tsx:20— ApprovalDetail.ApprovalDetail has cyclomatic complexity 41 (threshold 15). Of this number, 28 points are the body's own statements and 13 belong to 11 function items inside it that branch. 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.
SubscriptionCostCard.SubscriptionCostCard (cyclomatic 41) ui/src/components/SubscriptionCostCard.tsx:66— SubscriptionCostCard.SubscriptionCostCard has cyclomatic complexity 41 (threshold 15). Of this number, 24 points are the body's own statements and 17 belong to 2 function literals 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.
CostDataQualityNotice.CostDataQualityNotice (cyclomatic 41) ui/src/components/CostDataQualityNotice.tsx:40— CostDataQualityNotice.CostDataQualityNotice has cyclomatic complexity 41 (threshold 15). Of this number, 27 points are the body's own statements and 14 belong to 5 function items inside it that branch. 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.
CompanyImport.CompanyImport::buildFinalAdapterOverrides (cyclomatic 41) ui/src/pages/CompanyImport.tsx:1733— CompanyImport.CompanyImport::buildFinalAdapterOverrides 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. This shape REPEATS in the file: one other method here (CompanyImport.CompanyImport) 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.
RunnerGoalWidget.RunnerGoalWidget (cyclomatic 41) ui/src/components/task-chat/RunnerGoalWidget.tsx:183— RunnerGoalWidget.RunnerGoalWidget has cyclomatic complexity 41 (threshold 15). Of this number, 34 points are the body's own statements and 7 belong to 4 function items inside it that branch. 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.
TaskChatCompactInteractionCard.ConfirmationCard (cyclomatic 41) ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx:797— TaskChatCompactInteractionCard.ConfirmationCard has cyclomatic complexity 41 (threshold 15). Of this number, 30 points are the body's own statements and 11 belong to 5 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.
AgentMailIntentSetup.AgentMailIntentSetup (cyclomatic 41) ui/src/features/connections/AgentMailIntentSetup.tsx:23— AgentMailIntentSetup.AgentMailIntentSetup has cyclomatic complexity 41 (threshold 15). Of this number, 27 points are the body's own statements and 14 belong to 5 function literals inside it that branch. 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.
useAnnouncement.useAnnouncement (cyclomatic 41) ui/src/hooks/useAnnouncement.ts:14— useAnnouncement.useAnnouncement has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 3 of the 41 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 35, 79, 21, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
voice-session-controller.createVoiceSessionController.start (cyclomatic 41) ui/src/lib/voice-session-controller.ts:102— voice-session-controller.createVoiceSessionController.start has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 13 of the 41 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 108, 135). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
plugin.registerPluginCommands (cyclomatic 40) cli/src/commands/client/plugin.ts:321— plugin.registerPluginCommands has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 1 of the 40 points is its own statement and the rest belongs to 10 function literals inside it that branch (lines 414, 516, 369, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
server.promptServer (cyclomatic 40) cli/src/prompts/server.ts:15— server.promptServer has cyclomatic complexity 40 (threshold 15). Of this number, 22 points are the body's own statements and 18 belong to 5 function literals 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.
opencode-proxy-command.trustedOpenCodeLaunchBinding (cyclomatic 40) packages/paperclip-runner/src/cli/opencode-proxy-command.ts:34— opencode-proxy-command.trustedOpenCodeLaunchBinding has cyclomatic complexity 40 (threshold 15). Of this number, 17 points are the body's own statements and 23 belong to 2 function items inside it that branch. 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.
PaperclipSemanticDispatcher.dispatch (cyclomatic 40) packages/paperclip-runner/src/semantic-tools/paperclip-dispatcher.ts:156— PaperclipSemanticDispatcher.dispatch 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.
connection-methods.normalizeConnectionMethodConfig (cyclomatic 40) REDACTED:86— connection-methods.normalizeConnectionMethodConfig 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.
tool-gateway.createToolGatewayService.resolveCredentialHeadersUnrecorded (cyclomatic 40) server/src/services/tool-gateway.ts:4133— tool-gateway.createToolGatewayService.resolveCredentialHeadersUnrecorded 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.
execution-workspaces.executionWorkspaceService.reconcileExecutionWorkspaceBranch (cyclomatic 40) server/src/services/execution-workspaces.ts:4775— execution-workspaces.executionWorkspaceService.reconcileExecutionWorkspaceBranch has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 13 of the 40 points are its own statements and the rest belongs to one function literal inside it that branches (line 4846). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
task-retry.requestTaskRetry (cyclomatic 40) server/src/services/task-retry.ts:56— task-retry.requestTaskRetry has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 1 of the 40 points is its own statement and the rest belongs to one function literal inside it that branches (line 62). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
eval-schedule-monitor.inspectEvalSchedule (cyclomatic 40) scripts/eval-schedule-monitor.mjs:32— eval-schedule-monitor.inspectEvalSchedule has cyclomatic complexity 40 (threshold 15). Of this number, 31 points are the body's own statements and 9 belong to 2 function literals 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.
costs.costRoutes (cyclomatic 40) server/src/routes/costs.ts:69— costs.costRoutes has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 1 of the 40 points is its own statement and the rest belongs to 28 function items inside it that branch (a function literal at line 436, a function literal at line 232, a function literal at line 105, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
IssueShareSheet.IssueShareSheet (cyclomatic 40) ui/src/components/IssueShareSheet.tsx:160— IssueShareSheet.IssueShareSheet has cyclomatic complexity 40 (threshold 15). Of this number, 18 points are the body's own statements and 22 belong to 11 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.
database.promptDatabase (cyclomatic 39) cli/src/prompts/database.ts:9— database.promptDatabase has cyclomatic complexity 39 (threshold 15). Of this number, 22 points are the body's own statements and 17 belong to 5 function literals 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.
parse.createGeminiJsonlParser (cyclomatic 39) packages/adapters/gemini-local/src/server/parse.ts:81— parse.createGeminiJsonlParser has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 1 of the 39 points is its own statement and the rest belongs to 3 function items inside it that branch (a function literal at line 106, recordAccounting, a function literal at line 97). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
DurablePrpControlPlane.#handleJson (cyclomatic 39) REDACTED:2119— DurablePrpControlPlane.#handleJson has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DurablePrpControlPlane.#authResponse (cyclomatic 39) REDACTED:2593— DurablePrpControlPlane.#authResponse 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.
DurablePrpCodexTransport.#prepareLaunch (cyclomatic 39) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:4805— DurablePrpCodexTransport.#prepareLaunch 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.
materialize-pi-distribution.materializePiDistribution (cyclomatic 39) packages/paperclip-runner/scripts/materialize-pi-distribution.mjs:136— materialize-pi-distribution.materializePiDistribution has cyclomatic complexity 39 (threshold 15). Of this number, 34 points are the body's own statements and 5 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.
capability-inventory.validateInventories (cyclomatic 39) packages/paperclip-runner/scripts/lib/capability-inventory.mjs:248— capability-inventory.validateInventories 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.
runtime-context.nativeTaskConstraints (cyclomatic 39) packages/paperclip-runner/src/backends/runtime-context.ts:45— runtime-context.nativeTaskConstraints has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 12 of the 39 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 51, 88, 114). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
live-projection.projectCapabilityIssueThread (cyclomatic 39) packages/paperclip-runner/src/issue-thread/live-projection.ts:752— live-projection.projectCapabilityIssueThread 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.
pi-runtime-extension.askPiNativeQuestion (cyclomatic 39) packages/paperclip-runner/src/drivers/acpx/pi-runtime-extension.ts:205— pi-runtime-extension.askPiNativeQuestion has cyclomatic complexity 39 (threshold 15). Of this number, 34 points are the body's own statements and 5 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.
native-reconstruction-intervening-executions.reconciledInterveningExecutions (cyclomatic 39) server/src/services/native-runtime/native-reconstruction-intervening-executions.ts:17— native-reconstruction-intervening-executions.reconciledInterveningExecutions has cyclomatic complexity 39 (threshold 15). Of this number, 27 points are the body's own statements and 12 belong to 2 function literals inside it that branch. 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.
chat-slack-receipts.applySlackReceiptReaction (cyclomatic 39) server/src/services/chat-slack-receipts.ts:52— chat-slack-receipts.applySlackReceiptReaction has cyclomatic complexity 39 (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.
tool-gateway.createToolGatewayService.resolveConnectionGrant (cyclomatic 39) server/src/services/tool-gateway.ts:4563— tool-gateway.createToolGatewayService.resolveConnectionGrant has cyclomatic complexity 39 (threshold 15). Of this number, 34 points are the body's own statements and 5 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.
managed-repository-checkout.materializeManagedProjectWorkspace (cyclomatic 39) server/src/services/managed-repository-checkout.ts:17— managed-repository-checkout.materializeManagedProjectWorkspace has cyclomatic complexity 39 (threshold 15). Of this number, 35 points are the body's own statements and 4 belong to 3 function literals 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.
speko-tool-setup.configureSpekoSessionTools (cyclomatic 39) server/src/services/voice/speko-tool-setup.ts:9— speko-tool-setup.configureSpekoSessionTools has cyclomatic complexity 39 (threshold 15). Of this number, 38 points are the body's own statements and 1 belongs to one function literal 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.
connection-intents.connectionIntentService.setupOptions (cyclomatic 39) server/src/services/connection-intents.ts:861— connection-intents.connectionIntentService.setupOptions has cyclomatic complexity 39 (threshold 15). Of this number, 26 points are the body's own statements and 13 belong to 3 function literals inside it that branch. 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.
native-question-bridge.projectNativeRuntimeRequest (cyclomatic 39) server/src/services/native-runtime/native-question-bridge.ts:116— native-question-bridge.projectNativeRuntimeRequest has cyclomatic complexity 39 (threshold 15). Of this number, 35 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
events.createPhotonEvents.handlePhotonEvent (cyclomatic 39) server/src/services/chat-channels/imessage-photon/events.ts:712— events.createPhotonEvents.handlePhotonEvent has cyclomatic complexity 39 (threshold 15). Of this number, 26 points are the body's own statements and 13 belong to 2 function literals inside it that branch. 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.
issues.listIssueReviewAttentionMap (cyclomatic 39) server/src/services/issues.ts:4535— issues.listIssueReviewAttentionMap has cyclomatic complexity 39 (threshold 15). Of this number, 21 points are the body's own statements and 18 belong to 2 function literals 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.
native-workspace-sync.prepareNativeWorkspaceSync (cyclomatic 39) server/src/services/native-runtime/native-workspace-sync.ts:890— native-workspace-sync.prepareNativeWorkspaceSync has cyclomatic complexity 39 (threshold 15). Of this number, 38 points are the body's own statements and 1 belongs to one function literal 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.
run-preparation.attestReviewedExternalChatRun (cyclomatic 39) server/src/services/heartbeat/run-preparation.ts:2052— run-preparation.attestReviewedExternalChatRun has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 7 of the 39 points are its own statements and the rest belongs to one function literal inside it that branches (line 2064). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
service.recoveryService.repairNativeBlockedWait (cyclomatic 39) REDACTED:1603— service.recoveryService.repairNativeBlockedWait has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 3 of the 39 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1612, 1740). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
service.recoveryService.reconcileDispositionRepair (cyclomatic 39) REDACTED:3882— service.recoveryService.reconcileDispositionRepair has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
recovery.createHeartbeatRecovery.sweepPendingCleanupLeases (cyclomatic 39) server/src/services/heartbeat/recovery.ts:1555— recovery.createHeartbeatRecovery.sweepPendingCleanupLeases has cyclomatic complexity 39 (threshold 15). Of this number, 36 points are the body's own statements and 3 belong to 3 function literals 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.
queue.createHeartbeatQueue.enqueueWakeup::existingDurableReceipt (cyclomatic 39) server/src/services/heartbeat/queue.ts:2349— queue.createHeartbeatQueue.enqueueWakeup::existingDurableReceipt has cyclomatic complexity 39 (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. This shape REPEATS in the file: one other method here (queue.createHeartbeatQueue.enqueueWakeup) 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.
queue.createHeartbeatQueue.dispatchPendingNativeStatusWakeups (cyclomatic 39) server/src/services/heartbeat/queue.ts:4629— queue.createHeartbeatQueue.dispatchPendingNativeStatusWakeups 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.
ai-connection-router.aiConnectionRouterService.resolve (cyclomatic 39) server/src/services/ai-connection-router.ts:205— ai-connection-router.aiConnectionRouterService.resolve has cyclomatic complexity 39 (threshold 15). Of this number, 32 points are the body's own statements and 7 belong to one function literal 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.
companies.companyService.update (cyclomatic 39) server/src/services/companies.ts:295— companies.companyService.update has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 7 of the 39 points are its own statements and the rest belongs to one function literal inside it that branches (line 301). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
company-portability.filterPortableExtensionYaml (cyclomatic 39) server/src/services/company-portability.ts:2086— company-portability.filterPortableExtensionYaml has cyclomatic complexity 39 (threshold 15). Of this number, 31 points are the body's own statements and 8 belong to 3 function literals 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.
connection-intent-delivery.connectionIntentDeliveryService.deliver (cyclomatic 39) server/src/services/connection-intent-delivery.ts:118— connection-intent-delivery.connectionIntentDeliveryService.deliver has cyclomatic complexity 39 (threshold 15). Of this number, 33 points are the body's own statements and 6 belong to one function literal 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.
BreadcrumbBar.BreadcrumbBar (cyclomatic 39) ui/src/components/BreadcrumbBar.tsx:55— BreadcrumbBar.BreadcrumbBar has cyclomatic complexity 39 (threshold 15). Of this number, 19 points are the body's own statements and 20 belong to one function literal 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.
OnboardingCharacter.OnboardingCharacter (cyclomatic 39) ui/src/components/onboarding/OnboardingCharacter.tsx:42— OnboardingCharacter.OnboardingCharacter has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 6 of the 39 points are its own statements and the rest belongs to 9 function items inside it that branch (mount, wake, a function literal at line 164, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
DotRunnerConnection.DotRunnerConnection (cyclomatic 39) ui/src/components/DotRunnerConnection.tsx:16— DotRunnerConnection.DotRunnerConnection has cyclomatic complexity 39 (threshold 15). Of this number, 29 points are the body's own statements and 10 belong to 4 function literals inside it that branch. 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.
issue-chat-messages.buildAssistantPartsFromTranscript (cyclomatic 39) ui/src/lib/issue-chat-messages.ts:900— issue-chat-messages.buildAssistantPartsFromTranscript has cyclomatic complexity 39 (threshold 15). Of this number, 38 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.
IssueScheduledRetryCard.IssueScheduledRetryCard (cyclomatic 39) ui/src/components/IssueScheduledRetryCard.tsx:27— IssueScheduledRetryCard.IssueScheduledRetryCard 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.
RoutineTriggers.RoutineTriggers (cyclomatic 39) ui/src/components/routine-triggers/RoutineTriggers.tsx:65— RoutineTriggers.RoutineTriggers has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 13 of the 39 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 211, change, a function literal at line 158, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SmokeLabTab.SmokeLabTab (cyclomatic 39) ui/src/pages/tools/SmokeLabTab.tsx:69— SmokeLabTab.SmokeLabTab has cyclomatic complexity 39 (threshold 15). Of this number, 28 points are the body's own statements and 11 belong to 5 function items inside it that branch. 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.
OwnSlackAppSetup.OwnSlackAppSetup (cyclomatic 39) ui/src/pages/apps/chat/slack/OwnSlackAppSetup.tsx:13— OwnSlackAppSetup.OwnSlackAppSetup has cyclomatic complexity 39 (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. This shape REPEATS in the file: one other method here (OwnSlackAppSetup.OwnSlackAppSetup::create) 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.
ChatExecutionDefaults.ChatExecutionDefaults (cyclomatic 39) ui/src/pages/apps/chat/ChatExecutionDefaults.tsx:18— ChatExecutionDefaults.ChatExecutionDefaults has cyclomatic complexity 39 (threshold 15). Of this number, 27 points are the body's own statements and 12 belong to 4 function literals inside it that branch. 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.
AppNotConnected.AppNotConnected (cyclomatic 39) ui/src/pages/apps/AppNotConnected.tsx:25— AppNotConnected.AppNotConnected has cyclomatic complexity 39 (threshold 15). Of this number, 35 points are the body's own statements and 4 belong to 3 function literals inside it that branch. 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.
SkillStudio.InputPane (cyclomatic 39) ui/src/pages/SkillStudio.tsx:1894— SkillStudio.InputPane has cyclomatic complexity 39 (threshold 15). Of this number, 21 points are the body's own statements and 18 belong to 11 function literals 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.
AiConnectorPages.AiConnectorPages (cyclomatic 39) ui/storybook/prototypes/AiConnectorPages.tsx:59— AiConnectorPages.AiConnectorPages has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 2 of the 39 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 75, a function literal at line 73, a function literal at line 136, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
approvals.hireApprovalService.decide (cyclomatic 38) server/src/modules/agent-lifecycle/adapters/approvals.ts:21— approvals.hireApprovalService.decide has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 6 of the 38 points are its own statements and the rest belongs to one function literal inside it that branches (line 29). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
voice-reply-push.pushVoiceReplies (cyclomatic 38) server/src/services/voice/voice-reply-push.ts:28— voice-reply-push.pushVoiceReplies has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 15 of the 38 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 50, 115, 87, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
voice-session-service.voiceSessionService.start (cyclomatic 38) server/src/services/voice/voice-session-service.ts:48— voice-session-service.voiceSessionService.start has cyclomatic complexity 38 (threshold 15). Of this number, 26 points are the body's own statements and 12 belong to one function literal 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.
resource-reconciliation.createChatResourceReconciliation.updateResourceSelection (cyclomatic 38) server/src/services/chat-channels/resource-reconciliation.ts:175— resource-reconciliation.createChatResourceReconciliation.updateResourceSelection has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 9 of the 38 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 193, 273, 248, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
file-transfer-authority.createTeamsFileAuthority.teamsFileSourceBinding (cyclomatic 38) server/src/services/chat-channels/microsoft-teams/file-transfer-authority.ts:379— file-transfer-authority.createTeamsFileAuthority.teamsFileSourceBinding has cyclomatic complexity 38 (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.
endpoints.createChatEndpoints.update (cyclomatic 38) server/src/services/chat-channels/endpoints.ts:379— endpoints.createChatEndpoints.update has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 4 of the 38 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 389, 445). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-broker.createNativeExternalBroker.assertCurrentAuthority (cyclomatic 38) server/src/modules/external-agents/native-broker.ts:58— native-broker.createNativeExternalBroker.assertCurrentAuthority has cyclomatic complexity 38 (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.
company-skills.companySkillService.createLocalSkill (cyclomatic 38) server/src/services/company-skills.ts:4524— company-skills.companySkillService.createLocalSkill has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 12 of the 38 points are its own statements and the rest belongs to one function literal inside it that branches (line 4563). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
PaperclipRunnerToolAuthority.#projectMuseDocumentContent (cyclomatic 38) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:2131— PaperclipRunnerToolAuthority.#projectMuseDocumentContent has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 5 of the 38 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 2158, a function literal at line 2141, a function literal at line 2154, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
scheduling.createHeartbeatScheduling.dispatchClaimedIssueMonitor (cyclomatic 38) server/src/services/heartbeat/scheduling.ts:592— scheduling.createHeartbeatScheduling.dispatchClaimedIssueMonitor 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.
file-sync.syncFiles (cyclomatic 38) packages/plugins/sandbox-providers/createos/src/file-sync.ts:59— file-sync.syncFiles has cyclomatic complexity 38 (threshold 15). Of this number, 34 points are the body's own statements and 4 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.
pod-exec.execInPod (cyclomatic 38) packages/plugins/sandbox-providers/kubernetes/src/pod-exec.ts:57— pod-exec.execInPod has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 6 of the 38 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 149, 173, 197, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
provider-billing-import.fetchProviderDailyCosts (cyclomatic 38) server/src/services/provider-billing-import.ts:80— provider-billing-import.fetchProviderDailyCosts 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.
AdapterLoginChrome.LocalProviderLoginInstructions (cyclomatic 38) ui/src/components/AdapterLoginChrome.tsx:470— AdapterLoginChrome.LocalProviderLoginInstructions has cyclomatic complexity 38 (threshold 15). Of this number, 33 points are the body's own statements and 5 belong to 2 function items inside it that branch. 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.
Auth.AuthPage (cyclomatic 38) ui/src/pages/Auth.tsx:19— Auth.AuthPage has cyclomatic complexity 38 (threshold 15). Of this number, 30 points are the body's own statements and 8 belong to 6 function literals inside it that branch. 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.
transcript-adapter.buildTurnTimelineRows (cyclomatic 38) ui/src/components/task-chat/transcript-adapter.ts:1706— transcript-adapter.buildTurnTimelineRows has cyclomatic complexity 38 (threshold 15). Of this number, 30 points are the body's own statements and 8 belong to 3 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.
OutputFeedbackButtons.OutputFeedbackButtons (cyclomatic 38) ui/src/components/OutputFeedbackButtons.tsx:16— OutputFeedbackButtons.OutputFeedbackButtons has cyclomatic complexity 38 (threshold 15). Of this number, 18 points are the body's own statements and 20 belong to 8 function items inside it that branch. 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.
PasteConfigTab.PasteConfigTab (cyclomatic 38) ui/src/pages/tools/PasteConfigTab.tsx:103— PasteConfigTab.PasteConfigTab has cyclomatic complexity 38 (threshold 15). Of this number, 16 points are the body's own statements and 22 belong to 10 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.
GitHubConnectionRecovery.GitHubAppRecovery (cyclomatic 38) ui/src/pages/apps/chat/GitHubConnectionRecovery.tsx:43— GitHubConnectionRecovery.GitHubAppRecovery has cyclomatic complexity 38 (threshold 15). Of this number, 33 points are the body's own statements and 5 belong to 2 function items inside it that branch. 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.
TaskChatCompactInteractionCard.CheckboxConfirmationCard (cyclomatic 38) ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx:1061— TaskChatCompactInteractionCard.CheckboxConfirmationCard has cyclomatic complexity 38 (threshold 15). Of this number, 22 points are the body's own statements and 16 belong to 6 function items inside it that branch. 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.
ConnectorCatalogNavigation.ConnectorCatalogNavigation (cyclomatic 38) ui/storybook/prototypes/ConnectorCatalogNavigation.tsx:74— ConnectorCatalogNavigation.ConnectorCatalogNavigation has cyclomatic complexity 38 (threshold 15). Of this number, 21 points are the body's own statements and 17 belong to 7 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.
conversation-type-inventory.measureConversationType (cyclomatic 38) ui/storybook/support/design-proposals/conversation-type-inventory.ts:38— conversation-type-inventory.measureConversationType 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.
ui.parseAcpxStdoutLine (cyclomatic 37) packages/adapter-utils/src/acpx-engine/ui.ts:56— ui.parseAcpxStdoutLine has cyclomatic complexity 37 (threshold 15). Of this number, 27 points are the body's own statements and 10 belong to one function literal 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.
CapabilityLiveSession.#connect (cyclomatic 37) packages/paperclip-runner/src/live/live-session.ts:2354— CapabilityLiveSession.#connect 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.
materialize-pi-distribution.verifyLockedPiPackageGraph (cyclomatic 37) packages/paperclip-runner/scripts/materialize-pi-distribution.mjs:39— materialize-pi-distribution.verifyLockedPiPackageGraph has cyclomatic complexity 37 (threshold 15). Of this number, 36 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
runtime-sandbox.prepareAcpxRuntimeSandbox (cyclomatic 37) packages/paperclip-runner/src/drivers/acpx/runtime-sandbox.ts:342— runtime-sandbox.prepareAcpxRuntimeSandbox has cyclomatic complexity 37 (threshold 15). Of this number, 31 points are the body's own statements and 6 belong to 3 function literals 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.
sandbox-stop-and-retain.hasConfirmedSandboxStopAndRetain (cyclomatic 37) server/src/services/sandbox-stop-and-retain.ts:17— sandbox-stop-and-retain.hasConfirmedSandboxStopAndRetain has cyclomatic complexity 37 (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.
native-workspace-reconstruction.validateReconstructedWorkspaceDispatch (cyclomatic 37) server/src/services/native-runtime/native-workspace-reconstruction.ts:119— native-workspace-reconstruction.validateReconstructedWorkspaceDispatch has cyclomatic complexity 37 (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.
chat-teams-inline-image-intake.deriveTeamsInlineImageLocator (cyclomatic 37) server/src/services/chat-teams-inline-image-intake.ts:133— chat-teams-inline-image-intake.deriveTeamsInlineImageLocator has cyclomatic complexity 37 (threshold 15). Of this number, 33 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
prompt-injection-prevention.promptInjectionPreventionService.classify (cyclomatic 37) server/src/services/prompt-injection-prevention.ts:140— prompt-injection-prevention.promptInjectionPreventionService.classify has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 12 of the 37 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 155, 180). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
railway.createRailwayClient.call (cyclomatic 37) server/src/services/railway.ts:258— railway.createRailwayClient.call 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.
tool-gateway.createToolGatewayService.executeBuiltinTool (cyclomatic 37) server/src/services/tool-gateway.ts:3195— tool-gateway.createToolGatewayService.executeBuiltinTool has cyclomatic complexity 37 (threshold 15). Of this number, 34 points are the body's own statements and 3 belong to one function literal 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.
customer-owned.createCustomerOwnedSetup.create (cyclomatic 37) server/src/services/connectors/slack/setup/customer-owned.ts:11— customer-owned.createCustomerOwnedSetup.create has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 1 of the 37 points is its own statement and the rest belongs to one function literal inside it that branches (line 12). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
failed-run-retry.createChatFailedRunRetry.claimFailedChatRunRetry (cyclomatic 37) server/src/services/chat-channels/failed-run-retry.ts:1521— failed-run-retry.createChatFailedRunRetry.claimFailedChatRunRetry has cyclomatic complexity 37 (threshold 15). Of this number, 36 points are the body's own statements and 1 belongs to one function literal 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.
session-status.createSlackSessionStatus.processPendingSlackSessionSyncs (cyclomatic 37) server/src/services/chat-channels/slack/session-status.ts:65— session-status.createSlackSessionStatus.processPendingSlackSessionSyncs has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 13 of the 37 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 136, 315, 362, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-channels.chatChannelService.handleWebhook (cyclomatic 37) server/src/services/chat-channels.ts:2873— chat-channels.chatChannelService.handleWebhook 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.
health.createConnectionHealth.checkConnectionHealth (cyclomatic 37) server/src/services/tool-access/catalog/health.ts:75— health.createConnectionHealth.checkConnectionHealth has cyclomatic complexity 37 (threshold 15). Of this number, 36 points are the body's own statements and 1 belongs to one function literal 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.
dot.createBroker.authorizeAssignment (cyclomatic 37) server/src/modules/external-agents/dot.ts:55— dot.createBroker.authorizeAssignment has cyclomatic complexity 37 (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.
company-skills.auditInstalledSkillBytes (cyclomatic 37) server/src/services/company-skills.ts:2544— company-skills.auditInstalledSkillBytes 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.
ai-connection-router.poolMemberRuntimeConfig (cyclomatic 37) server/src/services/ai-connection-router.ts:27— ai-connection-router.poolMemberRuntimeConfig has cyclomatic complexity 37 (threshold 15). Of this number, 32 points are the body's own statements and 5 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.
app.WikiRouteSidebar (cyclomatic 37) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:2405— app.WikiRouteSidebar has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 6 of the 37 points are its own statements and the rest belongs to 15 function items inside it that branch (renderToolLink, a function literal at line 2470, a function literal at line 2485, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
plugin-lifecycle-delivery.registerPluginLifecycleDelivery (cyclomatic 37) server/src/services/plugin-lifecycle-delivery.ts:14— plugin-lifecycle-delivery.registerPluginLifecycleDelivery 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.
LiveUpdatesProvider.buildActivityToast (cyclomatic 37) ui/src/context/LiveUpdatesProvider.tsx:979— LiveUpdatesProvider.buildActivityToast 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.
LiveUpdatesProvider.LiveUpdatesProvider (cyclomatic 37) ui/src/context/LiveUpdatesProvider.tsx:2021— LiveUpdatesProvider.LiveUpdatesProvider has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 6 of the 37 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 2145, 2182, 2089, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
transcript-adapter.providerActivityItem (cyclomatic 37) ui/src/components/task-chat/transcript-adapter.ts:355— transcript-adapter.providerActivityItem has cyclomatic complexity 37 (threshold 15). Of this number, 32 points are the body's own statements and 5 belong to 3 function literals 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.
FastResponseSettings.FastResponseSettingsView (cyclomatic 37) ui/src/components/fast-responses/FastResponseSettings.tsx:35— FastResponseSettings.FastResponseSettingsView has cyclomatic complexity 37 (threshold 15). Of this number, 27 points are the body's own statements and 10 belong to 4 function literals inside it that branch. 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.
onboard.quickstartDefaultsFromEnv (cyclomatic 36) cli/src/commands/onboard.ts:173— onboard.quickstartDefaultsFromEnv has cyclomatic complexity 36 (threshold 15). Of this number, 35 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
sandbox-callback-bridge.startSandboxCallbackBridgeWorker.processRequestFile (cyclomatic 36) REDACTED:959— sandbox-callback-bridge.startSandboxCallbackBridgeWorker.processRequestFile has cyclomatic complexity 36 (threshold 15). Of this number, 28 points are the body's own statements and 8 belong to 2 function items inside it that branch. 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.
execution-target.startAdapterExecutionTargetProcessSessionBridge (cyclomatic 36) REDACTED:1988— execution-target.startAdapterExecutionTargetProcessSessionBridge has cyclomatic complexity 36 (threshold 15). Of this number, 18 points are the body's own statements and 18 belong to 7 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.
format-event.printItemCompleted (cyclomatic 36) packages/adapters/codex-local/src/cli/format-event.ts:59— format-event.printItemCompleted 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.
provider-assets-root.resolveRunnerProviderAssetsRoot (cyclomatic 36) REDACTED:19— provider-assets-root.resolveRunnerProviderAssetsRoot 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.
acp-permission-adapter.normalizeAcpxPermission (cyclomatic 36) packages/paperclip-runner/src/drivers/acpx/acp-permission-adapter.ts:19— acp-permission-adapter.normalizeAcpxPermission has cyclomatic complexity 36 (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.
PhotonReceiver.catchUp (cyclomatic 36) server/src/services/photon/receiver.ts:87— PhotonReceiver.catchUp 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.
chat-github-review-policy.githubReviewSchedulingDecision (cyclomatic 36) server/src/services/chat-github-review-policy.ts:91— chat-github-review-policy.githubReviewSchedulingDecision has cyclomatic complexity 36 (threshold 15). Of this number, 35 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
native-chat-review-presentation.authorizeNativeChatReviewPresentation (cyclomatic 36) server/src/services/native-runtime/native-chat-review-presentation.ts:317— native-chat-review-presentation.authorizeNativeChatReviewPresentation has cyclomatic complexity 36 (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.
tool-gateway.createToolGatewayService.namedGatewaySessionFromBearer (cyclomatic 36) server/src/services/tool-gateway.ts:7163— tool-gateway.createToolGatewayService.namedGatewaySessionFromBearer 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.
managed.createManagedSlackSetup.provision (cyclomatic 36) server/src/services/connectors/slack/setup/managed.ts:14— managed.createManagedSlackSetup.provision has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 3 of the 36 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 21, 29, 44). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
provider-effects.providerEffectPayload (cyclomatic 36) server/src/services/chat-channels/provider-effects.ts:87— provider-effects.providerEffectPayload has cyclomatic complexity 36 (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.
execution-workspace-policy.parseProjectExecutionWorkspacePolicy (cyclomatic 36) server/src/services/execution-workspace-policy.ts:107— execution-workspace-policy.parseProjectExecutionWorkspacePolicy has cyclomatic complexity 36 (threshold 15). Of this number, 30 points are the body's own statements and 6 belong to one function literal inside it that branches. 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.
isolated-repository-rehome.sweepOrphanedIsolatedRepositorySources (cyclomatic 36) server/src/services/isolated-repository-rehome.ts:719— isolated-repository-rehome.sweepOrphanedIsolatedRepositorySources has cyclomatic complexity 36 (threshold 15). Of this number, 16 points are the body's own statements and 20 belong to 3 function literals 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.
workspace-runtime.inspectGitWorktreeBranchIncoherence (cyclomatic 36) server/src/services/workspace-runtime.ts:1408— workspace-runtime.inspectGitWorktreeBranchIncoherence 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.
workspaces.prepareProjectRepositoryWorkspaces (cyclomatic 36) server/src/services/heartbeat/workspaces.ts:499— workspaces.prepareProjectRepositoryWorkspaces has cyclomatic complexity 36 (threshold 15). Of this number, 34 points are the body's own statements and 2 belong to one function literal 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.
publication-drafts.createTelegramPublicationDrafts.reserveTelegramPublicationDraft (cyclomatic 36) server/src/services/chat-channels/telegram/publication-drafts.ts:244— publication-drafts.createTelegramPublicationDrafts.reserveTelegramPublicationDraft has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 8 of the 36 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 344, 284). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
requests.createChatPublicationRequests.publishBoardMessage (cyclomatic 36) server/src/services/chat-channels/publications/requests.ts:175— requests.createChatPublicationRequests.publishBoardMessage has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 6 of the 36 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 207, validRejectedIds). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
messages.githubLifecycleEventFromRequest (cyclomatic 36) server/src/services/chat-channels/github/messages.ts:18— messages.githubLifecycleEventFromRequest 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.
routine.grokRoutineService.acknowledge (cyclomatic 36) server/src/services/grok-bot/routine.ts:276— routine.grokRoutineService.acknowledge has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 4 of the 36 points are its own statements and the rest belongs to one function literal inside it that branches (line 280). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-workspace-export-recovery.recoverLegacyUnsafeWorkspaceExports (cyclomatic 36) server/src/services/native-runtime/native-workspace-export-recovery.ts:14— native-workspace-export-recovery.recoverLegacyUnsafeWorkspaceExports has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 9 of the 36 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 30, selectCandidates, a function literal at line 50). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
successful-run-handoff.decideSuccessfulRunHandoff (cyclomatic 36) server/src/services/recovery/successful-run-handoff.ts:462— successful-run-handoff.decideSuccessfulRunHandoff 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.
recovery.createHeartbeatRecovery.reconcileHotRestartAdoption (cyclomatic 36) server/src/services/heartbeat/recovery.ts:608— recovery.createHeartbeatRecovery.reconcileHotRestartAdoption has cyclomatic complexity 36 (threshold 15). Of this number, 33 points are the body's own statements and 3 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.
recovery.createHeartbeatRecovery.drainRunningRunsForShutdown (cyclomatic 36) server/src/services/heartbeat/recovery.ts:1061— recovery.createHeartbeatRecovery.drainRunningRunsForShutdown has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 7 of the 36 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1096, 1212). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
prepare-bundled-package.stageBundledEsbuildOptionalDependencies (cyclomatic 36) scripts/prepare-bundled-package.mjs:215— prepare-bundled-package.stageBundledEsbuildOptionalDependencies has cyclomatic complexity 36 (threshold 15). Of this number, 29 points are the body's own statements and 7 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.
work-timeline.workTimelineService.getTimeline (cyclomatic 36) server/src/services/work-timeline.ts:464— work-timeline.workTimelineService.getTimeline 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.
projects.projectRoutes::handleProjectWorkspaceRuntimeCommand (cyclomatic 36) server/src/routes/projects.ts:721— projects.projectRoutes::handleProjectWorkspaceRuntimeCommand 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.
SwipeToArchive.SwipeToArchive (cyclomatic 36) ui/src/components/SwipeToArchive.tsx:17— SwipeToArchive.SwipeToArchive has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 8 of the 36 points are its own statements and the rest belongs to 9 function items inside it that branch (handleTouchMove, handleTouchEnd, handleTouchStart, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AdapterManager.AdapterManager (cyclomatic 36) ui/src/pages/AdapterManager.tsx:257— AdapterManager.AdapterManager has cyclomatic complexity 36 (threshold 15). Of this number, 18 points are the body's own statements and 18 belong to 11 function literals 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.
CommentThread.CommentCard (cyclomatic 36) ui/src/components/CommentThread.tsx:297— CommentThread.CommentCard 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.
worktree.readWorktreeSeedManifest (cyclomatic 35) cli/src/commands/worktree.ts:1858— worktree.readWorktreeSeedManifest has cyclomatic complexity 35 (threshold 15). Of this number, 31 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
runnerd-codex-transport.bridgedCodexQuestionParams (cyclomatic 35) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:1014— runnerd-codex-transport.bridgedCodexQuestionParams has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 13 of the 35 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1044, 1053). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
safe-locations.safeAcpxLocations (cyclomatic 35) packages/paperclip-runner/src/drivers/acpx/safe-locations.ts:33— safe-locations.safeAcpxLocations has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 2 of the 35 points are its own statements and the rest belongs to one function literal inside it that branches (line 42). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
cursor-tool-evidence.createCursorToolEvidence.tool (cyclomatic 35) packages/paperclip-runner/src/drivers/acpx/cursor-tool-evidence.ts:77— cursor-tool-evidence.createCursorToolEvidence.tool has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to one function literal inside it that branches (line 77). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-session-runtime.replayProvesEffectFreeInitialAcpxTurn (cyclomatic 35) packages/paperclip-runner/src/native-session-runtime.ts:1758— native-session-runtime.replayProvesEffectFreeInitialAcpxTurn has cyclomatic complexity 35 (threshold 15). Of this number, 26 points are the body's own statements and 9 belong to 5 function literals inside it that branch. 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.
secrets.secretService.rotateUnlocked (cyclomatic 35) server/src/services/secrets.ts:2402— secrets.secretService.rotateUnlocked has cyclomatic complexity 35 (threshold 15). Of this number, 31 points are the body's own statements and 4 belong to one function literal 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.
records.agentRecords.create (cyclomatic 35) server/src/modules/agent-lifecycle/adapters/records.ts:13— records.agentRecords.create has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 2 of the 35 points are its own statements and the rest belongs to one function literal inside it that branches (line 15). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
chat-question-forms.validateChatQuestionFormSubmission (cyclomatic 35) server/src/services/chat-question-forms.ts:665— chat-question-forms.validateChatQuestionFormSubmission has cyclomatic complexity 35 (threshold 15). Of this number, 34 points are the body's own statements and 1 belongs to one function literal 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.
chat-github-attachments.prepareGitHubPublicAttachment (cyclomatic 35) REDACTED:723— chat-github-attachments.prepareGitHubPublicAttachment 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.
chat-discord-native-commands.parseDiscordNativeCommand (cyclomatic 35) server/src/services/chat-discord-native-commands.ts:86— chat-discord-native-commands.parseDiscordNativeCommand has cyclomatic complexity 35 (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.
webhook-ingress.createGitHubWebhookIngress.processGitHubWebhookIngress (cyclomatic 35) server/src/services/chat-channels/github/webhook-ingress.ts:708— webhook-ingress.createGitHubWebhookIngress.processGitHubWebhookIngress 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.
chat-teams-inline-images.png (cyclomatic 35) server/src/services/chat-teams-inline-images.ts:36— chat-teams-inline-images.png 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.
chat-telegram-photo.supportedPng (cyclomatic 35) server/src/services/chat-telegram-photo.ts:21— chat-telegram-photo.supportedPng 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.
native-broker.createNativeExternalBroker.port.settle (cyclomatic 35) server/src/modules/external-agents/native-broker.ts:284— native-broker.createNativeExternalBroker.port.settle has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 2 of the 35 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 289, 287). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
usage-receipts.persistUsageReceipt (cyclomatic 35) server/src/services/usage-receipts.ts:67— usage-receipts.persistUsageReceipt has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to one function literal inside it that branches (line 70). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-deliverable-feedback.validateNativeDeliverableEvidence (cyclomatic 35) server/src/services/native-runtime/native-deliverable-feedback.ts:191— native-deliverable-feedback.validateNativeDeliverableEvidence has cyclomatic complexity 35 (threshold 15). Of this number, 30 points are the body's own statements and 5 belong to one function literal 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.
routines.routineService.update (cyclomatic 35) server/src/services/routines.ts:2324— routines.routineService.update has cyclomatic complexity 35 (threshold 15). Of this number, 20 points are the body's own statements and 15 belong to one function literal inside it that branches. 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.
routes.handleBridgeRequest (cyclomatic 35) packages/plugins/sandbox-providers/cloudflare/bridge-template/src/routes.ts:199— routes.handleBridgeRequest has cyclomatic complexity 35 (threshold 15). Of this number, 34 points are the body's own statements and 1 belongs to one function literal 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.
codemod-extract-misc.main (cyclomatic 35) scripts/codemod-extract-misc.mjs:453— codemod-extract-misc.main has cyclomatic complexity 35 (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.
native-workspace-owner-recovery.resumeNativeWorkspaceAfterOwnerStop (cyclomatic 35) server/src/services/native-runtime/native-workspace-owner-recovery.ts:16— native-workspace-owner-recovery.resumeNativeWorkspaceAfterOwnerStop has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 2 of the 35 points are its own statements and the rest belongs to one function literal inside it that branches (line 24). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
AgentBasicsDialog.AgentBasicsDialog::submit (cyclomatic 35) ui/src/components/new-agent/AgentBasicsDialog.tsx:110— AgentBasicsDialog.AgentBasicsDialog::submit 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. This shape REPEATS in the file: one other method here (AgentBasicsDialog.AgentBasicsDialog) 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.
IssueThreadInteractionCard.RequestCheckboxConfirmationCard (cyclomatic 35) ui/src/components/IssueThreadInteractionCard.tsx:2896— IssueThreadInteractionCard.RequestCheckboxConfirmationCard has cyclomatic complexity 35 (threshold 15). Of this number, 25 points are the body's own statements and 10 belong to 6 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.
IssueChatThread.IssueChatComposer::submitComment (cyclomatic 35) ui/src/components/IssueChatThread.tsx:4995— IssueChatThread.IssueChatComposer::submitComment 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. This shape REPEATS in the file: one other method here (IssueChatThread.IssueChatComposer) 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.
TaskChatMarker.TaskChatMarker (cyclomatic 35) ui/src/components/task-chat/TaskChatMarker.tsx:21— TaskChatMarker.TaskChatMarker 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.
RunTranscriptView.TranscriptToolGroup (cyclomatic 35) ui/src/components/transcript/RunTranscriptView.tsx:1281— RunTranscriptView.TranscriptToolGroup has cyclomatic complexity 35 (threshold 15). Of this number, 20 points are the body's own statements and 15 belong to 4 function literals inside it that branch. 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.
ExecutionWorkspaceCloseDialog.ExecutionWorkspaceCloseDialog (cyclomatic 35) ui/src/components/ExecutionWorkspaceCloseDialog.tsx:38— ExecutionWorkspaceCloseDialog.ExecutionWorkspaceCloseDialog has cyclomatic complexity 35 (threshold 15). Of this number, 31 points are the body's own statements and 4 belong to 4 function literals 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.
RoutineList.RoutineListRow (cyclomatic 35) ui/src/components/RoutineList.tsx:55— RoutineList.RoutineListRow 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.
PhotonConnectStep.PhotonConnectStep (cyclomatic 35) ui/src/pages/apps/chat/PhotonConnectStep.tsx:12— PhotonConnectStep.PhotonConnectStep has cyclomatic complexity 35 (threshold 15). Of this number, 28 points are the body's own statements and 7 belong to 3 function literals inside it that branch. 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.
CompanyImport.importAdapterValues (cyclomatic 35) ui/src/pages/CompanyImport.tsx:573— CompanyImport.importAdapterValues 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.
InstanceAccess.InstanceAccess (cyclomatic 35) ui/src/pages/InstanceAccess.tsx:14— InstanceAccess.InstanceAccess has cyclomatic complexity 35 (threshold 15). Of this number, 21 points are the body's own statements and 14 belong to 7 function literals 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.
Management.Management (cyclomatic 35) ui/storybook/prototypes/provider-routing/Management.tsx:30— Management.Management has cyclomatic complexity 35 (threshold 15). Of this number, 26 points are the body's own statements and 9 belong to 7 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.
server-utils.runChildProcess (cyclomatic 34) REDACTED:4711— server-utils.runChildProcess has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 1 of the 34 points is its own statement and the rest belongs to 11 function literals inside it that branch (lines 4820, 4766, 4736, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest. This is NOT this file's highest cyclomatic complexity: server-utils.isNormalizedPaperclipExternalChatQuestionResponseTurn (cyclomatic 40) 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 method is counted neither in this dimension's figures nor in its score.
format-event.printCursorStreamEvent (cyclomatic 34) packages/adapters/cursor-local/src/cli/format-event.ts:198— format-event.printCursorStreamEvent 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.LiveRunner (cyclomatic 34) packages/paperclip-runner/devtools/browser/src/App.tsx:245— App.LiveRunner has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 14 of the 34 points are its own statements and the rest belongs to 3 function items inside it that branch (startRun, handleRecord, postAction). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CodexHarnessSession.startTurn (cyclomatic 34) packages/paperclip-runner/src/drivers/codex/codex-harness-session.ts:161— CodexHarnessSession.startTurn has cyclomatic complexity 34 (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.
OpenCodeHarnessSession.#emitAssistantPart (cyclomatic 34) REDACTED:1848— OpenCodeHarnessSession.#emitAssistantPart has cyclomatic complexity 34 (threshold 15). Of this number, 31 points are the body's own statements and 3 belong to one function literal 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.
DurablePrpCodexTransport.#watchRunner (cyclomatic 34) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:6942— DurablePrpCodexTransport.#watchRunner has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 1 of the 34 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 6944, 6993). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
single-read-evidence.updateSingleReadEvidence (cyclomatic 34) packages/paperclip-runner/src/drivers/acpx/single-read-evidence.ts:33— single-read-evidence.updateSingleReadEvidence 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.
CodexAcpxSession.#pumpTurn (cyclomatic 34) REDACTED:1471— CodexAcpxSession.#pumpTurn 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.
harness-driver.runHarnessDriverConformance (cyclomatic 34) packages/paperclip-runner/src/conformance/harness-driver.ts:115— harness-driver.runHarnessDriverConformance has cyclomatic complexity 34 (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.
plugin-runner-task.createPluginRunnerTaskOwner.launcher (cyclomatic 34) server/src/services/native-runtime/plugin-runner-task.ts:127— plugin-runner-task.createPluginRunnerTaskOwner.launcher has cyclomatic complexity 34 (threshold 15). Of this number, 16 points are the body's own statements and 18 belong to 4 function literals 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.
remote-http-endpoint-guard.isPrivateOrReservedIpv4 (cyclomatic 34) server/src/services/remote-http-endpoint-guard.ts:161— remote-http-endpoint-guard.isPrivateOrReservedIpv4 has cyclomatic complexity 34 (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.
authorization.createAuthorizationService.decide (cyclomatic 34) server/src/services/authorization.ts:2792— authorization.createAuthorizationService.decide has cyclomatic complexity 34 (threshold 15). Of this number, 18 points are the body's own statements and 16 belong to 2 function literals 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.
chat-sdk-runtime.registerCallbacks (cyclomatic 34) server/src/services/chat-sdk-runtime.ts:1841— chat-sdk-runtime.registerCallbacks has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 9 of the 34 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 1923, 1988, 1855, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tool-access-policy.toolAccessPolicyService.recordInvocation (cyclomatic 34) server/src/services/tool-access-policy.ts:1653— tool-access-policy.toolAccessPolicyService.recordInvocation 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.
tool-gateway.createToolGatewayService.connectedMcpToolsForCompany (cyclomatic 34) server/src/services/tool-gateway.ts:1386— tool-gateway.createToolGatewayService.connectedMcpToolsForCompany has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 3 of the 34 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 1458, 1487, 1397, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tool-gateway.createToolGatewayService.maybeRefreshPaperclipCloudGrant (cyclomatic 34) server/src/services/tool-gateway.ts:3834— tool-gateway.createToolGatewayService.maybeRefreshPaperclipCloudGrant has cyclomatic complexity 34 (threshold 15). Of this number, 23 points are the body's own statements and 11 belong to one function literal inside it that branches. 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.
chat-github-management.githubChatManagementService.verification (cyclomatic 34) server/src/services/chat-github-management.ts:352— chat-github-management.githubChatManagementService.verification has cyclomatic complexity 34 (threshold 15). Of this number, 33 points are the body's own statements and 1 belongs to one function literal 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.
isolated-task-directory-snapshot.decodeTaskDirectorySnapshot (cyclomatic 34) server/src/services/isolated-task-directory-snapshot.ts:173— isolated-task-directory-snapshot.decodeTaskDirectorySnapshot 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.
chat-inbound-wakeup-publications.resolveInboundWakeReceipt (cyclomatic 34) server/src/services/chat-inbound-wakeup-publications.ts:67— chat-inbound-wakeup-publications.resolveInboundWakeReceipt has cyclomatic complexity 34 (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.
root-threads.createDiscordRootThreads.admitDiscordRootMention (cyclomatic 34) server/src/services/chat-channels/discord/root-threads.ts:68— root-threads.createDiscordRootThreads.admitDiscordRootMention has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 2 of the 34 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 86, 83, 338). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
case-handoff-lifecycle.recoverLegacyCaseHandoffCleanup (cyclomatic 34) server/src/services/heartbeat/case-handoff-lifecycle.ts:78— case-handoff-lifecycle.recoverLegacyCaseHandoffCleanup has cyclomatic complexity 34 (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.
native-codex-runner.executeNativeCodexRunner (cyclomatic 34) server/src/services/native-runtime/native-codex-runner.ts:323— native-codex-runner.executeNativeCodexRunner has cyclomatic complexity 34 (threshold 15). Of this number, 28 points are the body's own statements and 6 belong to one function literal inside it that branches. 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.
native-github-access.createNativeGitHubAccess (cyclomatic 34) server/src/services/native-runtime/native-github-access.ts:20— native-github-access.createNativeGitHubAccess has cyclomatic complexity 34 (threshold 15). Of this number, 18 points are the body's own statements and 16 belong to 3 function literals inside it that branch. 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.
service.recoveryService.terminalizeOrphanedRunningRun (cyclomatic 34) REDACTED:6072— service.recoveryService.terminalizeOrphanedRunningRun has cyclomatic complexity 34 (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.
queue.createHeartbeatQueue.startNextQueuedRunForAgent (cyclomatic 34) server/src/services/heartbeat/queue.ts:1960— queue.createHeartbeatQueue.startNextQueuedRunForAgent has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 2 of the 34 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1969, 2031, 2115). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
decision-models.decisionModelService.decide (cyclomatic 34) server/src/services/decision-models.ts:176— decision-models.decisionModelService.decide has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 13 of the 34 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 190, 211). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
app.CreateSpaceModal (cyclomatic 34) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:2043— app.CreateSpaceModal has cyclomatic complexity 34 (threshold 15). Of this number, 22 points are the body's own statements and 12 belong to 5 function items inside it that branch. 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.DistillationSettingsPanel (cyclomatic 34) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:5433— app.DistillationSettingsPanel has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 14 of the 34 points are its own statements and the rest belongs to 5 function items inside it that branch (enableForActiveProjects, runBackfill, runDistillNow, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
app.SpaceEditCard (cyclomatic 34) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6698— app.SpaceEditCard has cyclomatic complexity 34 (threshold 15). Of this number, 17 points are the body's own statements and 17 belong to 3 function items inside it that branch. 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.PaperclipIngestionSpaceCard (cyclomatic 34) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6912— app.PaperclipIngestionSpaceCard has cyclomatic complexity 34 (threshold 15). Of this number, 22 points are the body's own statements and 12 belong to 6 function items inside it that branch. 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.
check-maps.checkMaps (cyclomatic 34) REDACTED:31— check-maps.checkMaps has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 14 of the 34 points are its own statements and the rest belongs to 7 function items inside it that branch (field, links, accessRecord, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
billing-reconciliation.billingReconciliationService.adjust (cyclomatic 34) server/src/services/billing-reconciliation.ts:109— billing-reconciliation.billingReconciliationService.adjust has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 1 of the 34 points is its own statement and the rest belongs to one function literal inside it that branches (line 111). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
muse.museTransportRoutes::handler (cyclomatic 34) server/src/routes/muse.ts:42— muse.museTransportRoutes::handler 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.
tool-access.toolAccessRoutes::handlePaperclipCloudConnectorCallback (cyclomatic 34) REDACTED:1124— tool-access.toolAccessRoutes::handlePaperclipCloudConnectorCallback 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.
access.isPrivateOrReservedIpv4 (cyclomatic 34) REDACTED:2358— access.isPrivateOrReservedIpv4 has cyclomatic complexity 34 (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.
SearchableSelect.SearchableSelect (cyclomatic 34) ui/src/components/SearchableSelect.tsx:93— SearchableSelect.SearchableSelect has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 10 of the 34 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 149, selectOption, a function literal at line 130, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CliAuth.CliAuthPage (cyclomatic 34) ui/src/pages/CliAuth.tsx:24— CliAuth.CliAuthPage has cyclomatic complexity 34 (threshold 15). Of this number, 30 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
task-chat-activity-presentation.providerActivityPresentation (cyclomatic 34) ui/src/components/task-chat/task-chat-activity-presentation.ts:59— task-chat-activity-presentation.providerActivityPresentation 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.
IssueThreadInteractionCard.SuggestTasksCard (cyclomatic 34) ui/src/components/IssueThreadInteractionCard.tsx:717— IssueThreadInteractionCard.SuggestTasksCard has cyclomatic complexity 34 (threshold 15). Of this number, 24 points are the body's own statements and 10 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.
IssueChatThread.IssueChatChainOfThought (cyclomatic 34) ui/src/components/IssueChatThread.tsx:1204— IssueChatThread.IssueChatChainOfThought has cyclomatic complexity 34 (threshold 15). Of this number, 31 points are the body's own statements and 3 belong to 3 function literals 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.
TaskChatThreadView.renderItem (cyclomatic 34) ui/src/components/task-chat/TaskChatThreadView.tsx:82— TaskChatThreadView.renderItem has cyclomatic complexity 34 (threshold 15). Of this number, 32 points are the body's own statements and 2 belong to 2 function literals 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.
CaseDetail.CaseDetail (cyclomatic 34) ui/src/pages/CaseDetail.tsx:35— CaseDetail.CaseDetail has cyclomatic complexity 34 (threshold 15). Of this number, 30 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
AgentDetail.ConfigurationTab (cyclomatic 34) ui/src/pages/AgentDetail.tsx:1993— AgentDetail.ConfigurationTab has cyclomatic complexity 34 (threshold 15). Of this number, 24 points are the body's own statements and 10 belong to 6 function literals 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.
CompanySettings.CompanySettings (cyclomatic 34) ui/src/pages/CompanySettings.tsx:34— CompanySettings.CompanySettings has cyclomatic complexity 34 (threshold 15). Of this number, 27 points are the body's own statements and 7 belong to 5 function items inside it that branch. 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.
PromptInjectionPreventionSettings.PromptInjectionPreventionSettingsView (cyclomatic 34) ui/src/components/prompt-injection-prevention/PromptInjectionPreventionSettings.tsx:19— PromptInjectionPreventionSettings.PromptInjectionPreventionSettingsView has cyclomatic complexity 34 (threshold 15). Of this number, 26 points are the body's own statements and 8 belong to 5 function literals inside it that branch. 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.
SkillFolderTree.MoveToFolderDialog (cyclomatic 34) ui/src/components/folders/SkillFolderTree.tsx:812— SkillFolderTree.MoveToFolderDialog has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 13 of the 34 points are its own statements and the rest belongs to 6 function items inside it that branch (renderNode, matches, submitNewFolder, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CompanySkills.InstallPreviewDialog (cyclomatic 34) ui/src/pages/CompanySkills.tsx:1948— CompanySkills.InstallPreviewDialog has cyclomatic complexity 34 (threshold 15). Of this number, 21 points are the body's own statements and 13 belong to 7 function literals inside it that branch. 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.
SkillStudio.SkillPane (cyclomatic 34) ui/src/pages/SkillStudio.tsx:1270— SkillStudio.SkillPane has cyclomatic complexity 34 (threshold 15). Of this number, 25 points are the body's own statements and 9 belong to 6 function literals inside it that branch. 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.
Agents.production.Agents (cyclomatic 34) ui/src/pages/Agents.production.tsx:175— Agents.production.Agents has cyclomatic complexity 34 (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. This shape REPEATS in the file: one other method here (Agents.production.Agents::renderAgentRow) 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.
ScheduleEditor.parseCronToPreset (cyclomatic 34) ui/src/components/ScheduleEditor.tsx:48— ScheduleEditor.parseCronToPreset has cyclomatic complexity 34 (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.
CompanySkills.production.InstallPreviewDialog (cyclomatic 34) ui/src/pages/CompanySkills.production.tsx:2038— CompanySkills.production.InstallPreviewDialog has cyclomatic complexity 34 (threshold 15). Of this number, 21 points are the body's own statements and 13 belong to 7 function literals inside it that branch. 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.
IssueArtifactCard.IssueWorkProductArtifactCard (cyclomatic 34) ui/src/components/artifacts/IssueArtifactCard.tsx:201— IssueArtifactCard.IssueWorkProductArtifactCard has cyclomatic complexity 34 (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.
BulkAgentSettingsProposal.Proposal (cyclomatic 34) ui/storybook/support/design-proposals/BulkAgentSettingsProposal.tsx:143— BulkAgentSettingsProposal.Proposal has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 14 of the 34 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 153, a function literal at line 194, a function literal at line 146, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
worktree.ensureWorktreeSeeded (cyclomatic 33) cli/src/commands/worktree.ts:2218— worktree.ensureWorktreeSeeded 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.
local-process-sandbox.buildLocalProcessSandboxSpawnTarget (cyclomatic 33) packages/adapter-utils/src/local-process-sandbox.ts:341— local-process-sandbox.buildLocalProcessSandboxSpawnTarget has cyclomatic complexity 33 (threshold 15). Of this number, 29 points are the body's own statements and 4 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.
acp.testCodexAcpEnvironment (cyclomatic 33) packages/adapters/codex-local/src/server/acp.ts:520— acp.testCodexAcpEnvironment 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.
execute.buildPrompt (cyclomatic 33) packages/adapters/hermes/src/server/execute.ts:149— execute.buildPrompt has cyclomatic complexity 33 (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.
mcp-bridge.handleRequest (cyclomatic 33) packages/paperclip-runner/src/drivers/opencode/mcp-bridge.ts:135— mcp-bridge.handleRequest has cyclomatic complexity 33 (threshold 15). Of this number, 32 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
CapabilityLiveSession.#handleServerRequest (cyclomatic 33) packages/paperclip-runner/src/live/live-session.ts:2574— CapabilityLiveSession.#handleServerRequest 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.
copilot-metadata-probe.probeCopilotMetadata (cyclomatic 33) packages/paperclip-runner/src/drivers/copilot-metadata-probe.ts:19— copilot-metadata-probe.probeCopilotMetadata has cyclomatic complexity 33 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
secrets.secretService.updateUnlocked (cyclomatic 33) server/src/services/secrets.ts:2624— secrets.secretService.updateUnlocked 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.
paperclip-cloud-connector.paperclipCloudConnectorConfigFromEnv (cyclomatic 33) server/src/services/paperclip-cloud-connector.ts:198— paperclip-cloud-connector.paperclipCloudConnectorConfigFromEnv has cyclomatic complexity 33 (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.
external-chat-question-response.completedQuestionFormMatchesInteraction (cyclomatic 33) server/src/services/native-runtime/external-chat-question-response.ts:95— external-chat-question-response.completedQuestionFormMatchesInteraction 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.
browser-use.browserUseService.execute (cyclomatic 33) server/src/services/browser-use.ts:319— browser-use.browserUseService.execute 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. This shape REPEATS in the file: one other method here (browser-use.browserUseService.execute::admissionCheck) 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.
chat-receipt-reactions.stageReceiptReactionRemovals (cyclomatic 33) server/src/services/chat-receipt-reactions.ts:52— chat-receipt-reactions.stageReceiptReactionRemovals has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 12 of the 33 points are its own statements and the rest belongs to one function literal inside it that branches (line 127). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
chat-github-reviews.githubChatReviewService.scope (cyclomatic 33) server/src/services/chat-github-reviews.ts:134— chat-github-reviews.githubChatReviewService.scope has cyclomatic complexity 33 (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.
completion.createSlackCompletion.resumeLocked (cyclomatic 33) server/src/services/connectors/slack/setup/completion.ts:102— completion.createSlackCompletion.resumeLocked 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.
service.slackChatRegistrationService.complete (cyclomatic 33) server/src/services/connectors/slack/setup/service.ts:90— service.slackChatRegistrationService.complete has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to one function literal inside it that branches (line 92). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
queue.createChatPublicationQueue.processPendingPublications (cyclomatic 33) server/src/services/chat-channels/publications/queue.ts:182— queue.createChatPublicationQueue.processPendingPublications has cyclomatic complexity 33 (threshold 15). Of this number, 29 points are the body's own statements and 4 belong to 3 function literals 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.
failures.sanitizeHttpFailure (cyclomatic 33) server/src/services/tool-access/catalog/failures.ts:46— failures.sanitizeHttpFailure 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.
tool-connection-activity.listConnectionLifecycleEvents (cyclomatic 33) server/src/services/tool-connection-activity.ts:74— tool-connection-activity.listConnectionLifecycleEvents has cyclomatic complexity 33 (threshold 15). Of this number, 24 points are the body's own statements and 9 belong to 3 function literals 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.
agent-identity-redaction.createAgentIdentityRedactor (cyclomatic 33) server/src/services/agent-identity-redaction.ts:5— agent-identity-redaction.createAgentIdentityRedactor has cyclomatic complexity 33 (threshold 15). Of this number, 26 points are the body's own statements and 7 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.
agent-file-checkpoints.validateAgentFileCheckpoint (cyclomatic 33) server/src/services/agent-file-checkpoints.ts:34— agent-file-checkpoints.validateAgentFileCheckpoint 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.
sentry.captureRunFailure (cyclomatic 33) server/src/sentry.ts:209— sentry.captureRunFailure 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.
native-session-executor.executePaperclipNativeSession (cyclomatic 33) server/src/services/native-runtime/native-session-executor.ts:7646— native-session-executor.executePaperclipNativeSession has cyclomatic complexity 33 (threshold 15). Of this number, 32 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
service.recoveryService.applyStrandedAssignedIssueEscalation (cyclomatic 33) REDACTED:4083— service.recoveryService.applyStrandedAssignedIssueEscalation has cyclomatic complexity 33 (threshold 15). Of this number, 30 points are the body's own statements and 3 belong to one function literal 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.
use-cases.runReleaseDrain (cyclomatic 33) server/src/modules/wake-queue/application/use-cases.ts:135— use-cases.runReleaseDrain 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.
run-completion.createHeartbeatRunCompletion.failRunSetup (cyclomatic 33) server/src/services/heartbeat/run-completion.ts:1283— run-completion.createHeartbeatRunCompletion.failRunSetup 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.
plugin.executeInSession (cyclomatic 33) packages/plugins/sandbox-providers/daytona/src/plugin.ts:2218— plugin.executeInSession has cyclomatic complexity 33 (threshold 15). Of this number, 29 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.
check-module-boundaries.scanModuleBoundaries (cyclomatic 33) scripts/check-module-boundaries.mjs:92— check-module-boundaries.scanModuleBoundaries 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.
export.main (cyclomatic 33) scripts/ci-profile/export.mjs:49— export.main 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.
generate-unikraft-tools.generateUnikraftCatalog (cyclomatic 33) scripts/generate-unikraft-tools.mjs:49— generate-unikraft-tools.generateUnikraftCatalog 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.
status-cards.statusCardService.requestRefresh (cyclomatic 33) server/src/services/status-cards.ts:625— status-cards.statusCardService.requestRefresh has cyclomatic complexity 33 (threshold 15). Of this number, 32 points are the body's own statements and 1 belongs to one function literal 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.
muse-qualification.tick (cyclomatic 33) scripts/smoke/muse-qualification.ts:129— muse-qualification.tick has cyclomatic complexity 33 (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.
storybook-catalog.validateCatalog (cyclomatic 33) scripts/storybook-catalog.mjs:83— storybook-catalog.validateCatalog 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.
execution-control-reconciliation.reconcileAbandonedExecutionControl (cyclomatic 33) server/src/services/execution-control-reconciliation.ts:19— execution-control-reconciliation.reconcileAbandonedExecutionControl has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 77, 69, 55). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
issues.issueListSearchParams (cyclomatic 33) ui/src/api/issues.ts:123— issues.issueListSearchParams 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.
SecretPicker.SecretPicker (cyclomatic 33) ui/src/components/environment-variables-editor/SecretPicker.tsx:147— SecretPicker.SecretPicker has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 7 of the 33 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 286, 265, 166, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
IssueThreadInteractionCard.ConfirmationActionRow (cyclomatic 33) ui/src/components/IssueThreadInteractionCard.tsx:2120— IssueThreadInteractionCard.ConfirmationActionRow has cyclomatic complexity 33 (threshold 15). Of this number, 29 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
DocumentAnnotationPanel.AnnotationPanelBody (cyclomatic 33) ui/src/components/DocumentAnnotationPanel.tsx:105— DocumentAnnotationPanel.AnnotationPanelBody has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 12 of the 33 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 268, 162, 216, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TaskChatActivityPhase.TaskChatActivityPhase (cyclomatic 33) ui/src/components/task-chat/TaskChatActivityPhase.tsx:26— TaskChatActivityPhase.TaskChatActivityPhase has cyclomatic complexity 33 (threshold 15). Of this number, 25 points are the body's own statements and 8 belong to 2 function literals 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.
ConversationPlayback.ConversationPlayback (cyclomatic 33) ui/src/components/design-sandbox/ConversationPlayback.tsx:15— ConversationPlayback.ConversationPlayback has cyclomatic complexity 33 (threshold 15). Of this number, 24 points are the body's own statements and 9 belong to 6 function literals 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.
Agents.Agents (cyclomatic 33) ui/src/pages/Agents.tsx:188— Agents.Agents has cyclomatic complexity 33 (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. This shape REPEATS in the file: one other method here (Agents.Agents::renderAgentRow) 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.
RunTranscriptView.TranscriptCommandGroup (cyclomatic 33) ui/src/components/transcript/RunTranscriptView.tsx:1141— RunTranscriptView.TranscriptCommandGroup has cyclomatic complexity 33 (threshold 15). Of this number, 23 points are the body's own statements and 10 belong to 4 function literals inside it that branch. 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.
SkillPackagePreview.SkillPackagePreview (cyclomatic 33) ui/src/pages/skills/SkillPackagePreview.tsx:13— SkillPackagePreview.SkillPackagePreview has cyclomatic complexity 33 (threshold 15). Of this number, 29 points are the body's own statements and 4 belong to 4 function literals inside it that branch. 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.
ProfileSettings.ProfileSettings (cyclomatic 33) ui/src/pages/ProfileSettings.tsx:23— ProfileSettings.ProfileSettings has cyclomatic complexity 33 (threshold 15). Of this number, 23 points are the body's own statements and 10 belong to 9 function items inside it that branch. 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.
AgentProviderConnection.AgentProviderConnection::connect (cyclomatic 33) ui/src/components/new-agent/AgentProviderConnection.tsx:163— AgentProviderConnection.AgentProviderConnection::connect 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. This shape REPEATS in the file: one other method here (AgentProviderConnection.AgentProviderConnection) 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.
RunnerActivityPreview.RunnerActivityPreview (cyclomatic 33) ui/storybook/prototypes/runner-activity/RunnerActivityPreview.tsx:162— RunnerActivityPreview.RunnerActivityPreview has cyclomatic complexity 33 (threshold 15). Of this number, 19 points are the body's own statements and 14 belong to 4 function literals 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.
ExternalAgentInvitePreview.ExternalAgentInvitePreview (cyclomatic 33) ui/storybook/support/external-agent-invite/ExternalAgentInvitePreview.tsx:40— ExternalAgentInvitePreview.ExternalAgentInvitePreview has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 11 of the 33 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 54, 62, 95, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
codex-security-config.normalizedCodexPlatformManifest (cyclomatic 32) packages/paperclip-runner/src/drivers/codex/codex-security-config.ts:78— codex-security-config.normalizedCodexPlatformManifest has cyclomatic complexity 32 (threshold 15). Of this number, 27 points are the body's own statements and 5 belong to one function literal 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.
runner-provider-launch.validatePreparedRunnerLaunch (cyclomatic 32) packages/paperclip-runner/src/live/runner-provider-launch.ts:98— runner-provider-launch.validatePreparedRunnerLaunch has cyclomatic complexity 32 (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.
DurablePrpCodexTransport.#startTurn (cyclomatic 32) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:6010— DurablePrpCodexTransport.#startTurn has cyclomatic complexity 32 (threshold 15). Of this number, 28 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
DurablePrpCodexTransport.#applyProviderIdentityEvent (cyclomatic 32) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:6691— DurablePrpCodexTransport.#applyProviderIdentityEvent 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.
CapabilityLiveSession.#captureTurnUsage (cyclomatic 32) packages/paperclip-runner/src/live/live-session.ts:1759— CapabilityLiveSession.#captureTurnUsage has cyclomatic complexity 32 (threshold 15). Of this number, 29 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
build-copilot-distribution.readCopilotArchiveEntries (cyclomatic 32) packages/paperclip-runner/scripts/build-copilot-distribution.mjs:62— build-copilot-distribution.readCopilotArchiveEntries has cyclomatic complexity 32 (threshold 15). Of this number, 25 points are the body's own statements and 7 belong to 3 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.
installation-integrity.commandLease.spawn (cyclomatic 32) packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts:1541— installation-integrity.commandLease.spawn has cyclomatic complexity 32 (threshold 15). Of this number, 30 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
release-provider-pack.verifyReleaseProviderPack (cyclomatic 32) packages/paperclip-runner/scripts/release-provider-pack.mjs:10— release-provider-pack.verifyReleaseProviderPack has cyclomatic complexity 32 (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.
CodexAcpxSession.dispatchTool (cyclomatic 32) REDACTED:1125— CodexAcpxSession.dispatchTool 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.
PiUiBridge.handle (cyclomatic 32) packages/paperclip-runner/src/drivers/acpx/pi-acp-runtime.ts:437— PiUiBridge.handle has cyclomatic complexity 32 (threshold 15). Of this number, 30 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.
tool-gateway.createToolGatewayService.writeAudit (cyclomatic 32) server/src/services/tool-gateway.ts:1810— tool-gateway.createToolGatewayService.writeAudit 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.
chat-discord-command-registration-store.reconcileStoredDiscordCommandRegistration (cyclomatic 32) server/src/services/chat-discord-command-registration-store.ts:139— chat-discord-command-registration-store.reconcileStoredDiscordCommandRegistration has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 15 of the 32 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 164, a function literal at line 253, check, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
isolated-task-directory-retention.expireIsolatedTaskDirectory (cyclomatic 32) server/src/services/isolated-task-directory-retention.ts:186— isolated-task-directory-retention.expireIsolatedTaskDirectory has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 11 of the 32 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 207, 265). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-runtime.resolveManagedPaperclipRuntimePublicOrigin (cyclomatic 32) server/src/services/workspace-runtime.ts:5543— workspace-runtime.resolveManagedPaperclipRuntimePublicOrigin has cyclomatic complexity 32 (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.
policy.decideScheduledRetryGate (cyclomatic 32) server/src/modules/run-dispatch/domain/policy.ts:263— policy.decideScheduledRetryGate 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.
resolution.createChatPublicationResolution.resolveProviderEffect (cyclomatic 32) server/src/services/chat-channels/publications/resolution.ts:327— resolution.createChatPublicationResolution.resolveProviderEffect has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 3 of the 32 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 474, 352, 339). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
discovery.createOAuthDiscovery.endpointsFromMetadataUrl (cyclomatic 32) server/src/services/tool-access/oauth/discovery.ts:66— discovery.createOAuthDiscovery.endpointsFromMetadataUrl 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.
discovery.createOAuthDiscovery.discoverOAuthEndpoints (cyclomatic 32) server/src/services/tool-access/oauth/discovery.ts:213— discovery.createOAuthDiscovery.discoverOAuthEndpoints 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.
native-broker.createNativeExternalBroker.port.dispatch (cyclomatic 32) server/src/modules/external-agents/native-broker.ts:227— native-broker.createNativeExternalBroker.port.dispatch has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 1 of the 32 points is its own statement and the rest belongs to one function literal inside it that branches (line 229). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
issues.blockedInboxIssueConditions (cyclomatic 32) server/src/services/issues.ts:6297— issues.blockedInboxIssueConditions 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.
runner-api-catalog.buildRunnerApiCatalog (cyclomatic 32) server/src/services/native-runtime/runner-api-catalog.ts:71— runner-api-catalog.buildRunnerApiCatalog has cyclomatic complexity 32 (threshold 15). Of this number, 24 points are the body's own statements and 8 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.
agent-directory-probe.probeAgentDirectory::walk (cyclomatic 32) server/src/services/agent-directory-probe.ts:45— agent-directory-probe.probeAgentDirectory::walk 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. This shape REPEATS in the file: one other method here (agent-directory-probe.probeAgentDirectory) 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.
agent-directory-working-copies.agentDirectoryWorkingCopyService.adopt (cyclomatic 32) server/src/services/agent-directory-working-copies.ts:253— agent-directory-working-copies.agentDirectoryWorkingCopyService.adopt has cyclomatic complexity 32 (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.
workspace-file-resources.workspaceFileResourceService.list (cyclomatic 32) server/src/services/workspace-file-resources.ts:1452— workspace-file-resources.workspaceFileResourceService.list 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.
native-runner-file-handoff.scrubNativeRunnerStagingResidue (cyclomatic 32) server/src/services/native-runtime/native-runner-file-handoff.ts:491— native-runner-file-handoff.scrubNativeRunnerStagingResidue has cyclomatic complexity 32 (threshold 15). Of this number, 31 points are the body's own statements and 1 belongs to one function literal 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.
explicit-native-continuation.admitExplicitContinuationRetry (cyclomatic 32) server/src/services/explicit-native-continuation.ts:425— explicit-native-continuation.admitExplicitContinuationRetry has cyclomatic complexity 32 (threshold 15). Of this number, 25 points are the body's own statements and 7 belong to one function literal inside it that branches. 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.
service.recoveryService.reconcileResolvedDependencyWakeBackstop (cyclomatic 32) REDACTED:5759— service.recoveryService.reconcileResolvedDependencyWakeBackstop has cyclomatic complexity 32 (threshold 15). Of this number, 29 points are the body's own statements and 3 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.
queue.createHeartbeatQueue.claimQueuedRun::lockIssueExecutionClaim (cyclomatic 32) server/src/services/heartbeat/queue.ts:1176— queue.createHeartbeatQueue.claimQueuedRun::lockIssueExecutionClaim has cyclomatic complexity 32 (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. This shape REPEATS in the file: one other method here (queue.createHeartbeatQueue.claimQueuedRun) 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.
app.WikiPage (cyclomatic 32) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:1589— app.WikiPage has cyclomatic complexity 32 (threshold 15). Of this number, 18 points are the body's own statements and 14 belong to 9 function literals 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.
task-interruption-presentation.projectTaskInterruption (cyclomatic 32) server/src/services/task-interruption-presentation.ts:41— task-interruption-presentation.projectTaskInterruption 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.
instance-settings.instanceSettingsRoutes (cyclomatic 32) server/src/routes/instance-settings.ts:135— instance-settings.instanceSettingsRoutes has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 1 of the 32 points is its own statement and the rest belongs to 11 function literals inside it that branch (lines 310, 353, 412, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CellMarquee.CellMarquee (cyclomatic 32) ui/src/components/CellMarquee.tsx:21— CellMarquee.CellMarquee has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 15 of the 32 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 89, 61, 84, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useKeyboardShortcuts.useKeyboardShortcuts (cyclomatic 32) ui/src/hooks/useKeyboardShortcuts.ts:18— useKeyboardShortcuts.useKeyboardShortcuts has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 1 of the 32 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 51, 135, 32). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
config-fields.ClaudeLocalAdvancedFields (cyclomatic 32) ui/src/adapters/claude-local/config-fields.tsx:75— config-fields.ClaudeLocalAdvancedFields has cyclomatic complexity 32 (threshold 15). Of this number, 19 points are the body's own statements and 13 belong to 8 function literals inside it that branch. 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.
ChatIdentityConfirm.ChatIdentityConfirm (cyclomatic 32) ui/src/pages/apps/chat/ChatIdentityConfirm.tsx:22— ChatIdentityConfirm.ChatIdentityConfirm has cyclomatic complexity 32 (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.
TaskChatRunnerTurn.TaskChatRunnerTurn (cyclomatic 32) ui/src/components/task-chat/TaskChatRunnerTurn.tsx:117— TaskChatRunnerTurn.TaskChatRunnerTurn has cyclomatic complexity 32 (threshold 15). Of this number, 25 points are the body's own statements and 7 belong to 3 function literals 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.
IssueChatThread.SystemNoticeCommentContent (cyclomatic 32) ui/src/components/IssueChatThread.tsx:3490— IssueChatThread.SystemNoticeCommentContent has cyclomatic complexity 32 (threshold 15). Of this number, 21 points are the body's own statements and 11 belong to 4 function items inside it that branch. 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.
IssuePropertiesArtifactsTab.IssuePropertiesArtifactsTab (cyclomatic 32) ui/src/components/issue-properties/IssuePropertiesArtifactsTab.tsx:408— IssuePropertiesArtifactsTab.IssuePropertiesArtifactsTab has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 12 of the 32 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 587, a function literal at line 676, a function literal at line 657, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AggregatorConnectDialog.AggregatorConnectDialog (cyclomatic 32) ui/src/pages/apps/AggregatorConnectDialog.tsx:19— AggregatorConnectDialog.AggregatorConnectDialog has cyclomatic complexity 32 (threshold 15). Of this number, 20 points are the body's own statements and 12 belong to 7 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.
IdentitiesSection.IdentitiesSection (cyclomatic 32) ui/src/pages/apps/app-detail/IdentitiesSection.tsx:77— IdentitiesSection.IdentitiesSection has cyclomatic complexity 32 (threshold 15). Of this number, 29 points are the body's own statements and 3 belong to 3 function literals 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.
SkillStudio.RunsPane (cyclomatic 32) ui/src/pages/SkillStudio.tsx:2300— SkillStudio.RunsPane has cyclomatic complexity 32 (threshold 15). Of this number, 17 points are the body's own statements and 15 belong to 8 function literals inside it that branch. 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.
SkillStudio.RunDetailView (cyclomatic 32) ui/src/pages/SkillStudio.tsx:3025— SkillStudio.RunDetailView has cyclomatic complexity 32 (threshold 15). Of this number, 19 points are the body's own statements and 13 belong to 10 function literals inside it that branch. 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.
ImportFromVaultDialog.SelectStep (cyclomatic 32) ui/src/pages/secrets/ImportFromVaultDialog.tsx:853— ImportFromVaultDialog.SelectStep has cyclomatic complexity 32 (threshold 15). Of this number, 20 points are the body's own statements and 12 belong to 2 function literals 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.
PluginPage.PluginPage (cyclomatic 32) ui/src/pages/PluginPage.tsx:25— PluginPage.PluginPage has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 15 of the 32 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 60, 43, 101, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
IssueArtifactCard.IssueArtifactFile (cyclomatic 32) ui/src/components/artifacts/IssueArtifactCard.tsx:53— IssueArtifactCard.IssueArtifactFile has cyclomatic complexity 32 (threshold 15). Of this number, 31 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
AuditTab.ActivityRow (cyclomatic 32) ui/src/pages/tools/AuditTab.tsx:159— AuditTab.ActivityRow has cyclomatic complexity 32 (threshold 15). Of this number, 31 points are the body's own statements and 1 belongs to one function literal 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.
CodexProviderState::validate (cyclomatic 32) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:1111— CodexProviderState::validate has cyclomatic complexity 32 (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.
durable-prp-control-plane.spawnRunner (cyclomatic 31) REDACTED:3519— durable-prp-control-plane.spawnRunner has cyclomatic complexity 31 (threshold 15). Of this number, 25 points are the body's own statements and 6 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.
runner-provider-launch.createRunnerProviderLaunch (cyclomatic 31) packages/paperclip-runner/src/live/runner-provider-launch.ts:170— runner-provider-launch.createRunnerProviderLaunch 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.
OpenCodeHarnessSession.dispatchTool (cyclomatic 31) REDACTED:1024— OpenCodeHarnessSession.dispatchTool 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.
DurablePrpCodexTransport.constructor (cyclomatic 31) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:3592— DurablePrpCodexTransport.constructor has cyclomatic complexity 31 (threshold 15). Of this number, 30 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
DurablePrpCodexTransport.#recoverRunnerProcess (cyclomatic 31) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:7023— DurablePrpCodexTransport.#recoverRunnerProcess has cyclomatic complexity 31 (threshold 15). Of this number, 22 points are the body's own statements and 9 belong to 3 function literals 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.
installed-provider-authority.resolveInstalledProviderAuthority (cyclomatic 31) packages/paperclip-runner/src/drivers/acpx/installed-provider-authority.ts:5— installed-provider-authority.resolveInstalledProviderAuthority has cyclomatic complexity 31 (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-native-backend.createTransportBackedNativeSessionBackend (cyclomatic 31) packages/paperclip-runner/src/backends/codex-native-backend.ts:106— codex-native-backend.createTransportBackedNativeSessionBackend 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.
evidence-classifier.classifyEvidenceRef (cyclomatic 31) server/src/services/native-runtime/evidence-classifier.ts:105— evidence-classifier.classifyEvidenceRef 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.
chat-telegram-media-intake.mp4Kind::scan (cyclomatic 31) server/src/services/chat-telegram-media-intake.ts:453— chat-telegram-media-intake.mp4Kind::scan 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.
chat-teams-file-consent.classifyTeamsUploadResponse (cyclomatic 31) server/src/services/chat-teams-file-consent.ts:1006— chat-teams-file-consent.classifyTeamsUploadResponse 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.
voice-session-store.voiceSessionStore.reserve (cyclomatic 31) server/src/services/voice/voice-session-store.ts:158— voice-session-store.voiceSessionStore.reserve has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to one function literal inside it that branches (line 163). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
maintenance.createTelegramMaintenance.repairTelegramStopSubscription (cyclomatic 31) server/src/services/chat-channels/telegram/maintenance.ts:782— maintenance.createTelegramMaintenance.repairTelegramStopSubscription has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 14 of the 31 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 812, request, plainObject). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
execution-workspaces.executionWorkspaceService.assessDelivery (cyclomatic 31) server/src/services/execution-workspaces.ts:1925— execution-workspaces.executionWorkspaceService.assessDelivery has cyclomatic complexity 31 (threshold 15). Of this number, 30 points are the body's own statements and 1 belongs to one function literal 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.
postgres.createPostgresRunDispatchAdapter.loadGateFacts (cyclomatic 31) server/src/modules/run-dispatch/adapters/postgres.ts:275— postgres.createPostgresRunDispatchAdapter.loadGateFacts 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.
slack-conversation-lifecycle.settleExternalConversation (cyclomatic 31) server/src/services/slack-conversation-lifecycle.ts:7— slack-conversation-lifecycle.settleExternalConversation has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 2 of the 31 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 9, 47). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
publication-drafts.createTelegramPublicationDrafts.handleTelegramGenerationStopped (cyclomatic 31) server/src/services/chat-channels/telegram/publication-drafts.ts:65— publication-drafts.createTelegramPublicationDrafts.handleTelegramGenerationStopped has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 11 of the 31 points are its own statements and the rest belongs to one function literal inside it that branches (line 104). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
session-stop.slackSessionStopPayload (cyclomatic 31) server/src/services/chat-channels/slack/session-stop.ts:71— session-stop.slackSessionStopPayload has cyclomatic complexity 31 (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.
connection-refresh.createLegacyOAuthRefresh::refreshOAuthCredentials (cyclomatic 31) server/src/services/tool-access/oauth/connection-refresh.ts:98— connection-refresh.createLegacyOAuthRefresh::refreshOAuthCredentials 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.
oauth.createPublicMcpOAuth.token (cyclomatic 31) server/src/services/public-mcp/oauth.ts:633— oauth.createPublicMcpOAuth.token has cyclomatic complexity 31 (threshold 15). Of this number, 16 points are the body's own statements and 15 belong to one function literal 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.
native-cancellation-request.claimCancellationRequest (cyclomatic 31) server/src/services/native-runtime/native-cancellation-request.ts:77— native-cancellation-request.claimCancellationRequest has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 5 of the 31 points are its own statements and the rest belongs to one function literal inside it that branches (line 80). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
PaperclipRunnerToolAuthority.#callApi (cyclomatic 31) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:857— PaperclipRunnerToolAuthority.#callApi has cyclomatic complexity 31 (threshold 15). Of this number, 21 points are the body's own statements and 10 belong to 2 function items inside it that branch. 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.
native-board-response-wait.readNativeBoardResponseWaitSource (cyclomatic 31) server/src/services/native-runtime/native-board-response-wait.ts:175— native-board-response-wait.readNativeBoardResponseWaitSource has cyclomatic complexity 31 (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-preparation.mergeCoalescedContextSnapshot (cyclomatic 31) server/src/services/heartbeat/run-preparation.ts:1868— run-preparation.mergeCoalescedContextSnapshot has cyclomatic complexity 31 (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.
use-cases.createRecordWatchdogDecision (cyclomatic 31) server/src/modules/active-run-watchdog/application/use-cases.ts:136— use-cases.createRecordWatchdogDecision has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to one function literal inside it that branches (line 137). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
service.recoveryService.hasCurrentNativePassiveWait (cyclomatic 31) REDACTED:1257— service.recoveryService.hasCurrentNativePassiveWait has cyclomatic complexity 31 (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.
service.recoveryService.sweepStaleIssueLocks (cyclomatic 31) REDACTED:6308— service.recoveryService.sweepStaleIssueLocks has cyclomatic complexity 31 (threshold 15). Of this number, 29 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.
environment-run-orchestrator.environmentRunOrchestrator.acquireForRun (cyclomatic 31) server/src/services/environment-run-orchestrator.ts:269— environment-run-orchestrator.environmentRunOrchestrator.acquireForRun has cyclomatic complexity 31 (threshold 15). Of this number, 28 points are the body's own statements and 3 belong to one function literal inside it that branches. 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-completion.createHeartbeatRunCompletion.failRun (cyclomatic 31) server/src/services/heartbeat/run-completion.ts:1048— run-completion.createHeartbeatRunCompletion.failRun has cyclomatic complexity 31 (threshold 15). Of this number, 25 points are the body's own statements and 6 belong to 3 function items inside it that branch. 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.
tool-action-delivery.toolActionDeliveryService.deliver (cyclomatic 31) server/src/services/tool-action-delivery.ts:39— tool-action-delivery.toolActionDeliveryService.deliver has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 40, 219, 331, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
frontmatter.parseYamlBlock (cyclomatic 31) REDACTED:443— frontmatter.parseYamlBlock 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.
api-compression.apiCompression (cyclomatic 31) server/src/middleware/api-compression.ts:131— api-compression.apiCompression has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 183, 167, 208, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SidebarCompanyMenu.BuiltinCompanyMenu (cyclomatic 31) ui/src/components/SidebarCompanyMenu.tsx:159— SidebarCompanyMenu.BuiltinCompanyMenu has cyclomatic complexity 31 (threshold 15). Of this number, 18 points are the body's own statements and 13 belong to 6 function items inside it that branch. 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.
CreateSecretPopover.SecretPopoverForm (cyclomatic 31) ui/src/components/environment-variables-editor/CreateSecretPopover.tsx:30— CreateSecretPopover.SecretPopoverForm has cyclomatic complexity 31 (threshold 15). Of this number, 23 points are the body's own statements and 8 belong to 3 function items inside it that branch. 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.
recovery-lineage.readRecoveryRetryLineage (cyclomatic 31) ui/src/lib/recovery-lineage.ts:140— recovery-lineage.readRecoveryRetryLineage 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.
board-send-draft.readBoardSendDraft (cyclomatic 31) ui/src/components/chat/board-send-draft.ts:78— board-send-draft.readBoardSendDraft has cyclomatic complexity 31 (threshold 15). Of this number, 29 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
EmailEndpointSetup.EmailEndpointSettings (cyclomatic 31) ui/src/pages/apps/chat/EmailEndpointSetup.tsx:577— EmailEndpointSetup.EmailEndpointSettings has cyclomatic complexity 31 (threshold 15). Of this number, 28 points are the body's own statements and 3 belong to 3 function literals inside it that branch. 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.
CompanySkills.SkillCard (cyclomatic 31) ui/src/pages/CompanySkills.tsx:806— CompanySkills.SkillCard has cyclomatic complexity 31 (threshold 15). Of this number, 28 points are the body's own statements and 3 belong to one function literal 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.
CompanySkills.NewSkillWizard (cyclomatic 31) ui/src/pages/CompanySkills.tsx:1394— CompanySkills.NewSkillWizard has cyclomatic complexity 31 (threshold 15). Of this number, 22 points are the body's own statements and 9 belong to 5 function literals 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.
CompanySkills.production.NewSkillWizard (cyclomatic 31) ui/src/pages/CompanySkills.production.tsx:1484— CompanySkills.production.NewSkillWizard has cyclomatic complexity 31 (threshold 15). Of this number, 22 points are the body's own statements and 9 belong to 5 function literals 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.
ArtifactFileRow.ArtifactFileRow (cyclomatic 31) ui/src/components/artifacts/v1/ArtifactFileRow.tsx:27— ArtifactFileRow.ArtifactFileRow has cyclomatic complexity 31 (threshold 15). Of this number, 30 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
useSummaryDraftStream.useSummaryDraftStream (cyclomatic 31) ui/src/components/useSummaryDraftStream.ts:62— useSummaryDraftStream.useSummaryDraftStream has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 7 of the 31 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 129, 149, 100, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
cli.printAcpxStreamEvent (cyclomatic 30) packages/adapter-utils/src/acpx-engine/cli.ts:51— cli.printAcpxStreamEvent 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.
workspace-checkpoint.checkpointMain (cyclomatic 30) packages/adapter-utils/src/workspace-checkpoint.ts:17— workspace-checkpoint.checkpointMain has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 2 of the 30 points are its own statements and the rest belongs to 4 function items inside it that branch (walk::capture, walk, walk::flush, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
parse.createCursorJsonlParser (cyclomatic 30) packages/adapters/cursor-local/src/server/parse.ts:68— parse.createCursorJsonlParser has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 4 function items inside it that branch (a function literal at line 112, addCost, addUsage, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
DurablePrpControlPlane.queueCommand (cyclomatic 30) REDACTED:1932— DurablePrpControlPlane.queueCommand has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs to one function literal 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.
OpenCodeHarnessSession.#pumpEvents (cyclomatic 30) REDACTED:1350— OpenCodeHarnessSession.#pumpEvents 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.
materialize-copilot-binary.writeCopilotMaterialization (cyclomatic 30) packages/paperclip-runner/scripts/materialize-copilot-binary.mjs:64— materialize-copilot-binary.writeCopilotMaterialization has cyclomatic complexity 30 (threshold 15). Of this number, 25 points are the body's own statements and 5 belong to 3 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.
publish-runner-protocol-eval-history.validatePublicProtocolEvalReport (cyclomatic 30) packages/paperclip-runner/scripts/publish-runner-protocol-eval-history.mjs:140— publish-runner-protocol-eval-history.validatePublicProtocolEvalReport 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.
eval-session.boundedEvalSessionUsage (cyclomatic 30) packages/paperclip-runner/src/cli/eval-session.ts:308— eval-session.boundedEvalSessionUsage has cyclomatic complexity 30 (threshold 15). Of this number, 26 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
cloud-runtime-identity.verifyCloudControlAssertion (cyclomatic 30) server/src/services/cloud-runtime-identity.ts:504— cloud-runtime-identity.verifyCloudControlAssertion 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.
chat-completion-delivery.chatCompletionDeliveryService.deliver (cyclomatic 30) server/src/services/chat-completion-delivery.ts:164— chat-completion-delivery.chatCompletionDeliveryService.deliver has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs to one function literal 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.
chat-publication-projection.projectCard (cyclomatic 30) server/src/services/chat-publication-projection.ts:301— chat-publication-projection.projectCard has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to 2 function literals 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.
paperclip-cloud-connector-enrollment.startPaperclipCloudConnectorEnrollmentUnlocked (cyclomatic 30) server/src/services/paperclip-cloud-connector-enrollment.ts:145— paperclip-cloud-connector-enrollment.startPaperclipCloudConnectorEnrollmentUnlocked has cyclomatic complexity 30 (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.
tool-access-policy.argumentFiltersMatch (cyclomatic 30) server/src/services/tool-access-policy.ts:226— tool-access-policy.argumentFiltersMatch 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.
workspace-base-ref-diagnostics.readWorkspaceBaseRefDiagnostic (cyclomatic 30) server/src/services/workspace-base-ref-diagnostics.ts:24— workspace-base-ref-diagnostics.readWorkspaceBaseRefDiagnostic 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.
workspace-runtime.spawnLocalRuntimeService.readiness (cyclomatic 30) server/src/services/workspace-runtime.ts:6844— workspace-runtime.spawnLocalRuntimeService.readiness 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.
workspace-runtime.startRuntimeServicesForWorkspaceControlInvocation (cyclomatic 30) server/src/services/workspace-runtime.ts:7978— workspace-runtime.startRuntimeServicesForWorkspaceControlInvocation has cyclomatic complexity 30 (threshold 15). Of this number, 28 points are the body's own statements and 2 belong to 2 function literals 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.
file-receipts.createSlackFileReceipts.lockSlackFileReceiptAuthorization (cyclomatic 30) server/src/services/chat-channels/slack/file-receipts.ts:330— file-receipts.createSlackFileReceipts.lockSlackFileReceiptAuthorization has cyclomatic complexity 30 (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.
aggregator-app-discovery.discoverExecutorApps (cyclomatic 30) server/src/services/aggregator-app-discovery.ts:96— aggregator-app-discovery.discoverExecutorApps 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.
cloud-callback.createCloudOAuthCallback::completePaperclipCloudConnectorCallback (cyclomatic 30) server/src/services/tool-access/oauth/cloud-callback.ts:39— cloud-callback.createCloudOAuthCallback::completePaperclipCloudConnectorCallback has cyclomatic complexity 30 (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.
oauth.createPublicMcpOAuth.exchangeAuthorizationCode (cyclomatic 30) server/src/services/public-mcp/oauth.ts:348— oauth.createPublicMcpOAuth.exchangeAuthorizationCode has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 9 of the 30 points are its own statements and the rest belongs to one function literal inside it that branches (line 356). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
dot.createBroker.requestTurn (cyclomatic 30) server/src/modules/external-agents/dot.ts:331— dot.createBroker.requestTurn has cyclomatic complexity 30 (threshold 15). Of this number, 15 points are the body's own statements and 15 belong to one function literal inside it that branches. 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.
native-deliverable-feedback.explicitlyRequestsFileOutput (cyclomatic 30) server/src/services/native-runtime/native-deliverable-feedback.ts:81— native-deliverable-feedback.explicitlyRequestsFileOutput has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 88, 134, 99, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
assigned-mcp-tools.createAssignedMcpTools.search (cyclomatic 30) server/src/services/native-runtime/assigned-mcp-tools.ts:107— assigned-mcp-tools.createAssignedMcpTools.search has cyclomatic complexity 30 (threshold 15). Of this number, 24 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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.
issue-title.setIssueTitle (cyclomatic 30) server/src/services/issue-title.ts:15— issue-title.setIssueTitle has cyclomatic complexity 30 (threshold 15). Of this number, 28 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
company-skills.companySkillService.readLoadedSkillFile (cyclomatic 30) server/src/services/company-skills.ts:4397— company-skills.companySkillService.readLoadedSkillFile 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.
company-skills.companySkillService.listRuntimeSkillEntriesLocked (cyclomatic 30) server/src/services/company-skills.ts:6181— company-skills.companySkillService.listRuntimeSkillEntriesLocked 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.
native-session-executor.createRemoteRunnerProcessLauncher (cyclomatic 30) server/src/services/native-runtime/native-session-executor.ts:11302— native-session-executor.createRemoteRunnerProcessLauncher has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 11372, 11333). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-session-handoff.buildNativeSessionHandoff (cyclomatic 30) server/src/services/native-runtime/native-session-handoff.ts:50— native-session-handoff.buildNativeSessionHandoff has cyclomatic complexity 30 (threshold 15). Of this number, 24 points are the body's own statements and 6 belong to 4 function items inside it that branch. 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.ProvenanceDrawer (cyclomatic 30) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:3737— app.ProvenanceDrawer has cyclomatic complexity 30 (threshold 15). Of this number, 19 points are the body's own statements and 11 belong to one function literal 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.
pod-exec.execInPodStreaming (cyclomatic 30) packages/plugins/sandbox-providers/kubernetes/src/pod-exec.ts:298— pod-exec.execInPodStreaming has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 2 of the 30 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 338, 380, 351, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
managed-environments.applyManagedEnvironments (cyclomatic 30) server/src/services/managed-environments.ts:134— managed-environments.applyManagedEnvironments has cyclomatic complexity 30 (threshold 15). Of this number, 21 points are the body's own statements and 9 belong to 3 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.
StarToggle.StarToggle (cyclomatic 30) ui/src/components/StarToggle.tsx:43— StarToggle.StarToggle has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
config-fields.GeminiLocalConfigFields (cyclomatic 30) ui/src/adapters/gemini-local/config-fields.tsx:15— config-fields.GeminiLocalConfigFields has cyclomatic complexity 30 (threshold 15). Of this number, 19 points are the body's own statements and 11 belong to 6 function literals inside it that branch. 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.
SidebarCompanyMenu.production.BuiltinCompanyMenu (cyclomatic 30) ui/src/components/SidebarCompanyMenu.production.tsx:155— SidebarCompanyMenu.production.BuiltinCompanyMenu has cyclomatic complexity 30 (threshold 15). Of this number, 17 points are the body's own statements and 13 belong to 6 function items inside it that branch. 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.
workflow-sort.workflowSort (cyclomatic 30) ui/src/lib/workflow-sort.ts:19— workflow-sort.workflowSort has cyclomatic complexity 30 (threshold 15). Of this number, 21 points are the body's own statements and 9 belong to 3 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.
DispositionRecoveryNotice.DispositionRecoveryNotice (cyclomatic 30) ui/src/components/DispositionRecoveryNotice.tsx:71— DispositionRecoveryNotice.DispositionRecoveryNotice has cyclomatic complexity 30 (threshold 15). Of this number, 25 points are the body's own statements and 5 belong to one function item inside it that branches. 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.
completed-activity-summary.completedActivitySummary (cyclomatic 30) ui/src/components/task-chat/completed-activity-summary.ts:29— completed-activity-summary.completedActivitySummary has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 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.
TaskChatThreadView.TaskChatThreadView (cyclomatic 30) ui/src/components/task-chat/TaskChatThreadView.tsx:299— TaskChatThreadView.TaskChatThreadView has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 9 of the 30 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 336, 378, 357, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-run-events.runtimeRequestEntry (cyclomatic 30) ui/src/components/transcript/native-run-events.ts:142— native-run-events.runtimeRequestEntry has cyclomatic complexity 30 (threshold 15). Of this number, 26 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
AgentChat.AgentChat (cyclomatic 30) ui/src/pages/AgentChat.tsx:15— AgentChat.AgentChat has cyclomatic complexity 30 (threshold 15). Of this number, 21 points are the body's own statements and 9 belong to 3 function literals inside it that branch. 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.
Timeline.Timeline (cyclomatic 30) ui/src/pages/Timeline.tsx:307— Timeline.Timeline has cyclomatic complexity 30 (threshold 15). Of this number, 18 points are the body's own statements and 12 belong to 7 function items inside it that branch. 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.
TrustPresetSection.TrustPresetSection (cyclomatic 30) ui/src/components/TrustPresetSection.tsx:53— TrustPresetSection.TrustPresetSection has cyclomatic complexity 30 (threshold 15). Of this number, 26 points are the body's own statements and 4 belong to 3 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.
InstanceExperimentalSettings.InstanceExperimentalSettings (cyclomatic 30) ui/src/pages/InstanceExperimentalSettings.tsx:122— InstanceExperimentalSettings.InstanceExperimentalSettings has cyclomatic complexity 30 (threshold 15). Of this number, 23 points are the body's own statements and 7 belong to 5 function literals 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.
CompanyExport.filterPaperclipYaml (cyclomatic 30) ui/src/pages/CompanyExport.tsx:95— CompanyExport.filterPaperclipYaml has cyclomatic complexity 30 (threshold 15). Of this number, 26 points are the body's own statements and 4 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.
cron-readable.describeCron (cyclomatic 30) ui/src/lib/cron-readable.ts:37— cron-readable.describeCron 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.
editable-sections.production.OverviewSection (cyclomatic 30) ui/src/components/routine-sections/editable-sections.production.tsx:110— editable-sections.production.OverviewSection has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 14 of the 30 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 178, 192, 217, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TaskList.TaskList (cyclomatic 30) ui/src/components/TaskList.tsx:39— TaskList.TaskList has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 5 of the 30 points are its own statements and the rest belongs to 5 function items inside it that branch (sortValue, renderBranch, updateColumns, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CredentialTaskPage.CredentialTaskPage (cyclomatic 30) ui/storybook/support/credential-access/CredentialTaskPage.tsx:13— CredentialTaskPage.CredentialTaskPage has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 70, 17, 99). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
context.upsertProfile (cyclomatic 29) cli/src/client/context.ts:145— context.upsertProfile 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.
git-workspace-sync.integrateImportedGitHead (cyclomatic 29) packages/adapter-utils/src/git-workspace-sync.ts:936— git-workspace-sync.integrateImportedGitHead has cyclomatic complexity 29 (threshold 15). Of this number, 26 points are the body's own statements and 3 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.
setup-token-runner.runSetupTokenLogin (cyclomatic 29) packages/adapters/claude-local/src/server/setup-token-runner.ts:200— setup-token-runner.runSetupTokenLogin has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 11 of the 29 points are its own statements and the rest belongs to 4 function items inside it that branch (onData, submitCode, captureCredential, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
build-config.buildClaudeLocalConfig (cyclomatic 29) packages/adapters/claude-local/src/ui/build-config.ts:22— build-config.buildClaudeLocalConfig 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.
format-event.printCodexStreamEvent (cyclomatic 29) packages/adapters/codex-local/src/cli/format-event.ts:143— format-event.printCodexStreamEvent 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.
parse-stdout.parseAssistantMessage (cyclomatic 29) packages/adapters/cursor-local/src/ui/parse-stdout.ts:101— parse-stdout.parseAssistantMessage 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.
provider-events.canonicalProviderEventsFromAcpxRuntimeEvent (cyclomatic 29) packages/paperclip-runner/src/provider-events.ts:1125— provider-events.canonicalProviderEventsFromAcpxRuntimeEvent has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to one function literal 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.
harness-driver.parseHarnessRuntimeRequestResolution (cyclomatic 29) packages/paperclip-runner/src/contracts/harness-driver.ts:202— harness-driver.parseHarnessRuntimeRequestResolution 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.
native-execution.buildNativeModelEnvelope (cyclomatic 29) packages/paperclip-runner/src/contracts/native-execution.ts:953— native-execution.buildNativeModelEnvelope has cyclomatic complexity 29 (threshold 15). Of this number, 25 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
DurablePrpCodexTransport.#attachRun (cyclomatic 29) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:4092— DurablePrpCodexTransport.#attachRun has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to one function literal 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.
runner-protocol-eval-history-view.renderProtocolEvalHistoryIndex (cyclomatic 29) packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:75— runner-protocol-eval-history-view.renderProtocolEvalHistoryIndex has cyclomatic complexity 29 (threshold 15). Of this number, 18 points are the body's own statements and 11 belong to 6 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.
eval-gateway-runtime.prepareEvalGatewayRuntime (cyclomatic 29) packages/paperclip-runner/src/cli/eval-gateway-runtime.ts:21— eval-gateway-runtime.prepareEvalGatewayRuntime has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
worker.createLifecycleWorker.process (cyclomatic 29) server/src/modules/agent-lifecycle/application/worker.ts:17— worker.createLifecycleWorker.process has cyclomatic complexity 29 (threshold 15). Of this number, 28 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.
issue-thread-interaction-resolution.evaluateIssueThreadInteractionResolverAudience (cyclomatic 29) server/src/services/issue-thread-interaction-resolution.ts:155— issue-thread-interaction-resolution.evaluateIssueThreadInteractionResolverAudience 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.
chat-question-forms.parseFormField (cyclomatic 29) server/src/services/chat-question-forms.ts:422— chat-question-forms.parseFormField has cyclomatic complexity 29 (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.
PhotonCloudClient.allocation (cyclomatic 29) server/src/services/photon/cloud.ts:193— PhotonCloudClient.allocation has cyclomatic complexity 29 (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.
chat-telegram-media-intake.oggOpus (cyclomatic 29) server/src/services/chat-telegram-media-intake.ts:518— chat-telegram-media-intake.oggOpus 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.
chat-attachment-reuse.resolveExternalChatResponseWaitAuthorizationInTransaction (cyclomatic 29) server/src/services/native-runtime/chat-attachment-reuse.ts:628— chat-attachment-reuse.resolveExternalChatResponseWaitAuthorizationInTransaction 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.
run-origin.chatRunSourceMessageId (cyclomatic 29) server/src/services/chat-channels/run-origin.ts:11— run-origin.chatRunSourceMessageId 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.
costs.createCostEventInTransaction (cyclomatic 29) server/src/services/costs.ts:85— costs.createCostEventInTransaction 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.
tool-gateway.createToolGatewayService.buildTestCallStatus (cyclomatic 29) server/src/services/tool-gateway.ts:8607— tool-gateway.createToolGatewayService.buildTestCallStatus 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.
execution-workspaces.executionWorkspaceService.reopenClosedIsolatedExecutionWorkspaceForIssue::reopen (cyclomatic 29) server/src/services/execution-workspaces.ts:4080— execution-workspaces.executionWorkspaceService.reopenClosedIsolatedExecutionWorkspaceForIssue::reopen 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.
resource-reconciliation.createChatResourceReconciliation.applyProviderAvailability (cyclomatic 29) server/src/services/chat-channels/resource-reconciliation.ts:364— resource-reconciliation.createChatResourceReconciliation.applyProviderAvailability has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 1 of the 29 points is its own statement and the rest belongs to one function literal inside it that branches (line 373). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
policy.decideQueuedRunStaleness (cyclomatic 29) server/src/modules/run-dispatch/domain/policy.ts:499— policy.decideQueuedRunStaleness 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.
publications.createPhotonPublicationDelivery.deliverPhotonPublication (cyclomatic 29) server/src/services/chat-channels/imessage-photon/publications.ts:53— publications.createPhotonPublicationDelivery.deliverPhotonPublication has cyclomatic complexity 29 (threshold 15). Of this number, 19 points are the body's own statements and 10 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.
agent-runner-selection.resolveClaudeRunnerConfig (cyclomatic 29) server/src/services/agent-runner-selection.ts:103— agent-runner-selection.resolveClaudeRunnerConfig has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to one function literal 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.
setup-readiness.probeRemoteNativeCodex (cyclomatic 29) server/src/services/native-runtime/setup-readiness.ts:84— setup-readiness.probeRemoteNativeCodex has cyclomatic complexity 29 (threshold 15). Of this number, 15 points are the body's own statements and 14 belong to 6 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.
agent-file-store.agentFileStore.apply (cyclomatic 29) server/src/services/agent-file-store.ts:242— agent-file-store.agentFileStore.apply has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 1 of the 29 points is its own statement and the rest belongs to one function literal inside it that branches (line 243). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-session-executor.synchronizeCompletedProviderPlan (cyclomatic 29) server/src/services/native-runtime/native-session-executor.ts:1469— native-session-executor.synchronizeCompletedProviderPlan 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
service.recoveryService.reconcileActiveRecoveryActions (cyclomatic 29) REDACTED:3492— service.recoveryService.reconcileActiveRecoveryActions 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.
session-preparation.prepareHeartbeatSession (cyclomatic 29) server/src/services/heartbeat/session-preparation.ts:75— session-preparation.prepareHeartbeatSession 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.
environment-creation-cleanup.readEnvironmentCreationCleanupError (cyclomatic 29) packages/plugins/sdk/src/environment-creation-cleanup.ts:82— environment-creation-cleanup.readEnvironmentCreationCleanupError has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
subscription-report.subscriptionCostReport (cyclomatic 29) server/src/services/subscription-report.ts:25— subscription-report.subscriptionCostReport has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 1 of the 29 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 26, 110). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
skill-source-git-snapshot.runGit (cyclomatic 29) server/src/services/skill-source-git-snapshot.ts:76— skill-source-git-snapshot.runGit has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 1 of the 29 points is its own statement and the rest belongs to 13 function literals inside it that branch (lines 139, 78, 91, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
skill-source-sync.skillSourceSyncService.importBinding (cyclomatic 29) server/src/services/skill-source-sync.ts:188— skill-source-sync.skillSourceSyncService.importBinding has cyclomatic complexity 29 (threshold 15). Of this number, 20 points are the body's own statements and 9 belong to one function literal 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.
muse-qualification.main (cyclomatic 29) scripts/smoke/muse-qualification.ts:164— muse-qualification.main has cyclomatic complexity 29 (threshold 15). Of this number, 26 points are the body's own statements and 3 belong to one function literal 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.
ExternalAgentInviteContent.DotConnectionChecks (cyclomatic 29) ui/src/components/new-agent/ExternalAgentInviteContent.tsx:51— ExternalAgentInviteContent.DotConnectionChecks has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 13 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 64). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
AgentBasicsDialog.AgentBasicsDialog (cyclomatic 29) ui/src/components/new-agent/AgentBasicsDialog.tsx:44— AgentBasicsDialog.AgentBasicsDialog 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. This shape REPEATS in the file: one other method here (AgentBasicsDialog.AgentBasicsDialog::submit) 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.
issue-filters.applyIssueFilters (cyclomatic 29) ui/src/lib/issue-filters.ts:209— issue-filters.applyIssueFilters has cyclomatic complexity 29 (threshold 15). Of this number, 20 points are the body's own statements and 9 belong to 2 function literals inside it that branch. 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.
Sidebar.Sidebar (cyclomatic 29) ui/src/components/Sidebar.tsx:53— Sidebar.Sidebar has cyclomatic complexity 29 (threshold 15). Of this number, 25 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
AgentConversationSidebar.AgentConversationSidebar (cyclomatic 29) ui/src/components/AgentConversationSidebar.tsx:31— AgentConversationSidebar.AgentConversationSidebar has cyclomatic complexity 29 (threshold 15). Of this number, 18 points are the body's own statements and 11 belong to 4 function literals 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.
AiConnectionCredentialStep.ApiKeyConnectionStep (cyclomatic 29) ui/src/components/ai-connections/AiConnectionCredentialStep.tsx:103— AiConnectionCredentialStep.ApiKeyConnectionStep has cyclomatic complexity 29 (threshold 15). Of this number, 23 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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.
index.parseItemEvent (cyclomatic 29) ui/src/adapters/paperclip-runner/index.ts:210— index.parseItemEvent 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.
index.runtimeRequestEntry (cyclomatic 29) ui/src/adapters/paperclip-runner/index.ts:408— index.runtimeRequestEntry has cyclomatic complexity 29 (threshold 15). Of this number, 26 points are the body's own statements and 3 belong to 3 function literals inside it that branch. 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.
SearchResultRow.SearchResultRowImpl (cyclomatic 29) ui/src/components/search/SearchResultRow.tsx:59— SearchResultRow.SearchResultRowImpl 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.
DecisionHistory.DecisionHistoryTable (cyclomatic 29) ui/src/components/decision-models/DecisionHistory.tsx:8— DecisionHistory.DecisionHistoryTable has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 9 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 14). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
TokensPanel.TokensPanel (cyclomatic 29) ui/src/pages/apps/gateways/panels/TokensPanel.tsx:77— TokensPanel.TokensPanel has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 13 of the 29 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 298, a function literal at line 333, copyToken, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentBulkRoster.AgentBulkRoster (cyclomatic 29) ui/src/components/agents/AgentBulkRoster.tsx:16— AgentBulkRoster.AgentBulkRoster has cyclomatic complexity 29 (threshold 15). Of this number, 16 points are the body's own statements and 13 belong to 9 function items inside it that branch. 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.
TaskChatCompactInteractionCard.ReceiptDisclosure (cyclomatic 29) ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx:369— TaskChatCompactInteractionCard.ReceiptDisclosure has cyclomatic complexity 29 (threshold 15). Of this number, 25 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
ConnectionSetupFlow.OAuthConnectStateScreen (cyclomatic 29) ui/src/features/connections/ConnectionSetupFlow.tsx:2792— ConnectionSetupFlow.OAuthConnectStateScreen 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.
ServiceConsent.ServiceConsent (cyclomatic 29) ui/storybook/prototypes/google-workspace/ServiceConsent.tsx:21— ServiceConsent.ServiceConsent has cyclomatic complexity 29 (threshold 15). Of this number, 23 points are the body's own statements and 6 belong to 4 function literals 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.
work-journey.GrokWorkJourney (cyclomatic 29) ui/storybook/stories/agents/grok-bot/work-journey.tsx:35— work-journey.GrokWorkJourney has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to one function literal 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.
ManagedDurableState::validate (cyclomatic 29) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:535— ManagedDurableState::validate 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.
configure.configure (cyclomatic 28) cli/src/commands/configure.ts:84— configure.configure 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-home.seedManagedCodexHome (cyclomatic 28) packages/adapters/codex-local/src/server/codex-home.ts:658— codex-home.seedManagedCodexHome has cyclomatic complexity 28 (threshold 15). Of this number, 26 points are the body's own statements and 2 belong to one function literal 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.
runnerd-codex-transport.completedMaintenanceTerminalReceipt (cyclomatic 28) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:2161— runnerd-codex-transport.completedMaintenanceTerminalReceipt has cyclomatic complexity 28 (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.
local-runner-browser-server.createLocalRunnerBrowserMiddleware (cyclomatic 28) REDACTED:233— local-runner-browser-server.createLocalRunnerBrowserMiddleware has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 5 function items inside it that branch (a function literal at line 253, pruneFinishedRuns, a function literal at line 286, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
pi-message-projection.createPiMessageProjection.normalize (cyclomatic 28) packages/paperclip-runner/src/drivers/acpx/pi-message-projection.ts:13— pi-message-projection.createPiMessageProjection.normalize has cyclomatic complexity 28 (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.
harness-driver-backend.isBoundedPersistedJson::visit (cyclomatic 28) packages/paperclip-runner/src/backends/harness-driver-backend.ts:281— harness-driver-backend.isBoundedPersistedJson::visit 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.
capability-semantic-tool-runtime.commandForOperation (cyclomatic 28) packages/paperclip-runner/src/tools/capability-semantic-tool-runtime.ts:1524— capability-semantic-tool-runtime.commandForOperation 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.
plugin-runner-probe.probePluginRunnerEnvironment (cyclomatic 28) server/src/services/native-runtime/plugin-runner-probe.ts:15— plugin-runner-probe.probePluginRunnerEnvironment 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.
ai-connections.aiConnectionService.refreshQuotaCredential (cyclomatic 28) server/src/services/ai-connections.ts:1052— ai-connections.aiConnectionService.refreshQuotaCredential has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 1056, 1053). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
plugin-task-credential-writeback.settlePluginTaskCredentialHandoff (cyclomatic 28) server/src/services/plugin-task-credential-writeback.ts:59— plugin-task-credential-writeback.settlePluginTaskCredentialHandoff has cyclomatic complexity 28 (threshold 15). Of this number, 15 points are the body's own statements and 13 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.
index.vercelClient.send (cyclomatic 28) server/src/services/connectors/vercel/index.ts:56— index.vercelClient.send has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function literal 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.
prompt-injection-provider.runPromptInjectionProvider (cyclomatic 28) server/src/services/prompt-injection-provider.ts:66— prompt-injection-provider.runPromptInjectionProvider has cyclomatic complexity 28 (threshold 15). Of this number, 26 points are the body's own statements and 2 belong to one function literal 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.
prompt-injection-prevention.promptInjectionPreventionService.resolve (cyclomatic 28) server/src/services/prompt-injection-prevention.ts:77— prompt-injection-prevention.promptInjectionPreventionService.resolve 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.
tool-access-policy.scopeAllowsTool (cyclomatic 28) server/src/services/tool-access-policy.ts:754— tool-access-policy.scopeAllowsTool 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.
slack-access.authorizeSlackChannel (cyclomatic 28) server/src/services/connectors/slack-access.ts:13— slack-access.authorizeSlackChannel 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.
tool-gateway.createToolGatewayService.findToolForSession (cyclomatic 28) server/src/services/tool-gateway.ts:2883— tool-gateway.createToolGatewayService.findToolForSession has cyclomatic complexity 28 (threshold 15). Of this number, 24 points are the body's own statements and 4 belong to 2 function literals 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.
chat-provider-lifecycle.parseSlackLifecycle (cyclomatic 28) server/src/services/chat-provider-lifecycle.ts:89— chat-provider-lifecycle.parseSlackLifecycle 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.
manager-grants.createSlackManagerGrants.complete (cyclomatic 28) server/src/services/connectors/slack/setup/manager-grants.ts:99— manager-grants.createSlackManagerGrants.complete has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 2 of the 28 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 103, 128, 108). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
commands.createSlackCommands.handleSlackSlashCommand (cyclomatic 28) server/src/services/chat-channels/slack/commands.ts:90— commands.createSlackCommands.handleSlackSlashCommand has cyclomatic complexity 28 (threshold 15). Of this number, 21 points are the body's own statements and 7 belong to 3 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.
isolated-repository-rehome.cleanupRehomedSource (cyclomatic 28) server/src/services/isolated-repository-rehome.ts:605— isolated-repository-rehome.cleanupRehomedSource has cyclomatic complexity 28 (threshold 15). Of this number, 25 points are the body's own statements and 3 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.
execution-workspaces.inspectGitCloseReadiness (cyclomatic 28) server/src/services/execution-workspaces.ts:900— execution-workspaces.inspectGitCloseReadiness 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.
setup-services.createSlackSetupServices (cyclomatic 28) server/src/services/chat-channels/slack/setup-services.ts:30— setup-services.createSlackSetupServices has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 10 function items inside it that branch (a function literal at line 41, a function literal at line 75, linkSlackAccount, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
email-channels.emailChannelService.authorize (cyclomatic 28) server/src/services/email-channels.ts:474— email-channels.emailChannelService.authorize 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.
connection-intents.connectionIntentService.usableConnectionForAgent (cyclomatic 28) server/src/services/connection-intents.ts:266— connection-intents.connectionIntentService.usableConnectionForAgent has cyclomatic complexity 28 (threshold 15). Of this number, 16 points are the body's own statements and 12 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.
failed-run-retry.createChatFailedRunRetry.authorizeFailedChatRunRetry (cyclomatic 28) server/src/services/chat-channels/failed-run-retry.ts:1321— failed-run-retry.createChatFailedRunRetry.authorizeFailedChatRunRetry has cyclomatic complexity 28 (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.
lifecycle.createChatMessageLifecycle.recordLifecycleDelivery (cyclomatic 28) server/src/services/chat-channels/inbound/lifecycle.ts:134— lifecycle.createChatMessageLifecycle.recordLifecycleDelivery has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 13 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 173). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
gateway-events.createDiscordGatewayEvents.processDiscordGatewayEvent (cyclomatic 28) server/src/services/chat-channels/discord/gateway-events.ts:77— gateway-events.createDiscordGatewayEvents.processDiscordGatewayEvent has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 7 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 116). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
github-access-discovery.loadGitHubGrantMetadata (cyclomatic 28) server/src/services/tool-access/github-access-discovery.ts:64— github-access-discovery.loadGitHubGrantMetadata 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.
issue-thread-interactions.issueThreadInteractionService.acceptRequestConfirmation (cyclomatic 28) server/src/services/issue-thread-interactions.ts:2150— issue-thread-interactions.issueThreadInteractionService.acceptRequestConfirmation has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 3 of the 28 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 2172, publish). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
native-broker.createNativeExternalBroker.reserveNativeOperation (cyclomatic 28) server/src/modules/external-agents/native-broker.ts:122— native-broker.createNativeExternalBroker.reserveNativeOperation has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to one function literal inside it that branches (line 124). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
case-handoff-lifecycle.isCaseHandoffSourceReleased (cyclomatic 28) server/src/services/heartbeat/case-handoff-lifecycle.ts:249— case-handoff-lifecycle.isCaseHandoffSourceReleased has cyclomatic complexity 28 (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.
legacy-execution-recovery.legacyExecutionNeedsReconciliation (cyclomatic 28) server/src/services/legacy-execution-recovery.ts:42— legacy-execution-recovery.legacyExecutionNeedsReconciliation has cyclomatic complexity 28 (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.
usage-receipts.createRunUsageRecorder.capture (cyclomatic 28) server/src/services/usage-receipts.ts:286— usage-receipts.createRunUsageRecorder.capture has cyclomatic complexity 28 (threshold 15). Of this number, 24 points are the body's own statements and 4 belong to one function literal 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.
openapi.resolveOperationAuthLevel (cyclomatic 28) server/src/routes/openapi.ts:1763— openapi.resolveOperationAuthLevel has cyclomatic complexity 28 (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.
company-skills.companySkillService.installFromCatalog (cyclomatic 28) server/src/services/company-skills.ts:5763— company-skills.companySkillService.installFromCatalog 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. This is NOT this file's highest cyclomatic complexity: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-runner-file-handoff.stageNativeRunnerWakeAttachments (cyclomatic 28) server/src/services/native-runtime/native-runner-file-handoff.ts:812— native-runner-file-handoff.stageNativeRunnerWakeAttachments has cyclomatic complexity 28 (threshold 15). Of this number, 18 points are the body's own statements and 10 belong to 4 function literals 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.
PaperclipRunnerToolAuthority.definitions (cyclomatic 28) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:246— PaperclipRunnerToolAuthority.definitions has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 12 of the 28 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 271, 284). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-session-executor.nativeSessionFailureSourceCode (cyclomatic 28) server/src/services/native-runtime/native-session-executor.ts:6458— native-session-executor.nativeSessionFailureSourceCode 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-provider-failure-evidence.observePersistedNativeTurnFailure (cyclomatic 28) server/src/services/native-runtime/native-provider-failure-evidence.ts:12— native-provider-failure-evidence.observePersistedNativeTurnFailure has cyclomatic complexity 28 (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-control.createHeartbeatRunControl.releaseEnvironmentLeasesForRun (cyclomatic 28) server/src/services/heartbeat/run-control.ts:351— run-control.createHeartbeatRunControl.releaseEnvironmentLeasesForRun has cyclomatic complexity 28 (threshold 15). Of this number, 26 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
instruction-working-copy.createHeartbeatInstructionWorkingCopy.prepare (cyclomatic 28) server/src/services/heartbeat/instruction-working-copy.ts:126— instruction-working-copy.createHeartbeatInstructionWorkingCopy.prepare has cyclomatic complexity 28 (threshold 15). Of this number, 27 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.
agent-observability.agentObservabilityService.configure (cyclomatic 28) server/src/services/agent-observability.ts:74— agent-observability.agentObservabilityService.configure has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 77, 100). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
cloud-migrator-artifacts.assertLockfile (cyclomatic 28) scripts/cloud-migrator-artifacts.mjs:39— cloud-migrator-artifacts.assertLockfile 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.
grok-public-install-sandbox.runMacInitialInstallWithDiagnostics (cyclomatic 28) scripts/grok-public-install-sandbox.mjs:14— grok-public-install-sandbox.runMacInitialInstallWithDiagnostics has cyclomatic complexity 28 (threshold 15). Of this number, 26 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.
status-cards.statusCardService.writeSummary (cyclomatic 28) server/src/services/status-cards.ts:792— status-cards.statusCardService.writeSummary has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 4 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 799). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
events.createPublicMcpEvents.start (cyclomatic 28) server/src/services/public-mcp/events.ts:378— events.createPublicMcpEvents.start has cyclomatic complexity 28 (threshold 15). Of this number, 22 points are the body's own statements and 6 belong to 2 function literals 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.
skill-repository-dependencies.skillRepositoryDependencies (cyclomatic 28) server/src/services/skill-repository-dependencies.ts:8— skill-repository-dependencies.skillRepositoryDependencies has cyclomatic complexity 28 (threshold 15). Of this number, 18 points are the body's own statements and 10 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.
assignees.suggestedCommentAssigneeValue (cyclomatic 28) ui/src/lib/assignees.ts:30— assignees.suggestedCommentAssigneeValue has cyclomatic complexity 28 (threshold 15). Of this number, 14 points are the body's own statements and 14 belong to one function literal 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.
NewGoalDialog.NewGoalDialog (cyclomatic 28) ui/src/components/NewGoalDialog.tsx:36— NewGoalDialog.NewGoalDialog has cyclomatic complexity 28 (threshold 15). Of this number, 14 points are the body's own statements and 14 belong to 8 function items inside it that branch. 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.
SidebarStarredProjects.SidebarStarredProjects (cyclomatic 28) ui/src/components/SidebarStarredProjects.tsx:42— SidebarStarredProjects.SidebarStarredProjects has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 4 of the 28 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 108, 59, 91, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SidebarShell.SidebarShell (cyclomatic 28) ui/src/components/SidebarShell.tsx:92— SidebarShell.SidebarShell has cyclomatic complexity 28 (threshold 15). Of this number, 17 points are the body's own statements and 11 belong to 5 function literals inside it that branch. 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.
SidebarStarredProjects.production.SidebarStarredProjects (cyclomatic 28) ui/src/components/SidebarStarredProjects.production.tsx:42— SidebarStarredProjects.production.SidebarStarredProjects has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 4 of the 28 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 108, 59, 91, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
LiveUpdatesProvider.resolveVisibleIssueRouteContext (cyclomatic 28) ui/src/context/LiveUpdatesProvider.tsx:352— LiveUpdatesProvider.resolveVisibleIssueRouteContext has cyclomatic complexity 28 (threshold 15). Of this number, 22 points are the body's own statements and 6 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.
transcript-adapter.paperclipRunnerActivityItems (cyclomatic 28) ui/src/components/task-chat/transcript-adapter.ts:1212— transcript-adapter.paperclipRunnerActivityItems has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 1218, 1216). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
IssueThreadInteractionCard.RequestConfirmationCard (cyclomatic 28) ui/src/components/IssueThreadInteractionCard.tsx:2564— IssueThreadInteractionCard.RequestConfirmationCard has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 12 of the 28 points are its own statements and the rest belongs to 6 function items inside it that branch (handleAddScreenshots, composeReason, handleAccept, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
RunWorkspaceRecoverySurface.RunWorkspaceRecoverySurface (cyclomatic 28) ui/src/components/RunWorkspaceRecoverySurface.tsx:54— RunWorkspaceRecoverySurface.RunWorkspaceRecoverySurface has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 9 of the 28 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 230, 127, 158, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentDetail.LatestRunCard (cyclomatic 28) ui/src/pages/AgentDetail.tsx:1577— AgentDetail.LatestRunCard has cyclomatic complexity 28 (threshold 15). Of this number, 18 points are the body's own statements and 10 belong to 3 function literals 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.
RoutineHistoryTab.RoutineHistoryTab (cyclomatic 28) ui/src/components/RoutineHistoryTab.tsx:62— RoutineHistoryTab.RoutineHistoryTab has cyclomatic complexity 28 (threshold 15). Of this number, 15 points are the body's own statements and 13 belong to 10 function items inside it that branch. 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.
editable-sections.OverviewSection (cyclomatic 28) ui/src/components/routine-sections/editable-sections.tsx:94— editable-sections.OverviewSection has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 12 of the 28 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 161, 175, 200, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentCommentary.AgentCommentary (cyclomatic 28) ui/src/pages/audit/AgentCommentary.tsx:78— AgentCommentary.AgentCommentary has cyclomatic complexity 28 (threshold 15). Of this number, 23 points are the body's own statements and 5 belong to 3 function literals 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.
GitHubBotManagement.GitHubRepositoryAccess (cyclomatic 28) ui/src/pages/apps/chat/GitHubBotManagement.tsx:41— GitHubBotManagement.GitHubRepositoryAccess has cyclomatic complexity 28 (threshold 15). Of this number, 17 points are the body's own statements and 11 belong to 4 function literals inside it that branch. 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.
SkillStudio.StudioNewSkillPanel (cyclomatic 28) ui/src/pages/SkillStudio.tsx:431— SkillStudio.StudioNewSkillPanel has cyclomatic complexity 28 (threshold 15). Of this number, 16 points are the body's own statements and 12 belong to 7 function literals inside it that branch. 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.
CompanySkills.production.SkillCard (cyclomatic 28) ui/src/pages/CompanySkills.production.tsx:805— CompanySkills.production.SkillCard has cyclomatic complexity 28 (threshold 15). Of this number, 25 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
AgentDetail.production.LatestRunCard (cyclomatic 28) ui/src/pages/AgentDetail.production.tsx:1631— AgentDetail.production.LatestRunCard has cyclomatic complexity 28 (threshold 15). Of this number, 18 points are the body's own statements and 10 belong to 3 function literals 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.
AgentDetail.production.ConfigurationTab (cyclomatic 28) ui/src/pages/AgentDetail.production.tsx:2080— AgentDetail.production.ConfigurationTab has cyclomatic complexity 28 (threshold 15). Of this number, 21 points are the body's own statements and 7 belong to 5 function literals 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.
worktree.applyMergePlan (cyclomatic 27) cli/src/commands/worktree.ts:3733— worktree.applyMergePlan has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 1 of the 27 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 3742, 3920). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
git-workspace-sync.readGitWorkspaceSnapshot (cyclomatic 27) packages/adapter-utils/src/git-workspace-sync.ts:199— git-workspace-sync.readGitWorkspaceSnapshot has cyclomatic complexity 27 (threshold 15). Of this number, 18 points are the body's own statements and 9 belong to 3 function items inside it that branch. 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.
workspace-seed-cache.publishWorkspaceSeedGeneration::capacity (cyclomatic 27) packages/adapter-utils/src/workspace-seed-cache.ts:177— workspace-seed-cache.publishWorkspaceSeedGeneration::capacity 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. This shape REPEATS in the file: one other method here (workspace-seed-cache.publishWorkspaceSeedGeneration) 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.
sandbox-callback-bridge.startSandboxCallbackBridgeWorker.loop (cyclomatic 27) REDACTED:1487— sandbox-callback-bridge.startSandboxCallbackBridgeWorker.loop has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 1 of the 27 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 1487, 1492). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
execution-target.runAdapterExecutionTargetProcess (cyclomatic 27) REDACTED:866— execution-target.runAdapterExecutionTargetProcess 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.
startup-reuse.summarizeStartupReuse (cyclomatic 27) packages/adapter-utils/src/startup-reuse.ts:68— startup-reuse.summarizeStartupReuse 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.
format-event.printTextMessage (cyclomatic 27) packages/adapters/gemini-local/src/cli/format-event.ts:44— format-event.printTextMessage 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-notification-identity.classifyCodexNotification (cyclomatic 27) packages/paperclip-runner/src/drivers/codex/codex-notification-identity.ts:27— codex-notification-identity.classifyCodexNotification has cyclomatic complexity 27 (threshold 15). Of this number, 25 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
CapabilitySemanticDispatcher.#applyMutation (cyclomatic 27) packages/paperclip-runner/src/semantic-tools/dispatcher.ts:327— CapabilitySemanticDispatcher.#applyMutation 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.
CapabilityLiveSessionService.create (cyclomatic 27) packages/paperclip-runner/src/live/live-session.ts:908— CapabilityLiveSessionService.create 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.
EvidencePanel.ToolsBrowser (cyclomatic 27) packages/paperclip-runner/devtools/issue-thread/src/EvidencePanel.tsx:169— EvidencePanel.ToolsBrowser has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 11 of the 27 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 202, 176, 220, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-distribution-integrity.readNativeAcpxDistributionEntries (cyclomatic 27) packages/paperclip-runner/src/drivers/acpx/native-distribution-integrity.ts:64— native-distribution-integrity.readNativeAcpxDistributionEntries has cyclomatic complexity 27 (threshold 15). Of this number, 25 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
runtime-sandbox.readAcpxRecoveryWorkspace (cyclomatic 27) packages/paperclip-runner/src/drivers/acpx/runtime-sandbox.ts:78— runtime-sandbox.readAcpxRecoveryWorkspace 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.
PiAssistantMessages.normalize (cyclomatic 27) packages/paperclip-runner/src/drivers/acpx/pi-acp-runtime.ts:153— PiAssistantMessages.normalize 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.
conversation.Conversation (cyclomatic 27) packages/paperclip-runner/src/react/components/conversation.tsx:51— conversation.Conversation has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 4 of the 27 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 143, 74, 64, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-operations.workspaceOperationService.createRecorder.recordOperation (cyclomatic 27) server/src/services/workspace-operations.ts:478— workspace-operations.workspaceOperationService.createRecorder.recordOperation has cyclomatic complexity 27 (threshold 15). Of this number, 16 points are the body's own statements and 11 belong to 4 function items inside it that branch. 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.
question-response-delivery.isRetiredExternalChatQuestionSource (cyclomatic 27) server/src/services/question-response-delivery.ts:292— question-response-delivery.isRetiredExternalChatQuestionSource has cyclomatic complexity 27 (threshold 15). Of this number, 22 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
index.supabaseClient.send (cyclomatic 27) server/src/services/connectors/supabase/index.ts:123— index.supabaseClient.send has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function literal 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.
index.supabaseClient.invoke (cyclomatic 27) server/src/services/connectors/supabase/index.ts:170— index.supabaseClient.invoke 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.
chat-github-attachments.validateGitHubAttachmentLocator (cyclomatic 27) REDACTED:199— chat-github-attachments.validateGitHubAttachmentLocator 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.
heartbeat-run-summary.resolveHeartbeatRunResponse (cyclomatic 27) server/src/services/heartbeat-run-summary.ts:403— heartbeat-run-summary.resolveHeartbeatRunResponse has cyclomatic complexity 27 (threshold 15). Of this number, 17 points are the body's own statements and 10 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.
tool-gateway.createToolGatewayService.updateNamedGateway (cyclomatic 27) server/src/services/tool-gateway.ts:8878— tool-gateway.createToolGatewayService.updateNamedGateway 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.
chat-provider-lifecycle.parseTelegramLifecycle (cyclomatic 27) server/src/services/chat-provider-lifecycle.ts:403— chat-provider-lifecycle.parseTelegramLifecycle 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.
commands.createDiscordCommands.reconcileDiscordCommands (cyclomatic 27) server/src/services/chat-channels/discord/commands.ts:91— commands.createDiscordCommands.reconcileDiscordCommands has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 5 of the 27 points are its own statements and the rest belongs to 4 function items inside it that branch (reconcile::authorize, reconcile, reconcile::setCapability, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
file-delivery.createTeamsFileDelivery.teamsTransferProtocol (cyclomatic 27) server/src/services/chat-channels/microsoft-teams/file-delivery.ts:69— file-delivery.createTeamsFileDelivery.teamsTransferProtocol has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 1 of the 27 points is its own statement and the rest belongs to 3 function items inside it that branch (a function literal at line 112, currentRuntime, a function literal at line 191). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
chat-provider-links.teamsConversationLink (cyclomatic 27) server/src/services/chat-provider-links.ts:35— chat-provider-links.teamsConversationLink 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.
webhook-callbacks.createSlackWebhookCallbacks.recordSlackWebhookCallback (cyclomatic 27) server/src/services/chat-channels/slack/webhook-callbacks.ts:55— webhook-callbacks.createSlackWebhookCallbacks.recordSlackWebhookCallback has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 3 of the 27 points are its own statements and the rest belongs to one function literal inside it that branches (line 60). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
reactions.createInboundReactions.handleReaction (cyclomatic 27) server/src/services/chat-channels/reactions.ts:316— reactions.createInboundReactions.handleReaction has cyclomatic complexity 27 (threshold 15). Of this number, 15 points are the body's own statements and 12 belong to one function literal inside it that branches. 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.
exchange.createConnectionTokenExchange::mintExchangeConnectionToken (cyclomatic 27) server/src/services/tool-access/token-broker/exchange.ts:135— exchange.createConnectionTokenExchange::mintExchangeConnectionToken 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.
legacy-execution-recovery.settleInterruptedNativeBootstrap (cyclomatic 27) server/src/services/legacy-execution-recovery.ts:301— legacy-execution-recovery.settleInterruptedNativeBootstrap has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 3 of the 27 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 307, 334). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
legacy-shutdown-workspace-settlement.allowLegacyShutdownWorkspaceCleanup (cyclomatic 27) server/src/services/legacy-shutdown-workspace-settlement.ts:107— legacy-shutdown-workspace-settlement.allowLegacyShutdownWorkspaceCleanup has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to one function literal inside it that branches (line 110). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
runner-goals.capabilityForAgent (cyclomatic 27) server/src/services/runner-goals.ts:51— runner-goals.capabilityForAgent 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.
agent-file-checkpoint.captureAgentFiles::walk (cyclomatic 27) server/src/services/scripts/agent-file-checkpoint.mjs:49— agent-file-checkpoint.captureAgentFiles::walk 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.
agent-instruction-revisions.agentInstructionRevisionService.commitInternal (cyclomatic 27) server/src/services/agent-instruction-revisions.ts:212— agent-instruction-revisions.agentInstructionRevisionService.commitInternal has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 223, 250, 256). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-file-resources.workspaceFileResourceService.readContent (cyclomatic 27) server/src/services/workspace-file-resources.ts:1666— workspace-file-resources.workspaceFileResourceService.readContent 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.
company-skills.companySkillService.list (cyclomatic 27) server/src/services/company-skills.ts:3269— company-skills.companySkillService.list has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 5 of the 27 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 3358, 3332, 3313). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest. This is NOT this file's highest cyclomatic complexity: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
run-failure-diagnostics.readNativeCloseSettlement (cyclomatic 27) REDACTED:86— run-failure-diagnostics.readNativeCloseSettlement 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.
native-session-executor.resolveNativeBilling (cyclomatic 27) server/src/services/native-runtime/native-session-executor.ts:10188— native-session-executor.resolveNativeBilling 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.verifyRemoteRunnerReattachment (cyclomatic 27) server/src/services/native-runtime/native-session-executor.ts:11124— native-session-executor.verifyRemoteRunnerReattachment 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.createRunnerdBackendWithinSessionClaim.bindManagedSession (cyclomatic 27) server/src/services/native-runtime/native-session-executor.ts:13660— native-session-executor.createRunnerdBackendWithinSessionClaim.bindManagedSession has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 10 of the 27 points are its own statements and the rest belongs to 5 function items inside it that branch (readAuth, a function literal at line 13684, a function literal at line 13703, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-workspace-sync.readNativeWorkspaceSyncReference (cyclomatic 27) server/src/services/native-runtime/native-workspace-sync.ts:303— native-workspace-sync.readNativeWorkspaceSyncReference 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.
native-workspace-sync.parseGitSnapshot (cyclomatic 27) server/src/services/native-runtime/native-workspace-sync.ts:416— native-workspace-sync.parseGitSnapshot has cyclomatic complexity 27 (threshold 15). Of this number, 23 points are the body's own statements and 4 belong to one function literal inside it that branches. 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-liveness.classifyRunLiveness (cyclomatic 27) server/src/services/run-liveness.ts:300— run-liveness.classifyRunLiveness has cyclomatic complexity 27 (threshold 15). Of this number, 24 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
BrokerCore.doExpose (cyclomatic 27) packages/tailscale-https-broker/src/broker-core.ts:371— BrokerCore.doExpose 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.
publish-announcements.main (cyclomatic 27) scripts/publish-announcements.ts:74— publish-announcements.main 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.
decisions.decisionService.sweepExpired (cyclomatic 27) server/src/services/decisions.ts:721— decisions.decisionService.sweepExpired 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.
company-portability.companyPortabilityService.resolveSource (cyclomatic 27) server/src/services/company-portability.ts:3783— company-portability.companyPortabilityService.resolveSource has cyclomatic complexity 27 (threshold 15). Of this number, 21 points are the body's own statements and 6 belong to one function literal 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.
events.createPublicMcpEvents.deliverOne (cyclomatic 27) server/src/services/public-mcp/events.ts:297— events.createPublicMcpEvents.deliverOne has cyclomatic complexity 27 (threshold 15). Of this number, 24 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
continuation-contract.rebindContinuationContract (cyclomatic 27) server/src/services/native-runtime/continuation-contract.ts:13— continuation-contract.rebindContinuationContract has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to one function literal inside it that branches (line 22). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
issueDetailCache.isCompleteIssueSnapshot (cyclomatic 27) ui/src/lib/issueDetailCache.ts:37— issueDetailCache.isCompleteIssueSnapshot 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.
SidebarRecentTasks.RecentTasksList (cyclomatic 27) ui/src/components/SidebarRecentTasks.tsx:94— SidebarRecentTasks.RecentTasksList has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 4 of the 27 points are its own statements and the rest belongs to 5 function items inside it that branch (toggleTaskPause, a function literal at line 249, submitRename, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
Inbox.FailedRunInboxRow (cyclomatic 27) ui/src/pages/Inbox.tsx:357— Inbox.FailedRunInboxRow 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.
TaskChatSystemNotice.TaskChatSystemNotice (cyclomatic 27) ui/src/components/task-chat/TaskChatSystemNotice.tsx:52— TaskChatSystemNotice.TaskChatSystemNotice 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.
task-chat-adapter.commentsToTaskChatItems (cyclomatic 27) ui/src/components/task-chat/task-chat-adapter.ts:68— task-chat-adapter.commentsToTaskChatItems 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.
interaction-audience.describeResolverAudience (cyclomatic 27) ui/src/lib/interaction-audience.ts:169— interaction-audience.describeResolverAudience has cyclomatic complexity 27 (threshold 15). Of this number, 26 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.
RunnerInspector.JsonNode (cyclomatic 27) ui/src/components/RunnerInspector.tsx:392— RunnerInspector.JsonNode has cyclomatic complexity 27 (threshold 15). Of this number, 24 points are the body's own statements and 3 belong to 3 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.
RunTranscriptView.TranscriptProviderActivity (cyclomatic 27) ui/src/components/transcript/RunTranscriptView.tsx:864— RunTranscriptView.TranscriptProviderActivity has cyclomatic complexity 27 (threshold 15). Of this number, 19 points are the body's own statements and 8 belong to 3 function literals 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.
DecisionResolver.DecisionResolver (cyclomatic 27) ui/src/components/DecisionResolver.tsx:43— DecisionResolver.DecisionResolver has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 11 of the 27 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 73, a function literal at line 113, a function literal at line 128, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
FeedCard.resolveContent (cyclomatic 27) ui/src/components/FeedCard.tsx:287— FeedCard.resolveContent 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.
profile-model.parseEntries (cyclomatic 27) ui/src/pages/tools/profiles/profile-model.ts:258— profile-model.parseEntries 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.
ChatEndpointDetail.Settings (cyclomatic 27) ui/src/pages/apps/chat/ChatEndpointDetail.tsx:462— ChatEndpointDetail.Settings has cyclomatic complexity 27 (threshold 15). Of this number, 19 points are the body's own statements and 8 belong to 3 function literals 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.
AdvancedPanel.DangerZone (cyclomatic 27) ui/src/pages/apps/app-detail/AdvancedPanel.tsx:433— AdvancedPanel.DangerZone has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function literal 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.
JoinRequestQueue.JoinRequestQueue (cyclomatic 27) ui/src/pages/JoinRequestQueue.tsx:14— JoinRequestQueue.JoinRequestQueue has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 8 of the 27 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 126, 32). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
DesignPageAside.DesignPageAside (cyclomatic 27) ui/src/components/DesignPageAside.tsx:15— DesignPageAside.DesignPageAside has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 9 of the 27 points are its own statements and the rest belongs to 7 function items inside it that branch (resizeWithKeyboard, a function literal at line 48, a function literal at line 59, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
FrontmatterPanel.FrontmatterPanel (cyclomatic 27) ui/src/components/FrontmatterPanel.tsx:219— FrontmatterPanel.FrontmatterPanel has cyclomatic complexity 27 (threshold 15). Of this number, 22 points are the body's own statements and 5 belong to 4 function literals inside it that branch. 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.
MemberMultiSelect.MemberMultiSelect (cyclomatic 27) ui/src/components/MemberMultiSelect.tsx:32— MemberMultiSelect.MemberMultiSelect has cyclomatic complexity 27 (threshold 15). Of this number, 16 points are the body's own statements and 11 belong to 7 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.
InvitesSection.InvitesSection (cyclomatic 27) ui/src/components/access/InvitesSection.tsx:49— InvitesSection.InvitesSection has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 13 of the 27 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 311, a function literal at line 189, a function literal at line 58, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
VoiceControls.VoiceControls (cyclomatic 27) ui/src/components/voice/VoiceControls.tsx:29— VoiceControls.VoiceControls has cyclomatic complexity 27 (threshold 15). Of this number, 24 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
worktree.worktreeCleanupCommand (cyclomatic 26) cli/src/commands/worktree.ts:2882— worktree.worktreeCleanupCommand has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
parse-stdout.parseAssistantMessage (cyclomatic 26) packages/adapters/gemini-local/src/ui/parse-stdout.ts:78— parse-stdout.parseAssistantMessage 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.
parse-stdout.parseGeminiStdoutLine (cyclomatic 26) packages/adapters/gemini-local/src/ui/parse-stdout.ts:212— parse-stdout.parseGeminiStdoutLine 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.
build-config.buildOpenClawGatewayConfig (cyclomatic 26) packages/adapters/openclaw-gateway/src/ui/build-config.ts:15— build-config.buildOpenClawGatewayConfig 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.
parse.createOpenCodeJsonlParser (cyclomatic 26) packages/adapters/opencode-local/src/server/parse.ts:27— parse.createOpenCodeJsonlParser has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 42, 67). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
provider-events.canonicalProviderEventsFromOpenCodePart (cyclomatic 26) packages/paperclip-runner/src/provider-events.ts:1006— provider-events.canonicalProviderEventsFromOpenCodePart 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.
CodexSessionState.constructor (cyclomatic 26) packages/paperclip-runner/src/drivers/codex/codex-session-state.ts:153— CodexSessionState.constructor has cyclomatic complexity 26 (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.
CodexHarnessSession.goal (cyclomatic 26) packages/paperclip-runner/src/drivers/codex/codex-harness-session.ts:569— CodexHarnessSession.goal 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.
durable-prp-control-plane.unsettledSemanticInput (cyclomatic 26) REDACTED:572— durable-prp-control-plane.unsettledSemanticInput has cyclomatic complexity 26 (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.
DevtoolsInspector.DevtoolsInspector (cyclomatic 26) packages/paperclip-runner/devtools/issue-thread/src/DevtoolsInspector.tsx:346— DevtoolsInspector.DevtoolsInspector has cyclomatic complexity 26 (threshold 15). Of this number, 22 points are the body's own statements and 4 belong to 4 function literals 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.
protocol-contract.assertAcpxQuestionFixture (cyclomatic 26) REDACTED:361— protocol-contract.assertAcpxQuestionFixture 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.
installation-integrity.verifyQualifiedRuntimeExecutable (cyclomatic 26) packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts:1023— installation-integrity.verifyQualifiedRuntimeExecutable 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.
acpx-runtime-sidecar.waitForTool (cyclomatic 26) packages/paperclip-runner/src/cli/acpx-runtime-sidecar.ts:711— acpx-runtime-sidecar.waitForTool has cyclomatic complexity 26 (threshold 15). Of this number, 20 points are the body's own statements and 6 belong to 4 function literals 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.
eval-session.parseEvalSessionCliArgs (cyclomatic 26) packages/paperclip-runner/src/cli/eval-session.ts:60— eval-session.parseEvalSessionCliArgs 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.
pi-runtime-extension.checkPiNativeTool (cyclomatic 26) packages/paperclip-runner/src/drivers/acpx/pi-runtime-extension.ts:170— pi-runtime-extension.checkPiNativeTool 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.
acpx-qualification.resolveAcpxQualification (cyclomatic 26) server/src/services/native-runtime/acpx-qualification.ts:8— acpx-qualification.resolveAcpxQualification has cyclomatic complexity 26 (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.
remote-deliverable-file.readVerifiedRemoteWorkspaceFile (cyclomatic 26) server/src/services/native-runtime/remote-deliverable-file.ts:75— remote-deliverable-file.readVerifiedRemoteWorkspaceFile has cyclomatic complexity 26 (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.
authorization.createAuthorizationService.decideReadsForActors (cyclomatic 26) server/src/services/authorization.ts:768— authorization.createAuthorizationService.decideReadsForActors has cyclomatic complexity 26 (threshold 15). Of this number, 17 points are the body's own statements and 9 belong to 3 function literals inside it that branch. 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.
secrets.secretService.resolveAdapterConfigForRuntime (cyclomatic 26) server/src/services/secrets.ts:5606— secrets.secretService.resolveAdapterConfigForRuntime 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.
external-bot-authority.authorizeExternalBotBinding (cyclomatic 26) server/src/services/external-bot-authority.ts:15— external-bot-authority.authorizeExternalBotBinding has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
budgets.budgetServiceInTransaction.reconcileScope (cyclomatic 26) server/src/services/budgets.ts:574— budgets.budgetServiceInTransaction.reconcileScope 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.
PhotonChatAdapter.sendPart (cyclomatic 26) server/src/services/photon/adapter.ts:465— PhotonChatAdapter.sendPart has cyclomatic complexity 26 (threshold 15). Of this number, 22 points are the body's own statements and 4 belong to 3 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.
chat-telegram-media-intake.gif (cyclomatic 26) server/src/services/chat-telegram-media-intake.ts:621— chat-telegram-media-intake.gif has cyclomatic complexity 26 (threshold 15). Of this number, 22 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.
voice-inbound-service.voiceInboundService.decide (cyclomatic 26) server/src/services/voice/voice-inbound-service.ts:215— voice-inbound-service.voiceInboundService.decide has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 5 of the 26 points are its own statements and the rest belongs to one function literal inside it that branches (line 217). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
distribution-plugin-catalog.distributionPluginActivationGuard (cyclomatic 26) server/src/services/distribution-plugin-catalog.ts:52— distribution-plugin-catalog.distributionPluginActivationGuard has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 58, 65). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tool-gateway.createToolGatewayService.executeApprovedAgentInvocation (cyclomatic 26) server/src/services/tool-gateway.ts:8043— tool-gateway.createToolGatewayService.executeApprovedAgentInvocation 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.
resources.githubRepositoryInventoryItemFromPayload (cyclomatic 26) server/src/services/chat-channels/github/resources.ts:9— resources.githubRepositoryInventoryItemFromPayload 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.
plugin-workspaces.callWorkspaceProvider (cyclomatic 26) server/src/services/plugin-workspaces.ts:73— plugin-workspaces.callWorkspaceProvider 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.
git-connection-failure.classifyTransportLine (cyclomatic 26) server/src/services/git-connection-failure.ts:59— git-connection-failure.classifyTransportLine 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.
git-workspace-restoration.assertReproducibleBaseGitStorage (cyclomatic 26) server/src/services/git-workspace-restoration.ts:170— git-workspace-restoration.assertReproducibleBaseGitStorage has cyclomatic complexity 26 (threshold 15). Of this number, 16 points are the body's own statements and 10 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.
projects.projectService.update (cyclomatic 26) server/src/services/projects.ts:967— projects.projectService.update has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 970, 1014, 1044). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-github-wizard.githubChatWizardService.cloudCallback (cyclomatic 26) server/src/services/chat-github-wizard.ts:1331— chat-github-wizard.githubChatWizardService.cloudCallback 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.
native-workspace-platform-proof.verifyWorkspaceWorkerStopReceipt (cyclomatic 26) server/src/services/native-runtime/native-workspace-platform-proof.ts:25— native-workspace-platform-proof.verifyWorkspaceWorkerStopReceipt has cyclomatic complexity 26 (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-pricing.priceCodexReceipt (cyclomatic 26) server/src/services/codex-pricing.ts:18— codex-pricing.priceCodexReceipt has cyclomatic complexity 26 (threshold 15). Of this number, 24 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
publication-replacement.createChatPublicationReplacement.inboundWakePublicationToReplace (cyclomatic 26) server/src/services/chat-channels/publication-replacement.ts:448— publication-replacement.createChatPublicationReplacement.inboundWakePublicationToReplace 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.
messages.telegramLifecycleEventFromPayload (cyclomatic 26) server/src/services/chat-channels/telegram/messages.ts:53— messages.telegramLifecycleEventFromPayload has cyclomatic complexity 26 (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.
wakeup-notices.createInboundWakeNotices.enqueueInboundWakeupPublications (cyclomatic 26) server/src/services/chat-channels/inbound/wakeup-notices.ts:133— wakeup-notices.createInboundWakeNotices.enqueueInboundWakeupPublications has cyclomatic complexity 26 (threshold 15). Of this number, 17 points are the body's own statements and 9 belong to one function literal inside it that branches. 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.
task-authority.createSlackTaskAuthorityRegistration.authorize (cyclomatic 26) server/src/services/chat-channels/slack/task-authority.ts:57— task-authority.createSlackTaskAuthorityRegistration.authorize has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 5 of the 26 points are its own statements and the rest belongs to one function literal inside it that branches (line 64). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
reader.createToolCatalogReader.listCatalog (cyclomatic 26) server/src/services/tool-access/catalog/reader.ts:19— reader.createToolCatalogReader.listCatalog has cyclomatic complexity 26 (threshold 15). Of this number, 21 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
health.buildRuntimeAlerts (cyclomatic 26) server/src/services/tool-access/runtime/health.ts:19— health.buildRuntimeAlerts 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.
tool-access.toolAccessService.ensureNoDuplicateNameError (cyclomatic 26) server/src/services/tool-access.ts:4786— tool-access.toolAccessService.ensureNoDuplicateNameError 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.
client-metadata.createClientMetadataResolver (cyclomatic 26) server/src/services/public-mcp/client-metadata.ts:49— client-metadata.createClientMetadataResolver has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to one function literal inside it that branches (line 51). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
task-watchdogs.classifyTaskWatchdogSubtree (cyclomatic 26) server/src/services/task-watchdogs.ts:371— task-watchdogs.classifyTaskWatchdogSubtree has cyclomatic complexity 26 (threshold 15). Of this number, 21 points are the body's own statements and 5 belong to 3 function literals 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.
issues.listIssueBlockerAttentionMap::classifyPath (cyclomatic 26) server/src/services/issues.ts:4170— issues.listIssueBlockerAttentionMap::classifyPath 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. This shape REPEATS in the file: one other method here (issues.listIssueBlockerAttentionMap) 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.
environment-runtime.createPluginEnvironmentDriver.acquireRunLease (cyclomatic 26) server/src/services/environment-runtime.ts:3657— environment-runtime.createPluginEnvironmentDriver.acquireRunLease 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.
provider-pack-layers.readProviderPackLayers (cyclomatic 26) server/src/services/native-runtime/provider-pack-layers.ts:37— provider-pack-layers.readProviderPackLayers has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
runner-api-client.runnerApiUrl (cyclomatic 26) server/src/services/native-runtime/runner-api-client.ts:74— runner-api-client.runnerApiUrl has cyclomatic complexity 26 (threshold 15). Of this number, 20 points are the body's own statements and 6 belong to 2 function literals 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.
agent-directory-working-copies.agentDirectoryWorkingCopyService.collectStopped (cyclomatic 26) server/src/services/agent-directory-working-copies.ts:358— agent-directory-working-copies.agentDirectoryWorkingCopyService.collectStopped 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.
company-skills.readUrlSkillImports (cyclomatic 26) server/src/services/company-skills.ts:1631— company-skills.readUrlSkillImports has cyclomatic complexity 26 (threshold 15). Of this number, 21 points are the body's own statements and 5 belong to 4 function literals 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. This is NOT this file's highest cyclomatic complexity: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
company-skills.companySkillService.resolveRuntimeSkillSource (cyclomatic 26) server/src/services/company-skills.ts:6064— company-skills.companySkillService.resolveRuntimeSkillSource 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. This is NOT this file's highest cyclomatic complexity: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
built-in-agents.validateBuiltInAgentDefinitions (cyclomatic 26) server/src/services/built-in-agents.ts:562— built-in-agents.validateBuiltInAgentDefinitions has cyclomatic complexity 26 (threshold 15). Of this number, 23 points are the body's own statements and 3 belong to one function literal 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.
native-session-executor.rebaseRetainedNativeCleanupProviderHome (cyclomatic 26) server/src/services/native-runtime/native-session-executor.ts:2660— native-session-executor.rebaseRetainedNativeCleanupProviderHome has cyclomatic complexity 26 (threshold 15). Of this number, 24 points are the body's own statements and 2 belong to one function literal inside it that branches. 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: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.createRunnerdBackendWithinSessionClaim.checkpointRemoteRunner (cyclomatic 26) server/src/services/native-runtime/native-session-executor.ts:12948— native-session-executor.createRunnerdBackendWithinSessionClaim.checkpointRemoteRunner has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 12 of the 26 points are its own statements and the rest belongs to one function literal inside it that branches (line 13000). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
policy.decideReleaseRecovery (cyclomatic 26) server/src/modules/wake-queue/domain/policy.ts:379— policy.decideReleaseRecovery 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.
queue.createHeartbeatQueue.resumeQueuedRuns (cyclomatic 26) server/src/services/heartbeat/queue.ts:1793— queue.createHeartbeatQueue.resumeQueuedRuns has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal 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.
run-lifecycle.createHeartbeatLifecycle.handleSuccessfulRunHandoff (cyclomatic 26) server/src/services/heartbeat/run-lifecycle.ts:1631— run-lifecycle.createHeartbeatLifecycle.handleSuccessfulRunHandoff 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.
native-chat-workspace.nativeChatWorkspaceCwd (cyclomatic 26) server/src/services/native-runtime/native-chat-workspace.ts:127— native-chat-workspace.nativeChatWorkspaceCwd has cyclomatic complexity 26 (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.buildRoutineHealthItems (cyclomatic 26) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4896— app.buildRoutineHealthItems has cyclomatic complexity 26 (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.
github-skill-repository.parseGitHubSkillRepositoryUrl (cyclomatic 26) packages/shared/src/github-skill-repository.ts:2— github-skill-repository.parseGitHubSkillRepositoryUrl has cyclomatic complexity 26 (threshold 15). Of this number, 23 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
plugin.pluginUiSlotDeclarationSchema (cyclomatic 26) packages/shared/src/validators/plugin.ts:395— plugin.pluginUiSlotDeclarationSchema has cyclomatic complexity 26 (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.
feature-map.featureIndex (cyclomatic 26) scripts/feature-map.mjs:6— feature-map.featureIndex has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal 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.
prepare-runner-release-image.main (cyclomatic 26) scripts/prepare-runner-release-image.mjs:70— prepare-runner-release-image.main has cyclomatic complexity 26 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
company-search-extract.companySearchExtractService.extract (cyclomatic 26) server/src/services/company-search-extract.ts:154— company-search-extract.companySearchExtractService.extract 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.
feedback.buildAgentContext (cyclomatic 26) server/src/services/feedback.ts:1086— feedback.buildAgentContext has cyclomatic complexity 26 (threshold 15). Of this number, 22 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
decisions.decisionService.createInStore (cyclomatic 26) server/src/services/decisions.ts:191— decisions.decisionService.createInStore has cyclomatic complexity 26 (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.
decisions.decisionService.decide (cyclomatic 26) server/src/services/decisions.ts:638— decisions.decisionService.decide 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.
agents.agentRoutes (cyclomatic 26) server/src/routes/agents.ts:500— agents.agentRoutes 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. This shape REPEATS in the file: 6 other methods here (agents.agentRoutes::assertSelectableAdapterType, agents.agentRoutes::applyHiringAgentAuthInheritance, agents.agentRoutes::validateManagedAgentBinding, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 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.
transcript-adapter.deriveRunStatusLabel (cyclomatic 26) ui/src/components/task-chat/transcript-adapter.ts:2104— transcript-adapter.deriveRunStatusLabel 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.
IssueChatThread.IssueChatFeedbackButtons (cyclomatic 26) ui/src/components/IssueChatThread.tsx:2746— IssueChatThread.IssueChatFeedbackButtons has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 10 of the 26 points are its own statements and the rest belongs to 7 function items inside it that branch (handleVote, handleSubmitReason, a function literal at line 2771, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
IssuePropertiesArtifactsTab.MarkdownWorkProductRow (cyclomatic 26) ui/src/components/issue-properties/IssuePropertiesArtifactsTab.tsx:116— IssuePropertiesArtifactsTab.MarkdownWorkProductRow has cyclomatic complexity 26 (threshold 15). Of this number, 16 points are the body's own statements and 10 belong to 5 function items inside it that branch. 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.
task-side-panel-state.parsePayload (cyclomatic 26) ui/src/lib/task-side-panel-state.ts:90— task-side-panel-state.parsePayload 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.
ActivityRow.ActivityRow (cyclomatic 26) ui/src/components/ActivityRow.tsx:36— ActivityRow.ActivityRow 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.
index.StatusCards (cyclomatic 26) ui/src/pages/StatusCards/index.tsx:21— index.StatusCards has cyclomatic complexity 26 (threshold 15). Of this number, 17 points are the body's own statements and 9 belong to 8 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.
AgentBubbleActionRow.IssueChatFeedbackButtons (cyclomatic 26) ui/src/components/AgentBubbleActionRow.tsx:175— AgentBubbleActionRow.IssueChatFeedbackButtons has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 10 of the 26 points are its own statements and the rest belongs to 7 function items inside it that branch (handleVote, handleSubmitReason, a function literal at line 196, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentMultiSelect.AgentMultiSelect (cyclomatic 26) ui/src/components/AgentMultiSelect.tsx:115— AgentMultiSelect.AgentMultiSelect has cyclomatic complexity 26 (threshold 15). Of this number, 16 points are the body's own statements and 10 belong to 7 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.
InboxAgentPolicyControl.InboxAgentPolicyControl (cyclomatic 26) ui/src/components/InboxAgentPolicyControl.tsx:47— InboxAgentPolicyControl.InboxAgentPolicyControl has cyclomatic complexity 26 (threshold 15). Of this number, 19 points are the body's own statements and 7 belong to 6 function literals 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.
AiConnectionAuth.AuthAttempt (cyclomatic 26) ui/src/components/ai-connections/AiConnectionAuth.tsx:43— AiConnectionAuth.AuthAttempt has cyclomatic complexity 26 (threshold 15). Of this number, 24 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.
useNativeRunTranscripts.useNativeRunTranscripts (cyclomatic 26) ui/src/components/transcript/useNativeRunTranscripts.ts:27— useNativeRunTranscripts.useNativeRunTranscripts has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 10 function literals inside it that branch (lines 74, 49, 115, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TeamCatalog.StepPreview (cyclomatic 26) ui/src/pages/TeamCatalog.tsx:1767— TeamCatalog.StepPreview has cyclomatic complexity 26 (threshold 15). Of this number, 19 points are the body's own statements and 7 belong to 2 function literals inside it that branch. 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.
wizard-preview-main.respond (cyclomatic 26) ui/src/wizard-preview-main.tsx:50— wizard-preview-main.respond 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.
AwsAgentCoreHarnessProvider::poll (cyclomatic 26) packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:1711— AwsAgentCoreHarnessProvider::poll 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.
(anonymous) (cyclomatic 26) ui/public/sw.js:101— (anonymous) has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 11 of the 26 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 137, 154, 146, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
access.registerAccessCommands (cyclomatic 25) cli/src/commands/client/access.ts:26— access.registerAccessCommands has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to 18 function literals inside it that branch (lines 175, 109, 223, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
worktree.runWorktreeInit (cyclomatic 25) cli/src/commands/worktree.ts:2409— worktree.runWorktreeInit has cyclomatic complexity 25 (threshold 15). Of this number, 22 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
usage-checkpoint.createUsageCheckpointLog (cyclomatic 25) packages/adapter-utils/src/usage-checkpoint.ts:68— usage-checkpoint.createUsageCheckpointLog has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 4 of the 25 points are its own statements and the rest belongs to 3 function items inside it that branch (publish, log, retain). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
format-event.printAssistantMessage (cyclomatic 25) packages/adapters/cursor-local/src/cli/format-event.ts:51— format-event.printAssistantMessage 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.
acp.testGeminiAcpEnvironment (cyclomatic 25) packages/adapters/gemini-local/src/server/acp.ts:389— acp.testGeminiAcpEnvironment 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.
tools.createToolDefinitions (cyclomatic 25) packages/mcp-server/src/tools.ts:270— tools.createToolDefinitions has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 10 function literals inside it that branch (lines 327, 357, 650, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
replay-contract.bindingIssues (cyclomatic 25) packages/paperclip-runner/src/protocol/replay-contract.ts:256— replay-contract.bindingIssues has cyclomatic complexity 25 (threshold 15). Of this number, 15 points are the body's own statements and 10 belong to 2 function literals 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.
copilot-extension-adapter.summary (cyclomatic 25) packages/paperclip-runner/src/drivers/acpx/copilot-extension-adapter.ts:47— copilot-extension-adapter.summary 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.
policy.decideCapabilitySemanticAuthorization (cyclomatic 25) packages/paperclip-runner/src/semantic-tools/policy.ts:53— policy.decideCapabilitySemanticAuthorization has cyclomatic complexity 25 (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.
DurablePrpControlPlane.#commandResult (cyclomatic 25) REDACTED:2926— DurablePrpControlPlane.#commandResult 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.
runnerd-codex-transport.liveAcpxRuntimeRequests (cyclomatic 25) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:985— runnerd-codex-transport.liveAcpxRuntimeRequests has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 10 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 994). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-distribution-integrity.parseNativeAcpxDistributionEntries (cyclomatic 25) packages/paperclip-runner/src/drivers/acpx/native-distribution-integrity.ts:44— native-distribution-integrity.parseNativeAcpxDistributionEntries has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 8 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 50). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
install-copilot-assets.installCopilotAssets (cyclomatic 25) packages/paperclip-runner/scripts/install-copilot-assets.mjs:16— install-copilot-assets.installCopilotAssets 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.
acpx-sidecar-input.directAcpxSidecarErrorCode (cyclomatic 25) packages/paperclip-runner/src/cli/acpx-sidecar-input.ts:59— acpx-sidecar-input.directAcpxSidecarErrorCode 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.
tailnet-gateway.createCapabilityTailnetGateway (cyclomatic 25) packages/paperclip-runner/src/live/tailnet-gateway.ts:185— tailnet-gateway.createCapabilityTailnetGateway has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 310, a function literal at line 227, capabilityValid, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
task-workspace-access.taskWorkspaceProjectRequirements (cyclomatic 25) server/src/services/task-workspace-access.ts:20— task-workspace-access.taskWorkspaceProjectRequirements has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 12 of the 25 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 28, 44, 38, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
delivery-work-coordinator.createDeliveryWorkCoordinator.register.start (cyclomatic 25) server/src/services/delivery-work-coordinator.ts:52— delivery-work-coordinator.createDeliveryWorkCoordinator.register.start has cyclomatic complexity 25 (threshold 15). Of this number, 16 points are the body's own statements and 9 belong to 5 function literals inside it that branch. 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.
sandbox-stop-and-retain.readStopOnlyCleanup (cyclomatic 25) server/src/services/sandbox-stop-and-retain.ts:56— sandbox-stop-and-retain.readStopOnlyCleanup has cyclomatic complexity 25 (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.
policy.transition (cyclomatic 25) server/src/modules/agent-lifecycle/domain/policy.ts:17— policy.transition 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.
chat-question-forms.createChatQuestionFormDraft (cyclomatic 25) server/src/services/chat-question-forms.ts:265— chat-question-forms.createChatQuestionFormDraft 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.
chat-github-client.githubBotRequestOnce (cyclomatic 25) server/src/services/chat-github-client.ts:45— chat-github-client.githubBotRequestOnce 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.
cognee-connection.callCogneeCloud (cyclomatic 25) server/src/services/cognee-connection.ts:50— cognee-connection.callCogneeCloud has cyclomatic complexity 25 (threshold 15). Of this number, 22 points are the body's own statements and 3 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.
slack-delivery.slackDelivery (cyclomatic 25) server/src/services/connectors/slack-delivery.ts:18— slack-delivery.slackDelivery has cyclomatic complexity 25 (threshold 15). Of this number, 24 points are the body's own statements and 1 belongs to one function literal 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.
tool-gateway.createToolGatewayService.namedGatewayContextProtocol (cyclomatic 25) server/src/services/tool-gateway.ts:5603— tool-gateway.createToolGatewayService.namedGatewayContextProtocol has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to one function literal 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.
callback-verification.createSlackCallbackVerification.verifySlackRequestUrl (cyclomatic 25) server/src/services/chat-channels/slack/callback-verification.ts:250— callback-verification.createSlackCallbackVerification.verifySlackRequestUrl has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 258). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
execution-workspace-policy.parseIssueExecutionWorkspaceSettings (cyclomatic 25) server/src/services/execution-workspace-policy.ts:211— execution-workspace-policy.parseIssueExecutionWorkspaceSettings has cyclomatic complexity 25 (threshold 15). Of this number, 15 points are the body's own statements and 10 belong to 3 function literals inside it that branch. 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.
ai-provider-routing.managedProviderRouting (cyclomatic 25) server/src/services/ai-provider-routing.ts:9— ai-provider-routing.managedProviderRouting 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.
workspaces.resolveRunReferencedProjects (cyclomatic 25) server/src/services/heartbeat/workspaces.ts:1668— workspaces.resolveRunReferencedProjects 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.
budget-reservations.reserveRunBudget (cyclomatic 25) server/src/services/budget-reservations.ts:73— budget-reservations.reserveRunBudget has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 74, 111). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
fast-responses.fastResponseSourceCurrent (cyclomatic 25) server/src/services/fast-responses.ts:210— fast-responses.fastResponseSourceCurrent has cyclomatic complexity 25 (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.
connection-intents.connectionIntentService.resolveService (cyclomatic 25) server/src/services/connection-intents.ts:366— connection-intents.connectionIntentService.resolveService has cyclomatic complexity 25 (threshold 15). Of this number, 24 points are the body's own statements and 1 belongs to one function literal 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.
postgres.createPostgresRunDispatchAdapter.loadStalenessFacts (cyclomatic 25) server/src/modules/run-dispatch/adapters/postgres.ts:527— postgres.createPostgresRunDispatchAdapter.loadStalenessFacts has cyclomatic complexity 25 (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.
preparation.createChatPublicationPreparation.ensureDurablePublicationTransport (cyclomatic 25) server/src/services/chat-channels/publications/preparation.ts:37— preparation.createChatPublicationPreparation.ensureDurablePublicationTransport has cyclomatic complexity 25 (threshold 15). Of this number, 14 points are the body's own statements and 11 belong to 2 function literals 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.
muse-oauth-diagnostics.recordMuseCodeRejection (cyclomatic 25) server/src/services/public-mcp/muse-oauth-diagnostics.ts:67— muse-oauth-diagnostics.recordMuseCodeRejection has cyclomatic complexity 25 (threshold 15). Of this number, 16 points are the body's own statements and 9 belong to one function literal inside it that branches. 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.
copilot-connection-probe.probeCopilotConnection (cyclomatic 25) server/src/services/copilot-connection-probe.ts:15— copilot-connection-probe.probeCopilotConnection 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.
copilot-connection-probe.probeCopilotExecutionTarget (cyclomatic 25) server/src/services/copilot-connection-probe.ts:80— copilot-connection-probe.probeCopilotExecutionTarget 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.
agent-commentary.submitAgentCommentary (cyclomatic 25) server/src/services/agent-commentary.ts:22— agent-commentary.submitAgentCommentary has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 6 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 36). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
company-skills.companySkillService.updateStatus (cyclomatic 25) server/src/services/company-skills.ts:4285— company-skills.companySkillService.updateStatus 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. This is NOT this file's highest cyclomatic complexity: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
company-skills.companySkillService.browseProjectWorkspace (cyclomatic 25) server/src/services/company-skills.ts:5096— company-skills.companySkillService.browseProjectWorkspace has cyclomatic complexity 25 (threshold 15). Of this number, 19 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
current-wake-comments.readCurrentWakeComments (cyclomatic 25) server/src/services/native-runtime/current-wake-comments.ts:607— current-wake-comments.readCurrentWakeComments has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 5 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 625). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
PaperclipRunnerToolAuthority.#withInstructionMutationReceipt (cyclomatic 25) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:2260— PaperclipRunnerToolAuthority.#withInstructionMutationReceipt has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 4 of the 25 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 2283, a function literal at line 2278, a function literal at line 2330, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
native-session-executor.assertCleanupActivationCommitted (cyclomatic 25) server/src/services/native-runtime/native-session-executor.ts:4040— native-session-executor.assertCleanupActivationCommitted has cyclomatic complexity 25 (threshold 15). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
case-context.getCaseExecutionContext (cyclomatic 25) server/src/services/case-context.ts:30— case-context.getCaseExecutionContext has cyclomatic complexity 25 (threshold 15). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
provider-trace-store.assessProviderTraceEntries (cyclomatic 25) server/src/services/provider-trace-store.ts:171— provider-trace-store.assessProviderTraceEntries 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.
use-cases.createAdmitWakeBehindIssueExecution (cyclomatic 25) server/src/modules/wake-queue/application/use-cases.ts:790— use-cases.createAdmitWakeBehindIssueExecution has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to one function literal inside it that branches (line 795). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
recovery.createHeartbeatRecovery.recoverNativeRunsAfterRestart (cyclomatic 25) server/src/services/heartbeat/recovery.ts:910— recovery.createHeartbeatRecovery.recoverNativeRunsAfterRestart 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.
ai-provider-routing.aiProviderRoutingSchema (cyclomatic 25) packages/shared/src/ai-provider-routing.ts:29— ai-provider-routing.aiProviderRoutingSchema has cyclomatic complexity 25 (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.
workspace-commands.scoreWorkspaceRuntimeServiceMatch (cyclomatic 25) packages/shared/src/workspace-commands.ts:182— workspace-commands.scoreWorkspaceRuntimeServiceMatch has cyclomatic complexity 25 (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.
serve-config.parseServeStatus (cyclomatic 25) packages/tailscale-https-broker/src/serve-config.ts:58— serve-config.parseServeStatus 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.
paperclip-commit-metrics.parseArgs (cyclomatic 25) scripts/paperclip-commit-metrics.ts:183— paperclip-commit-metrics.parseArgs 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.
run-vitest-stable.parseCliOptions (cyclomatic 25) scripts/run-vitest-stable.mjs:250— run-vitest-stable.parseCliOptions 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.
ai-connections.aiConnectionRoutes (cyclomatic 25) server/src/routes/ai-connections.ts:141— ai-connections.aiConnectionRoutes has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 13 function items inside it that branch (a function literal at line 294, a function literal at line 252, a function literal at line 339, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
status-cards.statusCardService.update (cyclomatic 25) server/src/services/status-cards.ts:268— status-cards.statusCardService.update 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.
agent-harness-verification.agentHarnessVerificationService.verify (cyclomatic 25) server/src/services/agent-harness-verification.ts:41— agent-harness-verification.agentHarnessVerificationService.verify 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.
skill-package-inspection.inspectSkillPackage (cyclomatic 25) server/src/services/skill-package-inspection.ts:44— skill-package-inspection.inspectSkillPackage has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to 2 function literals 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.
decision-training.decisionTrainingRoutes (cyclomatic 25) server/src/routes/decision-training.ts:53— decision-training.decisionTrainingRoutes has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 8 function items inside it that branch (a function literal at line 199, a function literal at line 233, a function literal at line 175, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
decisions.decisionRoutes (cyclomatic 25) server/src/routes/decisions.ts:52— decisions.decisionRoutes has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 58, 164, 174, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
plugin-local-folders.inspectPluginLocalFolder (cyclomatic 25) server/src/services/plugin-local-folders.ts:134— plugin-local-folders.inspectPluginLocalFolder 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.
native-harness-backup-expiration.nativeHarnessBackupExpirationService.tick (cyclomatic 25) server/src/services/native-runtime/native-harness-backup-expiration.ts:480— native-harness-backup-expiration.nativeHarnessBackupExpirationService.tick has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 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.
environment-custom-image-terminal-ws.setupEnvironmentCustomImageTerminalWebSocketServer (cyclomatic 25) server/src/realtime/environment-custom-image-terminal-ws.ts:484— environment-custom-image-terminal-ws.setupEnvironmentCustomImageTerminalWebSocketServer has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 521, 634, 722, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SidebarAccountMenu.SidebarAccountMenu (cyclomatic 25) ui/src/components/SidebarAccountMenu.tsx:120— SidebarAccountMenu.SidebarAccountMenu has cyclomatic complexity 25 (threshold 15). Of this number, 24 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
WorkspaceFileLink.WorkspaceFileLink (cyclomatic 25) ui/src/components/WorkspaceFileLink.tsx:24— WorkspaceFileLink.WorkspaceFileLink has cyclomatic complexity 25 (threshold 15). Of this number, 17 points are the body's own statements and 8 belong to one function item inside it that branches. 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.
attention.attentionDetailLine (cyclomatic 25) ui/src/lib/attention.ts:201— attention.attentionDetailLine 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.
AiConnectionCredentialStep.SubscriptionConnectionStep (cyclomatic 25) ui/src/components/ai-connections/AiConnectionCredentialStep.tsx:41— AiConnectionCredentialStep.SubscriptionConnectionStep has cyclomatic complexity 25 (threshold 15). Of this number, 21 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
QuestionForm.answerError (cyclomatic 25) ui/src/components/task-chat/QuestionForm.tsx:69— QuestionForm.answerError 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.
WorkspaceRuntimeControls.CommandActionButtons (cyclomatic 25) ui/src/components/WorkspaceRuntimeControls.tsx:348— WorkspaceRuntimeControls.CommandActionButtons has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 6 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 372). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
TaskBrowserFooter.TaskBrowserFooter (cyclomatic 25) ui/src/components/task-side-panel/TaskBrowserFooter.tsx:38— TaskBrowserFooter.TaskBrowserFooter has cyclomatic complexity 25 (threshold 15). Of this number, 22 points are the body's own statements and 3 belong to 3 function literals inside it that branch. 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.
activity-format.formatIssueActivityAction (cyclomatic 25) ui/src/lib/activity-format.ts:509— activity-format.formatIssueActivityAction 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.
RunTranscriptView.TranscriptToolCard (cyclomatic 25) ui/src/components/transcript/RunTranscriptView.tsx:1028— RunTranscriptView.TranscriptToolCard 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.
RoutineVariablesEditor.RoutineVariablesEditor (cyclomatic 25) ui/src/components/RoutineVariablesEditor.tsx:53— RoutineVariablesEditor.RoutineVariablesEditor has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 94, 190, 72, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
setup-state.slackSetupState (cyclomatic 25) ui/src/pages/apps/chat/slack/setup-state.ts:16— setup-state.slackSetupState 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.
ConnectClientDialog.ConnectClientDialog (cyclomatic 25) ui/src/pages/apps/gateways/ConnectClientDialog.tsx:63— ConnectClientDialog.ConnectClientDialog has cyclomatic complexity 25 (threshold 15). Of this number, 14 points are the body's own statements and 11 belong to 10 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.
ImportSkillsFromProjectDialog.SelectStep (cyclomatic 25) ui/src/pages/skills/ImportSkillsFromProjectDialog.tsx:923— ImportSkillsFromProjectDialog.SelectStep has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 11 of the 25 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1070, 1054). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SkillFolderTree.SkillFolderRail (cyclomatic 25) ui/src/components/folders/SkillFolderTree.tsx:125— SkillFolderTree.SkillFolderRail has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 10 of the 25 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 233, a function literal at line 164, a function literal at line 168, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SkillStudio.RunTemplateAdvancedPanel (cyclomatic 25) ui/src/pages/SkillStudio.tsx:2630— SkillStudio.RunTemplateAdvancedPanel has cyclomatic complexity 25 (threshold 15). Of this number, 18 points are the body's own statements and 7 belong to 6 function literals 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.
Secrets.AgentAccessSection (cyclomatic 25) ui/src/pages/Secrets.tsx:4379— Secrets.AgentAccessSection has cyclomatic complexity 25 (threshold 15). Of this number, 15 points are the body's own statements and 10 belong to 5 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.
TaskChatCompactInteractionCard.TaskChatCompactInteractionCard (cyclomatic 25) ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx:1879— TaskChatCompactInteractionCard.TaskChatCompactInteractionCard 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.
TaskChatQueuedMessages.TaskChatQueuedMessages::runRowAction (cyclomatic 25) ui/src/components/task-chat/TaskChatQueuedMessages.tsx:306— TaskChatQueuedMessages.TaskChatQueuedMessages::runRowAction 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.
useWorkspaceFileAvailability.useWorkspaceFileAvailability (cyclomatic 25) ui/src/hooks/useWorkspaceFileAvailability.ts:51— useWorkspaceFileAvailability.useWorkspaceFileAvailability has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 88, 155, 190, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
UserSecretDefinitionsTab.UserSecretDefinitionsTab (cyclomatic 25) ui/src/pages/secrets/UserSecretDefinitionsTab.tsx:66— UserSecretDefinitionsTab.UserSecretDefinitionsTab has cyclomatic complexity 25 (threshold 15). Of this number, 13 points are the body's own statements and 12 belong to 8 function literals inside it that branch. 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.
managed-install-check.managedInstallChecks (cyclomatic 24) cli/src/checks/managed-install-check.ts:47— managed-install-check.managedInstallChecks 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.
http2-bridge-server.wrapDuplexChannelAsNodeDuplex (cyclomatic 24) packages/adapter-utils/src/http2-bridge-server.ts:357— http2-bridge-server.wrapDuplexChannelAsNodeDuplex has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 11 of the 24 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 459, endReadableIfDrained, clearBackpressureStallTimer, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
parse.createClaudeStreamParser (cyclomatic 24) packages/adapters/claude-local/src/server/parse.ts:74— parse.createClaudeStreamParser has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to one function literal inside it that branches (line 83). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
parse.createCodexJsonlParser (cyclomatic 24) packages/adapters/codex-local/src/server/parse.ts:34— parse.createCodexJsonlParser has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 48, 61). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
format-event.printKimiStreamEvent (cyclomatic 24) packages/adapters/kimi-local/src/cli/format-event.ts:23— format-event.printKimiStreamEvent 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-boundaries.validateCodexWorkingDirectory (cyclomatic 24) packages/paperclip-runner/src/drivers/codex/codex-boundaries.ts:50— codex-boundaries.validateCodexWorkingDirectory 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.
evidence-redaction.capabilityEvidenceDetail (cyclomatic 24) packages/paperclip-runner/src/live/evidence-redaction.ts:382— evidence-redaction.capabilityEvidenceDetail has cyclomatic complexity 24 (threshold 15). Of this number, 22 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.
environment.createAcpxSidecarHostEnvironment (cyclomatic 24) packages/paperclip-runner/src/drivers/acpx/environment.ts:45— environment.createAcpxSidecarHostEnvironment 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.
EvidencePanel.EvidencePanel (cyclomatic 24) packages/paperclip-runner/devtools/issue-thread/src/EvidencePanel.tsx:335— EvidencePanel.EvidencePanel has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 7 of the 24 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 479, 615, 367, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
operation-groups-doc.validateOperationGroupsInput (cyclomatic 24) packages/paperclip-runner/src/catalog/operation-groups-doc.ts:107— operation-groups-doc.validateOperationGroupsInput 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.
installation-integrity.isDeclaredHoistedProviderPlatform (cyclomatic 24) packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts:395— installation-integrity.isDeclaredHoistedProviderPlatform has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
runner-protocol-eval-campaign.buildProtocolEvalCatalog (cyclomatic 24) packages/paperclip-runner/scripts/runner-protocol-eval-campaign.mjs:126— runner-protocol-eval-campaign.buildProtocolEvalCatalog has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to one function literal 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.
copilot-permission-context.safeCopilotEditTarget (cyclomatic 24) packages/paperclip-runner/src/drivers/acpx/copilot-permission-context.ts:34— copilot-permission-context.safeCopilotEditTarget has cyclomatic complexity 24 (threshold 15). Of this number, 16 points are the body's own statements and 8 belong to 3 function literals inside it that branch. 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.
runner-tool-bridge.taggedValue (cyclomatic 24) packages/paperclip-runner/src/drivers/runner-tool-bridge.ts:761— runner-tool-bridge.taggedValue has cyclomatic complexity 24 (threshold 15). Of this number, 20 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
cursor-instructions.createCursorInstructionAdmission.createGuard (cyclomatic 24) packages/paperclip-runner/src/drivers/acpx/cursor-instructions.ts:29— cursor-instructions.createCursorInstructionAdmission.createGuard has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to one function literal inside it that branches (line 33). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
codex-runtime-adapter.goalSnapshotFromAcpMessage (cyclomatic 24) packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts:2157— codex-runtime-adapter.goalSnapshotFromAcpMessage has cyclomatic complexity 24 (threshold 15). Of this number, 18 points are the body's own statements and 6 belong to 2 function items inside it that branch. 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.
environments.environmentService.acquireLease (cyclomatic 24) REDACTED:1425— environments.environmentService.acquireLease has cyclomatic complexity 24 (threshold 15). Of this number, 15 points are the body's own statements and 9 belong to one function literal 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.
authorization.createAuthorizationService.decideTaskBridgeAccess (cyclomatic 24) server/src/services/authorization.ts:1468— authorization.createAuthorizationService.decideTaskBridgeAccess 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.
cloud-runtime-identity.verifyClaims (cyclomatic 24) server/src/services/cloud-runtime-identity.ts:260— cloud-runtime-identity.verifyClaims has cyclomatic complexity 24 (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.
agent-conversations.prepareConversationTurn (cyclomatic 24) server/src/services/agent-conversations.ts:119— agent-conversations.prepareConversationTurn has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 4 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 127). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
budgets.budgetServiceInTransaction.upsertPolicy (cyclomatic 24) server/src/services/budgets.ts:736— budgets.budgetServiceInTransaction.upsertPolicy 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.
paperclip-cloud-connector.unseal (cyclomatic 24) server/src/services/paperclip-cloud-connector.ts:691— paperclip-cloud-connector.unseal has cyclomatic complexity 24 (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.
chat-sdk-runtime.validatedAttachmentRecoveryDescriptor (cyclomatic 24) server/src/services/chat-sdk-runtime.ts:1673— chat-sdk-runtime.validatedAttachmentRecoveryDescriptor 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.
native-rest-client.nativeRestSender.send (cyclomatic 24) server/src/services/native-rest-client.ts:68— native-rest-client.nativeRestSender.send 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.
browser-use-client.browserUseClient.call (cyclomatic 24) server/src/services/browser-use-client.ts:116— browser-use-client.browserUseClient.call 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.
tool-access-policy.selectorMatches (cyclomatic 24) server/src/services/tool-access-policy.ts:413— tool-access-policy.selectorMatches has cyclomatic complexity 24 (threshold 15). Of this number, 15 points are the body's own statements and 9 belong to 2 function items inside it that branch. 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. This is NOT this file's highest cyclomatic complexity: tool-access-policy.toolAccessPolicyService.admittedRateLimitAdmissions (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 method is counted neither in this dimension's figures nor in its score.
tool-gateway.createToolGatewayService.runTestToolInvocation (cyclomatic 24) server/src/services/tool-gateway.ts:7404— tool-gateway.createToolGatewayService.runTestToolInvocation 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.
project-workspace-provider.resolveProjectWorkspaceProvider (cyclomatic 24) server/src/services/project-workspace-provider.ts:26— project-workspace-provider.resolveProjectWorkspaceProvider 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.
git-workspace-restoration.inspectRecipe (cyclomatic 24) server/src/services/git-workspace-restoration.ts:572— git-workspace-restoration.inspectRecipe 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. This is NOT this file's highest cyclomatic complexity: git-workspace-restoration.readGitCacheRestoration (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 method is counted neither in this dimension's figures nor in its score.
fast-responses.fastResponseService.resolve (cyclomatic 24) server/src/services/fast-responses.ts:423— fast-responses.fastResponseService.resolve 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.
publication-policy.createGitHubPublicationPolicy.settleGitHubAutomaticPublication (cyclomatic 24) server/src/services/chat-channels/github/publication-policy.ts:235— publication-policy.createGitHubPublicationPolicy.settleGitHubAutomaticPublication has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 belong to 2 function literals 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.
resolution.createChatPublicationResolution.resolvePublication (cyclomatic 24) server/src/services/chat-channels/publications/resolution.ts:141— resolution.createChatPublicationResolution.resolvePublication has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 2 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 156). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
delivery-ledger.normalizedLifecycleEffect (cyclomatic 24) server/src/services/chat-channels/inbound/delivery-ledger.ts:87— delivery-ledger.normalizedLifecycleEffect has cyclomatic complexity 24 (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.
media.validateHeifDimensions::visit (cyclomatic 24) server/src/services/photon/media.ts:21— media.validateHeifDimensions::visit 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.
client.createOAuthClientProtocol.exchangeOAuthToken (cyclomatic 24) server/src/services/tool-access/oauth/client.ts:299— client.createOAuthClientProtocol.exchangeOAuthToken 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.
health.createToolRuntimeHealth (cyclomatic 24) server/src/services/tool-access/runtime/health.ts:197— health.createToolRuntimeHealth has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 15 function items inside it that branch (runtimeHealth, a function literal at line 256, a function literal at line 267, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
tool-access.toolAccessService.reconnectGalleryApp (cyclomatic 24) server/src/services/tool-access.ts:3547— tool-access.toolAccessService.reconnectGalleryApp has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 9 of the 24 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 3623, 3577, 3576). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tool-access.toolAccessService.listGitHubRepositories (cyclomatic 24) server/src/services/tool-access.ts:4262— tool-access.toolAccessService.listGitHubRepositories has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 4266, 4316, 4363, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
issue-thread-interactions.issueThreadInteractionService.recordSecretProposalExecutionResult (cyclomatic 24) server/src/services/issue-thread-interactions.ts:3095— issue-thread-interactions.issueThreadInteractionService.recordSecretProposalExecutionResult has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to one function literal inside it that branches (line 3101). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
runtime-context.resolveNativeRuntimeMcpSnapshot (cyclomatic 24) server/src/services/native-runtime/runtime-context.ts:196— runtime-context.resolveNativeRuntimeMcpSnapshot has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 6 of the 24 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 233, 199, 198). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
case-handoffs.caseHandoffService.apply (cyclomatic 24) server/src/services/case-handoffs.ts:242— case-handoffs.caseHandoffService.apply 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.
case-handoffs.caseHandoffService.acceptTerminal (cyclomatic 24) server/src/services/case-handoffs.ts:285— case-handoffs.caseHandoffService.acceptTerminal 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.
runner-api-response.captureRunnerApiResponse (cyclomatic 24) server/src/services/native-runtime/runner-api-response.ts:13— runner-api-response.captureRunnerApiResponse has cyclomatic complexity 24 (threshold 15). Of this number, 22 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.
runner-bridge-tools.executeWorkspaceToolInLane (cyclomatic 24) server/src/services/native-runtime/runner-bridge-tools.ts:147— runner-bridge-tools.executeWorkspaceToolInLane has cyclomatic complexity 24 (threshold 15). Of this number, 13 points are the body's own statements and 11 belong to 6 function literals 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.
workspace-file-resources.enumerateWorkspaceFiles (cyclomatic 24) server/src/services/workspace-file-resources.ts:877— workspace-file-resources.enumerateWorkspaceFiles has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal 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.
company-skills.classifyInventoryKind (cyclomatic 24) server/src/services/company-skills.ts:710— company-skills.classifyInventoryKind has cyclomatic complexity 24 (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. This is NOT this file's highest cyclomatic complexity: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.claimWarmNativeInstructionCopy (cyclomatic 24) server/src/services/native-runtime/native-session-executor.ts:586— native-session-executor.claimWarmNativeInstructionCopy has cyclomatic complexity 24 (threshold 15). Of this number, 21 points are the body's own statements and 3 belong to 2 function items inside it that branch. 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: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.createRemoteNativeArtifactPreparation.prepare::prepareRunner (cyclomatic 24) server/src/services/native-runtime/native-session-executor.ts:13886— native-session-executor.createRemoteNativeArtifactPreparation.prepare::prepareRunner 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
service.recoveryService.decidePersistedLegacyContinuation (cyclomatic 24) REDACTED:3802— service.recoveryService.decidePersistedLegacyContinuation has cyclomatic complexity 24 (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.
use-cases.promoteDeferredWake (cyclomatic 24) server/src/modules/wake-queue/application/use-cases.ts:326— use-cases.promoteDeferredWake has cyclomatic complexity 24 (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-control.createHeartbeatRunControl.completedRunTerminationProof (cyclomatic 24) server/src/services/heartbeat/run-control.ts:1067— run-control.createHeartbeatRunControl.completedRunTerminationProof has cyclomatic complexity 24 (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.OnThisPagePane (cyclomatic 24) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:3474— app.OnThisPagePane has cyclomatic complexity 24 (threshold 15). Of this number, 14 points are the body's own statements and 10 belong to 4 function literals inside it that branch. 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.
file-sync.syncInFileMappings (cyclomatic 24) packages/plugins/sandbox-providers/daytona/src/file-sync.ts:726— file-sync.syncInFileMappings has cyclomatic complexity 24 (threshold 15). Of this number, 18 points are the body's own statements and 6 belong to 2 function literals 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.
cloud-source-verification.readSourceVerification (cyclomatic 24) scripts/cloud-source-verification.mjs:22— cloud-source-verification.readSourceVerification 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.
generate-company-assets.parseFrontmatter (cyclomatic 24) scripts/generate-company-assets.ts:22— generate-company-assets.parseFrontmatter 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.
company-portability.parseYamlBlock (cyclomatic 24) server/src/services/company-portability.ts:2774— company-portability.parseYamlBlock 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. This is NOT this file's highest cyclomatic complexity: company-portability.isSensitiveEnvKey (cyclomatic 26) 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 method is counted neither in this dimension's figures nor in its score.
agent-instance-secrets.agentInstanceSecretService.apply (cyclomatic 24) server/src/services/agent-instance-secrets.ts:16— agent-instance-secrets.agentInstanceSecretService.apply has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 9 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 22, 19). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
skill-source-git-snapshot.openGitSkillSnapshot (cyclomatic 24) server/src/services/skill-source-git-snapshot.ts:238— skill-source-git-snapshot.openGitSkillSnapshot 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.
skill-sources.skillSourceService.settings (cyclomatic 24) server/src/services/skill-sources.ts:320— skill-sources.skillSourceService.settings has cyclomatic complexity 24 (threshold 15). Of this number, 15 points are the body's own statements and 9 belong to one function literal 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.
restricted-workspace-retry.prepareRestrictedWorkspaceRetry (cyclomatic 24) server/src/services/restricted-workspace-retry.ts:8— restricted-workspace-retry.prepareRestrictedWorkspaceRetry has cyclomatic complexity 24 (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.
plugin-api-ws.proxyPluginApiWebSocket (cyclomatic 24) server/src/realtime/plugin-api-ws.ts:35— plugin-api-ws.proxyPluginApiWebSocket has cyclomatic complexity 24 (threshold 15). Of this number, 13 points are the body's own statements and 11 belong to 3 function items inside it that branch. 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.
schema-config-fields.ComboboxField (cyclomatic 24) ui/src/adapters/schema-config-fields.tsx:65— schema-config-fields.ComboboxField has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 9 of the 24 points are its own statements and the rest belongs to 6 function items inside it that branch (handleKeyDown, a function literal at line 85, a function literal at line 168, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SidebarAccountMenu.production.SidebarAccountMenu (cyclomatic 24) ui/src/components/SidebarAccountMenu.production.tsx:118— SidebarAccountMenu.production.SidebarAccountMenu has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
TaskChatStatusPill.TaskChatStatusPill (cyclomatic 24) ui/src/components/task-chat/TaskChatStatusPill.tsx:286— TaskChatStatusPill.TaskChatStatusPill has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal 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.
AllowedProjectsEditor.AllowedProjectsEditor (cyclomatic 24) ui/src/components/AllowedProjectsEditor.tsx:16— AllowedProjectsEditor.AllowedProjectsEditor has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 belong to 3 function items inside it that branch. 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.
Projects.Projects (cyclomatic 24) ui/src/pages/Projects.tsx:69— Projects.Projects has cyclomatic complexity 24 (threshold 15). Of this number, 14 points are the body's own statements and 10 belong to 3 function literals inside it that branch. 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.
ProjectWorkspaceSummaryCard.ProjectWorkspaceSummaryCard (cyclomatic 24) ui/src/components/ProjectWorkspaceSummaryCard.tsx:41— ProjectWorkspaceSummaryCard.ProjectWorkspaceSummaryCard has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal 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.
RoutineTriggers.WebhookSettings (cyclomatic 24) ui/src/components/routine-triggers/RoutineTriggers.tsx:506— RoutineTriggers.WebhookSettings has cyclomatic complexity 24 (threshold 15). Of this number, 21 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
SlackIdentityStep.SlackIdentityStep (cyclomatic 24) ui/src/pages/apps/chat/SlackIdentityStep.tsx:11— SlackIdentityStep.SlackIdentityStep has cyclomatic complexity 24 (threshold 15). Of this number, 14 points are the body's own statements and 10 belong to 4 function literals 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.
ExecutionParticipantPicker.ExecutionParticipantPicker (cyclomatic 24) ui/src/components/ExecutionParticipantPicker.tsx:29— ExecutionParticipantPicker.ExecutionParticipantPicker has cyclomatic complexity 24 (threshold 15). Of this number, 13 points are the body's own statements and 11 belong to 8 function items inside it that branch. 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.
JsonSchemaForm.SecretField (cyclomatic 24) REDACTED:583— JsonSchemaForm.SecretField has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to 2 function literals 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.
AiConnectionAccountControls.AiConnectionAccountControls (cyclomatic 24) ui/src/components/ai-connections/AiConnectionAccountControls.tsx:10— AiConnectionAccountControls.AiConnectionAccountControls has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
SpekoPhoneLine.SpekoPhoneLineForm (cyclomatic 24) ui/src/components/voice/SpekoPhoneLine.tsx:8— SpekoPhoneLine.SpekoPhoneLineForm has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
useMuseConnection.museConnectionState (cyclomatic 24) ui/src/hooks/useMuseConnection.ts:8— useMuseConnection.museConnectionState 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.
api.installFixtureApi.fixtureFetch (cyclomatic 24) ui/storybook/support/capability-gaps/api.ts:42— api.installFixtureApi.fixtureFetch has cyclomatic complexity 24 (threshold 15). Of this number, 21 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
CodexProviderConfig::validate (cyclomatic 24) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:427— CodexProviderConfig::validate 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.
DurableRunnerConfig::validate (cyclomatic 24) packages/paperclip-runner/runner/crates/runner-core/src/durable/mod.rs:202— DurableRunnerConfig::validate has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
workspace-seed-cache.readWorkspaceSeedGeneration (cyclomatic 23) packages/adapter-utils/src/workspace-seed-cache.ts:23— workspace-seed-cache.readWorkspaceSeedGeneration has cyclomatic complexity 23 (threshold 15). Of this number, 20 points are the body's own statements and 3 belong to one function literal 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.
ssh.integrateImportedGitHead (cyclomatic 23) REDACTED:920— ssh.integrateImportedGitHead has cyclomatic complexity 23 (threshold 15). Of this number, 21 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.
parse-stdout.parseCodexItem (cyclomatic 23) packages/adapters/codex-local/src/ui/parse-stdout.ts:168— parse-stdout.parseCodexItem 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.
format-event.printToolCallEventTopLevel (cyclomatic 23) packages/adapters/cursor-local/src/cli/format-event.ts:109— format-event.printToolCallEventTopLevel 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.
parse-stdout.parseCursorToolCallEvent (cyclomatic 23) packages/adapters/cursor-local/src/ui/parse-stdout.ts:182— parse-stdout.parseCursorToolCallEvent 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.
format-event.printOpenCodeStreamEvent (cyclomatic 23) packages/adapters/opencode-local/src/cli/format-event.ts:42— format-event.printOpenCodeStreamEvent 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.
runtime-config.prepareOpenCodeRuntimeConfig (cyclomatic 23) packages/adapters/opencode-local/src/server/runtime-config.ts:107— runtime-config.prepareOpenCodeRuntimeConfig 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.
redaction.inspect (cyclomatic 23) packages/paperclip-runner/src/semantic-tools/redaction.ts:71— redaction.inspect 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-question-adapter.runtimeRequestResponse (cyclomatic 23) packages/paperclip-runner/src/drivers/codex/codex-question-adapter.ts:563— codex-question-adapter.runtimeRequestResponse 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-driver-values.parseProviderIdentity (cyclomatic 23) packages/paperclip-runner/src/drivers/codex/codex-driver-values.ts:47— codex-driver-values.parseProviderIdentity has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
CapabilityMockControlPlaneAdapter.#validateState (cyclomatic 23) packages/paperclip-runner/src/mock-core/capability-mock-control-plane-adapter.ts:1802— CapabilityMockControlPlaneAdapter.#validateState 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.
evidence-redaction.redactCapabilityEvidenceData (cyclomatic 23) packages/paperclip-runner/src/live/evidence-redaction.ts:285— evidence-redaction.redactCapabilityEvidenceData has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to 2 function literals 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.
runnerd-codex-transport.acpxProviderPackageAuthority (cyclomatic 23) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:3012— runnerd-codex-transport.acpxProviderPackageAuthority has cyclomatic complexity 23 (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.
ThreadItems.ProviderActivity (cyclomatic 23) packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx:157— ThreadItems.ProviderActivity has cyclomatic complexity 23 (threshold 15). Of this number, 17 points are the body's own statements and 6 belong to 2 function literals 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.
materialize-cursor-distribution.materializePinnedCursorDistribution (cyclomatic 23) packages/paperclip-runner/scripts/materialize-cursor-distribution.mjs:63— materialize-cursor-distribution.materializePinnedCursorDistribution has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function literal 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.
acpx-runtime-sidecar.sanitizeRuntimeEvent (cyclomatic 23) packages/paperclip-runner/src/cli/acpx-runtime-sidecar.ts:1019— acpx-runtime-sidecar.sanitizeRuntimeEvent 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.
capability-semantic-tool-runtime.validateJsonSchema (cyclomatic 23) packages/paperclip-runner/src/tools/capability-semantic-tool-runtime.ts:1617— capability-semantic-tool-runtime.validateJsonSchema 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.
menu.Menu (cyclomatic 23) packages/paperclip-runner/src/react/components/menu.tsx:15— menu.Menu has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 7 of the 23 points are its own statements and the rest belongs to 9 function items inside it that branch (onMenuKeyDown, focusItem, a function literal at line 116, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
runner-prp-outbound.connectRunnerPrpIngress (cyclomatic 23) server/src/realtime/runner-prp-outbound.ts:260— runner-prp-outbound.connectRunnerPrpIngress has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to one function literal inside it that branches (line 296). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
sandbox-absence-proof.verifySandboxAbsenceReceipt (cyclomatic 23) server/src/services/sandbox-absence-proof.ts:17— sandbox-absence-proof.verifySandboxAbsenceReceipt has cyclomatic complexity 23 (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.
case-access.assertCaseTrustedForExecution (cyclomatic 23) server/src/services/case-access.ts:56— case-access.assertCaseTrustedForExecution has cyclomatic complexity 23 (threshold 15). Of this number, 20 points are the body's own statements and 3 belong to 3 function items inside it that branch. 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.
agent-records.configPatchFromSnapshot (cyclomatic 23) server/src/lib/agent-records.ts:235— agent-records.configPatchFromSnapshot 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.
chat-question-forms.parseChatQuestionFormSubmitTokenPayload (cyclomatic 23) server/src/services/chat-question-forms.ts:485— chat-question-forms.parseChatQuestionFormSubmitTokenPayload has cyclomatic complexity 23 (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.
installs.createConnectionInstalls.putConnectionInstalls (cyclomatic 23) server/src/services/tool-access/connections/installs.ts:145— installs.createConnectionInstalls.putConnectionInstalls has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 6 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 178, 262). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-teams-file-consent.installTeamsFileConsentHook (cyclomatic 23) server/src/services/chat-teams-file-consent.ts:795— chat-teams-file-consent.installTeamsFileConsentHook has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 6 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 820). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
chat-discord-command-registration.request (cyclomatic 23) server/src/services/chat-discord-command-registration.ts:315— chat-discord-command-registration.request 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.
provider-effects.createProviderEffects.lockCurrentProviderEffectAuthorization (cyclomatic 23) server/src/services/chat-channels/provider-effects.ts:441— provider-effects.createProviderEffects.lockCurrentProviderEffectAuthorization 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.
git-workspace-restoration.assertReproducibleFetchHead (cyclomatic 23) server/src/services/git-workspace-restoration.ts:441— git-workspace-restoration.assertReproducibleFetchHead has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function literal 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. This is NOT this file's highest cyclomatic complexity: git-workspace-restoration.readGitCacheRestoration (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 method is counted neither in this dimension's figures nor in its score.
execution-workspace-repositories.executionWorkspaceRepositoryService.request (cyclomatic 23) server/src/services/execution-workspace-repositories.ts:125— execution-workspace-repositories.executionWorkspaceRepositoryService.request has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 146, 176). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
execution-workspace-repositories.executionWorkspaceRepositoryService.prepareConfiguredRepositoryCopy::verify (cyclomatic 23) server/src/services/execution-workspace-repositories.ts:228— execution-workspace-repositories.executionWorkspaceRepositoryService.prepareConfiguredRepositoryCopy::verify has cyclomatic complexity 23 (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.
managed-workspace-identity.probeManagedWorkspaceReadiness (cyclomatic 23) server/src/services/managed-workspace-identity.ts:132— managed-workspace-identity.probeManagedWorkspaceReadiness 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.
ai-connection-runtime.assertManagedAiProjectAuth (cyclomatic 23) server/src/services/ai-connection-runtime.ts:83— ai-connection-runtime.assertManagedAiProjectAuth 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.
execution-workspaces.executionWorkspaceService.resolveSourceWorkspaceConfiguration (cyclomatic 23) server/src/services/execution-workspaces.ts:1434— execution-workspaces.executionWorkspaceService.resolveSourceWorkspaceConfiguration 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.
chat-github-wizard.githubChatWizardService.exchangeCloudManifest (cyclomatic 23) server/src/services/chat-github-wizard.ts:403— chat-github-wizard.githubChatWizardService.exchangeCloudManifest has cyclomatic complexity 23 (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.
chat-teams-file-transfers.teamsFileTransferService.process (cyclomatic 23) server/src/services/chat-teams-file-transfers.ts:737— chat-teams-file-transfers.teamsFileTransferService.process has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 6 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 799). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
slack-board-authority.authorizeSlackBoardPublication (cyclomatic 23) server/src/services/slack-board-authority.ts:53— slack-board-authority.authorizeSlackBoardPublication 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.
credential-access.createConnectionCredentialAccess.resolveCredentialHeaders (cyclomatic 23) server/src/services/tool-access/credential-access.ts:112— credential-access.createConnectionCredentialAccess.resolveCredentialHeaders 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.
agent-runner-selection.resolveAgentRunnerTargetForCompany (cyclomatic 23) server/src/services/agent-runner-selection.ts:291— agent-runner-selection.resolveAgentRunnerTargetForCompany 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.
oauth.createPublicMcpOAuth.authorize (cyclomatic 23) server/src/services/public-mcp/oauth.ts:479— oauth.createPublicMcpOAuth.authorize has cyclomatic complexity 23 (threshold 15). Of this number, 16 points are the body's own statements and 7 belong to 2 function literals 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.
routine.grokRoutineService.send (cyclomatic 23) server/src/services/grok-bot/routine.ts:167— routine.grokRoutineService.send has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 6 of the 23 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 168, handoff, a function literal at line 220). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
native-broker.createNativeExternalBroker.port.attach (cyclomatic 23) server/src/modules/external-agents/native-broker.ts:197— native-broker.createNativeExternalBroker.port.attach has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 9 of the 23 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 204, drain, a function literal at line 225). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
muse-receiver.createReceiver.signal (cyclomatic 23) server/src/services/muse-receiver.ts:57— muse-receiver.createReceiver.signal has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 7 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 69). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
case-handoff-authority.assertCaseHandoffSourceAuthority (cyclomatic 23) server/src/services/case-handoff-authority.ts:124— case-handoff-authority.assertCaseHandoffSourceAuthority has cyclomatic complexity 23 (threshold 15). Of this number, 16 points are the body's own statements and 7 belong to one function literal 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.
native-deliverable-text.createNativeDeliverableTextObservation (cyclomatic 23) server/src/services/native-runtime/native-deliverable-text.ts:15— native-deliverable-text.createNativeDeliverableTextObservation has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 2 function items inside it that branch (a function literal at line 28, observeItem). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
remote-pi-companion.importRemotePiCompanion (cyclomatic 23) server/src/services/native-runtime/remote-pi-companion.ts:105— remote-pi-companion.importRemotePiCompanion has cyclomatic complexity 23 (threshold 15). Of this number, 20 points are the body's own statements and 3 belong to 3 function items inside it that branch. 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.
case-agent-read.projectAgentCaseRead (cyclomatic 23) server/src/services/case-agent-read.ts:87— case-agent-read.projectAgentCaseRead 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.
runtime-mode.resolveNativeRuntimeMode (cyclomatic 23) server/src/services/native-runtime/runtime-mode.ts:100— runtime-mode.resolveNativeRuntimeMode 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.
case-context.caseWakeWithInstructionReference (cyclomatic 23) server/src/services/case-context.ts:234— case-context.caseWakeWithInstructionReference has cyclomatic complexity 23 (threshold 15). Of this number, 16 points are the body's own statements and 7 belong to 4 function items inside it that branch. 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-lifecycle.createHeartbeatLifecycle.setRunStatusFromLive (cyclomatic 23) server/src/services/heartbeat/run-lifecycle.ts:1114— run-lifecycle.createHeartbeatLifecycle.setRunStatusFromLive has cyclomatic complexity 23 (threshold 15). Of this number, 14 points are the body's own statements and 9 belong to 2 function literals 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.
protocol.decodeRequest (cyclomatic 23) packages/tailscale-https-broker/src/protocol.ts:79— protocol.decodeRequest 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.
dev-runner.maybeAutoRestartChild (cyclomatic 23) scripts/dev-runner.ts:757— dev-runner.maybeAutoRestartChild 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.
ingest-app-definitions.specialMethodsFor (cyclomatic 23) scripts/ingest-app-definitions.mjs:1204— ingest-app-definitions.specialMethodsFor 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.
secret-proposals.createSecretProposalsService.createBinding (cyclomatic 23) server/src/services/secret-proposals.ts:360— secret-proposals.createSecretProposalsService.createBinding has cyclomatic complexity 23 (threshold 15). Of this number, 18 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
teams-catalog.renderYamlBlock (cyclomatic 23) server/src/services/teams-catalog.ts:365— teams-catalog.renderYamlBlock has cyclomatic complexity 23 (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.
slack-search-oauth.slackSearchOAuthService.complete (cyclomatic 23) server/src/services/connectors/slack-search-oauth.ts:502— slack-search-oauth.slackSearchOAuthService.complete has cyclomatic complexity 23 (threshold 15). Of this number, 15 points are the body's own statements and 8 belong to one function literal inside it that branches. 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.
issues.buildIssueWakeDiagnosis (cyclomatic 23) server/src/routes/issues.ts:1551— issues.buildIssueWakeDiagnosis 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.
tool-gateway.handleMcpGatewayProtocol (cyclomatic 23) REDACTED:73— tool-gateway.handleMcpGatewayProtocol 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.
chat-webhook-ingress.probeTarget (cyclomatic 23) scripts/smoke/chat-webhook-ingress.mjs:189— chat-webhook-ingress.probeTarget has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 234, 273, 216, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
case-handoff-delivery.caseHandoffDeliveryService.deliver (cyclomatic 23) server/src/services/case-handoff-delivery.ts:81— case-handoff-delivery.caseHandoffDeliveryService.deliver 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.
case-handoff-delivery.caseHandoffDeliveryService.sweepPending (cyclomatic 23) server/src/services/case-handoff-delivery.ts:124— case-handoff-delivery.caseHandoffDeliveryService.sweepPending 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.
AgentCharacter.AgentCharacter (cyclomatic 23) ui/src/components/AgentCharacter.tsx:17— AgentCharacter.AgentCharacter has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 11 of the 23 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 24, 32, 37, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SidebarProjects.SidebarProjects (cyclomatic 23) ui/src/components/SidebarProjects.tsx:256— SidebarProjects.SidebarProjects has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 363, 351, 336, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
search-query-parser.parseSearchQuery (cyclomatic 23) ui/src/lib/search-query-parser.ts:187— search-query-parser.parseSearchQuery 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.
CompanySettingsSidebar.production.CompanySettingsSidebar (cyclomatic 23) ui/src/components/CompanySettingsSidebar.production.tsx:46— CompanySettingsSidebar.production.CompanySettingsSidebar has cyclomatic complexity 23 (threshold 15). Of this number, 17 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
IssueColumns.InboxIssueTrailingColumns (cyclomatic 23) ui/src/components/IssueColumns.tsx:268— IssueColumns.InboxIssueTrailingColumns has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 322). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
LiveUpdatesProvider.handleLiveEvent (cyclomatic 23) ui/src/context/LiveUpdatesProvider.tsx:1824— LiveUpdatesProvider.handleLiveEvent 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.
issue-queued-comment-queue.normalizeIssueQueuedCommentQueue (cyclomatic 23) ui/src/lib/issue-queued-comment-queue.ts:26— issue-queued-comment-queue.normalizeIssueQueuedCommentQueue has cyclomatic complexity 23 (threshold 15). Of this number, 13 points are the body's own statements and 10 belong to one function literal inside it that branches. 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.
TaskChatProtocolActivityRow.TaskChatProtocolActivityRow (cyclomatic 23) ui/src/components/task-chat/TaskChatProtocolActivityRow.tsx:279— TaskChatProtocolActivityRow.TaskChatProtocolActivityRow 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.
IssueChatThread.VirtualizedIssueChatThreadListInner (cyclomatic 23) ui/src/components/IssueChatThread.tsx:4331— IssueChatThread.VirtualizedIssueChatThreadListInner has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 4420, 4441, 4450, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TaskTreeControls.TaskTreeControlDialog (cyclomatic 23) ui/src/components/TaskTreeControls.tsx:74— TaskTreeControls.TaskTreeControlDialog has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function literal 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.
ProviderTraceStatusBadge.ProviderTraceStatusBadge (cyclomatic 23) ui/src/components/ProviderTraceStatusBadge.tsx:18— ProviderTraceStatusBadge.ProviderTraceStatusBadge 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.
TaskChatToolCard.TaskChatToolCard (cyclomatic 23) ui/src/components/task-chat/TaskChatToolCard.tsx:33— TaskChatToolCard.TaskChatToolCard 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.
Companies.Companies (cyclomatic 23) ui/src/pages/Companies.tsx:35— Companies.Companies has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 4 of the 23 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 127, saveEdit, a function literal at line 147, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
BuiltInBundlePanel.BuiltInBundlePanel (cyclomatic 23) ui/src/components/BuiltInBundlePanel.tsx:242— BuiltInBundlePanel.BuiltInBundlePanel has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
SearchFilterMenu.SearchFilterMenu (cyclomatic 23) ui/src/components/search/SearchFilterMenu.tsx:59— SearchFilterMenu.SearchFilterMenu has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 181, a function literal at line 147, handleOptionClick, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AppLogo.AppLogo (cyclomatic 23) ui/src/pages/apps/AppLogo.tsx:38— AppLogo.AppLogo has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to 2 function literals 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.
GitHubBotManagement.GitHubBotManagement (cyclomatic 23) ui/src/pages/apps/chat/GitHubBotManagement.tsx:185— GitHubBotManagement.GitHubBotManagement has cyclomatic complexity 23 (threshold 15). Of this number, 18 points are the body's own statements and 5 belong to 2 function items inside it that branch. 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.
RailwayAccessPanel.RailwayAccessPanel (cyclomatic 23) ui/src/pages/apps/app-detail/RailwayAccessPanel.tsx:10— RailwayAccessPanel.RailwayAccessPanel has cyclomatic complexity 23 (threshold 15). Of this number, 20 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
AdvancedPanel.ReconnectForm (cyclomatic 23) ui/src/pages/apps/app-detail/AdvancedPanel.tsx:274— AdvancedPanel.ReconnectForm has cyclomatic complexity 23 (threshold 15). Of this number, 12 points are the body's own statements and 11 belong to 7 function literals inside it that branch. 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.
SkillSourceConnectionRepair.SkillSourceConnectionRepair (cyclomatic 23) ui/src/components/skill-studio/SkillSourceConnectionRepair.tsx:13— SkillSourceConnectionRepair.SkillSourceConnectionRepair has cyclomatic complexity 23 (threshold 15). Of this number, 17 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
TaskVoiceLauncher.TaskVoiceLauncher (cyclomatic 23) ui/src/components/voice/TaskVoiceLauncher.tsx:10— TaskVoiceLauncher.TaskVoiceLauncher has cyclomatic complexity 23 (threshold 15). Of this number, 12 points are the body's own statements and 11 belong to 4 function literals 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.
artifact-card-data.parseArtifactCsv (cyclomatic 23) ui/src/lib/artifact-card-data.ts:55— artifact-card-data.parseArtifactCsv has cyclomatic complexity 23 (threshold 15). Of this number, 22 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.
board-auth.loginBoardCli (cyclomatic 22) cli/src/client/board-auth.ts:208— board-auth.loginBoardCli 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.
run.registerRunCommands (cyclomatic 22) cli/src/commands/client/run.ts:46— run.registerRunCommands has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 10 function literals inside it that branch (lines 136, 54, 79, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
secrets.registerSecretCommands (cyclomatic 22) cli/src/commands/client/secrets.ts:367— secrets.registerSecretCommands has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 14 function literals inside it that branch (lines 393, 541, 375, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
agent-observability.buildProviderObservabilityLaunch (cyclomatic 22) packages/adapter-utils/src/agent-observability.ts:45— agent-observability.buildProviderObservabilityLaunch has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
command-managed-runtime.createCommandManagedRuntimeClient (cyclomatic 22) packages/adapter-utils/src/command-managed-runtime.ts:258— command-managed-runtime.createCommandManagedRuntimeClient has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 4 of the 22 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 341, fallbackSyncIn, a function literal at line 289, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
execution-target.createDuplexReadinessGate (cyclomatic 22) REDACTED:4035— execution-target.createDuplexReadinessGate has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 4116, 4252, 4268, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
execute.classifyError (cyclomatic 22) packages/adapter-utils/src/acpx-engine/execute.ts:3513— execute.classifyError has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to one function literal inside it that branches. 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.
quota-probe.main (cyclomatic 22) packages/adapters/claude-local/src/cli/quota-probe.ts:33— quota-probe.main 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.
setup-token-parse.hasValidQuery (cyclomatic 22) packages/adapters/claude-local/src/server/setup-token-parse.ts:260— setup-token-parse.hasValidQuery 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.
client.reconcilePendingMigrationHistory (cyclomatic 22) REDACTED:938— client.reconcilePendingMigrationHistory 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-security-config.createIsolatedCodexAppServerArgs (cyclomatic 22) packages/paperclip-runner/src/drivers/codex/codex-security-config.ts:251— codex-security-config.createIsolatedCodexAppServerArgs has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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-session-workspace.recordCanonicalWorkspaceChange (cyclomatic 22) packages/paperclip-runner/src/drivers/codex/codex-session-workspace.ts:95— codex-session-workspace.recordCanonicalWorkspaceChange has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 100). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
BoundedJsonCompactor.write (cyclomatic 22) packages/paperclip-runner/src/drivers/opencode/sse-frames.ts:236— BoundedJsonCompactor.write 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.
OpenCodeHarnessSession.resolveRuntimeRequest (cyclomatic 22) REDACTED:746— OpenCodeHarnessSession.resolveRuntimeRequest has cyclomatic complexity 22 (threshold 15). Of this number, 20 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.
DurablePrpCodexTransport.#stopProviderBeforeSuspend (cyclomatic 22) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:4367— DurablePrpCodexTransport.#stopProviderBeforeSuspend has cyclomatic complexity 22 (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.
DurablePrpCodexTransport.#handleSemanticToolInput (cyclomatic 22) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:5908— DurablePrpCodexTransport.#handleSemanticToolInput has cyclomatic complexity 22 (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.
runnerd-codex-transport.rotateLocalAuthorityEpoch (cyclomatic 22) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:282— runnerd-codex-transport.rotateLocalAuthorityEpoch 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.
operation-groups-doc.renderOperationGroupsDocument (cyclomatic 22) packages/paperclip-runner/src/catalog/operation-groups-doc.ts:258— operation-groups-doc.renderOperationGroupsDocument 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.
pi-installation.verifyPiInstallation (cyclomatic 22) packages/paperclip-runner/src/drivers/acpx/pi-installation.ts:49— pi-installation.verifyPiInstallation has cyclomatic complexity 22 (threshold 15). Of this number, 18 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
CodexAcpxSession.#mapRuntimeEvent (cyclomatic 22) REDACTED:1676— CodexAcpxSession.#mapRuntimeEvent 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.
live-projection.derivedRecordItems (cyclomatic 22) packages/paperclip-runner/src/issue-thread/live-projection.ts:416— live-projection.derivedRecordItems 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.
opencode-app-server-proxy.handle (cyclomatic 22) packages/paperclip-runner/src/cli/opencode-app-server-proxy.ts:321— opencode-app-server-proxy.handle 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.
capability-eval-suite.runCapabilityLiveCodexMatrix (cyclomatic 22) packages/paperclip-runner/src/conformance/capability-eval-suite.ts:302— capability-eval-suite.runCapabilityLiveCodexMatrix has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to 2 function literals 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.
pi-acp-runtime.createPiLaunchSpec (cyclomatic 22) packages/paperclip-runner/src/drivers/acpx/pi-acp-runtime.ts:366— pi-acp-runtime.createPiLaunchSpec 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.
workflow-report.runnerWorkflowAlerts (cyclomatic 22) packages/paperclip-runner/src/eval/workflow-report.ts:211— workflow-report.runnerWorkflowAlerts has cyclomatic complexity 22 (threshold 15). Of this number, 17 points are the body's own statements and 5 belong to 3 function literals inside it that branch. 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.
execution-preparation-timing.measure (cyclomatic 22) server/src/services/execution-preparation-timing.ts:139— execution-preparation-timing.measure has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 5 function items inside it that branch (run, a function literal at line 169, a function literal at line 154, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
redaction.authorizationCredentialRange (cyclomatic 22) server/src/redaction.ts:571— redaction.authorizationCredentialRange 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.
remote-connection-failure.classifyRemoteConnectionError (cyclomatic 22) server/src/services/remote-connection-failure.ts:61— remote-connection-failure.classifyRemoteConnectionError 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.
authorization.evaluateAuthorizationPolicyForAssignment (cyclomatic 22) server/src/services/authorization.ts:299— authorization.evaluateAuthorizationPolicyForAssignment has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
secrets.secretService.resolveSecretValueInternal (cyclomatic 22) server/src/services/secrets.ts:1356— secrets.secretService.resolveSecretValueInternal 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.
secrets.secretService.createSecretUnlocked (cyclomatic 22) server/src/services/secrets.ts:2180— secrets.secretService.createSecretUnlocked has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal 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.
workspace-operations.workspaceOperationService.sweepRuntimeControlOperations (cyclomatic 22) server/src/services/workspace-operations.ts:290— workspace-operations.workspaceOperationService.sweepRuntimeControlOperations 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.
native-provider-failure.createNativeProviderFailureObservation.observe (cyclomatic 22) server/src/services/native-runtime/native-provider-failure.ts:188— native-provider-failure.createNativeProviderFailureObservation.observe has cyclomatic complexity 22 (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.
agent-conversations.settleConversationTurn (cyclomatic 22) server/src/services/agent-conversations.ts:283— agent-conversations.settleConversationTurn has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 292). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
chat-teams-inline-image-intake.route (cyclomatic 22) server/src/services/chat-teams-inline-image-intake.ts:79— chat-teams-inline-image-intake.route has cyclomatic complexity 22 (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.
chat-sdk-runtime.createProviderAdapter (cyclomatic 22) server/src/services/chat-sdk-runtime.ts:1351— chat-sdk-runtime.createProviderAdapter has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 10 of the 22 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 1439, 1403, 1410, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-attachment-reuse.authorizeChatConversationForBoundRun (cyclomatic 22) server/src/services/native-runtime/chat-attachment-reuse.ts:433— chat-attachment-reuse.authorizeChatConversationForBoundRun has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to one function literal 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.
chat-run-publications.enqueueSafeNativeChatProgress (cyclomatic 22) server/src/services/chat-run-publications.ts:283— chat-run-publications.enqueueSafeNativeChatProgress has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 421). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
chat-github-response-comments.githubResponseCommentService.finishRun (cyclomatic 22) server/src/services/chat-github-response-comments.ts:305— chat-github-response-comments.githubResponseCommentService.finishRun 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.
voice-delivery-diagnostics.captureVoiceDeliveryDiagnostics (cyclomatic 22) server/src/services/voice/voice-delivery-diagnostics.ts:14— voice-delivery-diagnostics.captureVoiceDeliveryDiagnostics has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to 2 function literals inside it that branch. 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.
slack-client.slackClient (cyclomatic 22) server/src/services/connectors/slack-client.ts:27— slack-client.slackClient has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 28, 48). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
distribution-plugin-catalog.readDistributionPluginCatalog (cyclomatic 22) server/src/services/distribution-plugin-catalog.ts:126— distribution-plugin-catalog.readDistributionPluginCatalog has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 8 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 142). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
tool-gateway.createToolGatewayService.resolveConnectedRemoteTool (cyclomatic 22) server/src/services/tool-gateway.ts:4890— tool-gateway.createToolGatewayService.resolveConnectedRemoteTool has cyclomatic complexity 22 (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.
tool-gateway.createToolGatewayService.callLocalStdioMcp (cyclomatic 22) server/src/services/tool-gateway.ts:5176— tool-gateway.createToolGatewayService.callLocalStdioMcp has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 5252, 5196, 5319, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tool-gateway.createToolGatewayService.executePluginTool (cyclomatic 22) server/src/services/tool-gateway.ts:11243— tool-gateway.createToolGatewayService.executePluginTool 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.
git-workspace-restoration.assertReproducibleManagedCheckout (cyclomatic 22) server/src/services/git-workspace-restoration.ts:277— git-workspace-restoration.assertReproducibleManagedCheckout 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: git-workspace-restoration.readGitCacheRestoration (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 method is counted neither in this dimension's figures nor in its score.
nested-clone-migration.inspectStandaloneClone (cyclomatic 22) server/src/services/nested-clone-migration.ts:191— nested-clone-migration.inspectStandaloneClone 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. This is NOT this file's highest cyclomatic complexity: nested-clone-migration.readPending (cyclomatic 24) 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 method is counted neither in this dimension's figures nor in its score.
execution-workspace-repositories.executionWorkspaceRepositoryService.sharedPublicationPin (cyclomatic 22) server/src/services/execution-workspace-repositories.ts:288— execution-workspace-repositories.executionWorkspaceRepositoryService.sharedPublicationPin has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
workspace-login-handoff.verifyWorkspaceHandoffTicket (cyclomatic 22) server/src/auth/workspace-login-handoff.ts:322— workspace-login-handoff.verifyWorkspaceHandoffTicket 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.
workspace-runtime.refreshRemoteTrackingBaseRefWithDiagnostic (cyclomatic 22) server/src/services/workspace-runtime.ts:977— workspace-runtime.refreshRemoteTrackingBaseRefWithDiagnostic has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1009, 989, 996). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
email-connections.emailConnectionService.listCredentials (cyclomatic 22) server/src/services/email-connections.ts:78— email-connections.emailConnectionService.listCredentials has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 4 function items inside it that branch (a function literal at line 92, a function literal at line 125, a function literal at line 84, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
connection-intents.connectionIntentService.validate (cyclomatic 22) server/src/services/connection-intents.ts:162— connection-intents.connectionIntentService.validate has cyclomatic complexity 22 (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.
connection-intents.connectionIntentService.search::aggregatorAlternatives (cyclomatic 22) server/src/services/connection-intents.ts:530— connection-intents.connectionIntentService.search::aggregatorAlternatives 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 shape REPEATS in the file: one other method here (connection-intents.connectionIntentService.search) 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.
file-delivery.createTeamsFileDelivery.tryProcessTeamsFilePublication (cyclomatic 22) server/src/services/chat-channels/microsoft-teams/file-delivery.ts:264— file-delivery.createTeamsFileDelivery.tryProcessTeamsFilePublication has cyclomatic complexity 22 (threshold 15). Of this number, 11 points are the body's own statements and 11 belong to 2 function literals 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.
publication-preparation.createTelegramPublicationPreparation.prepareTelegramPublication (cyclomatic 22) server/src/services/chat-channels/telegram/publication-preparation.ts:24— publication-preparation.createTelegramPublicationPreparation.prepareTelegramPublication has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 43, 125). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
reactions.createInboundReactions.processPendingReactionDelivery (cyclomatic 22) server/src/services/chat-channels/reactions.ts:624— reactions.createInboundReactions.processPendingReactionDelivery has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 652). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest. This is NOT this file's highest cyclomatic complexity: reactions.createInboundReactions.normalizedPendingReaction (cyclomatic 26) 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 method is counted neither in this dimension's figures nor in its score.
grant-refresh.createOAuthGrantRefresh::refreshOAuthGrantCredentials (cyclomatic 22) server/src/services/tool-access/oauth/grant-refresh.ts:38— grant-refresh.createOAuthGrantRefresh::refreshOAuthGrantCredentials 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.
composio-app-setup.composioAppAccounts::visit (cyclomatic 22) server/src/services/composio-app-setup.ts:32— composio-app-setup.composioAppAccounts::visit 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.
client-registration.createOAuthClientRegistration::oauthClientBindingMatches (cyclomatic 22) server/src/services/tool-access/oauth/client-registration.ts:232— client-registration.createOAuthClientRegistration::oauthClientBindingMatches has cyclomatic complexity 22 (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.
tool-access.toolAccessService.configureRailwaySsh (cyclomatic 22) server/src/services/tool-access.ts:4649— tool-access.toolAccessService.configureRailwaySsh has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 4651). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
issue-thread-interactions.issueThreadInteractionService.createConnectionIntent (cyclomatic 22) server/src/services/issue-thread-interactions.ts:2605— issue-thread-interactions.issueThreadInteractionService.createConnectionIntent has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 10 of the 22 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2643, 2665, 2717). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
issue-thread-interactions.issueThreadInteractionService.sweepMergedPullRequestConfirmations (cyclomatic 22) server/src/services/issue-thread-interactions.ts:2862— issue-thread-interactions.issueThreadInteractionService.sweepMergedPullRequestConfirmations has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal 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.
oauth.createPublicMcpOAuth.actorForGrant (cyclomatic 22) server/src/services/public-mcp/oauth.ts:121— oauth.createPublicMcpOAuth.actorForGrant has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal 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.
case-handoff-lifecycle.completeTerminalCaseHandoffsForIssue (cyclomatic 22) server/src/services/heartbeat/case-handoff-lifecycle.ts:170— case-handoff-lifecycle.completeTerminalCaseHandoffsForIssue 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.
issues.issueService::enrichCommentsWithDerivedAgentAttribution (cyclomatic 22) server/src/services/issues.ts:7023— issues.issueService::enrichCommentsWithDerivedAgentAttribution 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.
openapi.zodToOpenApiSchema (cyclomatic 22) server/src/routes/openapi.ts:469— openapi.zodToOpenApiSchema has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
agent-directory-working-copies.agentDirectoryWorkingCopyService.checkpoint (cyclomatic 22) server/src/services/agent-directory-working-copies.ts:319— agent-directory-working-copies.agentDirectoryWorkingCopyService.checkpoint has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal 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.
agent-instruction-working-copies.agentInstructionWorkingCopyService.recoverStopped (cyclomatic 22) server/src/services/agent-instruction-working-copies.ts:328— agent-instruction-working-copies.agentInstructionWorkingCopyService.recoverStopped 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.
workspace-file-resources.workspaceFileResourceService.visibleCandidates (cyclomatic 22) server/src/services/workspace-file-resources.ts:1045— workspace-file-resources.workspaceFileResourceService.visibleCandidates 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.
company-skills.deriveImportedSkillSource (cyclomatic 22) server/src/services/company-skills.ts:1007— company-skills.deriveImportedSkillSource 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: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
company-skills.companySkillService.resetSkill (cyclomatic 22) server/src/services/company-skills.ts:4997— company-skills.companySkillService.resetSkill 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. This is NOT this file's highest cyclomatic complexity: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
routines.routineService.tickScheduledTriggers (cyclomatic 22) server/src/services/routines.ts:3213— routines.routineService.tickScheduledTriggers 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.
PaperclipRunnerToolAuthority.#boundContext (cyclomatic 22) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:1228— PaperclipRunnerToolAuthority.#boundContext has cyclomatic complexity 22 (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.
native-session-executor.runtimeQuestionFallbackFromEvent (cyclomatic 22) server/src/services/native-runtime/native-session-executor.ts:929— native-session-executor.runtimeQuestionFallbackFromEvent has cyclomatic complexity 22 (threshold 15). Of this number, 16 points are the body's own statements and 6 belong to 2 function literals 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.providerSessionIdentityTransitionIsAllowed (cyclomatic 22) server/src/services/native-runtime/native-session-executor.ts:5916— native-session-executor.providerSessionIdentityTransitionIsAllowed has cyclomatic complexity 22 (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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-local-process-stop.releaseSettledNativeRunProcess (cyclomatic 22) server/src/services/native-local-process-stop.ts:145— native-local-process-stop.releaseSettledNativeRunProcess has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 146, 166). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-restart-recovery.classifyNativeRunnerRecoveryEvidence (cyclomatic 22) server/src/services/native-runtime/native-restart-recovery.ts:294— native-restart-recovery.classifyNativeRunnerRecoveryEvidence 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.
fresh-workspace-continuation.readFreshWorkspaceReadiness (cyclomatic 22) server/src/services/fresh-workspace-continuation.ts:51— fresh-workspace-continuation.readFreshWorkspaceReadiness has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal 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.
run-state.createHeartbeatRunState.evaluateSessionCompaction (cyclomatic 22) server/src/services/heartbeat/run-state.ts:1345— run-state.createHeartbeatRunState.evaluateSessionCompaction 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.
run-lifecycle.createHeartbeatLifecycle.finalizeIssueCommentPolicy (cyclomatic 22) server/src/services/heartbeat/run-lifecycle.ts:2505— run-lifecycle.createHeartbeatLifecycle.finalizeIssueCommentPolicy 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.
app.SettingsBody::fixAllConfigurationErrors (cyclomatic 22) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6029— app.SettingsBody::fixAllConfigurationErrors 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. This shape REPEATS in the file: one other method here (app.SettingsBody) 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.
core.assemblePaperclipSourceBundle (cyclomatic 22) packages/plugins/plugin-llm-wiki/src/wiki/core.ts:2609— core.assemblePaperclipSourceBundle 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.
config.parseConfig (cyclomatic 22) packages/plugins/sandbox-providers/createos/src/config.ts:11— config.parseConfig has cyclomatic complexity 22 (threshold 15). Of this number, 18 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
catalog-builder.buildReferencedCatalogSkill (cyclomatic 22) packages/skills-catalog/src/catalog-builder.ts:331— catalog-builder.buildReferencedCatalogSkill has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
BrokerCore.compensateExpose (cyclomatic 22) packages/tailscale-https-broker/src/broker-core.ts:568— BrokerCore.compensateExpose 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.
generate-company-assets.parseCompanyPackage (cyclomatic 22) scripts/generate-company-assets.ts:136— generate-company-assets.parseCompanyPackage 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.
github-connection-events.githubSnapshotUpdate (cyclomatic 22) server/src/services/github-connection-events.ts:173— github-connection-events.githubSnapshotUpdate 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.
costs.parseCostDateRange (cyclomatic 22) server/src/routes/costs.ts:41— costs.parseCostDateRange 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.
capabilities.createPublicMcpExecutor (cyclomatic 22) server/src/services/public-mcp/capabilities.ts:163— capabilities.createPublicMcpExecutor has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to one function literal inside it that branches (line 164). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
skill-source-sync.skillSourceSyncService.sweep (cyclomatic 22) server/src/services/skill-source-sync.ts:249— skill-source-sync.skillSourceSyncService.sweep 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.
recovery-observability.recoveryObservabilityService.report (cyclomatic 22) server/src/services/recovery-observability.ts:170— recovery-observability.recoveryObservabilityService.report 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.
composer-run-settings.composerEfforts (cyclomatic 22) ui/src/components/task-chat/composer-run-settings.ts:63— composer-run-settings.composerEfforts 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.
issue-timeline-events.extractIssueTimelineEvents (cyclomatic 22) ui/src/lib/issue-timeline-events.ts:158— issue-timeline-events.extractIssueTimelineEvents 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.
composer-draft.draftAttachments (cyclomatic 22) ui/src/lib/composer-draft.ts:182— composer-draft.draftAttachments 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.
IssueLinkQuicklook.IssueLinkQuicklook (cyclomatic 22) ui/src/components/IssueLinkQuicklook.tsx:231— IssueLinkQuicklook.IssueLinkQuicklook has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 335, 324, 262, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
IssueAttachmentsSection.IssueAttachmentsSection (cyclomatic 22) ui/src/components/IssueAttachmentsSection.tsx:227— IssueAttachmentsSection.IssueAttachmentsSection has cyclomatic complexity 22 (threshold 15). Of this number, 12 points are the body's own statements and 10 belong to 6 function items inside it that branch. 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.
IssuePlanDecompositionsSection.IssuePlanDecompositionsSection (cyclomatic 22) ui/src/components/IssuePlanDecompositionsSection.tsx:33— IssuePlanDecompositionsSection.IssuePlanDecompositionsSection has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 56). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
OutputPrimaryCard.OutputPrimaryCard (cyclomatic 22) ui/src/components/issue-output/OutputPrimaryCard.tsx:27— OutputPrimaryCard.OutputPrimaryCard has cyclomatic complexity 22 (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.
use-side-panel-tabs.sidePanelTabsReducer (cyclomatic 22) ui/src/components/side-panel/use-side-panel-tabs.ts:28— use-side-panel-tabs.sidePanelTabsReducer has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal 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.
AgentDetail.WorkspaceOperationsSection (cyclomatic 22) ui/src/pages/AgentDetail.tsx:675— AgentDetail.WorkspaceOperationsSection has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 690). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
AgentDetail.AgentOverview (cyclomatic 22) ui/src/pages/AgentDetail.tsx:1722— AgentDetail.AgentOverview has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal 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.
RoutineSaveBar.RoutineSaveBar (cyclomatic 22) ui/src/components/RoutineSaveBar.tsx:31— RoutineSaveBar.RoutineSaveBar has cyclomatic complexity 22 (threshold 15). Of this number, 13 points are the body's own statements and 9 belong to 2 function literals 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.
cron-fires.parseField (cyclomatic 22) ui/src/lib/cron-fires.ts:45— cron-fires.parseField 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.
DecisionTriageStrip.DecisionTriageStrip (cyclomatic 22) ui/src/components/DecisionTriageStrip.tsx:79— DecisionTriageStrip.DecisionTriageStrip has cyclomatic complexity 22 (threshold 15). Of this number, 14 points are the body's own statements and 8 belong to 5 function literals inside it that branch. 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.
AdvancedPanel.ReconnectCard (cyclomatic 22) ui/src/pages/apps/app-detail/AdvancedPanel.tsx:147— AdvancedPanel.ReconnectCard has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to 4 function literals 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.
SkillFolderTree.TreeBranch (cyclomatic 22) ui/src/components/folders/SkillFolderTree.tsx:527— SkillFolderTree.TreeBranch has cyclomatic complexity 22 (threshold 15). Of this number, 17 points are the body's own statements and 5 belong to 4 function literals 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.
SkillStudio.VersionHistorySheet (cyclomatic 22) ui/src/pages/SkillStudio.tsx:3425— SkillStudio.VersionHistorySheet has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 10 of the 22 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 3495, 3471, 3472, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CaseListRow.CaseListRow (cyclomatic 22) ui/src/components/cases/CaseListRow.tsx:9— CaseListRow.CaseListRow has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
TaskChatCompactInteractionCard.SuggestedTasksCard (cyclomatic 22) ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx:1351— TaskChatCompactInteractionCard.SuggestedTasksCard has cyclomatic complexity 22 (threshold 15). Of this number, 11 points are the body's own statements and 11 belong to 5 function items inside it that branch. 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.
useWindowAutoFollow.useWindowAutoFollow (cyclomatic 22) ui/src/components/task-chat/useWindowAutoFollow.ts:33— useWindowAutoFollow.useWindowAutoFollow has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 8 function items inside it that branch (a function literal at line 99, reconcile, a function literal at line 75, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SpekoProviderSetup.SpekoProviderSetup (cyclomatic 22) ui/src/components/voice/SpekoProviderSetup.tsx:17— SpekoProviderSetup.SpekoProviderSetup has cyclomatic complexity 22 (threshold 15). Of this number, 17 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.
useMuseConnection.useMuseConnection (cyclomatic 22) ui/src/hooks/useMuseConnection.ts:45— useMuseConnection.useMuseConnection has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 71, 54, 57, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentDetail.production.WorkspaceOperationsSection (cyclomatic 22) ui/src/pages/AgentDetail.production.tsx:663— AgentDetail.production.WorkspaceOperationsSection has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 678). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
AiConnectorPages.Setup (cyclomatic 22) ui/storybook/prototypes/AiConnectorPages.tsx:157— AiConnectorPages.Setup has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 5 function items inside it that branch (complete, a function literal at line 174, a function literal at line 169, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AccessEditor.AccessEditor (cyclomatic 22) ui/storybook/prototypes/github-chat/AccessEditor.tsx:54— AccessEditor.AccessEditor has cyclomatic complexity 22 (threshold 15). Of this number, 12 points are the body's own statements and 10 belong to 6 function items inside it that branch. 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.
workspace-restore-merge.mergeDirectoryWithBaseline (cyclomatic 21) packages/adapter-utils/src/workspace-restore-merge.ts:741— workspace-restore-merge.mergeDirectoryWithBaseline has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 757, 779). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-checkpoint.validateCheckpointPayload (cyclomatic 21) packages/adapter-utils/src/workspace-checkpoint.ts:134— workspace-checkpoint.validateCheckpointPayload 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.
workspace-seed-cache.evictSeedGenerations (cyclomatic 21) packages/adapter-utils/src/workspace-seed-cache.ts:103— workspace-seed-cache.evictSeedGenerations has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to 3 function items inside it that branch. 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.
ssh.parseSshRemoteExecutionSpec (cyclomatic 21) REDACTED:161— ssh.parseSshRemoteExecutionSpec has cyclomatic complexity 21 (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.
sandbox-callback-bridge.startSandboxCallbackBridgeWorker.failPendingRequests (cyclomatic 21) REDACTED:1313— sandbox-callback-bridge.startSandboxCallbackBridgeWorker.failPendingRequests 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.
terminal-session-failure.sanitizeTerminalSessionFailure (cyclomatic 21) REDACTED:55— terminal-session-failure.sanitizeTerminalSessionFailure has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to 2 function literals 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.
quota.mapCodexRpcQuota (cyclomatic 21) packages/adapters/codex-local/src/server/quota.ts:417— quota.mapCodexRpcQuota 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.
acp.testKimiAcpEnvironment (cyclomatic 21) packages/adapters/kimi-local/src/server/acp.ts:279— acp.testKimiAcpEnvironment 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.
parse-stdout.parseKimiStdoutLine (cyclomatic 21) packages/adapters/kimi-local/src/ui/parse-stdout.ts:48— parse-stdout.parseKimiStdoutLine 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.
execute.extractRuntimeServicesFromMeta (cyclomatic 21) packages/adapters/openclaw-gateway/src/server/execute.ts:947— execute.extractRuntimeServicesFromMeta has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to 2 function literals 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.
ProcessCodexAppServerTransport.#onLine (cyclomatic 21) packages/paperclip-runner/src/drivers/codex/app-server-transport.ts:615— ProcessCodexAppServerTransport.#onLine 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.
cursor-extensions.createCursorProfileExtensionAdapter.notification (cyclomatic 21) packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts:76— cursor-extensions.createCursorProfileExtensionAdapter.notification 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.
cursor-extensions.createCursorNotificationNormalizer (cyclomatic 21) packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts:289— cursor-extensions.createCursorNotificationNormalizer has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 293, 305). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
codex-driver-values.differingJsonPaths (cyclomatic 21) packages/paperclip-runner/src/drivers/codex/codex-driver-values.ts:191— codex-driver-values.differingJsonPaths 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.
CodexHarnessSession.reconcile (cyclomatic 21) packages/paperclip-runner/src/drivers/codex/codex-harness-session.ts:687— CodexHarnessSession.reconcile 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.
environment.createSanitizedAcpxSpawnInput (cyclomatic 21) packages/paperclip-runner/src/drivers/acpx/environment.ts:101— environment.createSanitizedAcpxSpawnInput 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.
DurablePrpControlPlane.rotateRunIdentity (cyclomatic 21) REDACTED:1728— DurablePrpControlPlane.rotateRunIdentity 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. This is NOT this file's highest cyclomatic complexity: durable-prp-control-plane.warmTransitionReceipt (cyclomatic 23) 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 method is counted neither in this dimension's figures nor in its score.
durable-prp-control-plane.validStoredWarmTransition (cyclomatic 21) REDACTED:515— durable-prp-control-plane.validStoredWarmTransition has cyclomatic complexity 21 (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. This is NOT this file's highest cyclomatic complexity: durable-prp-control-plane.warmTransitionReceipt (cyclomatic 23) 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 method is counted neither in this dimension's figures nor in its score.
runnerd-codex-transport.awaitRunnerSuspensionBarrier (cyclomatic 21) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:756— runnerd-codex-transport.awaitRunnerSuspensionBarrier has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 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.
IssueHeader.IssueHeader (cyclomatic 21) packages/paperclip-runner/devtools/issue-thread/src/IssueHeader.tsx:33— IssueHeader.IssueHeader has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
forbidden-imports.violationReason (cyclomatic 21) packages/paperclip-runner/scripts/lib/forbidden-imports.mjs:166— forbidden-imports.violationReason 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.
cursor-native-usage.createCursorNativeUsage.begin (cyclomatic 21) packages/paperclip-runner/scripts/cursor-native-usage.mjs:21— cursor-native-usage.createCursorNativeUsage.begin 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.
provision-pi.provisionPi (cyclomatic 21) packages/paperclip-runner/scripts/provision-pi.mjs:52— provision-pi.provisionPi has cyclomatic complexity 21 (threshold 15). Of this number, 12 points are the body's own statements and 9 belong to 3 function literals inside it that branch. 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.
cursor-launch-policy.assertCursorWorkspacePolicy (cyclomatic 21) packages/paperclip-runner/src/drivers/acpx/cursor-launch-policy.ts:28— cursor-launch-policy.assertCursorWorkspacePolicy 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.
DotSession.command (cyclomatic 21) packages/paperclip-runner/src/drivers/dot/dot-harness-driver.ts:138— DotSession.command has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 153). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
workflow-traceability.validateStressTraceabilityManifest (cyclomatic 21) packages/paperclip-runner/src/eval/workflow-traceability.ts:29— workflow-traceability.validateStressTraceabilityManifest 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.
public-view.publicItem (cyclomatic 21) packages/paperclip-runner/src/issue-thread/public-view.ts:349— public-view.publicItem has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function literal 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.
scenario-parity.capabilityScenarioParity (cyclomatic 21) packages/paperclip-runner/src/scenarios/scenario-parity.ts:64— scenario-parity.capabilityScenarioParity has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
LiveConsoleScriptedSession.#runBeat (cyclomatic 21) packages/paperclip-runner/src/mock-core/live-console-scripted-driver.ts:504— LiveConsoleScriptedSession.#runBeat has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal 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.
redaction.sanitizeValue (cyclomatic 21) server/src/redaction.ts:751— redaction.sanitizeValue 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.
redaction.sanitizeRecord (cyclomatic 21) server/src/redaction.ts:899— redaction.sanitizeRecord 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.
environments.environmentService.update (cyclomatic 21) REDACTED:1134— environments.environmentService.update has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function literal 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.
worktree-config.collectSiblingWorktreePorts (cyclomatic 21) server/src/worktree-config.ts:232— worktree-config.collectSiblingWorktreePorts 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.
worktree-config.maybeRepairLegacyWorktreeConfigAndEnvFiles (cyclomatic 21) server/src/worktree-config.ts:450— worktree-config.maybeRepairLegacyWorktreeConfigAndEnvFiles has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 470). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
provider-fresh-workspace.reserveFreshPluginTaskWorkspace (cyclomatic 21) server/src/services/provider-fresh-workspace.ts:91— provider-fresh-workspace.reserveFreshPluginTaskWorkspace has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to one function literal inside it that branches (line 98). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
conversation-continuation.getConversationOwnershipBlocker (cyclomatic 21) server/src/services/conversation-continuation.ts:107— conversation-continuation.getConversationOwnershipBlocker 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.
agent-records.configPatchFromApprovalPayload (cyclomatic 21) server/src/lib/agent-records.ts:173— agent-records.configPatchFromApprovalPayload 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.
chat-sdk-runtime.createAttachmentRecoveryDescriptor (cyclomatic 21) server/src/services/chat-sdk-runtime.ts:1565— chat-sdk-runtime.createAttachmentRecoveryDescriptor 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.
heartbeat-run-summary.findHeartbeatRunCompletionComment (cyclomatic 21) server/src/services/heartbeat-run-summary.ts:623— heartbeat-run-summary.findHeartbeatRunCompletionComment 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.
chat-run-publications.githubRunReplyState (cyclomatic 21) server/src/services/chat-run-publications.ts:132— chat-run-publications.githubRunReplyState 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.
cron.parseField (cyclomatic 21) server/src/services/cron.ts:70— cron.parseField 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.
task-start.createSlackTaskStart.finalizeSlackTaskStartFailure (cyclomatic 21) server/src/services/chat-channels/slack/task-start.ts:188— task-start.createSlackTaskStart.finalizeSlackTaskStartFailure has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 240). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
execution-workspace-policy.buildExecutionWorkspaceAdapterConfig (cyclomatic 21) server/src/services/execution-workspace-policy.ts:435— execution-workspace-policy.buildExecutionWorkspaceAdapterConfig 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.
isolated-repository-rehome.inspectWorktree (cyclomatic 21) server/src/services/isolated-repository-rehome.ts:174— isolated-repository-rehome.inspectWorktree 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, 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.
isolated-repository-rehome.cloneDisposable (cyclomatic 21) server/src/services/isolated-repository-rehome.ts:540— isolated-repository-rehome.cloneDisposable has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
isolated-repository-rehome.rehomeExpiredIsolatedRestoration (cyclomatic 21) server/src/services/isolated-repository-rehome.ts:677— isolated-repository-rehome.rehomeExpiredIsolatedRestoration has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
workspace-instance-cleanup.cleanupWorktreeInstanceArtifacts (cyclomatic 21) server/src/services/workspace-instance-cleanup.ts:266— workspace-instance-cleanup.cleanupWorktreeInstanceArtifacts has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to 2 function items inside it that branch. 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.
local-service-supervisor.normalizeRegistryRecord (cyclomatic 21) server/src/services/local-service-supervisor.ts:97— local-service-supervisor.normalizeRegistryRecord has cyclomatic complexity 21 (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.
workspace-runtime.startLocalRuntimeService (cyclomatic 21) server/src/services/workspace-runtime.ts:7027— workspace-runtime.startLocalRuntimeService 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.
chat-github-webhook-config.resyncGitHubAppWebhook (cyclomatic 21) server/src/services/chat-github-webhook-config.ts:690— chat-github-webhook-config.resyncGitHubAppWebhook has cyclomatic complexity 21 (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.
chat-github-wizard.githubChatWizardService.start (cyclomatic 21) server/src/services/chat-github-wizard.ts:214— chat-github-wizard.githubChatWizardService.start has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to one function literal 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.
chat-teams-inline-images.prepareTeamsInlineImage (cyclomatic 21) server/src/services/chat-teams-inline-images.ts:286— chat-teams-inline-images.prepareTeamsInlineImage 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.
outbound-attachments.hydrateOutboundAttachment (cyclomatic 21) server/src/services/chat-channels/outbound-attachments.ts:75— outbound-attachments.hydrateOutboundAttachment has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to 2 function literals 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.
fast-response-provider.fastResponseModel (cyclomatic 21) server/src/services/fast-response-provider.ts:96— fast-response-provider.fastResponseModel has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 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.
wakeup-notices.createInboundWakeNotices.currentInboundWakeNotice (cyclomatic 21) server/src/services/chat-channels/inbound/wakeup-notices.ts:24— wakeup-notices.createInboundWakeNotices.currentInboundWakeNotice has cyclomatic complexity 21 (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.
root-threads.createDiscordRootThreads.reconcileDiscordRootThread (cyclomatic 21) server/src/services/chat-channels/discord/root-threads.ts:391— root-threads.createDiscordRootThreads.reconcileDiscordRootThread has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 493, 420, 448). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-channels.chatChannelService.applyProviderLifecycleEffect (cyclomatic 21) server/src/services/chat-channels.ts:2648— chat-channels.chatChannelService.applyProviderLifecycleEffect has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2733, 2810, 2659). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
github-grant-continuity.createGitHubGrantContinuity.refreshManagedGitHubGrantAccessOnce (cyclomatic 21) server/src/services/tool-access/github-grant-continuity.ts:62— github-grant-continuity.createGitHubGrantContinuity.refreshManagedGitHubGrantAccessOnce has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to 2 function literals 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.
aggregator-app-discovery.pages (cyclomatic 21) server/src/services/aggregator-app-discovery.ts:31— aggregator-app-discovery.pages 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.
tool-access.gitHubReadGrantAccess (cyclomatic 21) server/src/services/tool-access.ts:695— tool-access.gitHubReadGrantAccess has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
git-credentials.resolveManagedGitHubCredential::acquire (cyclomatic 21) server/src/services/git-credentials.ts:497— git-credentials.resolveManagedGitHubCredential::acquire 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.
github-external-object-provider.pullRequestSnapshot (cyclomatic 21) server/src/services/github-external-object-provider.ts:240— github-external-object-provider.pullRequestSnapshot 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.
issue-thread-interactions.issueThreadInteractionService.submitItemVerdicts (cyclomatic 21) server/src/services/issue-thread-interactions.ts:4176— issue-thread-interactions.issueThreadInteractionService.submitItemVerdicts has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 3 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 4188). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
issue-thread-interactions.issueThreadInteractionService.expireRequestConfirmationsSupersededByHistoricalComments (cyclomatic 21) server/src/services/issue-thread-interactions.ts:4463— issue-thread-interactions.issueThreadInteractionService.expireRequestConfirmationsSupersededByHistoricalComments has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to 3 function literals 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.
oauth.createPublicMcpOAuth.approveGrant (cyclomatic 21) server/src/services/public-mcp/oauth.ts:254— oauth.createPublicMcpOAuth.approveGrant has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
workspace-inspection.inspectGrokWorkspaceObligations (cyclomatic 21) server/src/services/grok-bot/workspace-inspection.ts:23— workspace-inspection.inspectGrokWorkspaceObligations has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 28). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-broker.createNativeExternalBroker.forward (cyclomatic 21) server/src/modules/external-agents/native-broker.ts:94— native-broker.createNativeExternalBroker.forward has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 belong to 2 function literals 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.
dot.createDotRunnerMcpTools.callTool (cyclomatic 21) server/src/modules/external-agents/dot.ts:607— dot.createDotRunnerMcpTools.callTool 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.
issues.listPendingFinalizeBlockerIssueIds (cyclomatic 21) server/src/services/issues.ts:2488— issues.listPendingFinalizeBlockerIssueIds 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.
stopped-codex-turn.completionScriptInput::literal (cyclomatic 21) server/src/services/native-runtime/stopped-codex-turn.ts:37— stopped-codex-turn.completionScriptInput::literal has cyclomatic complexity 21 (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. This is NOT this file's highest cyclomatic complexity: stopped-codex-turn.completionScriptInput (cyclomatic 26) 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 method is counted neither in this dimension's figures nor in its score.
provider-pack-layers.stageProviderPackLayers (cyclomatic 21) server/src/services/native-runtime/provider-pack-layers.ts:102— provider-pack-layers.stageProviderPackLayers has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 belong to 3 function items inside it that branch. 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.
PaperclipControlPlanePort.appendEvent (cyclomatic 21) server/src/services/native-runtime/paperclip-control-plane-port.ts:217— PaperclipControlPlanePort.appendEvent has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
company-skills.companySkillService.upsertImportedSkills (cyclomatic 21) server/src/services/company-skills.ts:6375— company-skills.companySkillService.upsertImportedSkills 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. This is NOT this file's highest cyclomatic complexity: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
fireflies-webhook.verifyFirefliesWebhook (cyclomatic 21) server/src/services/fireflies-webhook.ts:5— fireflies-webhook.verifyFirefliesWebhook has cyclomatic complexity 21 (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.
native-session-executor.runtimeInputLifecycleMetric (cyclomatic 21) server/src/services/native-runtime/native-session-executor.ts:1047— native-session-executor.runtimeInputLifecycleMetric 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.semanticProviderPlanMarkdown (cyclomatic 21) server/src/services/native-runtime/native-session-executor.ts:1148— native-session-executor.semanticProviderPlanMarkdown has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.runnerdAuthorityLifecycle (cyclomatic 21) server/src/services/native-runtime/native-session-executor.ts:2065— native-session-executor.runnerdAuthorityLifecycle 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.cleanupProviderHomeSnapshot::visit (cyclomatic 21) server/src/services/native-runtime/native-session-executor.ts:2542— native-session-executor.cleanupProviderHomeSnapshot::visit 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.createRunnerdBackendWithinSessionClaim.prepareRemoteRunner (cyclomatic 21) server/src/services/native-runtime/native-session-executor.ts:12301— native-session-executor.createRunnerdBackendWithinSessionClaim.prepareRemoteRunner has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to 3 function literals 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
plan-review-context.buildDocumentReviewContext (cyclomatic 21) server/src/services/plan-review-context.ts:347— plan-review-context.buildDocumentReviewContext has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to one function literal 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.
external-chat-question-response-input.materializeExternalChatQuestionResponseInput (cyclomatic 21) server/src/services/native-runtime/external-chat-question-response-input.ts:17— external-chat-question-response-input.materializeExternalChatQuestionResponseInput has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 5 of the 21 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 24, 98). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
app.FreshnessChip (cyclomatic 21) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:3624— app.FreshnessChip has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.IngestTab (cyclomatic 21) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:3978— app.IngestTab has cyclomatic complexity 21 (threshold 15). Of this number, 12 points are the body's own statements and 9 belong to one function item inside it that branches. 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.
check-no-git-push.stripLineComment (cyclomatic 21) scripts/check-no-git-push.mjs:61— check-no-git-push.stripLineComment has cyclomatic complexity 21 (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.
extract-proposed-events.classifyTypeNode (cyclomatic 21) scripts/extract-proposed-events.mjs:231— extract-proposed-events.classifyTypeNode 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.
org-chart-svg.guessRoleTag (cyclomatic 21) server/src/routes/org-chart-svg.ts:138— org-chart-svg.guessRoleTag has cyclomatic complexity 21 (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.
local-ai-credentials.readVerifiedLocalAiCredential (cyclomatic 21) server/src/services/local-ai-credentials.ts:11— local-ai-credentials.readVerifiedLocalAiCredential 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.
billing-reconciliation.billingReconciliationService.importInvoice (cyclomatic 21) server/src/services/billing-reconciliation.ts:26— billing-reconciliation.billingReconciliationService.importInvoice has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to one function literal inside it that branches (line 26). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
activity.activityService.runsForIssue (cyclomatic 21) server/src/services/activity.ts:430— activity.activityService.runsForIssue has cyclomatic complexity 21 (threshold 15). Of this number, 11 points are the body's own statements and 10 belong to one function literal 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.
dashboard.dashboardService.summary (cyclomatic 21) server/src/services/dashboard.ts:30— dashboard.dashboardService.summary 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.
company-portability.buildPortableProjectWorkspaces (cyclomatic 21) server/src/services/company-portability.ts:1491— company-portability.buildPortableProjectWorkspaces 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. This is NOT this file's highest cyclomatic complexity: company-portability.isSensitiveEnvKey (cyclomatic 26) 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 method is counted neither in this dimension's figures nor in its score.
slack-search-oauth.slackSearchOAuthService.accessToken (cyclomatic 21) server/src/services/connectors/slack-search-oauth.ts:223— slack-search-oauth.slackSearchOAuthService.accessToken has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 225, 261). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
built-in-agents.builtInAgentRoutes (cyclomatic 21) server/src/routes/built-in-agents.ts:72— built-in-agents.builtInAgentRoutes has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 8 function items inside it that branch (assertCanControlBuiltInRoutine, logBuiltInAgentMutation, a function literal at line 183, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
agent-action-audit.agentActionAuditService.list (cyclomatic 21) server/src/services/agent-action-audit.ts:55— agent-action-audit.agentActionAuditService.list 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.
plugin-host-services.buildHostServices.readAuthorizationPolicy (cyclomatic 21) server/src/services/plugin-host-services.ts:1512— plugin-host-services.buildHostServices.readAuthorizationPolicy 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.
notion-generic-live-lib.extractNotionIdentity::visit (cyclomatic 21) REDACTED:377— notion-generic-live-lib.extractNotionIdentity::visit 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.
cross-tab-poll.stableFingerprint::visit (cyclomatic 21) ui/src/lib/cross-tab-poll.ts:200— cross-tab-poll.stableFingerprint::visit 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.
useLocalAiLogin.useLocalAiLogin (cyclomatic 21) ui/src/components/ai-connections/useLocalAiLogin.ts:6— useLocalAiLogin.useLocalAiLogin has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 48, 28, 71). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
index.parseQuestionSet.questions (cyclomatic 21) ui/src/adapters/paperclip-runner/index.ts:538— index.parseQuestionSet.questions has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal 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.
SidebarShell.production.SidebarShell (cyclomatic 21) ui/src/components/SidebarShell.production.tsx:91— SidebarShell.production.SidebarShell has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to 4 function literals inside it that branch. 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.
DesignSandboxTasks.DesignSandboxTasks (cyclomatic 21) ui/src/pages/DesignSandboxTasks.tsx:28— DesignSandboxTasks.DesignSandboxTasks has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 belong to 3 function literals 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.
TaskListColumns.SortableColumnHeader (cyclomatic 21) ui/src/components/TaskListColumns.tsx:65— TaskListColumns.SortableColumnHeader has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to one function literal 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.
DispositionRecoveryNotice.dispositionRetryUnavailableReason (cyclomatic 21) ui/src/components/DispositionRecoveryNotice.tsx:40— DispositionRecoveryNotice.dispositionRetryUnavailableReason 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.
tool-taxonomy.toolActivityPresentation (cyclomatic 21) ui/src/components/task-chat/tool-taxonomy.ts:363— tool-taxonomy.toolActivityPresentation 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.
RichWorkProductCard.stateChipFor (cyclomatic 21) ui/src/components/task-chat/RichWorkProductCard.tsx:36— RichWorkProductCard.stateChipFor 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.
transcript-adapter.coalesceSettledTurns (cyclomatic 21) ui/src/components/task-chat/transcript-adapter.ts:1994— transcript-adapter.coalesceSettledTurns 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.
IssueThreadInteractionCard.TaskTreeNode (cyclomatic 21) ui/src/components/IssueThreadInteractionCard.tsx:557— IssueThreadInteractionCard.TaskTreeNode 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.
IssueThreadInteractionCard.ToolActionResolution (cyclomatic 21) ui/src/components/IssueThreadInteractionCard.tsx:1686— IssueThreadInteractionCard.ToolActionResolution 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.
DocumentAnnotationPopover.DocumentAnnotationPopover (cyclomatic 21) ui/src/components/DocumentAnnotationPopover.tsx:29— DocumentAnnotationPopover.DocumentAnnotationPopover has cyclomatic complexity 21 (threshold 15). Of this number, 11 points are the body's own statements and 10 belong to 6 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.
issue-change-receipt.formatIssueChangeValue (cyclomatic 21) ui/src/lib/issue-change-receipt.ts:63— issue-change-receipt.formatIssueChangeValue 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.
IssueMonitorBanner.buildMonitorSurfaceCopy (cyclomatic 21) ui/src/components/IssueMonitorBanner.tsx:77— IssueMonitorBanner.buildMonitorSurfaceCopy 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.
runRetryState.describeRunRetryState (cyclomatic 21) ui/src/lib/runRetryState.ts:47— runRetryState.describeRunRetryState 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.
activity-format.formatStructuredIssueChange (cyclomatic 21) ui/src/lib/activity-format.ts:420— activity-format.formatStructuredIssueChange 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.
activity-format.formatActivityVerb (cyclomatic 21) ui/src/lib/activity-format.ts:462— activity-format.formatActivityVerb 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.
ProjectAccessMembers.ProjectAccessMembers (cyclomatic 21) ui/src/components/ProjectAccessMembers.tsx:18— ProjectAccessMembers.ProjectAccessMembers has cyclomatic complexity 21 (threshold 15). Of this number, 12 points are the body's own statements and 9 belong to 4 function literals inside it that branch. 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.
RoutineHistoryTab.RevisionPreview (cyclomatic 21) ui/src/components/RoutineHistoryTab.tsx:490— RoutineHistoryTab.RevisionPreview has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
ExecutionWorkspaceDetail.readConfiguredRuntimeServicePorts (cyclomatic 21) ui/src/pages/ExecutionWorkspaceDetail.tsx:181— ExecutionWorkspaceDetail.readConfiguredRuntimeServicePorts has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 187, addServices). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AuditHub.AuditHub (cyclomatic 21) ui/src/pages/audit/AuditHub.tsx:22— AuditHub.AuditHub has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 belong to 5 function literals 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.
BudgetIncidentCard.BudgetIncidentCard (cyclomatic 21) ui/src/components/BudgetIncidentCard.tsx:28— BudgetIncidentCard.BudgetIncidentCard has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
FeedCard.getIconSpec (cyclomatic 21) ui/src/components/FeedCard.tsx:173— FeedCard.getIconSpec 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.
ProfileDetail.ProfileDetail (cyclomatic 21) ui/src/pages/tools/profiles/ProfileDetail.tsx:49— ProfileDetail.ProfileDetail has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 belong to 5 function literals inside it that branch. 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.
AggregatorAppManager.AccountObservations (cyclomatic 21) ui/src/pages/apps/AggregatorAppManager.tsx:33— AggregatorAppManager.AccountObservations has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to 2 function literals 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.
AssistantConnection.AssistantConnection (cyclomatic 21) ui/src/pages/apps/AssistantConnection.tsx:88— AssistantConnection.AssistantConnection has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
ComposioAppSetup.ComposioAppSetup (cyclomatic 21) ui/src/pages/apps/ComposioAppSetup.tsx:13— ComposioAppSetup.ComposioAppSetup has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 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.
ChatEndpointDetail.Access (cyclomatic 21) ui/src/pages/apps/chat/ChatEndpointDetail.tsx:674— ChatEndpointDetail.Access has cyclomatic complexity 21 (threshold 15). Of this number, 11 points are the body's own statements and 10 belong to 5 function literals 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.
AgentConnectionAccess.AgentConnectionAccess (cyclomatic 21) ui/src/pages/apps/app-detail/AgentConnectionAccess.tsx:6— AgentConnectionAccess.AgentConnectionAccess has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 3 of the 21 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 17, a function literal at line 61, remove, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
GatewaysList.GatewaysList (cyclomatic 21) ui/src/pages/apps/gateways/GatewaysList.tsx:31— GatewaysList.GatewaysList has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 97, 123, 172, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CompanySkills.CatalogDetailPane (cyclomatic 21) ui/src/pages/CompanySkills.tsx:1772— CompanySkills.CatalogDetailPane 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.
CompanySkills.production.CatalogDetailPane (cyclomatic 21) ui/src/pages/CompanySkills.production.tsx:1862— CompanySkills.production.CatalogDetailPane 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.
AiConnectionUsagePanel.AiConnectionUsagePanel (cyclomatic 21) ui/src/components/ai-connections/AiConnectionUsagePanel.tsx:75— AiConnectionUsagePanel.AiConnectionUsagePanel has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
ForkSkillDialog.ForkSkillDialog (cyclomatic 21) ui/src/components/skill-studio/ForkSkillDialog.tsx:39— ForkSkillDialog.ForkSkillDialog has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to 6 function items inside it that branch. 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.
TaskChatQueuedMessages.SortableQueuedMessage (cyclomatic 21) ui/src/components/task-chat/TaskChatQueuedMessages.tsx:78— TaskChatQueuedMessages.SortableQueuedMessage has cyclomatic complexity 21 (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.
RemoteMcpProductionSetup.RemoteMcpProductionSetup (cyclomatic 21) ui/src/features/connections/remote-mcp/RemoteMcpProductionSetup.tsx:30— RemoteMcpProductionSetup.RemoteMcpProductionSetup 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. This shape REPEATS in the file: one other method here (RemoteMcpProductionSetup.RemoteMcpProductionSetup::submit) 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.
ProviderStartupAttempt::validate (cyclomatic 21) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:143— ProviderStartupAttempt::validate has cyclomatic complexity 21 (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.
service-health-check.serviceHealthChecks (cyclomatic 20) cli/src/checks/service-health-check.ts:43— service-health-check.serviceHealthChecks 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.
teams.registerTeamCommands (cyclomatic 20) cli/src/commands/client/teams.ts:63— teams.registerTeamCommands has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 139, 222, 73, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
worktree.collectClaimedWorktreePorts (cyclomatic 20) cli/src/commands/worktree.ts:600— worktree.collectClaimedWorktreePorts 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.
remote-managed-runtime.prepareRemoteManagedRuntime (cyclomatic 20) packages/adapter-utils/src/remote-managed-runtime.ts:109— remote-managed-runtime.prepareRemoteManagedRuntime 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.
http2-bridge-server.createHttp2BridgeServer.handleStream (cyclomatic 20) packages/adapter-utils/src/http2-bridge-server.ts:1161— http2-bridge-server.createHttp2BridgeServer.handleStream 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.
execution-target.startAdapterExecutionTargetPaperclipBridge.forwardBridgeRequest (cyclomatic 20) REDACTED:4460— execution-target.startAdapterExecutionTargetPaperclipBridge.forwardBridgeRequest 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.
env-bindings.parseEnvBindings (cyclomatic 20) packages/adapter-utils/src/env-bindings.ts:26— env-bindings.parseEnvBindings 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.
runtime-config.parseCodexProvidersConfig (cyclomatic 20) packages/adapters/codex-local/src/server/runtime-config.ts:77— runtime-config.parseCodexProvidersConfig 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.
build-config.buildCodexLocalConfig (cyclomatic 20) packages/adapters/codex-local/src/ui/build-config.ts:34— build-config.buildCodexLocalConfig 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.
format-event.printPiStreamEvent (cyclomatic 20) packages/adapters/pi-local/src/cli/format-event.ts:29— format-event.printPiStreamEvent 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.
menu.Menu (cyclomatic 20) packages/paperclip-runner/devtools/browser/src/components/ui/menu.tsx:15— menu.Menu has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 9 function items inside it that branch (onMenuKeyDown, focusItem, a function literal at line 108, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
codex-turn-diff.parseCodexTurnDiff::finish (cyclomatic 20) packages/paperclip-runner/src/drivers/codex/codex-turn-diff.ts:93— codex-turn-diff.parseCodexTurnDiff::finish 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 shape REPEATS in the file: one other method here (codex-turn-diff.parseCodexTurnDiff) 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-security-config.codexExecutableReadOnlyRoots (cyclomatic 20) packages/paperclip-runner/src/drivers/codex/codex-security-config.ts:32— codex-security-config.codexExecutableReadOnlyRoots has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 belong to 2 function items inside it that branch. 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.
BoundedJsonCompactor.#endString (cyclomatic 20) packages/paperclip-runner/src/drivers/opencode/sse-frames.ts:311— BoundedJsonCompactor.#endString 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.
runtime-context-materializer.managedCodexProviderConfig (cyclomatic 20) packages/paperclip-runner/src/drivers/runtime-context-materializer.ts:313— runtime-context-materializer.managedCodexProviderConfig has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
opencode-server-driver.resolvePinnedOpenCodeCommand (cyclomatic 20) REDACTED:100— opencode-server-driver.resolvePinnedOpenCodeCommand 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-command.resolveCodexCommand (cyclomatic 20) packages/paperclip-runner/src/drivers/codex/codex-command.ts:6— codex-command.resolveCodexCommand has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 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.
Composer.Composer (cyclomatic 20) packages/paperclip-runner/devtools/issue-thread/src/Composer.tsx:35— Composer.Composer has cyclomatic complexity 20 (threshold 15). Of this number, 14 points are the body's own statements and 6 belong to 3 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.
ThreadItems.ThreadItemView (cyclomatic 20) packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx:325— ThreadItems.ThreadItemView 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.
materialize-cursor-distribution.cursorDistributionClosure::walk (cyclomatic 20) packages/paperclip-runner/scripts/materialize-cursor-distribution.mjs:27— materialize-cursor-distribution.cursorDistributionClosure::walk 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.
forbidden-imports.findSpecifiersInFiles (cyclomatic 20) packages/paperclip-runner/scripts/lib/forbidden-imports.mjs:50— forbidden-imports.findSpecifiersInFiles has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 3 function items inside it that branch (visit, add, a function literal at line 63). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
installation-integrity.openVerifiedRuntimeExecutable (cyclomatic 20) packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts:1206— installation-integrity.openVerifiedRuntimeExecutable has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
provision-pi.provisionPackageRoot (cyclomatic 20) packages/paperclip-runner/scripts/provision-pi.mjs:20— provision-pi.provisionPackageRoot has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PiToolIdentities.normalize (cyclomatic 20) packages/paperclip-runner/src/drivers/acpx/pi-acp-runtime.ts:263— PiToolIdentities.normalize 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.
native-session-runtime.reconcileRecoveryCheckpoint (cyclomatic 20) packages/paperclip-runner/src/native-session-runtime.ts:1569— native-session-runtime.reconcileRecoveryCheckpoint 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.
authorization.decidePaperclipSemanticAuthorization (cyclomatic 20) packages/paperclip-runner/src/semantic-tools/authorization.ts:11— authorization.decidePaperclipSemanticAuthorization 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.
ScenarioChatDemoRuntime.handle (cyclomatic 20) REDACTED:570— ScenarioChatDemoRuntime.handle 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.
authorization.scopeAllows (cyclomatic 20) server/src/services/authorization.ts:425— authorization.scopeAllows 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.
secrets.secretResolutionErrorCode (cyclomatic 20) server/src/services/secrets.ts:839— secrets.secretResolutionErrorCode 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.
secrets.secretService.collectMissingRuntimeBindings (cyclomatic 20) server/src/services/secrets.ts:5290— secrets.secretService.collectMissingRuntimeBindings has cyclomatic complexity 20 (threshold 15). Of this number, 12 points are the body's own statements and 8 belong to 2 function literals 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.
issue-recovery-actions.issueRecoveryActionService.projectNativeRunActivity (cyclomatic 20) server/src/services/issue-recovery-actions.ts:160— issue-recovery-actions.issueRecoveryActionService.projectNativeRunActivity has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to one function literal 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.
issue-execution-policy.normalizeIssueExecutionPolicy (cyclomatic 20) server/src/services/issue-execution-policy.ts:346— issue-execution-policy.normalizeIssueExecutionPolicy has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 belong to 3 function literals inside it that branch. 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.
chat-telegram-media-intake.mp3 (cyclomatic 20) server/src/services/chat-telegram-media-intake.ts:571— chat-telegram-media-intake.mp3 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.
UploadCapability.exchange (cyclomatic 20) server/src/services/chat-teams-file-consent.ts:422— UploadCapability.exchange 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.
ChatSdkEndpointRuntime.attachmentRecoveryDescriptor (cyclomatic 20) server/src/services/chat-sdk-runtime.ts:2741— ChatSdkEndpointRuntime.attachmentRecoveryDescriptor 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.
chat-attachment-reuse.principalAuthorized (cyclomatic 20) server/src/services/native-runtime/chat-attachment-reuse.ts:338— chat-attachment-reuse.principalAuthorized has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 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.
voice-inbound-service.voiceInboundService.saveConfiguration (cyclomatic 20) server/src/services/voice/voice-inbound-service.ts:63— voice-inbound-service.voiceInboundService.saveConfiguration has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
decision-model-provider.runDecisionProvider (cyclomatic 20) server/src/services/decision-model-provider.ts:43— decision-model-provider.runDecisionProvider has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to one function literal 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.
tool-access-policy.timeWindowMatches (cyclomatic 20) server/src/services/tool-access-policy.ts:473— tool-access-policy.timeWindowMatches has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to one function literal 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. This is NOT this file's highest cyclomatic complexity: tool-access-policy.toolAccessPolicyService.admittedRateLimitAdmissions (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 method is counted neither in this dimension's figures nor in its score.
tool-access-policy.toolAccessPolicyService.createTrustRuleFromActionRequest (cyclomatic 20) server/src/services/tool-access-policy.ts:1938— tool-access-policy.toolAccessPolicyService.createTrustRuleFromActionRequest 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. This is NOT this file's highest cyclomatic complexity: tool-access-policy.toolAccessPolicyService.admittedRateLimitAdmissions (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 method is counted neither in this dimension's figures nor in its score.
mcp-http.readMcpHttpResponse (cyclomatic 20) server/src/services/mcp-http.ts:180— mcp-http.readMcpHttpResponse has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 belong to 3 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.
tool-gateway.createToolGatewayService.resolveRunContext (cyclomatic 20) server/src/services/tool-gateway.ts:1715— tool-gateway.createToolGatewayService.resolveRunContext 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.
identity-links.createChatIdentityLinks.confirmIdentityLink (cyclomatic 20) server/src/services/chat-channels/identity-links.ts:232— identity-links.createChatIdentityLinks.confirmIdentityLink has cyclomatic complexity 20 (threshold 15). Of this number, 10 points are the body's own statements and 10 belong to one function literal inside it that branches. 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.
isolated-remote-workspace-source.canIsolateRemoteWorkspaceSource (cyclomatic 20) server/src/services/isolated-remote-workspace-source.ts:86— isolated-remote-workspace-source.canIsolateRemoteWorkspaceSource has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
git-workspace-contents.restoreSettings (cyclomatic 20) server/src/services/git-workspace-contents.ts:171— git-workspace-contents.restoreSettings has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
effective-run-config-fingerprints.canonicalizeValue (cyclomatic 20) server/src/services/effective-run-config-fingerprints.ts:305— effective-run-config-fingerprints.canonicalizeValue has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal 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.
workspaces.buildExecutionWorkspaceConfigSnapshot (cyclomatic 20) server/src/services/heartbeat/workspaces.ts:274— workspaces.buildExecutionWorkspaceConfigSnapshot has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
workspaces.assertGitWorktreeBaseWorkspaceReady (cyclomatic 20) server/src/services/heartbeat/workspaces.ts:923— workspaces.assertGitWorktreeBaseWorkspaceReady 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, 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.
execution-workspaces.executionWorkspaceService.compactTerminalWorkspace (cyclomatic 20) server/src/services/execution-workspaces.ts:2322— execution-workspaces.executionWorkspaceService.compactTerminalWorkspace has cyclomatic complexity 20 (threshold 15). Of this number, 12 points are the body's own statements and 8 belong to one function literal inside it that branches. 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-setup.createGitHubAppSetup.storeGitHubApp (cyclomatic 20) server/src/services/chat-channels/github/app-setup.ts:91— app-setup.createGitHubAppSetup.storeGitHubApp has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 94, 105, 125). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-discord-native-commands.parseDiscordNativeCommandReceipt (cyclomatic 20) server/src/services/chat-discord-native-commands.ts:226— chat-discord-native-commands.parseDiscordNativeCommandReceipt has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
anthropic-pricing.priceAnthropicReceipt (cyclomatic 20) server/src/services/anthropic-pricing.ts:12— anthropic-pricing.priceAnthropicReceipt has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
email-channels.emailChannelService.runTick (cyclomatic 20) server/src/services/email-channels.ts:2142— email-channels.emailChannelService.runTick has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 2163, 2258, 2194, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
connection-intents.connectionIntentService.requestForRunAuthFailure (cyclomatic 20) server/src/services/connection-intents.ts:1207— connection-intents.connectionIntentService.requestForRunAuthFailure has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
messages.microsoftTeamsLifecycleEventFromPayload (cyclomatic 20) server/src/services/chat-channels/microsoft-teams/messages.ts:18— messages.microsoftTeamsLifecycleEventFromPayload 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.
direct-callback.createDirectOAuthCallback::completeOAuthCallback (cyclomatic 20) server/src/services/tool-access/oauth/direct-callback.ts:55— direct-callback.createDirectOAuthCallback::completeOAuthCallback 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.
vercel-callback.createVercelOAuthCallback::completeVercelConnectCallback (cyclomatic 20) server/src/services/tool-access/oauth/vercel-callback.ts:33— vercel-callback.createVercelOAuthCallback::completeVercelConnectCallback 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.
issue-thread-interactions.issueThreadInteractionService.rejectRequestConfirmation (cyclomatic 20) server/src/services/issue-thread-interactions.ts:2425— issue-thread-interactions.issueThreadInteractionService.rejectRequestConfirmation has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 2454). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
oauth.createPublicMcpOAuth.dotPairingContext (cyclomatic 20) server/src/services/public-mcp/oauth.ts:298— oauth.createPublicMcpOAuth.dotPairingContext has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
native-broker.createNativeExternalBroker.operation (cyclomatic 20) server/src/modules/external-agents/native-broker.ts:159— native-broker.createNativeExternalBroker.operation 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.
dot-runner.createDotRunnerMcpBridge.callTool (cyclomatic 20) server/src/services/public-mcp/dot-runner.ts:53— dot-runner.createDotRunnerMcpBridge.callTool 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.
dot.createBroker.requestWork (cyclomatic 20) server/src/modules/external-agents/dot.ts:375— dot.createBroker.requestWork has cyclomatic complexity 20 (threshold 15). Of this number, 16 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.
dot.createBroker.challenge (cyclomatic 20) server/src/modules/external-agents/dot.ts:447— dot.createBroker.challenge has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 454). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
dot.createBroker.stopGrokWork (cyclomatic 20) server/src/modules/external-agents/dot.ts:491— dot.createBroker.stopGrokWork has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to one function literal inside it that branches (line 492). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
issues.listBlockedInboxIssues (cyclomatic 20) server/src/services/issues.ts:6431— issues.listBlockedInboxIssues has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 belong to one function literal inside it that branches. 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.
company-skills.discoverProjectWorkspaceSkillDirectories (cyclomatic 20) server/src/services/company-skills.ts:1475— company-skills.discoverProjectWorkspaceSkillDirectories 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: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
routines.routineService.restoreRevision (cyclomatic 20) server/src/services/routines.ts:2743— routines.routineService.restoreRevision has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 2773, 2795). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PaperclipRunnerToolAuthority.#assertDotApiFileAccess (cyclomatic 20) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:1114— PaperclipRunnerToolAuthority.#assertDotApiFileAccess 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.
run-failure-diagnostics.collectRunFailureSecretValues (cyclomatic 20) REDACTED:176— run-failure-diagnostics.collectRunFailureSecretValues has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
run-failure-report.isMissingSecretConfigurationBlocker (cyclomatic 20) server/src/services/run-failure-report.ts:92— run-failure-report.isMissingSecretConfigurationBlocker has cyclomatic complexity 20 (threshold 15). Of this number, 12 points are the body's own statements and 8 belong to one function literal inside it that branches. 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-preparation.createHeartbeatRunPreparation.resolveResponsibleUserIdForRunSeed (cyclomatic 20) server/src/services/heartbeat/run-preparation.ts:3162— run-preparation.createHeartbeatRunPreparation.resolveResponsibleUserIdForRunSeed 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.
run-state.buildExplicitResumeSessionOverride (cyclomatic 20) server/src/services/heartbeat/run-state.ts:591— run-state.buildExplicitResumeSessionOverride 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.
run-state.resolveNextSessionState (cyclomatic 20) server/src/services/heartbeat/run-state.ts:912— run-state.resolveNextSessionState 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.
service.recoveryService.enqueueStrandedIssueRecovery (cyclomatic 20) REDACTED:1995— service.recoveryService.enqueueStrandedIssueRecovery 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.
idle-drain.createPluginIdleDrain.prepare (cyclomatic 20) packages/plugins/sdk/src/idle-drain.ts:32— idle-drain.createPluginIdleDrain.prepare 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.
worker-rpc-host.startWorkerRpcHost.handleLine (cyclomatic 20) packages/plugins/sdk/src/worker-rpc-host.ts:2325— worker-rpc-host.startWorkerRpcHost.handleLine has cyclomatic complexity 20 (threshold 15). Of this number, 14 points are the body's own statements and 6 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.
issue.paperclipQuestionSchema (cyclomatic 20) packages/shared/src/validators/issue.ts:1364— issue.paperclipQuestionSchema has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
issue-references.stripMarkdownCode (cyclomatic 20) packages/shared/src/issue-references.ts:16— issue-references.stripMarkdownCode 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.
external-objects-server.stripMarkdownCode (cyclomatic 20) packages/shared/src/external-objects-server.ts:17— external-objects-server.stripMarkdownCode 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.
catalog-builder.validateLocalReferences (cyclomatic 20) packages/teams-catalog/src/catalog-builder.ts:480— catalog-builder.validateLocalReferences 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.
authz.assertCompanyAccess (cyclomatic 20) server/src/routes/authz.ts:75— authz.assertCompanyAccess has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal 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.
local-ai-login.localAiLoginService.start (cyclomatic 20) server/src/services/local-ai-login.ts:86— local-ai-login.localAiLoginService.start has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 90). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
company-search.issueFilterConditions (cyclomatic 20) server/src/services/company-search.ts:272— company-search.issueFilterConditions 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.
feedback.feedbackService.saveIssueVote (cyclomatic 20) server/src/services/feedback.ts:1926— feedback.feedbackService.saveIssueVote has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to one function literal inside it that branches (line 1935). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
artifact-review-documents.artifactReviewDocumentService.ensureForWorkProduct (cyclomatic 20) server/src/services/artifact-review-documents.ts:157— artifact-review-documents.artifactReviewDocumentService.ensureForWorkProduct 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.
github-connection-events.githubConnectionEventService.runPoll (cyclomatic 20) server/src/services/github-connection-events.ts:463— github-connection-events.githubConnectionEventService.runPoll 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.
attention.blockedWorkCountMap (cyclomatic 20) server/src/services/attention.ts:995— attention.blockedWorkCountMap has cyclomatic complexity 20 (threshold 15). Of this number, 18 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.
decisions.parseAttentionArchiveManifest (cyclomatic 20) server/src/services/decisions.ts:76— decisions.parseAttentionArchiveManifest has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
decisions.decisionService.list (cyclomatic 20) server/src/services/decisions.ts:265— decisions.decisionService.list has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 belong to one function literal inside it that branches. 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.
muse-maintenance.startMuseMaintenance (cyclomatic 20) server/src/services/muse-maintenance.ts:9— muse-maintenance.startMuseMaintenance has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal 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.
public-mcp.publicMcpManagementRoutes (cyclomatic 20) REDACTED:198— public-mcp.publicMcpManagementRoutes has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 11 function items inside it that branch (requestOAuth, realUser, sameOrigin, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
workspace-readiness.resolveWorkspaceReadiness (cyclomatic 20) server/src/services/workspace-readiness.ts:183— workspace-readiness.resolveWorkspaceReadiness 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.
skill-sources.skillSourceService.importFromUrl (cyclomatic 20) server/src/services/skill-sources.ts:423— skill-sources.skillSourceService.importFromUrl has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 belong to 2 function literals inside it that branch. 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.
issues.buildExecutionStageWakeup (cyclomatic 20) server/src/routes/issues.ts:2754— issues.buildExecutionStageWakeup 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.
assets.sanitizeSvgBuffer (cyclomatic 20) server/src/routes/assets.ts:27— assets.sanitizeSvgBuffer has cyclomatic complexity 20 (threshold 15). Of this number, 15 points are the body's own statements and 5 belong to one function literal 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.
plugin-host-services.buildHostServices.queuePluginInteractionContinuationWakeup (cyclomatic 20) server/src/services/plugin-host-services.ts:1066— plugin-host-services.buildHostServices.queuePluginInteractionContinuationWakeup 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.
posthog-live.completePosthogAuthorization (cyclomatic 20) scripts/smoke/posthog-live.mjs:277— posthog-live.completePosthogAuthorization has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal 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.
prepare-native-run.prepareNativeHeartbeatRun (cyclomatic 20) server/src/services/native-runtime/prepare-native-run.ts:39— prepare-native-run.prepareNativeHeartbeatRun has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 100). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-replacement-evidence.decideNativeReplacement (cyclomatic 20) server/src/services/native-runtime/native-replacement-evidence.ts:25— native-replacement-evidence.decideNativeReplacement has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 belong to 3 function literals inside it that branch. 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.
sw.self.addEventListener("fetch") (cyclomatic 20) ui/public/sw.js:101— sw.self.addEventListener("fetch") has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 154, 137, 146). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
remark-workspace-file-refs.parseWorkspaceFileHref (cyclomatic 20) ui/src/lib/remark-workspace-file-refs.ts:36— remark-workspace-file-refs.parseWorkspaceFileHref 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.
inbox.buildInboxIssueGroupCreateDefaults (cyclomatic 20) ui/src/lib/inbox.ts:1015— inbox.buildInboxIssueGroupCreateDefaults 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.
CompanySettingsSidebar.CompanySettingsSidebar (cyclomatic 20) ui/src/components/CompanySettingsSidebar.tsx:45— CompanySettingsSidebar.CompanySettingsSidebar has cyclomatic complexity 20 (threshold 15). Of this number, 15 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
qualify-claude-setup.qualifyRunnerEnvironment (cyclomatic 20) ui/src/lib/qualify-claude-setup.ts:31— qualify-claude-setup.qualifyRunnerEnvironment has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
index.parseDeltaEvent (cyclomatic 20) ui/src/adapters/paperclip-runner/index.ts:267— index.parseDeltaEvent has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to one function literal 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.
issueDetailBreadcrumb.isIssueDetailHeaderSeed (cyclomatic 20) ui/src/lib/issueDetailBreadcrumb.ts:56— issueDetailBreadcrumb.isIssueDetailHeaderSeed has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
issue-monitor.deriveMonitorState (cyclomatic 20) ui/src/lib/issue-monitor.ts:176— issue-monitor.deriveMonitorState 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.
TaskChatPlanPreviewCard.TaskChatPlanPreviewCard (cyclomatic 20) ui/src/components/task-chat/TaskChatPlanPreviewCard.tsx:79— TaskChatPlanPreviewCard.TaskChatPlanPreviewCard 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.
composer-draft.loadDraftSubmission (cyclomatic 20) ui/src/lib/composer-draft.ts:106— composer-draft.loadDraftSubmission has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
IssueThreadInteractionCard.RequestConfirmationResolution (cyclomatic 20) ui/src/components/IssueThreadInteractionCard.tsx:1555— IssueThreadInteractionCard.RequestConfirmationResolution 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.
IssueThreadInteractionCard.RequestConnectionAuthorizationCard (cyclomatic 20) ui/src/components/IssueThreadInteractionCard.tsx:2380— IssueThreadInteractionCard.RequestConnectionAuthorizationCard has cyclomatic complexity 20 (threshold 15). Of this number, 18 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.
TaskChatThread.acceptedSemanticResultVerificationCaveats (cyclomatic 20) ui/src/components/TaskChatThread.tsx:361— TaskChatThread.acceptedSemanticResultVerificationCaveats has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 393, 370). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
issue-output.getOutputFileGlyph (cyclomatic 20) ui/src/lib/issue-output.ts:185— issue-output.getOutputFileGlyph 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.
EntityRow.EntityRow (cyclomatic 20) ui/src/components/EntityRow.tsx:46— EntityRow.EntityRow has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RunTranscriptView.summarizeToolDecision (cyclomatic 20) ui/src/components/transcript/RunTranscriptView.tsx:403— RunTranscriptView.summarizeToolDecision has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RunTranscriptView.RunTranscriptView (cyclomatic 20) ui/src/components/transcript/RunTranscriptView.tsx:1847— RunTranscriptView.RunTranscriptView has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1887, 1862). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentDetail.RunInvocationCard (cyclomatic 20) ui/src/pages/AgentDetail.tsx:447— AgentDetail.RunInvocationCard has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DecisionQueuePage.DecisionQueuePage (cyclomatic 20) ui/src/pages/DecisionQueuePage.tsx:61— DecisionQueuePage.DecisionQueuePage has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 belong to 7 function literals inside it that branch. 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.
EmailEndpointSetup.readEmailSetupDraft (cyclomatic 20) ui/src/pages/apps/chat/EmailEndpointSetup.tsx:64— EmailEndpointSetup.readEmailSetupDraft 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.
GatewayDetail.GatewayDetail (cyclomatic 20) ui/src/pages/apps/gateways/GatewayDetail.tsx:29— GatewayDetail.GatewayDetail has cyclomatic complexity 20 (threshold 15). Of this number, 12 points are the body's own statements and 8 belong to 5 function literals inside it that branch. 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.
CompanyImport.ImportPreviewPane (cyclomatic 20) ui/src/pages/CompanyImport.tsx:205— CompanyImport.ImportPreviewPane has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to one function literal 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.
DesignGuide.DesignGuide (cyclomatic 20) REDACTED:508— DesignGuide.DesignGuide has cyclomatic complexity 20 (threshold 15). Of this number, 12 points are the body's own statements and 8 belong to 4 function literals inside it that branch. 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.
AdapterManager.AdapterRow (cyclomatic 20) ui/src/pages/AdapterManager.tsx:36— AdapterManager.AdapterRow has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
IssuePrivacyActions.IssuePrivacyActions (cyclomatic 20) ui/src/components/IssuePrivacyActions.tsx:40— IssuePrivacyActions.IssuePrivacyActions has cyclomatic complexity 20 (threshold 15). Of this number, 15 points are the body's own statements and 5 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.
TweakPanel.TweakPanel (cyclomatic 20) ui/src/components/task-chat/TweakPanel.tsx:46— TweakPanel.TweakPanel has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 164, 61, 82, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
webhook-url-warning.webhookUrlWarningReason (cyclomatic 20) ui/src/lib/webhook-url-warning.ts:12— webhook-url-warning.webhookUrlWarningReason 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.
AgentDetail.production.RunInvocationCard (cyclomatic 20) ui/src/pages/AgentDetail.production.tsx:435— AgentDetail.production.RunInvocationCard has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ComposerRunSettingsLiveStory.ComposerRunSettingsLiveStory (cyclomatic 20) ui/storybook/prototypes/composer-model-picker/ComposerRunSettingsLiveStory.tsx:41— ComposerRunSettingsLiveStory.ComposerRunSettingsLiveStory has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 belong to 4 function items inside it that branch. 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.
UploadPreview.UploadPreview (cyclomatic 20) ui/storybook/support/artifact-upload/UploadPreview.tsx:15— UploadPreview.UploadPreview has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to 8 function items inside it that branch (handlePreviewLink, a function literal at line 17, a function literal at line 40, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentWorkloadTrial.AgentWorkloadContent (cyclomatic 20) ui/storybook/support/design-proposals/AgentWorkloadTrial.tsx:55— AgentWorkloadTrial.AgentWorkloadContent has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 88, 67, 128, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AcpxProviderSessionConfig::validate (cyclomatic 20) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs:109— AcpxProviderSessionConfig::validate 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.
(anonymous) (cyclomatic 20) docker/openclaw-smoke/server.mjs:43— (anonymous) 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.
mcp-auth.loginMcpDevice (cyclomatic 19) cli/src/client/mcp-auth.ts:148— mcp-auth.loginMcpDevice 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.
storage.promptStorage (cyclomatic 19) cli/src/prompts/storage.ts:25— storage.promptStorage has cyclomatic complexity 19 (threshold 15). Of this number, 13 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
service.registerServiceCommands (cyclomatic 19) cli/src/commands/service.ts:166— service.registerServiceCommands has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 174, 198, 228, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-restore-diagnostics.sanitizeWorkspaceRestoreDiagnostic (cyclomatic 19) packages/adapter-utils/src/workspace-restore-diagnostics.ts:175— workspace-restore-diagnostics.sanitizeWorkspaceRestoreDiagnostic 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.
workspace-restore-merge.directoryMergeConflicts (cyclomatic 19) packages/adapter-utils/src/workspace-restore-merge.ts:707— workspace-restore-merge.directoryMergeConflicts has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 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.
execute.emitRuntimeEvent (cyclomatic 19) packages/adapter-utils/src/acpx-engine/execute.ts:3230— execute.emitRuntimeEvent 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.
execute.describeErrorDiagnostics (cyclomatic 19) packages/adapter-utils/src/acpx-engine/execute.ts:3479— execute.describeErrorDiagnostics 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.
CodexRpcClient.onStdout (cyclomatic 19) packages/adapters/codex-local/src/server/quota.ts:518— CodexRpcClient.onStdout 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.
quota-probe.main (cyclomatic 19) packages/adapters/codex-local/src/cli/quota-probe.ts:35— quota-probe.main 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.
parse-stdout.parseCommandExecutionItem (cyclomatic 19) packages/adapters/codex-local/src/ui/parse-stdout.ts:52— parse-stdout.parseCommandExecutionItem has cyclomatic complexity 19 (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.
parse-stdout.parseSdkMessage (cyclomatic 19) packages/adapters/cursor-cloud/src/ui/parse-stdout.ts:55— parse-stdout.parseSdkMessage 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.
replay-contract.versionIssues (cyclomatic 19) packages/paperclip-runner/src/protocol/replay-contract.ts:169— replay-contract.versionIssues has cyclomatic complexity 19 (threshold 15). Of this number, 11 points are the body's own statements and 8 belong to one function literal 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.
pi-extension-adapter.createPiProfileExtensionAdapter.notification (cyclomatic 19) packages/paperclip-runner/src/drivers/acpx/pi-extension-adapter.ts:15— pi-extension-adapter.createPiProfileExtensionAdapter.notification 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.
completion-continuation.resolveCompletionContinuation (cyclomatic 19) packages/paperclip-runner/src/drivers/completion-continuation.ts:2— completion-continuation.resolveCompletionContinuation has cyclomatic complexity 19 (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-runner.replayPersistedCodexEvents (cyclomatic 19) packages/paperclip-runner/src/mock-core/codex-runner.ts:259— codex-runner.replayPersistedCodexEvents 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.
capability-clean-room-smoke.main (cyclomatic 19) packages/paperclip-runner/scripts/capability-clean-room-smoke.mjs:66— capability-clean-room-smoke.main has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
archive.decodeControlledEvidence (cyclomatic 19) packages/paperclip-runner/scripts/controlled-evals/archive.mjs:77— archive.decodeControlledEvidence has cyclomatic complexity 19 (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.
installation-integrity.inspectCommand (cyclomatic 19) packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts:1133— installation-integrity.inspectCommand has cyclomatic complexity 19 (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.
grok-credentials.stageManagedGrokCredential (cyclomatic 19) packages/paperclip-runner/src/drivers/acpx/grok-credentials.ts:12— grok-credentials.stageManagedGrokCredential has cyclomatic complexity 19 (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.
opencode-app-server-proxy.pumpEvents (cyclomatic 19) packages/paperclip-runner/src/cli/opencode-app-server-proxy.ts:194— opencode-app-server-proxy.pumpEvents 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.
CapabilityToolAuthorizationEngine.#evaluate (cyclomatic 19) packages/paperclip-runner/src/tools/capability-tool-authorization.ts:85— CapabilityToolAuthorizationEngine.#evaluate 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.
pi-acp-runtime.snapshotPiWorkspaceFile (cyclomatic 19) packages/paperclip-runner/src/drivers/acpx/pi-acp-runtime.ts:339— pi-acp-runtime.snapshotPiWorkspaceFile has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
workflow-scoring.scoreRunnerWorkflow (cyclomatic 19) packages/paperclip-runner/src/eval/workflow-scoring.ts:90— workflow-scoring.scoreRunnerWorkflow 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.
provider-profile.claudeRunnerUnsupportedSettings (cyclomatic 19) server/src/services/native-runtime/provider-profile.ts:387— provider-profile.claudeRunnerUnsupportedSettings has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
secrets.secretService.resolveSecretValueForAgentAccess (cyclomatic 19) server/src/services/secrets.ts:1594— secrets.secretService.resolveSecretValueForAgentAccess has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal 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.
secrets.secretService.completeClaudeOAuthUserSecret (cyclomatic 19) server/src/services/secrets.ts:3271— secrets.secretService.completeClaudeOAuthUserSecret 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.
secrets.secretService.resolveUserSecretValue (cyclomatic 19) server/src/services/secrets.ts:4220— secrets.secretService.resolveUserSecretValue 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.
legacy-workspace-restore-recovery.matchesOriginalSource (cyclomatic 19) server/src/services/legacy-workspace-restore-recovery.ts:33— legacy-workspace-restore-recovery.matchesOriginalSource has cyclomatic complexity 19 (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.
hot-restart.isObservedHotRestartTargetAlive (cyclomatic 19) server/src/services/hot-restart.ts:234— hot-restart.isObservedHotRestartTargetAlive 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.
chat-question-forms.formKind (cyclomatic 19) server/src/services/chat-question-forms.ts:216— chat-question-forms.formKind 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.
interactions.parsePhotonQuestionAnswer (cyclomatic 19) server/src/services/photon/interactions.ts:76— interactions.parsePhotonQuestionAnswer 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.
chat-run-publications.enqueueChatRunMilestones (cyclomatic 19) server/src/services/chat-run-publications.ts:661— chat-run-publications.enqueueChatRunMilestones 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.
plugin-capability-validator.pluginCapabilityValidator.validateManifestCapabilities (cyclomatic 19) server/src/services/plugin-capability-validator.ts:466— plugin-capability-validator.pluginCapabilityValidator.validateManifestCapabilities 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.
plugin-database.splitSqlStatements (cyclomatic 19) server/src/services/plugin-database.ts:57— plugin-database.splitSqlStatements 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.
bundled-plugins.reconcileBundledPluginManifest (cyclomatic 19) server/src/services/bundled-plugins.ts:261— bundled-plugins.reconcileBundledPluginManifest 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.
plugin-loader.ensureLocalPluginBuilt (cyclomatic 19) REDACTED:877— plugin-loader.ensureLocalPluginBuilt 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.
credentials.verifyGitHubCredentials (cyclomatic 19) server/src/services/chat-channels/github/credentials.ts:26— credentials.verifyGitHubCredentials has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to one function literal 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.
execution-workspace-policy.parseExecutionWorkspaceStrategy (cyclomatic 19) server/src/services/execution-workspace-policy.ts:33— execution-workspace-policy.parseExecutionWorkspaceStrategy has cyclomatic complexity 19 (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.
git-restore-point.writeIgnoredFiles (cyclomatic 19) REDACTED:257— git-restore-point.writeIgnoredFiles has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to one function literal 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.
git-restore-point.decodeRestorePointPayload (cyclomatic 19) REDACTED:395— git-restore-point.decodeRestorePointPayload has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
git-workspace-restoration.finishGitCacheTrash (cyclomatic 19) server/src/services/git-workspace-restoration.ts:672— git-workspace-restoration.finishGitCacheTrash has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal 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. This is NOT this file's highest cyclomatic complexity: git-workspace-restoration.readGitCacheRestoration (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 method is counted neither in this dimension's figures nor in its score.
isolated-task-directory-retention.sweepIsolatedTaskDirectories (cyclomatic 19) server/src/services/isolated-task-directory-retention.ts:555— isolated-task-directory-retention.sweepIsolatedTaskDirectories has cyclomatic complexity 19 (threshold 15). Of this number, 18 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.
local-service-supervisor.terminateLocalService (cyclomatic 19) server/src/services/local-service-supervisor.ts:548— local-service-supervisor.terminateLocalService has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to 2 function items inside it that branch. 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.
workspace-runtime.restartDesiredRuntimeServicesOnStartup (cyclomatic 19) server/src/services/workspace-runtime.ts:8872— workspace-runtime.restartDesiredRuntimeServicesOnStartup 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.
execution-workspaces.preserveWorkspaceMetadataForPatch (cyclomatic 19) server/src/services/execution-workspaces.ts:261— execution-workspaces.preserveWorkspaceMetadataForPatch 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.
chat-github-webhook-config.nextCursor (cyclomatic 19) server/src/services/chat-github-webhook-config.ts:190— chat-github-webhook-config.nextCursor 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.
chat-github-cloud-ingress.dispatchGitHubBotCloudEvent (cyclomatic 19) server/src/services/chat-github-cloud-ingress.ts:29— chat-github-cloud-ingress.dispatchGitHubBotCloudEvent has cyclomatic complexity 19 (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.
chat-github-registration.githubChatRegistrationService.start (cyclomatic 19) server/src/services/chat-github-registration.ts:58— chat-github-registration.githubChatRegistrationService.start has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
chat-github-registration.githubChatRegistrationService.complete (cyclomatic 19) server/src/services/chat-github-registration.ts:280— chat-github-registration.githubChatRegistrationService.complete has cyclomatic complexity 19 (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.
email-channels.emailChannelService.control (cyclomatic 19) server/src/services/email-channels.ts:2373— email-channels.emailChannelService.control has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 2379, 2442, 2401, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
connection-intents.connectionIntentService.selectedProvider (cyclomatic 19) server/src/services/connection-intents.ts:670— connection-intents.connectionIntentService.selectedProvider has cyclomatic complexity 19 (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.
satisfied-connection-intents.findAvailableToolConnection (cyclomatic 19) server/src/services/satisfied-connection-intents.ts:15— satisfied-connection-intents.findAvailableToolConnection has cyclomatic complexity 19 (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.
failed-run-retry.createChatFailedRunRetry.assertFailedNativeRetryState (cyclomatic 19) server/src/services/chat-channels/failed-run-retry.ts:548— failed-run-retry.createChatFailedRunRetry.assertFailedNativeRetryState 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. This is NOT this file's highest cyclomatic complexity: failed-run-retry.createChatFailedRunRetry.isPreProviderReviewedChatFailure (cyclomatic 21) 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 method is counted neither in this dimension's figures nor in its score.
failed-run-retry.createChatFailedRunRetry.enqueueFailedChatRetryPublications (cyclomatic 19) server/src/services/chat-channels/failed-run-retry.ts:1742— failed-run-retry.createChatFailedRunRetry.enqueueFailedChatRetryPublications has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to one function literal inside it that branches. 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. This is NOT this file's highest cyclomatic complexity: failed-run-retry.createChatFailedRunRetry.isPreProviderReviewedChatFailure (cyclomatic 21) 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 method is counted neither in this dimension's figures nor in its score.
chat-teams-file-transfers.teamsFileTransferService.expireAndRecover (cyclomatic 19) server/src/services/chat-teams-file-transfers.ts:862— chat-teams-file-transfers.teamsFileTransferService.expireAndRecover has cyclomatic complexity 19 (threshold 15). Of this number, 11 points are the body's own statements and 8 belong to one function literal 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.
file-transfer-authority.createTeamsFileAuthority.stageTeamsBoardFileIntent (cyclomatic 19) server/src/services/chat-channels/microsoft-teams/file-transfer-authority.ts:720— file-transfer-authority.createTeamsFileAuthority.stageTeamsBoardFileIntent has cyclomatic complexity 19 (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.
chat-publication-batches.projectChatFileTransfer (cyclomatic 19) server/src/services/chat-publication-batches.ts:42— chat-publication-batches.projectChatFileTransfer has cyclomatic complexity 19 (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.
chat-publication-text-parts.boundedMarkdownBlocks (cyclomatic 19) server/src/services/chat-publication-text-parts.ts:123— chat-publication-text-parts.boundedMarkdownBlocks has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 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.
policy.definiteAttachmentProviderRejection (cyclomatic 19) server/src/services/chat-channels/publications/policy.ts:31— policy.definiteAttachmentProviderRejection has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
board-messages.createSlackBoardMessages.processPendingSlackBoardMessages (cyclomatic 19) server/src/services/chat-channels/slack/board-messages.ts:25— board-messages.createSlackBoardMessages.processPendingSlackBoardMessages has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 31, 66). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
runtime-reconciliation.createDiscordRuntimeReconciliation.reconcileDiscordRuntime (cyclomatic 19) server/src/services/chat-channels/discord/runtime-reconciliation.ts:26— runtime-reconciliation.createDiscordRuntimeReconciliation.reconcileDiscordRuntime has cyclomatic complexity 19 (threshold 15). Of this number, 10 points are the body's own statements and 9 belong to one function literal inside it that branches. 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.
chat-discord-question-forms.validDraft (cyclomatic 19) server/src/services/chat-discord-question-forms.ts:76— chat-discord-question-forms.validDraft has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
discovery.createOAuthDiscovery.oauthEndpointsForConnection (cyclomatic 19) server/src/services/tool-access/oauth/discovery.ts:410— discovery.createOAuthDiscovery.oauthEndpointsForConnection has cyclomatic complexity 19 (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.
refresh-leases.createOAuthRefreshLeases.acquireOAuthGrantRefreshLease (cyclomatic 19) server/src/services/tool-access/oauth/refresh-leases.ts:196— refresh-leases.createOAuthRefreshLeases.acquireOAuthGrantRefreshLease 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.
catalog-completion.createOAuthCatalogCompletion::finishOAuthCatalogWithRecommendedDefaults (cyclomatic 19) server/src/services/tool-access/oauth/catalog-completion.ts:16— catalog-completion.createOAuthCatalogCompletion::finishOAuthCatalogWithRecommendedDefaults 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.
tool-access.toolAccessService.createConnection (cyclomatic 19) server/src/services/tool-access.ts:4464— tool-access.toolAccessService.createConnection 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.
github-operation-credentials.allowsGitHubCredentialExport (cyclomatic 19) server/src/services/github-operation-credentials.ts:32— github-operation-credentials.allowsGitHubCredentialExport has cyclomatic complexity 19 (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.
github-pull-request-merge.createPullRequestMergeDetailsResolver (cyclomatic 19) server/src/services/github-pull-request-merge.ts:89— github-pull-request-merge.createPullRequestMergeDetailsResolver has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to one function literal inside it that branches (line 93). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
issue-thread-interactions.issueThreadInteractionService.answerQuestions (cyclomatic 19) server/src/services/issue-thread-interactions.ts:5017— issue-thread-interactions.issueThreadInteractionService.answerQuestions has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 5068). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
dot-assignment-follow-up.consumeDotHistoryReceipt (cyclomatic 19) server/src/services/dot-assignment-follow-up.ts:53— dot-assignment-follow-up.consumeDotHistoryReceipt has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 73, 60, 58). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
routine.grokRoutineService.reserve (cyclomatic 19) server/src/services/grok-bot/routine.ts:127— routine.grokRoutineService.reserve has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 131). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
muse-assignment-follow-up.consumeMuseHistoryReceipt (cyclomatic 19) server/src/services/muse-assignment-follow-up.ts:49— muse-assignment-follow-up.consumeMuseHistoryReceipt has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 69, 56, 54). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
remote-pi-companion.validate (cyclomatic 19) server/src/services/native-runtime/remote-pi-companion.ts:83— remote-pi-companion.validate has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
openapi.applyDocumentFixups (cyclomatic 19) server/src/routes/openapi.ts:1806— openapi.applyDocumentFixups 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.
workspace-file-resources.workspaceFileResourceService.resolve (cyclomatic 19) server/src/services/workspace-file-resources.ts:1401— workspace-file-resources.workspaceFileResourceService.resolve has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal 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.
runtime-skill-cache.matches (cyclomatic 19) server/src/services/runtime-skill-cache.ts:93— runtime-skill-cache.matches has cyclomatic complexity 19 (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.
company-skills.parseSkillImportSourceInput (cyclomatic 19) server/src/services/company-skills.ts:874— company-skills.parseSkillImportSourceInput has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal 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. This is NOT this file's highest cyclomatic complexity: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
company-skills.companySkillService.importPackageFiles (cyclomatic 19) server/src/services/company-skills.ts:6236— company-skills.companySkillService.importPackageFiles 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. This is NOT this file's highest cyclomatic complexity: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
company-skills.companySkillService.getTestRunDetail (cyclomatic 19) server/src/services/company-skills.ts:6956— company-skills.companySkillService.getTestRunDetail 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. This is NOT this file's highest cyclomatic complexity: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
routines.routineService.updateTrigger (cyclomatic 19) server/src/services/routines.ts:2580— routines.routineService.updateTrigger has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to one function literal 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.
native-session-executor.reserveWarmNativeInstructionDirectory (cyclomatic 19) server/src/services/native-runtime/native-session-executor.ts:653— native-session-executor.reserveWarmNativeInstructionDirectory has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.migrateLegacyRunnerdStateRoot (cyclomatic 19) server/src/services/native-runtime/native-session-executor.ts:1984— native-session-executor.migrateLegacyRunnerdStateRoot has cyclomatic complexity 19 (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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
runtime-mode.resolveHeartbeatNativeRuntimeMode (cyclomatic 19) server/src/services/native-runtime/runtime-mode.ts:282— runtime-mode.resolveHeartbeatNativeRuntimeMode 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.
obsolete-policy-reviews.dismissObsoleteNativePolicyReviews (cyclomatic 19) server/src/services/native-runtime/obsolete-policy-reviews.ts:16— obsolete-policy-reviews.dismissObsoleteNativePolicyReviews has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 61). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
service.recoveryService.ensureSourceScopedStrandedRecoveryAction (cyclomatic 19) REDACTED:2555— service.recoveryService.ensureSourceScopedStrandedRecoveryAction 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.
preserved-result-finalization.resumePreservedResultFinalization (cyclomatic 19) server/src/services/preserved-result-finalization.ts:7— preserved-result-finalization.resumePreservedResultFinalization has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to one function literal inside it that branches (line 8). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
plugin.createSandbox (cyclomatic 19) packages/plugins/sandbox-providers/daytona/src/plugin.ts:958— plugin.createSandbox has cyclomatic complexity 19 (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.
plugin.destroyFailedCreation (cyclomatic 19) packages/plugins/sandbox-providers/daytona/src/plugin.ts:1038— plugin.destroyFailedCreation has cyclomatic complexity 19 (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.
file-sync.assertTarballEntriesConfined (cyclomatic 19) packages/plugins/sandbox-providers/daytona/src/file-sync.ts:301— file-sync.assertTarballEntriesConfined has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 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.
ai-connections.isAiConnectionCompatible (cyclomatic 19) packages/shared/src/ai-connections.ts:119— ai-connections.isAiConnectionCompatible has cyclomatic complexity 19 (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.
ai-connections.createAiConnectionSchema (cyclomatic 19) packages/shared/src/ai-connections.ts:205— ai-connections.createAiConnectionSchema has cyclomatic complexity 19 (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.
portability-zip.readZipArchive (cyclomatic 19) packages/shared/src/portability-zip.ts:208— portability-zip.readZipArchive 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.
codemod-extract-sizes.main (cyclomatic 19) scripts/codemod-extract-sizes.mjs:425— codemod-extract-sizes.main has cyclomatic complexity 19 (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.
billing-reconciliation.billingReconciliationService.reconcile (cyclomatic 19) server/src/services/billing-reconciliation.ts:87— billing-reconciliation.billingReconciliationService.reconcile has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to one function literal inside it that branches (line 87). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
feedback.buildOpenCodeTraceFiles (cyclomatic 19) server/src/services/feedback.ts:569— feedback.buildOpenCodeTraceFiles has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
feedback.resolveFeedbackTarget (cyclomatic 19) server/src/services/feedback.ts:790— feedback.resolveFeedbackTarget 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.
summary-slots.summarySlotService.assertSummarizerWriter (cyclomatic 19) server/src/services/summary-slots.ts:553— summary-slots.summarySlotService.assertSummarizerWriter 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.
status-cards.statusCardService.assertSummarizerWriter (cyclomatic 19) server/src/services/status-cards.ts:432— status-cards.statusCardService.assertSummarizerWriter has cyclomatic complexity 19 (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.
company-portability.resolvePortableRoutineDefinition (cyclomatic 19) server/src/services/company-portability.ts:1795— company-portability.resolvePortableRoutineDefinition 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. This is NOT this file's highest cyclomatic complexity: company-portability.isSensitiveEnvKey (cyclomatic 26) 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 method is counted neither in this dimension's figures nor in its score.
idle-admission.trackIdleRequestHandlers (cyclomatic 19) server/src/middleware/idle-admission.ts:71— idle-admission.trackIdleRequestHandlers has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 3 function items inside it that branch (visit, visit::invoke, a function literal at line 96). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
customer-success.customerSuccessRoutes (cyclomatic 19) server/src/routes/customer-success.ts:73— customer-success.customerSuccessRoutes has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 87, 79). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest. This is NOT this file's highest cyclomatic complexity: customer-success.verifyInspectionPermit (cyclomatic 28) 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 method is counted neither in this dimension's figures nor in its score.
skill-source-git-snapshot.acquire.readBlobs (cyclomatic 19) server/src/services/skill-source-git-snapshot.ts:194— skill-source-git-snapshot.acquire.readBlobs 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.
native-agent-runtime-inheritance.inheritedScalar (cyclomatic 19) server/src/services/native-runtime/native-agent-runtime-inheritance.ts:41— native-agent-runtime-inheritance.inheritedScalar 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.
posthog-live-lib.preflightPosthogLive (cyclomatic 19) scripts/smoke/posthog-live-lib.mjs:31— posthog-live-lib.preflightPosthogLive has cyclomatic complexity 19 (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.
historical-cleanup-verification.historicalCleanupVerificationService.run (cyclomatic 19) server/src/services/historical-cleanup-verification.ts:21— historical-cleanup-verification.historicalCleanupVerificationService.run has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (inspect, a function literal at line 70). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SetMyUserSecretDialog.SetMyUserSecretDialog (cyclomatic 19) ui/src/pages/secrets/SetMyUserSecretDialog.tsx:27— SetMyUserSecretDialog.SetMyUserSecretDialog has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to 4 function literals 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.
ComposerAddMenu.ComposerAddMenu (cyclomatic 19) ui/src/components/task-chat/ComposerAddMenu.tsx:32— ComposerAddMenu.ComposerAddMenu has cyclomatic complexity 19 (threshold 15). Of this number, 11 points are the body's own statements and 8 belong to 6 function items inside it that branch. 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.
ExternalAgentInviteContent.MuseConnectionChecks (cyclomatic 19) ui/src/components/new-agent/ExternalAgentInviteContent.tsx:97— ExternalAgentInviteContent.MuseConnectionChecks has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to one function literal 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.
StatusIcon.blockedAttentionLabel (cyclomatic 19) ui/src/components/StatusIcon.tsx:27— StatusIcon.blockedAttentionLabel 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.
SidebarProjects.ProjectItem (cyclomatic 19) ui/src/components/SidebarProjects.tsx:113— SidebarProjects.ProjectItem has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
AgentConversationsSidebar.AgentConversationsSidebar (cyclomatic 19) ui/src/components/AgentConversationsSidebar.tsx:12— AgentConversationsSidebar.AgentConversationsSidebar has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 41, 23, 29, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SavedProviderKeySelect.useSavedProviderKeys (cyclomatic 19) ui/src/components/onboarding/SavedProviderKeySelect.tsx:15— SavedProviderKeySelect.useSavedProviderKeys has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
config-fields.HermesGatewayConfigFields (cyclomatic 19) ui/src/adapters/hermes-gateway/config-fields.tsx:100— config-fields.HermesGatewayConfigFields has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 229, a function literal at line 117, readValue, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
registry.syncExternalAdapters (cyclomatic 19) ui/src/adapters/registry.ts:154— registry.syncExternalAdapters has cyclomatic complexity 19 (threshold 15). Of this number, 13 points are the body's own statements and 6 belong to 5 function literals 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.
BreadcrumbBar.production.BreadcrumbBar (cyclomatic 19) ui/src/components/BreadcrumbBar.production.tsx:42— BreadcrumbBar.production.BreadcrumbBar has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 117). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
KanbanBoard.KanbanCard (cyclomatic 19) ui/src/components/KanbanBoard.tsx:275— KanbanBoard.KanbanCard has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 3 function items inside it that branch. 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.
LiveUpdatesProvider.useTaskRunLiveUpdates (cyclomatic 19) ui/src/context/LiveUpdatesProvider.tsx:137— LiveUpdatesProvider.useTaskRunLiveUpdates has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 168, 147, 162, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ExecutionBlockerNotice.ExecutionBlockerNotice (cyclomatic 19) ui/src/components/ExecutionBlockerNotice.tsx:8— ExecutionBlockerNotice.ExecutionBlockerNotice has cyclomatic complexity 19 (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.
TaskChatRunnerActivityGroup.presentation (cyclomatic 19) ui/src/components/task-chat/TaskChatRunnerActivityGroup.tsx:30— TaskChatRunnerActivityGroup.presentation 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.
TaskChatProtocolCard.WorkspaceChangeCard (cyclomatic 19) ui/src/components/task-chat/TaskChatProtocolCard.tsx:390— TaskChatProtocolCard.WorkspaceChangeCard has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 3 function literals inside it that branch. 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.
transcript-adapter.paperclipRunnerFinalResponse (cyclomatic 19) ui/src/components/task-chat/transcript-adapter.ts:1335— transcript-adapter.paperclipRunnerFinalResponse has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 2 function literals 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.
IssueThreadInteractionCard.RequestToolActionCard (cyclomatic 19) ui/src/components/IssueThreadInteractionCard.tsx:1740— IssueThreadInteractionCard.RequestToolActionCard has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 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.
WorkspaceRuntimeControls.buildWorkspaceServiceControlEntries (cyclomatic 19) ui/src/components/WorkspaceRuntimeControls.tsx:230— WorkspaceRuntimeControls.buildWorkspaceServiceControlEntries has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 243, 255). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TaskChatStatusPill.useHeldSelfTalk (cyclomatic 19) ui/src/components/task-chat/TaskChatStatusPill.tsx:147— TaskChatStatusPill.useHeldSelfTalk has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 158, 241, 174, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Agents.Agents::renderAgentRow (cyclomatic 19) ui/src/pages/Agents.tsx:339— Agents.Agents::renderAgentRow has cyclomatic complexity 19 (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. This shape REPEATS in the file: one other method here (Agents.Agents) 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.
Routines.buildRoutineGroups (cyclomatic 19) ui/src/pages/Routines.tsx:159— Routines.buildRoutineGroups has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 173, 203, 217, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
UserProfile.UserProfile (cyclomatic 19) ui/src/pages/UserProfile.tsx:205— UserProfile.UserProfile has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
Approvals.Approvals (cyclomatic 19) ui/src/pages/Approvals.tsx:19— Approvals.Approvals has cyclomatic complexity 19 (threshold 15). Of this number, 11 points are the body's own statements and 8 belong to 5 function literals inside it that branch. 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.
ProfilesIndex.ProfilesIndex (cyclomatic 19) ui/src/pages/tools/profiles/ProfilesIndex.tsx:46— ProfilesIndex.ProfilesIndex has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 227, 182, 66, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Browse.connectorAction (cyclomatic 19) ui/src/pages/apps/Browse.tsx:276— Browse.connectorAction 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.
IdentitiesSection.GitHubConnectionSummary (cyclomatic 19) ui/src/pages/apps/app-detail/IdentitiesSection.tsx:287— IdentitiesSection.GitHubConnectionSummary has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal 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.
CompanySkills.CatalogList (cyclomatic 19) ui/src/pages/CompanySkills.tsx:1629— CompanySkills.CatalogList has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (renderRow, a function literal at line 1659). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CompanySkills.SkillDetailPage::renderFilesBody (cyclomatic 19) ui/src/pages/CompanySkills.tsx:2941— CompanySkills.SkillDetailPage::renderFilesBody 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. This shape REPEATS in the file: one other method here (CompanySkills.SkillDetailPage) 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.
Routines.production.buildRoutineGroups (cyclomatic 19) ui/src/pages/Routines.production.tsx:159— Routines.production.buildRoutineGroups has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 173, 203, 217, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CompanySkills.production.CatalogList (cyclomatic 19) ui/src/pages/CompanySkills.production.tsx:1719— CompanySkills.production.CatalogList has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (renderRow, a function literal at line 1749). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CompanySkills.production.SkillDetailPage::renderFilesBody (cyclomatic 19) ui/src/pages/CompanySkills.production.tsx:3026— CompanySkills.production.SkillDetailPage::renderFilesBody 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. This shape REPEATS in the file: one other method here (CompanySkills.production.SkillDetailPage) 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.
CaseWorkSummary.CaseWorkSummary (cyclomatic 19) ui/src/components/cases/CaseWorkSummary.tsx:11— CaseWorkSummary.CaseWorkSummary 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.
ConnectionSetupFlow.LinkConnectStep (cyclomatic 19) ui/src/features/connections/ConnectionSetupFlow.tsx:3280— ConnectionSetupFlow.LinkConnectStep has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
csv-preview.parseCsv (cyclomatic 19) ui/src/lib/csv-preview.ts:6— csv-preview.parseCsv 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.
TeamCatalog.TeamDetailPane (cyclomatic 19) ui/src/pages/TeamCatalog.tsx:671— TeamCatalog.TeamDetailPane has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
CompletedActivityPreview.CompletedActivityPreview (cyclomatic 19) ui/storybook/prototypes/completed-activity/CompletedActivityPreview.tsx:195— CompletedActivityPreview.CompletedActivityPreview has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to one function literal 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.
ManagedProviderCommandExecutor::project_event (cyclomatic 19) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1547— ManagedProviderCommandExecutor::project_event has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity· main (cyclomatic 19) · ×1
main (cyclomatic 19) ui/src/artifact-directions/shot.cjs:215— main 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.
worktree.runWorktreeReseed (cyclomatic 18) cli/src/commands/worktree.ts:4262— worktree.runWorktreeReseed 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.
server-utils.normalizePaperclipWakeExecutionStage (cyclomatic 18) REDACTED:1548— server-utils.normalizePaperclipWakeExecutionStage has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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. This is NOT this file's highest cyclomatic complexity: server-utils.isNormalizedPaperclipExternalChatQuestionResponseTurn (cyclomatic 40) 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 method is counted neither in this dimension's figures nor in its score.
server-utils.materializePaperclipSkillCopy (cyclomatic 18) REDACTED:4532— server-utils.materializePaperclipSkillCopy has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to one function item inside it that branches. 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: server-utils.isNormalizedPaperclipExternalChatQuestionResponseTurn (cyclomatic 40) 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 method is counted neither in this dimension's figures nor in its score.
git-workspace-sync.isNotAGitRepositoryError (cyclomatic 18) packages/adapter-utils/src/git-workspace-sync.ts:372— git-workspace-sync.isNotAGitRepositoryError 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.
http2-bridge-server.parseCanonicalBridgeRequestPath (cyclomatic 18) packages/adapter-utils/src/http2-bridge-server.ts:547— http2-bridge-server.parseCanonicalBridgeRequestPath 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.
execution-target.startAdapterExecutionTargetProcessSessionBridge.server (cyclomatic 18) REDACTED:2302— execution-target.startAdapterExecutionTargetProcessSessionBridge.server has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 2319, 2365, 2314, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
codex-args.buildCodexExecArgs (cyclomatic 18) packages/adapters/codex-local/src/server/codex-args.ts:29— codex-args.buildCodexExecArgs 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.
detect-model.resolveProvider (cyclomatic 18) packages/adapters/hermes/src/server/detect-model.ts:137— detect-model.resolveProvider 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.
parse.parseKimiJsonl (cyclomatic 18) packages/adapters/kimi-local/src/server/parse.ts:79— parse.parseKimiJsonl 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.
response-capture.responseValueSize (cyclomatic 18) packages/db/src/response-capture.ts:35— response-capture.responseValueSize has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals 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.
clean-poisoned-claude-sessions.main (cyclomatic 18) packages/db/scripts/clean-poisoned-claude-sessions.ts:283— clean-poisoned-claude-sessions.main has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
check-migration-safety.splitSqlList (cyclomatic 18) packages/db/src/check-migration-safety.ts:345— check-migration-safety.splitSqlList 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.
result-normalization.normalizePrpResultSignals (cyclomatic 18) packages/paperclip-runner/src/protocol/result-normalization.ts:216— result-normalization.normalizePrpResultSignals has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 223). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
Inspector.Inspector (cyclomatic 18) packages/paperclip-runner/devtools/browser/src/live/Inspector.tsx:40— Inspector.Inspector has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to 4 function literals 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.
RequestCard.RequestCard (cyclomatic 18) packages/paperclip-runner/devtools/browser/src/live/RequestCard.tsx:47— RequestCard.RequestCard has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to 3 function literals 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.
evidence-redaction.capabilityEvidenceDetails (cyclomatic 18) packages/paperclip-runner/src/live/evidence-redaction.ts:437— evidence-redaction.capabilityEvidenceDetails has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
durable-prp-control-plane.runnerEnvironment (cyclomatic 18) REDACTED:3472— durable-prp-control-plane.runnerEnvironment 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. This is NOT this file's highest cyclomatic complexity: durable-prp-control-plane.warmTransitionReceipt (cyclomatic 23) 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 method is counted neither in this dimension's figures nor in its score.
opencode-server-driver.startOpenCodeProviderProxy.server (cyclomatic 18) REDACTED:2181— opencode-server-driver.startOpenCodeProviderProxy.server has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 2185, 2212, 2235). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
build-copilot-distribution.buildPinnedCopilotDistribution (cyclomatic 18) packages/paperclip-runner/scripts/build-copilot-distribution.mjs:14— build-copilot-distribution.buildPinnedCopilotDistribution 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.
private-snapshot.createAcpxPrivateSnapshot::copy (cyclomatic 18) packages/paperclip-runner/src/drivers/acpx/private-snapshot.ts:94— private-snapshot.createAcpxPrivateSnapshot::copy 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. This shape REPEATS in the file: one other method here (private-snapshot.createAcpxPrivateSnapshot) 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.
private-snapshot.createAcpxPrivateSnapshot (cyclomatic 18) packages/paperclip-runner/src/drivers/acpx/private-snapshot.ts:53— private-snapshot.createAcpxPrivateSnapshot 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. This shape REPEATS in the file: one other method here (private-snapshot.createAcpxPrivateSnapshot::copy) 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.
pi-verified-runtime.discoverPiRuntimeFiles::visit (cyclomatic 18) packages/paperclip-runner/src/drivers/acpx/pi-verified-runtime.ts:42— pi-verified-runtime.discoverPiRuntimeFiles::visit 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.
semantic-tool-receipt.parseSemanticToolReceipt (cyclomatic 18) packages/paperclip-runner/src/drivers/semantic-tool-receipt.ts:32— semantic-tool-receipt.parseSemanticToolReceipt 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.
copilot-metadata-probe.validateCopilotMetadata (cyclomatic 18) packages/paperclip-runner/src/drivers/copilot-metadata-probe.ts:179— copilot-metadata-probe.validateCopilotMetadata 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.
live-projection.providerActivityItem (cyclomatic 18) packages/paperclip-runner/src/issue-thread/live-projection.ts:56— live-projection.providerActivityItem 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.
CapabilitySemanticToolRuntime.reconcileExpiredExtensionReceipt (cyclomatic 18) packages/paperclip-runner/src/tools/capability-semantic-tool-runtime.ts:153— CapabilitySemanticToolRuntime.reconcileExpiredExtensionReceipt has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal 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.
CapabilitySemanticToolRuntime.#snapshotProjection (cyclomatic 18) packages/paperclip-runner/src/tools/capability-semantic-tool-runtime.ts:1425— CapabilitySemanticToolRuntime.#snapshotProjection has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 3 function literals inside it that branch. 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.
capability-eval-suite.runCase (cyclomatic 18) packages/paperclip-runner/src/conformance/capability-eval-suite.ts:159— capability-eval-suite.runCase 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.
PiTurnUsage.accept (cyclomatic 18) packages/paperclip-runner/src/drivers/acpx/pi-acp-runtime.ts:519— PiTurnUsage.accept has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
pi-runtime-extension.piMcpToolError (cyclomatic 18) packages/paperclip-runner/src/drivers/acpx/pi-runtime-extension.ts:247— pi-runtime-extension.piMcpToolError 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.
compatibility.assertPaperclipRunnerEvalCompatibility (cyclomatic 18) packages/paperclip-runner/src/evals/compatibility.ts:83— compatibility.assertPaperclipRunnerEvalCompatibility 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.
native-session-runtime.retryQuarantinedSessionCleanups (cyclomatic 18) packages/paperclip-runner/src/native-session-runtime.ts:759— native-session-runtime.retryQuarantinedSessionCleanups 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.
native-session-runtime.goalFromEvent (cyclomatic 18) packages/paperclip-runner/src/native-session-runtime.ts:1432— native-session-runtime.goalFromEvent has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
inspector.Inspector (cyclomatic 18) packages/paperclip-runner/src/react/inspector.tsx:40— inspector.Inspector has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to 4 function literals 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.
authorization.createAuthorizationService.applyResponsibleUserIntersection (cyclomatic 18) server/src/services/authorization.ts:2657— authorization.createAuthorizationService.applyResponsibleUserIntersection 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. This is NOT this file's highest cyclomatic complexity: authorization.permissionForAction (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 method is counted neither in this dimension's figures nor in its score.
access.accessService.setUserCompanyAccess (cyclomatic 18) server/src/services/access.ts:806— access.accessService.setUserCompanyAccess has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 813, 823, 830, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
secrets.secretService.createCurrentUserSecretValue (cyclomatic 18) server/src/services/secrets.ts:2990— secrets.secretService.createCurrentUserSecretValue has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal 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.
resource-memberships.resourceMembershipService.updateAgent (cyclomatic 18) server/src/services/resource-memberships.ts:348— resource-memberships.resourceMembershipService.updateAgent 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.
paperclip-cloud-connector.createPaperclipCloudConnector.startAuthorization (cyclomatic 18) server/src/services/paperclip-cloud-connector.ts:431— paperclip-cloud-connector.createPaperclipCloudConnector.startAuthorization 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.
retry.githubProviderRetry (cyclomatic 18) server/src/services/chat-channels/github/retry.ts:13— retry.githubProviderRetry 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.
voice-session-store.voiceSessionStore.authorizeSession (cyclomatic 18) server/src/services/voice/voice-session-store.ts:135— voice-session-store.voiceSessionStore.authorizeSession 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.
issue-tree-control.issueTreeControlService.restoreIssueStatusesForHold (cyclomatic 18) server/src/services/issue-tree-control.ts:945— issue-tree-control.issueTreeControlService.restoreIssueStatusesForHold has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to one function literal 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.
browser-use.browserUseService.credentials (cyclomatic 18) server/src/services/browser-use.ts:100— browser-use.browserUseService.credentials has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
tool-gateway.createToolGatewayService.reflectToolActionInteractionLifecycle (cyclomatic 18) server/src/services/tool-gateway.ts:2260— tool-gateway.createToolGatewayService.reflectToolActionInteractionLifecycle has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 2285). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
tool-gateway.createToolGatewayService.buildRemoteHeaders (cyclomatic 18) server/src/services/tool-gateway.ts:3652— tool-gateway.createToolGatewayService.buildRemoteHeaders 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.
voice-session-service.voiceSessionService.reconcileReports (cyclomatic 18) server/src/services/voice/voice-session-service.ts:277— voice-session-service.voiceSessionService.reconcileReports has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to 2 function literals 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.
provider-client.createSlackSetupClient (cyclomatic 18) server/src/services/connectors/slack/setup/provider-client.ts:17— provider-client.createSlackSetupClient has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to one function literal inside it that branches (line 18). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
completion.createSlackCompletion.sendSetupMessage (cyclomatic 18) server/src/services/connectors/slack/setup/completion.ts:39— completion.createSlackCompletion.sendSetupMessage 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.
provider-effects.createProviderEffects.processProviderEffect::processClaimedEffect (cyclomatic 18) server/src/services/chat-channels/provider-effects.ts:606— provider-effects.createProviderEffects.processProviderEffect::processClaimedEffect 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.
git-restore-point.scanChangedPaths (cyclomatic 18) REDACTED:181— git-restore-point.scanChangedPaths has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal 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.
workspace-validation-diagnostics.readManagedGitInspectionDiagnostic (cyclomatic 18) server/src/services/workspace-validation-diagnostics.ts:29— workspace-validation-diagnostics.readManagedGitInspectionDiagnostic 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.
execution-workspaces.executionWorkspaceService.runTaskDirectoryFolderWork (cyclomatic 18) server/src/services/execution-workspaces.ts:1795— execution-workspaces.executionWorkspaceService.runTaskDirectoryFolderWork 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.
outbound-attachments.createOutboundAttachments.publicationFiles (cyclomatic 18) server/src/services/chat-channels/outbound-attachments.ts:201— outbound-attachments.createOutboundAttachments.publicationFiles has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to one function literal inside it that branches. 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.
runtime-tools-token.verifyRuntimeToolsToken (cyclomatic 18) server/src/runtime-tools-token.ts:70— runtime-tools-token.verifyRuntimeToolsToken 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.
connection-intents.connectionIntentService.directSearchResult (cyclomatic 18) server/src/services/connection-intents.ts:620— connection-intents.connectionIntentService.directSearchResult 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.
postgres.createPostgresRunDispatchAdapter.promoteOrCancelDueRetry::promoteLockedRun (cyclomatic 18) server/src/modules/run-dispatch/adapters/postgres.ts:782— postgres.createPostgresRunDispatchAdapter.promoteOrCancelDueRetry::promoteLockedRun 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.
chat-teams-file-transfers.teamsFileTransferService.resolveInTransaction (cyclomatic 18) server/src/services/chat-teams-file-transfers.ts:1095— chat-teams-file-transfers.teamsFileTransferService.resolveInTransaction 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.
chat-provider-links.chatProviderConversationUrl (cyclomatic 18) server/src/services/chat-provider-links.ts:139— chat-provider-links.chatProviderConversationUrl 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.
slack-board-messages.mirrorSlackBoardComment (cyclomatic 18) server/src/services/slack-board-messages.ts:26— slack-board-messages.mirrorSlackBoardComment has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal 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.
endpoints.createChatEndpoints.create (cyclomatic 18) server/src/services/chat-channels/endpoints.ts:239— endpoints.createChatEndpoints.create has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to one function literal inside it that branches. 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.
chat-discord-question-forms.retainDiscordQuestionFormCorrection (cyclomatic 18) server/src/services/chat-discord-question-forms.ts:135— chat-discord-question-forms.retainDiscordQuestionFormCorrection 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.
callbacks.createChatInteractionCallbacks.denyExternalAction (cyclomatic 18) server/src/services/chat-channels/interactions/callbacks.ts:152— callbacks.createChatInteractionCallbacks.denyExternalAction has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
chat-slack-sessions.setSlackSessionStatus (cyclomatic 18) server/src/services/chat-slack-sessions.ts:99— chat-slack-sessions.setSlackSessionStatus 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.
default-access.createCatalogDefaultAccess.enableCatalogEntriesByDefault (cyclomatic 18) server/src/services/tool-access/catalog/default-access.ts:42— default-access.createCatalogDefaultAccess.enableCatalogEntriesByDefault has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal 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.
aggregator-accounts.createAggregatorAccounts.aggregatorDiscoveryState (cyclomatic 18) server/src/services/tool-access/catalog/aggregator-accounts.ts:232— aggregator-accounts.createAggregatorAccounts.aggregatorDiscoveryState 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.
review-queue.createToolActionReviewQueue.listActionRequests (cyclomatic 18) server/src/services/tool-access/activity/review-queue.ts:14— review-queue.createToolActionReviewQueue.listActionRequests has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function literal 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.
tool-profile-entry-validation.assertProfileEntryInputs (cyclomatic 18) server/src/services/tool-profile-entry-validation.ts:33— tool-profile-entry-validation.assertProfileEntryInputs has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal 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.
git-credentials.createGitRemoteAuthProvider (cyclomatic 18) server/src/services/git-credentials.ts:224— git-credentials.createGitRemoteAuthProvider has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 2 function items inside it that branch (resolveCredential, a function literal at line 280). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
issue-thread-interactions.issueThreadInteractionService.expireStaleRequestConfirmationsForIssueDocument (cyclomatic 18) server/src/services/issue-thread-interactions.ts:4687— issue-thread-interactions.issueThreadInteractionService.expireStaleRequestConfirmationsForIssueDocument has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 4711, 4739). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
agent-configuration.prepareAgentConfiguration (cyclomatic 18) server/src/services/agent-configuration.ts:15— agent-configuration.prepareAgentConfiguration 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.
environment-config.resolveEnvironmentDriverConfigForRuntime (cyclomatic 18) server/src/services/environment-config.ts:649— environment-config.resolveEnvironmentDriverConfigForRuntime 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.
agent-runner-selection.agentRunnerAvailability (cyclomatic 18) server/src/services/agent-runner-selection.ts:39— agent-runner-selection.agentRunnerAvailability 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.
agent-runner-selection.resolvePiRunnerConfig (cyclomatic 18) server/src/services/agent-runner-selection.ts:62— agent-runner-selection.resolvePiRunnerConfig has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
muse-identity.museIdentity.authenticate (cyclomatic 18) server/src/services/muse-identity.ts:230— muse-identity.museIdentity.authenticate 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.
agent-profile-avatar.setAgentProfileAvatar (cyclomatic 18) server/src/services/agent-profile-avatar.ts:32— agent-profile-avatar.setAgentProfileAvatar has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 43). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
dot.createBroker.pair (cyclomatic 18) server/src/modules/external-agents/dot.ts:124— dot.createBroker.pair has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 128). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
issue-graph-liveness.classifyIssueReviewPaths (cyclomatic 18) server/src/services/recovery/issue-graph-liveness.ts:223— issue-graph-liveness.classifyIssueReviewPaths has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to 2 function items inside it that branch. 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.
issues.terminalExplicitBlockersByRoot (cyclomatic 18) server/src/services/issues.ts:3682— issues.terminalExplicitBlockersByRoot has cyclomatic complexity 18 (threshold 15). Of this number, 14 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.
runner-goals.normalizedPrpGoal (cyclomatic 18) server/src/services/runner-goals.ts:583— runner-goals.normalizedPrpGoal 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.
native-codex-runner.resolveRemotePaperclipRunnerBinary (cyclomatic 18) server/src/services/native-runtime/native-codex-runner.ts:211— native-codex-runner.resolveRemotePaperclipRunnerBinary 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.
native-runner-execution-driver.createNativeRunnerExecutionDriver.controlPlaneRegistration (cyclomatic 18) server/src/services/native-runtime/native-runner-execution-driver.ts:68— native-runner-execution-driver.createNativeRunnerExecutionDriver.controlPlaneRegistration has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 73, 251, 273, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
usage-receipts.recoverPendingRunUsageReceipts (cyclomatic 18) server/src/services/usage-receipts.ts:181— usage-receipts.recoverPendingRunUsageReceipts 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.
agent-instruction-authorization.resolveInstructionActor (cyclomatic 18) server/src/services/agent-instruction-authorization.ts:24— agent-instruction-authorization.resolveInstructionActor 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.
runner-api-client.validateRunnerApiCall (cyclomatic 18) server/src/services/native-runtime/runner-api-client.ts:52— runner-api-client.validateRunnerApiCall 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.
agent-directory-probe.retireAgentDirectoryTransferScratch (cyclomatic 18) server/src/services/agent-directory-probe.ts:118— agent-directory-probe.retireAgentDirectoryTransferScratch has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to 2 function items inside it that branch. 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.
skill-version-cache.protectedVersions (cyclomatic 18) server/src/services/skill-version-cache.ts:94— skill-version-cache.protectedVersions 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.
github-commit-details.createGitHubCommitDiffDetailsResolver (cyclomatic 18) server/src/services/github-commit-details.ts:82— github-commit-details.createGitHubCommitDiffDetailsResolver has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 92). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
company-skills.companySkillService.updateFile (cyclomatic 18) server/src/services/company-skills.ts:4728— company-skills.companySkillService.updateFile has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 4738, 4760). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest. This is NOT this file's highest cyclomatic complexity: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
company-skills.companySkillService.installUpdate (cyclomatic 18) server/src/services/company-skills.ts:4877— company-skills.companySkillService.installUpdate 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. This is NOT this file's highest cyclomatic complexity: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
PaperclipRunnerToolAuthority.#readApiFile (cyclomatic 18) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:1138— PaperclipRunnerToolAuthority.#readApiFile has cyclomatic complexity 18 (threshold 15). Of this number, 17 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.
native-session-executor.normalizeNativeUsage (cyclomatic 18) server/src/services/native-runtime/native-session-executor.ts:10218— native-session-executor.normalizeNativeUsage has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to one function item inside it that branches. 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: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.syncRemoteRunnerDirectoryOut (cyclomatic 18) server/src/services/native-runtime/native-session-executor.ts:10872— native-session-executor.syncRemoteRunnerDirectoryOut 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-restart-recovery.evaluateNativeControllerTakeover (cyclomatic 18) server/src/services/native-runtime/native-restart-recovery.ts:167— native-restart-recovery.evaluateNativeControllerTakeover 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.
native-interaction-bridge.routePersistedNativeResultAttention (cyclomatic 18) server/src/services/native-runtime/native-interaction-bridge.ts:561— native-interaction-bridge.routePersistedNativeResultAttention has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal 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.
run-preparation.enrichWakeContextSnapshot (cyclomatic 18) server/src/services/heartbeat/run-preparation.ts:1697— run-preparation.enrichWakeContextSnapshot 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.
process.createProcessAdapter.cleanupRunProcess (cyclomatic 18) server/src/modules/active-run-watchdog/adapters/process.ts:23— process.createProcessAdapter.cleanupRunProcess 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.
use-cases.createScanSilentActiveRuns (cyclomatic 18) server/src/modules/active-run-watchdog/application/use-cases.ts:239— use-cases.createScanSilentActiveRuns has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 3 function items inside it that branch (inspectSilentActiveRun, a function literal at line 303, resolveSourceIssue). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
service.parseProviderQuotaClockReset (cyclomatic 18) REDACTED:573— service.parseProviderQuotaClockReset has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
workspace-recovery.requestWorkspaceRecovery (cyclomatic 18) server/src/services/workspace-recovery.ts:31— workspace-recovery.requestWorkspaceRecovery has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to one function literal inside it that branches (line 32). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
ai-connection-session.aiConnectionSessionCompatibilityInputs (cyclomatic 18) server/src/services/ai-connection-session.ts:43— ai-connection-session.aiConnectionSessionCompatibilityInputs has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal 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.
execution-policy-bootstrap.parseExecutionPolicyBootstrapEnv (cyclomatic 18) server/src/services/execution-policy-bootstrap.ts:70— execution-policy-bootstrap.parseExecutionPolicyBootstrapEnv 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.
workspace-preparation.prepareHeartbeatWorkspaceLocked::bindIssueToPersistedExecutionWorkspace (cyclomatic 18) server/src/services/heartbeat/workspace-preparation.ts:762— workspace-preparation.prepareHeartbeatWorkspaceLocked::bindIssueToPersistedExecutionWorkspace 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. This shape REPEATS in the file: one other method here (workspace-preparation.prepareHeartbeatWorkspaceLocked) 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.
session-preparation.resolveHeartbeatAdapterSession (cyclomatic 18) server/src/services/heartbeat/session-preparation.ts:249— session-preparation.resolveHeartbeatAdapterSession 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.
app.SpaceRowMenu (cyclomatic 18) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:2795— app.SpaceRowMenu has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 4 function items inside it that branch (handleArchive, handleRefresh, a function literal at line 2819, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
app.LintPanelContent (cyclomatic 18) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4589— app.LintPanelContent has cyclomatic complexity 18 (threshold 15). Of this number, 11 points are the body's own statements and 7 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.
core.startWikiQuerySession (cyclomatic 18) packages/plugins/plugin-llm-wiki/src/wiki/core.ts:3836— core.startWikiQuerySession has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 3906). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
lease-lifecycle.checkLeaseResumable (cyclomatic 18) packages/plugins/sandbox-providers/kubernetes/src/lease-lifecycle.ts:63— lease-lifecycle.checkLeaseResumable 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.
environment-creation-cleanup.readEnvironmentAcquisitionDiagnostic (cyclomatic 18) packages/plugins/sdk/src/environment-creation-cleanup.ts:35— environment-creation-cleanup.readEnvironmentAcquisitionDiagnostic 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.
issue.createLegacyAskUserQuestionsPayloadSchema (cyclomatic 18) packages/shared/src/validators/issue.ts:1985— issue.createLegacyAskUserQuestionsPayloadSchema 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.
connection-search.scoreConnectionSearch (cyclomatic 18) packages/shared/src/connection-search.ts:42— connection-search.scoreConnectionSearch has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 2 function literals 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.
plugin.pluginLauncherDeclarationSchema (cyclomatic 18) packages/shared/src/validators/plugin.ts:560— plugin.pluginLauncherDeclarationSchema 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.
catalog-builder.readReferencedSkillDescriptor (cyclomatic 18) packages/skills-catalog/src/catalog-builder.ts:479— catalog-builder.readReferencedSkillDescriptor 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.
app-brand-validation.validateManifest (cyclomatic 18) scripts/app-brand-validation.mjs:26— app-brand-validation.validateManifest 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.
ingest-app-definitions.inferState (cyclomatic 18) scripts/ingest-app-definitions.mjs:1908— ingest-app-definitions.inferState 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.
company-search.matchedFacetConditions (cyclomatic 18) server/src/services/company-search.ts:310— company-search.matchedFacetConditions 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.
feedback.buildClaudeTraceFiles (cyclomatic 18) server/src/services/feedback.ts:441— feedback.buildClaudeTraceFiles 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.
company-portability.extractPortableScopedEnvInputs (cyclomatic 18) server/src/services/company-portability.ts:602— company-portability.extractPortableScopedEnvInputs 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. This is NOT this file's highest cyclomatic complexity: company-portability.isSensitiveEnvKey (cyclomatic 26) 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 method is counted neither in this dimension's figures nor in its score.
teams-catalog.collectCatalogTeamSkillPreparations (cyclomatic 18) server/src/services/teams-catalog.ts:591— teams-catalog.collectCatalogTeamSkillPreparations 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.
agent-harness-verification.assertHarnessTestPassed (cyclomatic 18) server/src/services/agent-harness-verification.ts:18— agent-harness-verification.assertHarnessTestPassed has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 2 function literals 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.
slack-tools.slackToolRoutes (cyclomatic 18) server/src/routes/slack-tools.ts:15— slack-tools.slackToolRoutes has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 8 function items inside it that branch (a function literal at line 141, a function literal at line 97, a function literal at line 43, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
auth.resolveCloudTenantActorOnce (cyclomatic 18) server/src/middleware/auth.ts:606— auth.resolveCloudTenantActorOnce 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.
skill-source-sync.projectSkillRepositories (cyclomatic 18) server/src/services/skill-source-sync.ts:28— skill-source-sync.projectSkillRepositories has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to one function literal 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.
provider-trace-workspace-diff-reprojection.projectCodexWorkspaceDiffsFromTrace (cyclomatic 18) server/src/services/provider-trace-workspace-diff-reprojection.ts:52— provider-trace-workspace-diff-reprojection.projectCodexWorkspaceDiffsFromTrace has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal 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.
workspace-runtime-service-authz.assertAgentCanManageRuntimeServicesForWorkspace (cyclomatic 18) server/src/routes/workspace-runtime-service-authz.ts:68— workspace-runtime-service-authz.assertAgentCanManageRuntimeServicesForWorkspace 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.
onboarding-seed.onboardingSeedService.applyWithin (cyclomatic 18) server/src/services/onboarding-seed.ts:217— onboarding-seed.onboardingSeedService.applyWithin 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.
idle-scheduled-work.readIdleRoutineSchedule (cyclomatic 18) server/src/services/idle-scheduled-work.ts:16— idle-scheduled-work.readIdleRoutineSchedule 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.
access.listAvailableSkills (cyclomatic 18) REDACTED:248— access.listAvailableSkills 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.
access.isPrivateOrReservedIpv6 (cyclomatic 18) REDACTED:2388— access.isPrivateOrReservedIpv6 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.
plugin-dev-watcher.resolvePluginWatchTargets (cyclomatic 18) server/src/services/plugin-dev-watcher.ts:75— plugin-dev-watcher.resolvePluginWatchTargets has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (addRuntimeFilesFromDir, addWatchTarget, a function literal at line 133). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
notion-generic-live.fetchNotionVerificationCodeFromAgentMail (cyclomatic 18) scripts/smoke/notion-generic-live.mjs:212— notion-generic-live.fetchNotionVerificationCodeFromAgentMail 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.
PrimaryAgentPresentation.SetPrimaryAgentButton (cyclomatic 18) ui/src/components/primary-agent/PrimaryAgentPresentation.tsx:42— PrimaryAgentPresentation.SetPrimaryAgentButton 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.
workspace-file-parser.looksLikeWorkspacePath (cyclomatic 18) ui/src/lib/workspace-file-parser.ts:48— workspace-file-parser.looksLikeWorkspacePath 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.
DevRestartBanner.DevRestartBanner (cyclomatic 18) ui/src/components/DevRestartBanner.tsx:33— DevRestartBanner.DevRestartBanner has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 2 function items inside it that branch. 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.
LiveUpdatesProvider.buildRunStatusToast (cyclomatic 18) ui/src/context/LiveUpdatesProvider.tsx:1152— LiveUpdatesProvider.buildRunStatusToast 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.
DispositionRecoveryNotice.readDispositionRecoverySnapshot (cyclomatic 18) ui/src/components/DispositionRecoveryNotice.tsx:25— DispositionRecoveryNotice.readDispositionRecoverySnapshot 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.
TaskChatProtocolCard.ProviderActivityCard (cyclomatic 18) ui/src/components/task-chat/TaskChatProtocolCard.tsx:257— TaskChatProtocolCard.ProviderActivityCard has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to 3 function literals 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.
run-log-chunks.applyRetentionBudget (cyclomatic 18) ui/src/lib/run-log-chunks.ts:85— run-log-chunks.applyRetentionBudget 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.
transcriptPresentation.summarizeToolInput (cyclomatic 18) ui/src/lib/transcriptPresentation.ts:125— transcriptPresentation.summarizeToolInput has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
transcriptPresentation.describeToolInput (cyclomatic 18) ui/src/lib/transcriptPresentation.ts:186— transcriptPresentation.describeToolInput has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 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.
issue-chat-messages.runDurationLabel (cyclomatic 18) ui/src/lib/issue-chat-messages.ts:798— issue-chat-messages.runDurationLabel 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.
property-picker.PropertyPicker (cyclomatic 18) ui/src/components/issue-properties/property-picker.tsx:9— property-picker.PropertyPicker 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.
ArtifactFileChip.ArtifactFileChip (cyclomatic 18) ui/src/components/ArtifactFileChip.tsx:24— ArtifactFileChip.ArtifactFileChip has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to one function item inside it that branches. 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.
TaskChatThinking.TaskChatThinking (cyclomatic 18) ui/src/components/task-chat/TaskChatThinking.tsx:10— TaskChatThinking.TaskChatThinking 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.
native-run-events.runResultEntry (cyclomatic 18) ui/src/components/transcript/native-run-events.ts:235— native-run-events.runResultEntry has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to 3 function literals inside it that branch. 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.
AuditFeed.AuditRow (cyclomatic 18) ui/src/pages/audit/AuditFeed.tsx:209— AuditFeed.AuditRow 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.
AgentDetail.RunListItem (cyclomatic 18) ui/src/pages/AgentDetail.tsx:3280— AgentDetail.RunListItem 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.
AuditRuns.AuditRuns (cyclomatic 18) ui/src/pages/audit/AuditRuns.tsx:129— AuditRuns.AuditRuns has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to 4 function literals 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.
OwnSlackAppSetup.OwnSlackAppSetup::create (cyclomatic 18) ui/src/pages/apps/chat/slack/OwnSlackAppSetup.tsx:64— OwnSlackAppSetup.OwnSlackAppSetup::create 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. This shape REPEATS in the file: one other method here (OwnSlackAppSetup.OwnSlackAppSetup) 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.
SkillSources.DisconnectSourceDialog (cyclomatic 18) ui/src/pages/SkillSources.tsx:209— SkillSources.DisconnectSourceDialog has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to 3 function literals inside it that branch. 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.
Agents.production.Agents::renderAgentRow (cyclomatic 18) ui/src/pages/Agents.production.tsx:325— Agents.production.Agents::renderAgentRow 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. This shape REPEATS in the file: one other method here (Agents.production.Agents) 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.
RoutineTriggerCard.RoutineTriggerCard (cyclomatic 18) ui/src/components/RoutineTriggerCard.tsx:34— RoutineTriggerCard.RoutineTriggerCard 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.
AgentChatPicker.AgentChatPickerResults (cyclomatic 18) ui/src/components/AgentChatPicker.tsx:35— AgentChatPicker.AgentChatPickerResults has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 89, selectAgent). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CaseFieldsPanel.CaseFieldValue (cyclomatic 18) ui/src/components/CaseFieldsPanel.tsx:158— CaseFieldsPanel.CaseFieldValue has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function literal 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.
CommentThread.TimelineList (cyclomatic 18) ui/src/components/CommentThread.tsx:547— CommentThread.TimelineList has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 593). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
CaseHandoffHistory.HandoffRow (cyclomatic 18) ui/src/components/cases/CaseHandoffHistory.tsx:40— CaseHandoffHistory.HandoffRow 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.
AgentsUsingSkillDialog.AgentsUsingSkillDialog (cyclomatic 18) ui/src/components/skill-studio/AgentsUsingSkillDialog.tsx:95— AgentsUsingSkillDialog.AgentsUsingSkillDialog has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 168, a function literal at line 158, a function literal at line 203, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ConnectionSetupFlow.validEnrollmentAccessState (cyclomatic 18) ui/src/features/connections/ConnectionSetupFlow.tsx:129— ConnectionSetupFlow.validEnrollmentAccessState 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.
voice-session-controller.createVoiceSessionController.notify (cyclomatic 18) ui/src/lib/voice-session-controller.ts:172— voice-session-controller.createVoiceSessionController.notify 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.
ButtonSpecimen.ButtonSpecimen (cyclomatic 18) ui/storybook/support/design-proposals/ButtonSpecimen.tsx:9— ButtonSpecimen.ButtonSpecimen has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to 3 function items inside it that branch. 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.
Client.migrate_input_receipts (cyclomatic 18) server/src/services/scripts/v9/client.py:482— Client.migrate_input_receipts 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.
State::validate (cyclomatic 18) packages/paperclip-runner/runner/crates/runner-core/src/external_provider_backend.rs:212— State::validate 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.
worktree.quarantineSeededWorktreeExecutionState (cyclomatic 17) cli/src/commands/worktree.ts:1282— worktree.quarantineSeededWorktreeExecutionState has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to one function literal inside it that branches (line 1288). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
worktree.inspectVerifiedSeedDatabase (cyclomatic 17) cli/src/commands/worktree.ts:1503— worktree.inspectVerifiedSeedDatabase 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.
worktree.worktreeMergeHistoryCommand (cyclomatic 17) cli/src/commands/worktree.ts:4126— worktree.worktreeMergeHistoryCommand 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.
worktree.worktreeRepairCommand (cyclomatic 17) cli/src/commands/worktree.ts:4378— worktree.worktreeRepairCommand 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.
server.server (cyclomatic 17) docker/openclaw-smoke/server.mjs:43— server.server 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.
workspace-restore-diagnostics.gitFailureKind (cyclomatic 17) packages/adapter-utils/src/workspace-restore-diagnostics.ts:82— workspace-restore-diagnostics.gitFailureKind 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.
server-utils.normalizePaperclipWakePlanReviewThread (cyclomatic 17) REDACTED:1002— server-utils.normalizePaperclipWakePlanReviewThread 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. This is NOT this file's highest cyclomatic complexity: server-utils.isNormalizedPaperclipExternalChatQuestionResponseTurn (cyclomatic 40) 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 method is counted neither in this dimension's figures nor in its score.
workspace-restore-merge.walkDirectory (cyclomatic 17) packages/adapter-utils/src/workspace-restore-merge.ts:147— workspace-restore-merge.walkDirectory has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (visitBatch, readEntry). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
workspace-restore-merge.acquireDirectoryMergeLock (cyclomatic 17) packages/adapter-utils/src/workspace-restore-merge.ts:369— workspace-restore-merge.acquireDirectoryMergeLock has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 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.
ssh.spawnText (cyclomatic 17) REDACTED:221— ssh.spawnText has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 230, 305, 250, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
execution-target.ensureSandboxCommandResolvable (cyclomatic 17) REDACTED:759— execution-target.ensureSandboxCommandResolvable 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.
execution-target.prepareGitHubExecutionEnvironment (cyclomatic 17) REDACTED:1639— execution-target.prepareGitHubExecutionEnvironment 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.
execute.prepareCodexSkillRuntime (cyclomatic 17) packages/adapter-utils/src/acpx-engine/execute.ts:1316— execute.prepareCodexSkillRuntime 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.
connection-failure.readConnectionFailure (cyclomatic 17) packages/adapter-utils/src/connection-failure.ts:44— connection-failure.readConnectionFailure 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.
acp.probeClaudeAcpSandboxLogin (cyclomatic 17) packages/adapters/claude-local/src/server/acp.ts:629— acp.probeClaudeAcpSandboxLogin 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.
format-event.printCursorCloudEvent (cyclomatic 17) packages/adapters/cursor-cloud/src/cli/format-event.ts:4— format-event.printCursorCloudEvent 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.
format-event.printGrokStreamEvent (cyclomatic 17) packages/adapters/grok-local/src/cli/format-event.ts:12— format-event.printGrokStreamEvent 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.
gateway-ui-parser.parseStdoutLine (cyclomatic 17) packages/adapters/hermes/gateway-ui-parser.cjs:51— gateway-ui-parser.parseStdoutLine 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.
execute.consumeEvents (cyclomatic 17) packages/adapters/hermes/src/gateway/server/execute.ts:641— execute.consumeEvents 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-config.buildPiLocalConfig (cyclomatic 17) packages/adapters/pi-local/src/ui/build-config.ts:3— build-config.buildPiLocalConfig 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.
prepared-queries.installPreparedQueries (cyclomatic 17) packages/db/src/prepared-queries.ts:3— prepared-queries.installPreparedQueries has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 3 function items inside it that branch (visit, a function literal at line 13, a function literal at line 28). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
session-reducer.timelineSummary (cyclomatic 17) packages/paperclip-runner/src/reducer/session-reducer.ts:105— session-reducer.timelineSummary 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. This is NOT this file's highest cyclomatic complexity: session-reducer.applyProjection (cyclomatic 24) 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 method is counted neither in this dimension's figures nor in its score.
composer.Composer (cyclomatic 17) packages/paperclip-runner/devtools/browser/src/components/ui/composer.tsx:31— composer.Composer has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 belong to 2 function items inside it that branch. 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.
workspace-diff.diffPaperclipWorkspace (cyclomatic 17) packages/paperclip-runner/src/live/workspace-diff.ts:173— workspace-diff.diffPaperclipWorkspace has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal 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.
redaction.redact (cyclomatic 17) packages/paperclip-runner/src/semantic-tools/redaction.ts:140— redaction.redact 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-turn-diff.gitDiffPath (cyclomatic 17) packages/paperclip-runner/src/drivers/codex/codex-turn-diff.ts:45— codex-turn-diff.gitDiffPath 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.
codex-question-adapter.runtimeRequestKind (cyclomatic 17) packages/paperclip-runner/src/drivers/codex/codex-question-adapter.ts:61— codex-question-adapter.runtimeRequestKind 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.
codex-thread-normalization.parseCodexThreadGoal (cyclomatic 17) packages/paperclip-runner/src/drivers/codex/codex-thread-normalization.ts:23— codex-thread-normalization.parseCodexThreadGoal 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. This is NOT this file's highest cyclomatic complexity: codex-thread-normalization.isSupportedCodexNotificationMethod (cyclomatic 28) 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 method is counted neither in this dimension's figures nor in its score.
codex-session-terminal.mapTerminalTurn (cyclomatic 17) packages/paperclip-runner/src/drivers/codex/codex-session-terminal.ts:102— codex-session-terminal.mapTerminalTurn 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.
CapabilityMockControlPlaneAdapter.completeRun (cyclomatic 17) packages/paperclip-runner/src/mock-core/capability-mock-control-plane-adapter.ts:543— CapabilityMockControlPlaneAdapter.completeRun 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.
native-mcp.nativeMcpLaunchBinding (cyclomatic 17) packages/paperclip-runner/src/drivers/native-mcp.ts:7— native-mcp.nativeMcpLaunchBinding 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.
runner-binary.runnerBinaryTarget (cyclomatic 17) packages/paperclip-runner/src/live/runner-binary.ts:5— runner-binary.runnerBinaryTarget 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.
DevtoolsInspector.EvalReportInspector (cyclomatic 17) packages/paperclip-runner/devtools/issue-thread/src/DevtoolsInspector.tsx:201— DevtoolsInspector.EvalReportInspector 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.
archive.readAttemptControlledEvidence (cyclomatic 17) packages/paperclip-runner/scripts/controlled-evals/archive.mjs:112— archive.readAttemptControlledEvidence 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.
protocol-contract.projectAcpxFixture (cyclomatic 17) REDACTED:430— protocol-contract.projectAcpxFixture has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function literal 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-credentials.acquireCredentialHomeLock (cyclomatic 17) packages/paperclip-runner/src/drivers/acpx/codex-credentials.ts:362— codex-credentials.acquireCredentialHomeLock has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal 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.
control-plane-port.runControlPlanePortConformance (cyclomatic 17) packages/paperclip-runner/src/conformance/control-plane-port.ts:85— control-plane-port.runControlPlanePortConformance 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.
pi-runtime-extension.readPiRuntimeConfiguration.servers (cyclomatic 17) packages/paperclip-runner/src/drivers/acpx/pi-runtime-extension.ts:93— pi-runtime-extension.readPiRuntimeConfiguration.servers 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.
request-card.RequestCard (cyclomatic 17) packages/paperclip-runner/src/react/request-card.tsx:47— request-card.RequestCard has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 3 function literals 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.
plugin-runner-task.createPluginRunnerTaskOwner.prepareLaunch (cyclomatic 17) server/src/services/native-runtime/plugin-runner-task.ts:69— plugin-runner-task.createPluginRunnerTaskOwner.prepareLaunch 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.
remote-http-endpoint-guard.isPrivateOrReservedIpv6 (cyclomatic 17) server/src/services/remote-http-endpoint-guard.ts:202— remote-http-endpoint-guard.isPrivateOrReservedIpv6 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.
remote-http-fetch.sendRequest (cyclomatic 17) server/src/services/remote-http-fetch.ts:275— remote-http-fetch.sendRequest has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
workspace-recovery-snapshot.attachPreservedWorkspaceSnapshots (cyclomatic 17) server/src/services/workspace-recovery-snapshot.ts:144— workspace-recovery-snapshot.attachPreservedWorkspaceSnapshots has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals 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.
provider-fresh-workspace.stageProviderFreshWorkspace (cyclomatic 17) server/src/services/provider-fresh-workspace.ts:20— provider-fresh-workspace.stageProviderFreshWorkspace has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal 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.
secrets.secretService.removeSecretUnlocked (cyclomatic 17) server/src/services/secrets.ts:3395— secrets.secretService.removeSecretUnlocked has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal 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.
secrets.secretService.collectMissingAdapterConfigRuntimeBindings (cyclomatic 17) server/src/services/secrets.ts:5449— secrets.secretService.collectMissingAdapterConfigRuntimeBindings has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 2 function literals 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.
connection-credentials.writeConnectionCredential (cyclomatic 17) server/src/services/connection-credentials.ts:38— connection-credentials.writeConnectionCredential 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.
ai-connection-usage.grok (cyclomatic 17) server/src/services/ai-connection-usage.ts:261— ai-connection-usage.grok 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-cancellation.cancellationResultJson (cyclomatic 17) server/src/services/run-cancellation.ts:89— run-cancellation.cancellationResultJson 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.
workspace-restore-recovery-state.nativeRunHasNoWorkspaceAccess (cyclomatic 17) server/src/services/workspace-restore-recovery-state.ts:10— workspace-restore-recovery-state.nativeRunHasNoWorkspaceAccess 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.
cloud-runtime-identity.cloudRuntimePublicKeyForKid (cyclomatic 17) server/src/services/cloud-runtime-identity.ts:234— cloud-runtime-identity.cloudRuntimePublicKeyForKid has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
case-access.assertActorCanWriteCase (cyclomatic 17) server/src/services/case-access.ts:20— case-access.assertActorCanWriteCase 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.
board-auth.boardAuthService.approveCliAuthChallenge (cyclomatic 17) server/src/services/board-auth.ts:371— board-auth.boardAuthService.approveCliAuthChallenge has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 373). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
PhotonCloudClient.request (cyclomatic 17) server/src/services/photon/cloud.ts:112— PhotonCloudClient.request 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.
paperclip-cloud-connector.createPaperclipCloudConnector.call (cyclomatic 17) server/src/services/paperclip-cloud-connector.ts:276— paperclip-cloud-connector.createPaperclipCloudConnector.call 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.
chat-github-attachments.githubAttachmentCommentFetch (cyclomatic 17) REDACTED:451— chat-github-attachments.githubAttachmentCommentFetch has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to one function literal inside it that branches (line 455). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
heartbeat-run-summary.summarizeHeartbeatRunResultJson (cyclomatic 17) server/src/services/heartbeat-run-summary.ts:65— heartbeat-run-summary.summarizeHeartbeatRunResultJson 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.
voice-session-store.voiceSessionStore.authorizeConnection (cyclomatic 17) server/src/services/voice/voice-session-store.ts:77— voice-session-store.voiceSessionStore.authorizeConnection has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
speko-call-report.parseSpekoCallReport (cyclomatic 17) server/src/services/voice/speko-call-report.ts:33— speko-call-report.parseSpekoCallReport 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-identity.explicitOperatorRunIdentity (cyclomatic 17) server/src/services/run-identity.ts:18— run-identity.explicitOperatorRunIdentity 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-identity.initializeRunIdentity (cyclomatic 17) server/src/services/run-identity.ts:169— run-identity.initializeRunIdentity has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to one function literal inside it that branches (line 183). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
recovery-effect-receipts.priorRecoveryApiReceipt (cyclomatic 17) server/src/services/recovery-effect-receipts.ts:38— recovery-effect-receipts.priorRecoveryApiReceipt 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.
tool-gateway.createToolGatewayService.requestApprovalForRecordedToolCall (cyclomatic 17) server/src/services/tool-gateway.ts:2414— tool-gateway.createToolGatewayService.requestApprovalForRecordedToolCall 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.
speko-agent-tools.resolveAuthority (cyclomatic 17) server/src/services/voice/speko-agent-tools.ts:19— speko-agent-tools.resolveAuthority 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.
provider-effects.createProviderEffects.finalizeProviderEffectFailure (cyclomatic 17) server/src/services/chat-channels/provider-effects.ts:236— provider-effects.createProviderEffects.finalizeProviderEffectFailure has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 253). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
git-connection-failure.classifyGitCloneFailure (cyclomatic 17) server/src/services/git-connection-failure.ts:32— git-connection-failure.classifyGitCloneFailure 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.
git-workspace-expiration-locks.lockPaths (cyclomatic 17) server/src/services/git-workspace-expiration-locks.ts:13— git-workspace-expiration-locks.lockPaths has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to 4 function literals 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.
execution-workspace-repositories.executionWorkspaceRepositoryService.assertRecoveryBinding (cyclomatic 17) server/src/services/execution-workspace-repositories.ts:265— execution-workspace-repositories.executionWorkspaceRepositoryService.assertRecoveryBinding 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.
workspace-runtime.recordWorkspaceCommandOperation (cyclomatic 17) server/src/services/workspace-runtime.ts:3156— workspace-runtime.recordWorkspaceCommandOperation has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 3183). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
workspace-runtime.waitForAllocatedPortBind (cyclomatic 17) server/src/services/workspace-runtime.ts:5418— workspace-runtime.waitForAllocatedPortBind 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.
execution-workspaces.executionWorkspaceService.findGitWorktreeContention (cyclomatic 17) server/src/services/execution-workspaces.ts:2898— execution-workspaces.executionWorkspaceService.findGitWorktreeContention 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.
execution-workspaces.executionWorkspaceService.sweepTerminalWorkspaces::expireTaskDirectory (cyclomatic 17) server/src/services/execution-workspaces.ts:3445— execution-workspaces.executionWorkspaceService.sweepTerminalWorkspaces::expireTaskDirectory 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. This shape REPEATS in the file: one other method here (execution-workspaces.executionWorkspaceService.sweepTerminalWorkspaces) 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.
budget-reservations.recheckRunBudgetReservationInTransaction (cyclomatic 17) server/src/services/budget-reservations.ts:27— budget-reservations.recheckRunBudgetReservationInTransaction 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.
chat-teams-file-transfers.teamsFileTransferService.canCancelConflict (cyclomatic 17) server/src/services/chat-teams-file-transfers.ts:1006— chat-teams-file-transfers.teamsFileTransferService.canCancelConflict 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.
publication-replacement.createChatPublicationReplacement.runOwnershipMilestoneSupersessionReason (cyclomatic 17) server/src/services/chat-channels/publication-replacement.ts:74— publication-replacement.createChatPublicationReplacement.runOwnershipMilestoneSupersessionReason has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
chat-provider-links.telegramConversationLink (cyclomatic 17) server/src/services/chat-provider-links.ts:100— chat-provider-links.telegramConversationLink 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.
aggregator-app-discovery.discoverArcadeApps (cyclomatic 17) server/src/services/aggregator-app-discovery.ts:57— aggregator-app-discovery.discoverArcadeApps 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.
aggregator-accounts.createAggregatorAccounts.syncAggregatorApps (cyclomatic 17) server/src/services/tool-access/catalog/aggregator-accounts.ts:324— aggregator-accounts.createAggregatorAccounts.syncAggregatorApps has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 350, 368, 347). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tool-access.toolAccessService.updateConnection (cyclomatic 17) server/src/services/tool-access.ts:4579— tool-access.toolAccessService.updateConnection has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
oauth.createPublicMcpOAuth.consent (cyclomatic 17) server/src/services/public-mcp/oauth.ts:555— oauth.createPublicMcpOAuth.consent has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 566, 562). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
file-transfers.createPublicMcpTransfers.authorize (cyclomatic 17) server/src/services/public-mcp/file-transfers.ts:104— file-transfers.createPublicMcpTransfers.authorize 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.
task-search.taskSearchCtes (cyclomatic 17) server/src/services/task-search.ts:84— task-search.taskSearchCtes has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to 3 function items inside it that branch. 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.
execution-projection.executionProjectionsForRuns (cyclomatic 17) server/src/services/execution-projection.ts:53— execution-projection.executionProjectionsForRuns has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 3 function items inside it that branch. 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.
issues.deriveIssueCommentRunLogAttribution (cyclomatic 17) server/src/services/issues.ts:1771— issues.deriveIssueCommentRunLogAttribution 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.
environment-execution-target.sandboxLeaseAcquisitionFromMetadata (cyclomatic 17) server/src/services/environment-execution-target.ts:76— environment-execution-target.sandboxLeaseAcquisitionFromMetadata 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.
runtime-request-resolution-authority.canonicalPendingRequest (cyclomatic 17) server/src/services/native-runtime/runtime-request-resolution-authority.ts:54— runtime-request-resolution-authority.canonicalPendingRequest 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.
runner-prp-coordinator.runnerPrpCoordinator.prepare (cyclomatic 17) server/src/services/native-runtime/runner-prp-coordinator.ts:149— runner-prp-coordinator.runnerPrpCoordinator.prepare has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
remote-launch-assets.stageRemoteLaunchAssets (cyclomatic 17) server/src/services/native-runtime/remote-launch-assets.ts:33— remote-launch-assets.stageRemoteLaunchAssets has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 36, measure, stageRuntimeContext, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
agentmail.executeAgentmailTool (cyclomatic 17) server/src/services/connectors/agentmail.ts:109— agentmail.executeAgentmailTool 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.
agent-instructions.deriveBundleState (cyclomatic 17) server/src/services/agent-instructions.ts:245— agent-instructions.deriveBundleState 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.
agent-directory-probe.probeAgentDirectory (cyclomatic 17) server/src/services/agent-directory-probe.ts:16— agent-directory-probe.probeAgentDirectory 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 shape REPEATS in the file: one other method here (agent-directory-probe.probeAgentDirectory::walk) 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.
workspace-file-resources.denyReasonForPathSegments (cyclomatic 17) server/src/services/workspace-file-resources.ts:314— workspace-file-resources.denyReasonForPathSegments 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.
workspace-file-resources.workspaceFileResourceService.listCandidates (cyclomatic 17) server/src/services/workspace-file-resources.ts:1121— workspace-file-resources.workspaceFileResourceService.listCandidates 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.
workspace-file-resources.workspaceFileResourceService.prepareDownload (cyclomatic 17) server/src/services/workspace-file-resources.ts:1750— workspace-file-resources.workspaceFileResourceService.prepareDownload 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.
skill-version-retention.skillVersionRetentionService.tick (cyclomatic 17) server/src/services/skill-version-retention.ts:427— skill-version-retention.skillVersionRetentionService.tick 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.
work-products.workProductDiffSummaryFromEventPayload (cyclomatic 17) server/src/services/work-products.ts:56— work-products.workProductDiffSummaryFromEventPayload 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.
company-skills.deriveCanonicalSkillKey (cyclomatic 17) server/src/services/company-skills.ts:664— company-skills.deriveCanonicalSkillKey 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: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
company-skills.companySkillService.reconcileLocalPathSkillSources (cyclomatic 17) server/src/services/company-skills.ts:3161— company-skills.companySkillService.reconcileLocalPathSkillSources has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal 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. This is NOT this file's highest cyclomatic complexity: company-skills.companySkillService.renameSkill (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
current-wake-comments.assertCurrentWakeCommentsRead (cyclomatic 17) server/src/services/native-runtime/current-wake-comments.ts:744— current-wake-comments.assertCurrentWakeCommentsRead has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to one function literal inside it that branches (line 754). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
PaperclipRunnerToolAuthority.#reserveApiResponseCapture (cyclomatic 17) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:1039— PaperclipRunnerToolAuthority.#reserveApiResponseCapture has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1081, 1043, 1077). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
run-failure-report.isHermesConnectionFailure (cyclomatic 17) server/src/services/run-failure-report.ts:183— run-failure-report.isHermesConnectionFailure 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.
native-session-executor.detachNativeSessionsForRestart (cyclomatic 17) server/src/services/native-runtime/native-session-executor.ts:304— native-session-executor.detachNativeSessionsForRestart 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: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.assertRetainedNativeSourceArchiveSettled (cyclomatic 17) server/src/services/native-runtime/native-session-executor.ts:3965— native-session-executor.assertRetainedNativeSourceArchiveSettled has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.assertRemoteRunnerBuildMetadata (cyclomatic 17) server/src/services/native-runtime/native-session-executor.ts:10569— native-session-executor.assertRemoteRunnerBuildMetadata 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-interaction-bridge.applyNativeAttentionStatusDecision (cyclomatic 17) server/src/services/native-runtime/native-interaction-bridge.ts:55— native-interaction-bridge.applyNativeAttentionStatusDecision has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 67). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
run-preparation.gatewayConnectionIds (cyclomatic 17) server/src/services/heartbeat/run-preparation.ts:1338— run-preparation.gatewayConnectionIds 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.
service.recoveryService.hasPersistedDurableWaitPath (cyclomatic 17) REDACTED:1467— service.recoveryService.hasPersistedDurableWaitPath 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.
retries.createHeartbeatRetries.retryScheduledRetryNow (cyclomatic 17) server/src/services/heartbeat/retries.ts:1701— retries.createHeartbeatRetries.retryScheduledRetryNow has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. 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-lifecycle.createHeartbeatLifecycle.setRunStatus (cyclomatic 17) server/src/services/heartbeat/run-lifecycle.ts:1026— run-lifecycle.createHeartbeatLifecycle.setRunStatus has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
fresh-workspace-seed.materializeFreshWorkspaceSeed (cyclomatic 17) server/src/services/fresh-workspace-seed.ts:13— fresh-workspace-seed.materializeFreshWorkspaceSeed has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 2 function literals 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.
app.IngestFilesModal (cyclomatic 17) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:1809— app.IngestFilesModal has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to 5 function items inside it that branch (confirm, a function literal at line 1846, a function literal at line 1841, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
core.validatePaperclipIngestionProfile (cyclomatic 17) packages/plugins/plugin-llm-wiki/src/wiki/core.ts:978— core.validatePaperclipIngestionProfile 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.
file-sync.validateArchive (cyclomatic 17) packages/plugins/sandbox-providers/createos/src/file-sync.ts:31— file-sync.validateArchive has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 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.
workspace-provider.parseWorkspaceProviderResult (cyclomatic 17) packages/plugins/sdk/src/workspace-provider.ts:116— workspace-provider.parseWorkspaceProviderResult 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.
issue.resolveIssueRecoveryActionSchema (cyclomatic 17) packages/shared/src/validators/issue.ts:629— issue.resolveIssueRecoveryActionSchema 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.
catalog-builder.classifyCatalogFile (cyclomatic 17) packages/teams-catalog/src/catalog-builder.ts:830— catalog-builder.classifyCatalogFile 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.
preview-artifacts.imageExists (cyclomatic 17) scripts/preview-artifacts.mjs:85— preview-artifacts.imageExists has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 2 function items inside it that branch. 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.
codemod-extract-type.main (cyclomatic 17) scripts/codemod-extract-type.mjs:166— codemod-extract-type.main 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.
ingest-app-definitions.validateApp (cyclomatic 17) scripts/ingest-app-definitions.mjs:2054— ingest-app-definitions.validateApp 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.
voice-sessions.voiceWebhookRoutes (cyclomatic 17) server/src/routes/voice-sessions.ts:91— voice-sessions.voiceWebhookRoutes has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 94, 106). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
decision-queues.decisionQueueService.materializeSeededQueues (cyclomatic 17) server/src/services/decision-queues.ts:685— decision-queues.decisionQueueService.materializeSeededQueues has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to one function literal 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.
company-portability.readPortableIssueComments (cyclomatic 17) server/src/services/company-portability.ts:887— company-portability.readPortableIssueComments 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: company-portability.isSensitiveEnvKey (cyclomatic 26) 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 method is counted neither in this dimension's figures nor in its score.
environment-custom-images.environmentCustomImageService.finishSetupSession (cyclomatic 17) server/src/services/environment-custom-images.ts:904— environment-custom-images.environmentCustomImageService.finishSetupSession has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
grok-bot.grokBotRoutes (cyclomatic 17) server/src/routes/grok-bot.ts:17— grok-bot.grokBotRoutes has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 6 function items inside it that branch (companyScope, scope, a function literal at line 39, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
email.agentmailErrorHandler (cyclomatic 17) server/src/routes/email.ts:34— email.agentmailErrorHandler 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.
skill-source-sync.adoptProjectSkillRepository (cyclomatic 17) server/src/services/skill-source-sync.ts:53— skill-source-sync.adoptProjectSkillRepository has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 61). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
company-skill-policy.companySkillPolicyRoutes (cyclomatic 17) server/src/routes/company-skill-policy.ts:10— company-skill-policy.companySkillPolicyRoutes has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 5 function items inside it that branch (assertCanAdministerPolicy, assertSkillPolicyCompanyAccess, currentPrincipal, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
announcement-feed.announcementFeedService.asset (cyclomatic 17) server/src/services/announcement-feed.ts:146— announcement-feed.announcementFeedService.asset has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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.
posthog-live-lib.extractProjectSummary::visit (cyclomatic 17) scripts/smoke/posthog-live-lib.mjs:149— posthog-live-lib.extractProjectSummary::visit 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.
standard-image-contract.resolveStandardImageDigest (cyclomatic 17) scripts/standard-image-contract.mjs:22— standard-image-contract.resolveStandardImageDigest has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (request, a function literal at line 58). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
verify-release-registry-state.parseArgs (cyclomatic 17) scripts/verify-release-registry-state.mjs:38— verify-release-registry-state.parseArgs 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.
native-workspace-sync-retention.retentionBlocker (cyclomatic 17) server/src/services/native-runtime/native-workspace-sync-retention.ts:141— native-workspace-sync-retention.retentionBlocker 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.
SidebarSection.SidebarSectionHeader (cyclomatic 17) ui/src/components/SidebarSection.tsx:66— SidebarSection.SidebarSectionHeader has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal 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.
MarkdownEditor.autocompleteOptionMatchesLink (cyclomatic 17) REDACTED:625— MarkdownEditor.autocompleteOptionMatchesLink 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.
select.SelectPopover (cyclomatic 17) ui/src/components/ui/select.tsx:25— select.SelectPopover has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 89, 69, 83, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AppConnectionSidebar.AppDetailSidebar (cyclomatic 17) ui/src/components/AppConnectionSidebar.tsx:32— AppConnectionSidebar.AppDetailSidebar has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 4 function literals inside it that branch. 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.
AiConnectionPicker.AiConnectionPicker (cyclomatic 17) ui/src/components/ai-connections/AiConnectionPicker.tsx:33— AiConnectionPicker.AiConnectionPicker has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 2 function literals 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.
proposal-review.ApproveDialog (cyclomatic 17) ui/src/pages/secrets/proposal-review.tsx:367— proposal-review.ApproveDialog has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal 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.
OnboardingWizard.OnboardingWizard (cyclomatic 17) ui/src/components/OnboardingWizard.tsx:349— OnboardingWizard.OnboardingWizard has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 428, 473, 355, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
app-connect-policy.canEnterAppsConnect (cyclomatic 17) ui/src/pages/apps/app-connect-policy.ts:56— app-connect-policy.canEnterAppsConnect 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.
Sidebar.production.Sidebar (cyclomatic 17) ui/src/components/Sidebar.production.tsx:47— Sidebar.production.Sidebar has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
TaskChatLab.useStreamingReplay (cyclomatic 17) ui/src/pages/TaskChatLab.tsx:70— TaskChatLab.useStreamingReplay has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 77, 119, 83, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
LegacyInbox.FailedRunInboxRow (cyclomatic 17) ui/src/pages/LegacyInbox.tsx:284— LegacyInbox.FailedRunInboxRow 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.
EmailMessageCard.EmailMessageCard (cyclomatic 17) ui/src/components/EmailMessageCard.tsx:41— EmailMessageCard.EmailMessageCard 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.
transcript-adapter.paperclipRunnerAcceptedResponseWake (cyclomatic 17) ui/src/components/task-chat/transcript-adapter.ts:1306— transcript-adapter.paperclipRunnerAcceptedResponseWake has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
IssueChatThread.ExpiredRequestConfirmationActivity (cyclomatic 17) ui/src/components/IssueChatThread.tsx:2979— IssueChatThread.ExpiredRequestConfirmationActivity 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.
TaskChatThread.semanticProgressCommentIds (cyclomatic 17) ui/src/components/TaskChatThread.tsx:340— TaskChatThread.semanticProgressCommentIds 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.
TaskAttachmentPanel.TextAttachmentPreview (cyclomatic 17) ui/src/components/task-side-panel/TaskAttachmentPanel.tsx:42— TaskAttachmentPanel.TextAttachmentPreview 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.
SidePanelFrame.SidePanelFrame (cyclomatic 17) ui/src/components/side-panel/SidePanelFrame.tsx:26— SidePanelFrame.SidePanelFrame 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.
SidePanelTabs.SidePanelTabs (cyclomatic 17) ui/src/components/side-panel/SidePanelTabs.tsx:159— SidePanelTabs.SidePanelTabs 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 shape REPEATS in the file: one other method here (SidePanelTabs.SidePanelTabs::handleKeyDown) 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.
TaskChatLiveRunPill.TaskChatLiveRunPill (cyclomatic 17) ui/src/components/task-chat/TaskChatLiveRunPill.tsx:47— TaskChatLiveRunPill.TaskChatLiveRunPill 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.
TaskChatTurnHandoff.TaskChatTurnHandoff (cyclomatic 17) ui/src/components/task-chat/TaskChatTurnHandoff.tsx:7— TaskChatTurnHandoff.TaskChatTurnHandoff has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 3 function literals inside it that branch. 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.
Agents.OrgTreeNode (cyclomatic 17) ui/src/pages/Agents.tsx:476— Agents.OrgTreeNode 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.
AgentSkillRow.AgentSkillRow (cyclomatic 17) ui/src/pages/agent-skills/AgentSkillRow.tsx:58— AgentSkillRow.AgentSkillRow has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
FileTree.FileTree::handleRowKeyDown (cyclomatic 17) ui/src/components/FileTree.tsx:318— FileTree.FileTree::handleRowKeyDown 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.
RunTranscriptView.summarizeToolInput (cyclomatic 17) ui/src/components/transcript/RunTranscriptView.tsx:259— RunTranscriptView.summarizeToolInput has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
SkillStudio.SkillStudio (cyclomatic 17) ui/src/pages/SkillStudio.tsx:276— SkillStudio.SkillStudio has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
Agents.production.OrgTreeNode (cyclomatic 17) ui/src/pages/Agents.production.tsx:517— Agents.production.OrgTreeNode 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.
ScheduleEditor.ScheduleEditor (cyclomatic 17) ui/src/components/ScheduleEditor.tsx:194— ScheduleEditor.ScheduleEditor has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 6 function items inside it that branch. 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.
editable-sections.production.TriggersSection (cyclomatic 17) ui/src/components/routine-sections/editable-sections.production.tsx:420— editable-sections.production.TriggersSection has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
ExcerptSheet.ExcerptSheet (cyclomatic 17) ui/src/artifact-directions/directions/d1-solid/ExcerptSheet.tsx:142— ExcerptSheet.ExcerptSheet has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 2 function literals 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.
ArtifactsPanel.ArtifactsPanel (cyclomatic 17) ui/src/components/ArtifactsPanel.tsx:87— ArtifactsPanel.ArtifactsPanel has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 173, 185, 139). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
BuiltInAgentGate.BuiltInAgentGate (cyclomatic 17) ui/src/components/BuiltInAgentGate.tsx:36— BuiltInAgentGate.BuiltInAgentGate has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
CaseRevisionRail.CaseRevisionRail (cyclomatic 17) ui/src/components/CaseRevisionRail.tsx:170— CaseRevisionRail.CaseRevisionRail has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 belong to 3 function literals inside it that branch. 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.
WorkspaceAccessCard.WorkspaceAccessCard (cyclomatic 17) ui/src/components/WorkspaceAccessCard.tsx:50— WorkspaceAccessCard.WorkspaceAccessCard 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.
AgentWorkPanels.AgentTasksPanel (cyclomatic 17) ui/src/components/chat/AgentWorkPanels.tsx:107— AgentWorkPanels.AgentTasksPanel has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 191, 138, 183). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TaskDetailTasksPanel.TaskDetailTasksPanel (cyclomatic 17) ui/src/components/task-detail/TaskDetailTasksPanel.tsx:51— TaskDetailTasksPanel.TaskDetailTasksPanel 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.
SpekoIncomingCalls.SpekoIncomingCallCard (cyclomatic 17) ui/src/components/voice/SpekoIncomingCalls.tsx:10— SpekoIncomingCalls.SpekoIncomingCallCard has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 2 function literals 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.
ConnectionSetup.ConnectionSetup::connect (cyclomatic 17) ui/storybook/prototypes/provider-routing/ConnectionSetup.tsx:80— ConnectionSetup.ConnectionSetup::connect 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 shape REPEATS in the file: one other method here (ConnectionSetup.ConnectionSetup) 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.
task-list-data.columnData (cyclomatic 17) ui/storybook/support/design-proposals/task-list-data.ts:40— task-list-data.columnData 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.
client.http (cyclomatic 17) server/src/services/scripts/v2/client.py:60— client.http 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.
Command::validate (cyclomatic 17) packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:77— Command::validate 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.
DurableState::enqueue_event_with_source_event_id (cyclomatic 17) packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:507— DurableState::enqueue_event_with_source_event_id 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.
RunnerTransportEndpoint::open (cyclomatic 17) packages/paperclip-runner/runner/crates/runner-core/src/durable/transport.rs:254— RunnerTransportEndpoint::open 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.
secrets-check.secretsCheck (cyclomatic 16) cli/src/checks/secrets-check.ts:51— secrets-check.secretsCheck has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
update.compareVersions (cyclomatic 16) cli/src/commands/update.ts:93— update.compareVersions has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal 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-observability-home.prepareAcpxCodexObservabilityHome (cyclomatic 16) packages/adapter-utils/src/codex-observability-home.ts:11— codex-observability-home.prepareAcpxCodexObservabilityHome has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
workspace-snapshot-thread.runSnapshotThread (cyclomatic 16) packages/adapter-utils/src/workspace-snapshot-thread.ts:34— workspace-snapshot-thread.runSnapshotThread has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
server-utils.readPaperclipSkillSyncPreference (cyclomatic 16) REDACTED:4153— server-utils.readPaperclipSkillSyncPreference has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 4167). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest. This is NOT this file's highest cyclomatic complexity: server-utils.isNormalizedPaperclipExternalChatQuestionResponseTurn (cyclomatic 40) 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 method is counted neither in this dimension's figures nor in its score.
workspace-git-stream.runWorkspaceGitProcess (cyclomatic 16) packages/adapter-utils/src/workspace-git-stream.ts:31— workspace-git-stream.runWorkspaceGitProcess has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 2 function items inside it that branch (collect, terminate). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
workspace-seed-cache.cachedGenerations (cyclomatic 16) packages/adapter-utils/src/workspace-seed-cache.ts:76— workspace-seed-cache.cachedGenerations 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.
workspace-seed-cache.publishWorkspaceSeedGeneration (cyclomatic 16) packages/adapter-utils/src/workspace-seed-cache.ts:161— workspace-seed-cache.publishWorkspaceSeedGeneration 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 shape REPEATS in the file: one other method here (workspace-seed-cache.publishWorkspaceSeedGeneration::capacity) 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.
sandbox-callback-bridge.createFileSystemSandboxCallbackBridgeQueueClient.writeResponseFile (cyclomatic 16) REDACTED:555— sandbox-callback-bridge.createFileSystemSandboxCallbackBridgeQueueClient.writeResponseFile 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.
execution-target.maybeRunSandboxInstallCommand (cyclomatic 16) REDACTED:1060— execution-target.maybeRunSandboxInstallCommand 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.
execute.buildPrompt (cyclomatic 16) packages/adapter-utils/src/acpx-engine/execute.ts:3105— execute.buildPrompt 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.
execute.summarizeAcpxTurnUsage (cyclomatic 16) packages/adapter-utils/src/acpx-engine/execute.ts:3403— execute.summarizeAcpxTurnUsage 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.
codex-auth-merge-decision.parseAuth (cyclomatic 16) packages/adapters/codex-local/src/server/codex-auth-merge-decision.cjs:6— codex-auth-merge-decision.parseAuth has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
parse.parseGrokJsonl (cyclomatic 16) packages/adapters/grok-local/src/server/parse.ts:33— parse.parseGrokJsonl 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.
execute.networkFailureReason (cyclomatic 16) packages/adapters/hermes/src/gateway/server/execute.ts:97— execute.networkFailureReason 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.
detect-model.parseModelFromConfig (cyclomatic 16) packages/adapters/hermes/src/server/detect-model.ts:53— detect-model.parseModelFromConfig 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.
parse-stdout.parseHermesStdoutLine (cyclomatic 16) packages/adapters/hermes/src/ui/parse-stdout.ts:193— parse-stdout.parseHermesStdoutLine 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.
ui-parser.parseStdoutLine (cyclomatic 16) packages/adapters/hermes/ui-parser.cjs:122— ui-parser.parseStdoutLine 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.
build-config.parseEnvBindings (cyclomatic 16) packages/adapters/kimi-local/src/ui/build-config.ts:26— build-config.parseEnvBindings 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.
runtime-config.preparePiRuntimeConfig (cyclomatic 16) packages/adapters/pi-local/src/server/runtime-config.ts:108— runtime-config.preparePiRuntimeConfig 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.
check-migration-safety.analyzeMigrationSafety (cyclomatic 16) packages/db/src/check-migration-safety.ts:886— check-migration-safety.analyzeMigrationSafety 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.
use-live-console.useLiveConsole (cyclomatic 16) packages/paperclip-runner/devtools/browser/src/live/use-live-console.ts:122— use-live-console.useLiveConsole has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 218, 243, 279, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
runtime-context.parseNativeRuntimeContext (cyclomatic 16) packages/paperclip-runner/src/contracts/runtime-context.ts:113— runtime-context.parseNativeRuntimeContext has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
workspace-diff.capturePaperclipWorkspace::visit (cyclomatic 16) packages/paperclip-runner/src/live/workspace-diff.ts:84— workspace-diff.capturePaperclipWorkspace::visit 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-startup-trust.trustCodexStartupRoot (cyclomatic 16) packages/paperclip-runner/src/drivers/codex/codex-startup-trust.ts:56— codex-startup-trust.trustCodexStartupRoot 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.
CodexHarnessSession.steer (cyclomatic 16) packages/paperclip-runner/src/drivers/codex/codex-harness-session.ts:332— CodexHarnessSession.steer 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-runner.dispositionIssues (cyclomatic 16) packages/paperclip-runner/src/mock-core/codex-runner.ts:76— codex-runner.dispositionIssues 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.
evidence-redaction.providerActivityDetails (cyclomatic 16) packages/paperclip-runner/src/live/evidence-redaction.ts:179— evidence-redaction.providerActivityDetails 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.
RawWebSocketWireConnection.#consume (cyclomatic 16) REDACTED:1380— RawWebSocketWireConnection.#consume 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: durable-prp-control-plane.warmTransitionReceipt (cyclomatic 23) 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 method is counted neither in this dimension's figures nor in its score.
durable-prp-control-plane.canonicalJson (cyclomatic 16) REDACTED:361— durable-prp-control-plane.canonicalJson 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: durable-prp-control-plane.warmTransitionReceipt (cyclomatic 23) 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 method is counted neither in this dimension's figures nor in its score.
DurablePrpCodexTransport.#commandResult (cyclomatic 16) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:6184— DurablePrpCodexTransport.#commandResult 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.
runnerd-codex-transport.providerDrainStateFromSnapshot (cyclomatic 16) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:558— runnerd-codex-transport.providerDrainStateFromSnapshot has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
runnerd-codex-transport.appServerThreadGoal (cyclomatic 16) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:1615— runnerd-codex-transport.appServerThreadGoal has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to one function item inside it that branches. 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.
runner-protocol-eval-history-view.chart (cyclomatic 16) packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:33— runner-protocol-eval-history-view.chart has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 45, a function literal at line 54, a function literal at line 36, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
qualify-copilot-acp.evaluateProbe (cyclomatic 16) packages/paperclip-runner/scripts/qualify-copilot-acp.mjs:26— qualify-copilot-acp.evaluateProbe has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to 2 function literals 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.
semantic-tool-receipt.readNativeSemanticReceipt (cyclomatic 16) packages/paperclip-runner/src/drivers/semantic-tool-receipt.ts:68— semantic-tool-receipt.readNativeSemanticReceipt has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
copilot-tool-evidence.createCopilotToolEvidence.notice (cyclomatic 16) packages/paperclip-runner/src/drivers/acpx/copilot-tool-evidence.ts:50— copilot-tool-evidence.createCopilotToolEvidence.notice 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.
runner-tool-bridge.startRunnerToolBridge (cyclomatic 16) packages/paperclip-runner/src/drivers/runner-tool-bridge.ts:110— runner-tool-bridge.startRunnerToolBridge has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal 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.
agent-files-binding.bindAcpxAgentFiles (cyclomatic 16) packages/paperclip-runner/src/drivers/acpx/agent-files-binding.ts:11— agent-files-binding.bindAcpxAgentFiles has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to one function item inside it that branches. 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-credentials.readManagedCredential (cyclomatic 16) packages/paperclip-runner/src/drivers/acpx/codex-credentials.ts:782— codex-credentials.readManagedCredential 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.
codex-credentials.runDirectorySyncHelper (cyclomatic 16) packages/paperclip-runner/src/drivers/acpx/codex-credentials.ts:1131— codex-credentials.runDirectorySyncHelper has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 1178, 1212, 1188, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
recovery-identity.createAcpxRecoveryBinding (cyclomatic 16) packages/paperclip-runner/src/drivers/acpx/recovery-identity.ts:48— recovery-identity.createAcpxRecoveryBinding 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: recovery-identity.verifyExpectedAcpxIdentity (cyclomatic 24) 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 method is counted neither in this dimension's figures nor in its score.
semantic-conformance.canonicalJson (cyclomatic 16) packages/paperclip-runner/src/conformance/semantic-conformance.ts:278— semantic-conformance.canonicalJson 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.
live-console-demo-server.requireTransportAdmission (cyclomatic 16) REDACTED:409— live-console-demo-server.requireTransportAdmission 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.
use-runner-console.useRunnerConsole (cyclomatic 16) packages/paperclip-runner/src/react/use-runner-console.ts:105— use-runner-console.useRunnerConsole has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 225, 250, 286, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
heartbeat-run-events.appendHeartbeatRunEvent (cyclomatic 16) server/src/services/heartbeat-run-events.ts:67— heartbeat-run-events.appendHeartbeatRunEvent has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 95). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
json-schema-secret-refs.collectSecretRefPaths (cyclomatic 16) server/src/services/json-schema-secret-refs.ts:33— json-schema-secret-refs.collectSecretRefPaths has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (walk). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
trust-preset-resolver.resolveCoreTrustPreset (cyclomatic 16) server/src/services/trust-preset-resolver.ts:273— trust-preset-resolver.resolveCoreTrustPreset 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.
service.assertPutFileInput (cyclomatic 16) server/src/storage/service.ts:73— service.assertPutFileInput 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.
aws-secrets-manager-provider.loadAwsSecretsManagerConfig (cyclomatic 16) server/src/secrets/aws-secrets-manager-provider.ts:376— aws-secrets-manager-provider.loadAwsSecretsManagerConfig 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.
secrets.secretService.listAgentSecretAccess (cyclomatic 16) server/src/services/secrets.ts:1760— secrets.secretService.listAgentSecretAccess has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 2 function literals inside it that branch. 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.
ai-connections.aiConnectionService.selectDecision (cyclomatic 16) server/src/services/ai-connections.ts:400— ai-connections.aiConnectionService.selectDecision 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.
ai-connections.aiConnectionService.selectFastResponse (cyclomatic 16) server/src/services/ai-connections.ts:434— ai-connections.aiConnectionService.selectFastResponse 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 shape REPEATS in the file: one other method here (ai-connections.aiConnectionService.selectPromptInjectionPrevention) 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.
ai-connections.aiConnectionService.selectPromptInjectionPrevention (cyclomatic 16) server/src/services/ai-connections.ts:467— ai-connections.aiConnectionService.selectPromptInjectionPrevention 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 shape REPEATS in the file: one other method here (ai-connections.aiConnectionService.selectFastResponse) 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.
ai-connections.aiConnectionService.credential (cyclomatic 16) server/src/services/ai-connections.ts:500— ai-connections.aiConnectionService.credential 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.
issue-queued-comment-queue.decideQueuedCommentQueueSteering (cyclomatic 16) server/src/services/issue-queued-comment-queue.ts:133— issue-queued-comment-queue.decideQueuedCommentQueueSteering 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.
case-access.canActorReceiveCase (cyclomatic 16) server/src/services/case-access.ts:194— case-access.canActorReceiveCase 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.
budget-exposure.readObservedSpends (cyclomatic 16) server/src/services/budget-exposure.ts:73— budget-exposure.readObservedSpends 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.
resource-memberships.resourceMembershipService.updateProject (cyclomatic 16) server/src/services/resource-memberships.ts:255— resource-memberships.resourceMembershipService.updateProject 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.
paperclip-cloud-connector.unsealEvents (cyclomatic 16) server/src/services/paperclip-cloud-connector.ts:721— paperclip-cloud-connector.unsealEvents 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.
chat-teams-file-consent.bindTeamsFileConsent (cyclomatic 16) server/src/services/chat-teams-file-consent.ts:900— chat-teams-file-consent.bindTeamsFileConsent 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.
ChatSdkEndpointRuntime.handleWebhook (cyclomatic 16) server/src/services/chat-sdk-runtime.ts:2376— ChatSdkEndpointRuntime.handleWebhook has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 2440, beforeDeadline). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
speko-protocol.verifySpekoSignature (cyclomatic 16) server/src/services/voice/speko-protocol.ts:25— speko-protocol.verifySpekoSignature 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.
environment-selection.assertEnvironmentSelectionForCompany (cyclomatic 16) server/src/services/environment-selection.ts:3— environment-selection.assertEnvironmentSelectionForCompany 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.
tool-content-guards.readToolArgumentsEnvelope (cyclomatic 16) REDACTED:142— tool-content-guards.readToolArgumentsEnvelope 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.
tool-access-policy.toolAccessPolicyService.matchingApprovedActionRequestCount (cyclomatic 16) server/src/services/tool-access-policy.ts:1763— tool-access-policy.toolAccessPolicyService.matchingApprovedActionRequestCount has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 1793). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest. This is NOT this file's highest cyclomatic complexity: tool-access-policy.toolAccessPolicyService.admittedRateLimitAdmissions (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 method is counted neither in this dimension's figures nor in its score.
tool-gateway.createToolGatewayService.matchingAgentActionRequest (cyclomatic 16) server/src/services/tool-gateway.ts:8421— tool-gateway.createToolGatewayService.matchingAgentActionRequest 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.
voice-session-service.voiceSessionService.reconcile (cyclomatic 16) server/src/services/voice/voice-session-service.ts:202— voice-session-service.voiceSessionService.reconcile 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.
chat-provider-lifecycle.parseGitHubLifecycle (cyclomatic 16) server/src/services/chat-provider-lifecycle.ts:203— chat-provider-lifecycle.parseGitHubLifecycle 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.
chat-discord-command-registration-store.stored (cyclomatic 16) server/src/services/chat-discord-command-registration-store.ts:69— chat-discord-command-registration-store.stored 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.
callback-verification.slackRequestWorkspaceId (cyclomatic 16) server/src/services/chat-channels/slack/callback-verification.ts:59— callback-verification.slackRequestWorkspaceId has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 4 function items inside it that branch (nestedId, stringField, authorizationField, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
callback-verification.slackCallbackObservationUrl (cyclomatic 16) server/src/services/chat-channels/slack/callback-verification.ts:217— callback-verification.slackCallbackObservationUrl 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.
repository-object-cache.readRepositoryObjectCache (cyclomatic 16) server/src/services/repository-object-cache.ts:52— repository-object-cache.readRepositoryObjectCache 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.
repository-object-cache.publishRepositoryObjectCache (cyclomatic 16) server/src/services/repository-object-cache.ts:88— repository-object-cache.publishRepositoryObjectCache has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 94). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
nested-repository-worktrees.restoreNestedRepositoryWorktree (cyclomatic 16) server/src/services/nested-repository-worktrees.ts:232— nested-repository-worktrees.restoreNestedRepositoryWorktree has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 241). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
git-restore-point.captureRestorePoint (cyclomatic 16) REDACTED:416— git-restore-point.captureRestorePoint has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
git-workspace-restoration.gitCacheExpirationLockLocations (cyclomatic 16) server/src/services/git-workspace-restoration.ts:622— git-workspace-restoration.gitCacheExpirationLockLocations has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 2 function items inside it that branch. 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. This is NOT this file's highest cyclomatic complexity: git-workspace-restoration.readGitCacheRestoration (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 method is counted neither in this dimension's figures nor in its score.
git-workspace-restoration.restoreGitCacheBase (cyclomatic 16) server/src/services/git-workspace-restoration.ts:714— git-workspace-restoration.restoreGitCacheBase has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals 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. This is NOT this file's highest cyclomatic complexity: git-workspace-restoration.readGitCacheRestoration (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 method is counted neither in this dimension's figures nor in its score.
nested-clone-migration.planRefs (cyclomatic 16) server/src/services/nested-clone-migration.ts:235— nested-clone-migration.planRefs 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: nested-clone-migration.readPending (cyclomatic 24) 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 method is counted neither in this dimension's figures nor in its score.
workspace-host-provision.workspaceRequiresCopyOnlyProvisioning (cyclomatic 16) server/src/services/workspace-host-provision.ts:9— workspace-host-provision.workspaceRequiresCopyOnlyProvisioning 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.
UnixBrokerClient.roundTrip (cyclomatic 16) server/src/services/runtime-exposure/broker-client.ts:205— UnixBrokerClient.roundTrip has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 244, 221). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
projects.projectService.createWorkspace (cyclomatic 16) server/src/services/projects.ts:1112— projects.projectService.createWorkspace has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 1115, 1147). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspaces.createHeartbeatWorkspaceResolver.managedLocalSourceGuard (cyclomatic 16) server/src/services/heartbeat/workspaces.ts:3277— workspaces.createHeartbeatWorkspaceResolver.managedLocalSourceGuard has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 3313, 3282). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
execution-workspaces.mergeExecutionWorkspaceConfig (cyclomatic 16) server/src/services/execution-workspaces.ts:1058— execution-workspaces.mergeExecutionWorkspaceConfig has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
execution-workspaces.executionWorkspaceService.terminalWorkspaceWorkSettled (cyclomatic 16) server/src/services/execution-workspaces.ts:3990— execution-workspaces.executionWorkspaceService.terminalWorkspaceWorkSettled 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.
email-channels.emailChannelService.queueSend (cyclomatic 16) server/src/services/email-channels.ts:1508— email-channels.emailChannelService.queueSend has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to one function literal 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.
email-channels.emailChannelService.reconnect (cyclomatic 16) server/src/services/email-channels.ts:2474— email-channels.emailChannelService.reconnect has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2491, 2512, 2518). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
connection-agent-access.grantConnectionAgentTools (cyclomatic 16) server/src/services/connection-agent-access.ts:12— connection-agent-access.grantConnectionAgentTools 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.
chat-teams-file-transfers.teamsFileTransferService.claim (cyclomatic 16) server/src/services/chat-teams-file-transfers.ts:642— chat-teams-file-transfers.teamsFileTransferService.claim has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 643). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
chat-publication-text-parts.renderPublicationTransportText (cyclomatic 16) server/src/services/chat-publication-text-parts.ts:30— chat-publication-text-parts.renderPublicationTransportText 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.
messages.telegramLifecycleActor (cyclomatic 16) server/src/services/chat-channels/telegram/messages.ts:22— messages.telegramLifecycleActor 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.
NativeRunCoordinatorStore.claimFinalization (cyclomatic 16) server/src/services/native-runtime/native-run-coordinator-store.ts:479— NativeRunCoordinatorStore.claimFinalization has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 492). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
aggregator-accounts.createAggregatorAccounts.discoverAggregatorInventory (cyclomatic 16) server/src/services/tool-access/catalog/aggregator-accounts.ts:277— aggregator-accounts.createAggregatorAccounts.discoverAggregatorInventory has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to 2 function literals 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.
aggregator-accounts.createAggregatorAccounts.manageComposioAppAccount (cyclomatic 16) server/src/services/tool-access/catalog/aggregator-accounts.ts:458— aggregator-accounts.createAggregatorAccounts.manageComposioAppAccount 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.
github-external-object-provider.createGitHubExternalObjectProvider::resolver (cyclomatic 16) server/src/services/github-external-object-provider.ts:432— github-external-object-provider.createGitHubExternalObjectProvider::resolver 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.
issue-thread-interactions.issueThreadInteractionService.acceptSuggestedTasks (cyclomatic 16) server/src/services/issue-thread-interactions.ts:3931— issue-thread-interactions.issueThreadInteractionService.acceptSuggestedTasks has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
environment-config.normalizeEnvironmentConfigForPersistence (cyclomatic 16) server/src/services/environment-config.ts:542— environment-config.normalizeEnvironmentConfigForPersistence 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.
agent-runner-selection.resolveAgentRunnerEnvironmentForCompany (cyclomatic 16) server/src/services/agent-runner-selection.ts:314— agent-runner-selection.resolveAgentRunnerEnvironmentForCompany 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.
muse-identity.inspectMuseConnectionCredential (cyclomatic 16) server/src/services/muse-identity.ts:106— muse-identity.inspectMuseConnectionCredential 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: muse-identity.assertMuseCurrentAuthority (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 method is counted neither in this dimension's figures nor in its score.
dot.createBroker.createPairing (cyclomatic 16) server/src/modules/external-agents/dot.ts:96— dot.createBroker.createPairing has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 102). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
environment-runtime.reusableSandboxLeaseScopeMatches (cyclomatic 16) server/src/services/environment-runtime.ts:1066— environment-runtime.reusableSandboxLeaseScopeMatches 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.
environment-runtime.createSandboxEnvironmentDriver::releasePluginBackedSandboxLease (cyclomatic 16) server/src/services/environment-runtime.ts:3323— environment-runtime.createSandboxEnvironmentDriver::releasePluginBackedSandboxLease 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 shape REPEATS in the file: one other method here (environment-runtime.createSandboxEnvironmentDriver) 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.
environment-runtime.createPluginEnvironmentDriver.resolvePluginDriverForRelease (cyclomatic 16) server/src/services/environment-runtime.ts:3596— environment-runtime.createPluginEnvironmentDriver.resolvePluginDriverForRelease 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.
runner-goals.settleLiveRunnerGoalBeforeInterrupt (cyclomatic 16) server/src/services/runner-goals.ts:954— runner-goals.settleLiveRunnerGoalBeforeInterrupt 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.
remote-pi-companion.inventoryRemoteCompanion (cyclomatic 16) server/src/services/native-runtime/remote-pi-companion.ts:49— remote-pi-companion.inventoryRemoteCompanion has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 2 function items inside it that branch (visit, a function literal at line 73). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
native-workflow-tools.executeNativeWorkflowTool (cyclomatic 16) server/src/services/native-runtime/native-workflow-tools.ts:19— native-workflow-tools.executeNativeWorkflowTool 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.
runner-task-attachments.readTaskAttachment (cyclomatic 16) server/src/services/native-runtime/runner-task-attachments.ts:119— runner-task-attachments.readTaskAttachment 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.
project-tools.callProjectTool (cyclomatic 16) server/src/services/project-tools.ts:19— project-tools.callProjectTool 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.
heartbeat-run-privacy.getHeartbeatRunReadDecisions (cyclomatic 16) server/src/services/heartbeat-run-privacy.ts:64— heartbeat-run-privacy.getHeartbeatRunReadDecisions has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
workspace-file-resources.workspaceFileResourceService.loadAvailabilityTargets (cyclomatic 16) server/src/services/workspace-file-resources.ts:1186— workspace-file-resources.workspaceFileResourceService.loadAvailabilityTargets has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal 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.
work-products.refreshPullRequestWorkProductMetadata (cyclomatic 16) server/src/services/work-products.ts:89— work-products.refreshPullRequestWorkProductMetadata has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 93). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
routines.routineService.recordSuppressedAutomaticRun (cyclomatic 16) server/src/services/routines.ts:1416— routines.routineService.recordSuppressedAutomaticRun has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 1427). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
built-in-agents.builtInAgentService.provision (cyclomatic 16) server/src/services/built-in-agents.ts:1865— built-in-agents.builtInAgentService.provision 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.
native-runner-file-handoff.writeStagedAttachment (cyclomatic 16) server/src/services/native-runtime/native-runner-file-handoff.ts:652— native-runner-file-handoff.writeStagedAttachment 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.
current-wake-comments.decodeCursor (cyclomatic 16) server/src/services/native-runtime/current-wake-comments.ts:345— current-wake-comments.decodeCursor 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.
PaperclipRunnerToolAuthority.#registerDeliverable (cyclomatic 16) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:1939— PaperclipRunnerToolAuthority.#registerDeliverable has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 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.
status-decision-committer.assertPendingEffectTarget (cyclomatic 16) server/src/services/native-runtime/status-decision-committer.ts:183— status-decision-committer.assertPendingEffectTarget 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.
native-session-executor.createGovernedWaitEventObservation.observe (cyclomatic 16) server/src/services/native-runtime/native-session-executor.ts:1362— native-session-executor.createGovernedWaitEventObservation.observe 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. This is NOT this file's highest cyclomatic complexity: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-session-executor.prepareRemoteExternalRunner.prepare (cyclomatic 16) server/src/services/native-runtime/native-session-executor.ts:11707— native-session-executor.prepareRemoteExternalRunner.prepare 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: native-session-executor.nativePreProviderRetryAfterCleanupStateIsSafe (cyclomatic 30) 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 method is counted neither in this dimension's figures nor in its score.
native-workspace-sync.verifiedDurableSeed (cyclomatic 16) server/src/services/native-runtime/native-workspace-sync.ts:197— native-workspace-sync.verifiedDurableSeed 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.
native-run-finalizer.claimCoordinator (cyclomatic 16) server/src/services/native-runtime/native-run-finalizer.ts:166— native-run-finalizer.claimCoordinator has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 173). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
run-preparation.gatewayAppliesToRun (cyclomatic 16) server/src/services/heartbeat/run-preparation.ts:1307— run-preparation.gatewayAppliesToRun 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.
service.classifyAdapterFailureForRecovery (cyclomatic 16) REDACTED:650— service.classifyAdapterFailureForRecovery 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.
run-lifecycle.createHeartbeatLifecycle.terminalizeRunOnLeaseRelease (cyclomatic 16) server/src/services/heartbeat/run-lifecycle.ts:1240— run-lifecycle.createHeartbeatLifecycle.terminalizeRunOnLeaseRelease 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.
agent-observability.agentObservabilityService.readCredentials (cyclomatic 16) server/src/services/agent-observability.ts:51— agent-observability.agentObservabilityService.readCredentials 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.
app.UnconfiguredFolder (cyclomatic 16) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:2988— app.UnconfiguredFolder has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 2 function items inside it that branch. 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.
core.normalizePaperclipIngestionProfile (cyclomatic 16) packages/plugins/plugin-llm-wiki/src/wiki/core.ts:783— core.normalizePaperclipIngestionProfile 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.
core.distillPaperclipProjectPage (cyclomatic 16) packages/plugins/plugin-llm-wiki/src/wiki/core.ts:3334— core.distillPaperclipProjectPage 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.
bridge-client.consumeExecuteEventStream (cyclomatic 16) packages/plugins/sandbox-providers/cloudflare/src/bridge-client.ts:222— bridge-client.consumeExecuteEventStream 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.
config.validateCloudflareDriverConfig (cyclomatic 16) packages/plugins/sandbox-providers/cloudflare/src/config.ts:43— config.validateCloudflareDriverConfig 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.
environment-sync-error.sanitize (cyclomatic 16) packages/plugins/sdk/src/environment-sync-error.ts:86— environment-sync-error.sanitize 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.
case-handoffs.agentCaseHandoffSchema (cyclomatic 16) packages/shared/src/case-handoffs.ts:53— case-handoffs.agentCaseHandoffSchema 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.
worktree-seed-source.resolveRegisteredWorktreeSeedSource (cyclomatic 16) REDACTED:115— worktree-seed-source.resolveRegisteredWorktreeSeedSource 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.
StrictParser.parseString (cyclomatic 16) packages/tailscale-https-broker/src/strict-json.ts:112— StrictParser.parseString 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.
grok-public-install-sandbox.grokConsumerDockerArgs (cyclomatic 16) scripts/grok-public-install-sandbox.mjs:352— grok-public-install-sandbox.grokConsumerDockerArgs 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.
company-export-readme.generateReadme (cyclomatic 16) server/src/services/company-export-readme.ts:74— company-export-readme.generateReadme 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.
local-ai-browser-login.startLocalBrowserLogin (cyclomatic 16) server/src/services/local-ai-browser-login.ts:50— local-ai-browser-login.startLocalBrowserLogin has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to 3 function literals inside it that branch. 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.
github-connection-events.githubConnectionEventService.applyInstallationEvent (cyclomatic 16) server/src/services/github-connection-events.ts:276— github-connection-events.githubConnectionEventService.applyInstallationEvent 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.
decision-queues.sourceIssueId (cyclomatic 16) server/src/services/decision-queues.ts:200— decision-queues.sourceIssueId 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.
decision-training.loadSourceDecision (cyclomatic 16) server/src/services/decision-training.ts:89— decision-training.loadSourceDecision 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.
decisions.decisionService.runEffects (cyclomatic 16) server/src/services/decisions.ts:547— decisions.decisionService.runEffects 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.
secret-proposals.createSecretProposalsService.applyBindingApproval (cyclomatic 16) server/src/services/secret-proposals.ts:658— secret-proposals.createSecretProposalsService.applyBindingApproval 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.
smoke-lab.smokeLabService.issueToken (cyclomatic 16) REDACTED:581— smoke-lab.smokeLabService.issueToken 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.
company-portability-agent-selection.resolvePortableExportAgentSelection (cyclomatic 16) server/src/services/company-portability-agent-selection.ts:11— company-portability-agent-selection.resolvePortableExportAgentSelection has cyclomatic complexity 16 (threshold 15). Of this number, 15 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.
company-portability.parseGitHubSourceUrl (cyclomatic 16) server/src/services/company-portability.ts:3519— company-portability.parseGitHubSourceUrl 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: company-portability.isSensitiveEnvKey (cyclomatic 26) 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 method is counted neither in this dimension's figures nor in its score.
agent-avatars.agentAvatarRoutes (cyclomatic 16) server/src/routes/agent-avatars.ts:27— agent-avatars.agentAvatarRoutes has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 30). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
skill-sources.skillSourceService.disconnect (cyclomatic 16) server/src/services/skill-sources.ts:368— skill-sources.skillSourceService.disconnect has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 4 function items inside it that branch. 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.
agent-runtime-settings.prepareRuntimeSettingsPatch (cyclomatic 16) server/src/services/agent-runtime-settings.ts:7— agent-runtime-settings.prepareRuntimeSettingsPatch 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.
agent-project-access.addAgentProjectAccess (cyclomatic 16) server/src/services/agent-project-access.ts:25— agent-project-access.addAgentProjectAccess has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 28). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
issues.readToolActionContinuationContext (cyclomatic 16) server/src/routes/issues.ts:2290— issues.readToolActionContinuationContext 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.
case-work-summary.enrichCaseWork (cyclomatic 16) server/src/services/case-work-summary.ts:10— case-work-summary.enrichCaseWork has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 53, 17, 18, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
plugin-local-folders.listPluginLocalFolderEntries (cyclomatic 16) server/src/services/plugin-local-folders.ts:417— plugin-local-folders.listPluginLocalFolderEntries has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (visit). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
connection-intents.runtimeConnectionIntentRoutes (cyclomatic 16) server/src/routes/connection-intents.ts:43— connection-intents.runtimeConnectionIntentRoutes has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 65, 47). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
plugin-host-services.isPrivateIP (cyclomatic 16) server/src/services/plugin-host-services.ts:120— plugin-host-services.isPrivateIP 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.
chat-webhook-ingress.parseArgs (cyclomatic 16) scripts/smoke/chat-webhook-ingress.mjs:122— chat-webhook-ingress.parseArgs 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.
native-workspace-sync-retention.nativeWorkspaceSyncRetentionService.expireFolder (cyclomatic 16) server/src/services/native-runtime/native-workspace-sync-retention.ts:287— native-workspace-sync-retention.nativeWorkspaceSyncRetentionService.expireFolder has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 301). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-workspace-sync-retention.nativeWorkspaceSyncRetentionService.nextDeadlineAt (cyclomatic 16) server/src/services/native-runtime/native-workspace-sync-retention.ts:387— native-workspace-sync-retention.nativeWorkspaceSyncRetentionService.nextDeadlineAt 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.
angle-bracket-markdown.transformAngleBrackets (cyclomatic 16) ui/src/lib/angle-bracket-markdown.ts:201— angle-bracket-markdown.transformAngleBrackets has cyclomatic complexity 16 (threshold 15). Of this number, 15 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.
composer-run-settings.composerDefaultModel (cyclomatic 16) ui/src/components/task-chat/composer-run-settings.ts:31— composer-run-settings.composerDefaultModel 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.
MarkdownBody.CodeBlock (cyclomatic 16) REDACTED:627— MarkdownBody.CodeBlock has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
CompanySettingsNav.getCompanySettingsTab (cyclomatic 16) ui/src/components/access/CompanySettingsNav.tsx:39— CompanySettingsNav.getCompanySettingsTab 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.
keyboardShortcuts.resolveAttentionQueueKeyAction (cyclomatic 16) ui/src/lib/keyboardShortcuts.ts:89— keyboardShortcuts.resolveAttentionQueueKeyAction 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.
keyboardShortcuts.resolveIssueDetailGoKeyAction (cyclomatic 16) ui/src/lib/keyboardShortcuts.ts:181— keyboardShortcuts.resolveIssueDetailGoKeyAction 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.
index.normalizedEnvEntries (cyclomatic 16) ui/src/components/environment-variables-editor/index.tsx:41— index.normalizedEnvEntries 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.
BlockedInboxView.BlockedInboxRow (cyclomatic 16) ui/src/components/BlockedInboxView.tsx:307— BlockedInboxView.BlockedInboxRow 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.
Issues.OrganizationIssues (cyclomatic 16) ui/src/pages/Issues.tsx:165— Issues.OrganizationIssues has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
LiveUpdatesProvider.applyRunLiveStatusPatchToCaches (cyclomatic 16) ui/src/context/LiveUpdatesProvider.tsx:700— LiveUpdatesProvider.applyRunLiveStatusPatchToCaches has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to 3 function literals inside it that branch. 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.
agent-detail-navigation.parseAgentDetailView (cyclomatic 16) ui/src/pages/agent-detail-navigation.ts:49— agent-detail-navigation.parseAgentDetailView 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.
ApprovalCard.ApprovalCard (cyclomatic 16) ui/src/components/ApprovalCard.tsx:27— ApprovalCard.ApprovalCard 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.
TaskChatRunnerActivityGroup.ActivityContent (cyclomatic 16) ui/src/components/task-chat/TaskChatRunnerActivityGroup.tsx:106— TaskChatRunnerActivityGroup.ActivityContent 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.
run-log-chunks.mergeRunLogChunks (cyclomatic 16) ui/src/lib/run-log-chunks.ts:202— run-log-chunks.mergeRunLogChunks 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-chat-messages.computeSegmentTimings (cyclomatic 16) ui/src/lib/issue-chat-messages.ts:743— issue-chat-messages.computeSegmentTimings 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.
issue-chat-messages.buildIssueChatMessages (cyclomatic 16) ui/src/lib/issue-chat-messages.ts:1162— issue-chat-messages.buildIssueChatMessages has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal 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.
IssueChatThread.IssueChatToolPart (cyclomatic 16) ui/src/components/IssueChatThread.tsx:1597— IssueChatThread.IssueChatToolPart has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal 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.
board-send-draft.canDismissBoardSendBatch (cyclomatic 16) ui/src/components/chat/board-send-draft.ts:134— board-send-draft.canDismissBoardSendBatch has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
WorkspaceRuntimeControls.CommandSection (cyclomatic 16) ui/src/components/WorkspaceRuntimeControls.tsx:411— WorkspaceRuntimeControls.CommandSection has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 452). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
TaskWorkspaceFilePanel.TaskWorkspaceFilePanel (cyclomatic 16) ui/src/components/task-side-panel/TaskWorkspaceFilePanel.tsx:17— TaskWorkspaceFilePanel.TaskWorkspaceFilePanel has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
SidePanelTabs.SidePanelTabs::handleKeyDown (cyclomatic 16) ui/src/components/side-panel/SidePanelTabs.tsx:267— SidePanelTabs.SidePanelTabs::handleKeyDown 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 shape REPEATS in the file: one other method here (SidePanelTabs.SidePanelTabs) 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.
wait-for-stopped-runs.waitForStoppedRuns (cyclomatic 16) ui/src/lib/wait-for-stopped-runs.ts:6— wait-for-stopped-runs.waitForStoppedRuns has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to one function literal inside it that branches. 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.
RunnerInspector.buildOperations (cyclomatic 16) ui/src/components/RunnerInspector.tsx:270— RunnerInspector.buildOperations has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 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.
IssueRunLedger.stopReasonLabel (cyclomatic 16) ui/src/components/IssueRunLedger.tsx:308— IssueRunLedger.stopReasonLabel 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.
InstructionHistory.InstructionHistory (cyclomatic 16) ui/src/components/InstructionHistory.tsx:7— InstructionHistory.InstructionHistory has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
FileTree.parseFrontmatter (cyclomatic 16) ui/src/components/FileTree.tsx:166— FileTree.parseFrontmatter 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.
AgentDetail.WorkspaceOperationLogViewer (cyclomatic 16) ui/src/pages/AgentDetail.tsx:605— AgentDetail.WorkspaceOperationLogViewer has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
AgentDetail.KeysTab (cyclomatic 16) ui/src/pages/AgentDetail.tsx:4675— AgentDetail.KeysTab has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to 4 function items inside it that branch. 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.
project-workspaces-tab.buildProjectWorkspaceSummaries (cyclomatic 16) ui/src/lib/project-workspaces-tab.ts:86— project-workspaces-tab.buildProjectWorkspaceSummaries has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal 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.
ExecutionWorkspaceDetail.ExecutionWorkspaceRoutinesList (cyclomatic 16) ui/src/pages/ExecutionWorkspaceDetail.tsx:645— ExecutionWorkspaceDetail.ExecutionWorkspaceRoutinesList has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 673, 705, 755, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ArtifactCard.VideoPreview (cyclomatic 16) ui/src/components/artifacts/ArtifactCard.tsx:55— ArtifactCard.VideoPreview has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 5 function items inside it that branch (loadThumbnailFrame, handleLoadedData, a function literal at line 61, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
DecisionCard.executionRow (cyclomatic 16) ui/src/components/DecisionCard.tsx:137— DecisionCard.executionRow 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.
CompanySettingsPluginPage.CompanySettingsPluginPage (cyclomatic 16) ui/src/pages/CompanySettingsPluginPage.tsx:8— CompanySettingsPluginPage.CompanySettingsPluginPage has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to 3 function literals inside it that branch. 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.
profile-model.buildEntries (cyclomatic 16) ui/src/pages/tools/profiles/profile-model.ts:203— profile-model.buildEntries 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.
Browse.ConnectionAccountRow (cyclomatic 16) ui/src/pages/apps/Browse.tsx:1347— Browse.ConnectionAccountRow 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.
ReviewQueueCard.ReviewRow (cyclomatic 16) ui/src/pages/apps/ReviewQueueCard.tsx:83— ReviewQueueCard.ReviewRow has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
ImportSkillsFromProjectDialog.ProjectSkillBrowser (cyclomatic 16) ui/src/pages/skills/ImportSkillsFromProjectDialog.tsx:780— ImportSkillsFromProjectDialog.ProjectSkillBrowser has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 862, 827, 845, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SkillStudio.SkillPathDialog (cyclomatic 16) ui/src/pages/SkillStudio.tsx:1720— SkillStudio.SkillPathDialog has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 1740, submit). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CompanyImport.ConflictResolutionList (cyclomatic 16) ui/src/pages/CompanyImport.tsx:437— CompanyImport.ConflictResolutionList has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 468). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
company-export-selection.buildExportCheckedFiles (cyclomatic 16) ui/src/lib/company-export-selection.ts:218— company-export-selection.buildExportCheckedFiles 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.
CompanyExport.generateReadmeFromSelection (cyclomatic 16) ui/src/pages/CompanyExport.tsx:415— CompanyExport.generateReadmeFromSelection has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.boardRoutes (cyclomatic 16) ui/src/App.tsx:144— App.boardRoutes has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
file-resources.buildQuery (cyclomatic 16) ui/src/api/file-resources.ts:29— file-resources.buildQuery 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.
PanelCard.PanelCard (cyclomatic 16) ui/src/artifact-directions/directions/d1-solid/PanelCard.tsx:48— PanelCard.PanelCard 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.
JsonSchemaForm.getDefaultForSchema (cyclomatic 16) REDACTED:148— JsonSchemaForm.getDefaultForSchema 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.
JsonSchemaForm.JsonSchemaForm (cyclomatic 16) REDACTED:1279— JsonSchemaForm.JsonSchemaForm has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1326, 1364, 1380). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AiConnectionUsagePanel.overageSummary (cyclomatic 16) ui/src/components/ai-connections/AiConnectionUsagePanel.tsx:47— AiConnectionUsagePanel.overageSummary has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal 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.
AgentsUsingSkillDialog.AgentRow (cyclomatic 16) ui/src/components/skill-studio/AgentsUsingSkillDialog.tsx:292— AgentsUsingSkillDialog.AgentRow has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals 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.
project-created-items.projectCreatedItems (cyclomatic 16) ui/src/components/task-chat/project-created-items.ts:4— project-created-items.projectCreatedItems has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 9, 33, 20). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
radio-card.RadioCardGroup (cyclomatic 16) ui/src/components/ui/radio-card.tsx:82— radio-card.RadioCardGroup has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 2 function items inside it that branch (handleKeyDown, a function literal at line 130). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
launchers.PluginLauncherProvider (cyclomatic 16) ui/src/plugins/launchers.tsx:615— launchers.PluginLauncherProvider has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 673, 633, 623, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentDetail.production.WorkspaceOperationLogViewer (cyclomatic 16) ui/src/pages/AgentDetail.production.tsx:593— AgentDetail.production.WorkspaceOperationLogViewer has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
AgentDetail.production.KeysTab (cyclomatic 16) ui/src/pages/AgentDetail.production.tsx:4386— AgentDetail.production.KeysTab has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to 4 function items inside it that branch. 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.
ComposioAppManager.ComposioAccountObservations (cyclomatic 16) ui/src/pages/apps/ComposioAppManager.tsx:29— ComposioAppManager.ComposioAccountObservations has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 51, refresh). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AuditTab.lifecycleSummary (cyclomatic 16) ui/src/pages/tools/AuditTab.tsx:90— AuditTab.lifecycleSummary 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.
AuditTab.AuditTab (cyclomatic 16) ui/src/pages/tools/AuditTab.tsx:326— AuditTab.AuditTab 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.
ConversationTypographyPreview.ConversationTypographyPreview (cyclomatic 16) ui/storybook/support/design-proposals/ConversationTypographyPreview.tsx:11— ConversationTypographyPreview.ConversationTypographyPreview has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 16, 35, 43). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ProjectHealthTrial.ProjectHealthContent (cyclomatic 16) ui/storybook/support/design-proposals/ProjectHealthTrial.tsx:40— ProjectHealthTrial.ProjectHealthContent has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 5 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.
Races the wall clock: getBuiltinRoutineVariableValues returns date in YYYY-MM-DD format packages/shared/src/routine-variables.test.ts:85— This test reads `new Date()` and compares it against the value the code under test computed from its own clock read, compared exactly in `toBe(new Date().toISOString().slice(0, 10))`. Those are two independent clock reads, so the test passes only while no boundary falls between them — a second ticking over between the code's read and the test's, or, for a date, a day that differs between the machine's local zone and UTC. It passes or fails on the time of day and the build agent's time zone, and re-running the suite on one machine cannot reveal it. Read the clock once: give the code under test a clock the test controls (a fake time provider, fake timers with a fixed system time) and build the expectation from that same instant, or assert a range rather than an exact value.
TaskChatThread.TaskChatThread (cognitive 1060) ui/src/components/TaskChatThread.tsx:497— TaskChatThread.TaskChatThread has cognitive complexity 1060 (threshold 15). Drivers by points: ternaries 206 (592 pts), if/else 127 (218 pts), boolean chains 212, loops 30 (34 pts), error handling 3 (4 pts) (nesting depth added 482). Of this number, 223 points are the body's own statements and 837 belong to 89 function literals inside it that branch. 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.
IssueDetail.TaskDetailSurface (cognitive 904) ui/src/pages/IssueDetail.tsx:3146— IssueDetail.TaskDetailSurface has cognitive complexity 904 (threshold 15). Drivers by points: ternaries 269 (436 pts), if/else 205 (239 pts), boolean chains 196, loops 19 (22 pts), error handling 7 (10 pts), match/switch 1 (nesting depth added 207). Of this number, 385 points are the body's own statements and 519 belong to 194 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.
company-portability.companyPortabilityService.importBundle (cognitive 689) server/src/services/company-portability.ts:5255— company-portability.companyPortabilityService.importBundle has cognitive complexity 689 (threshold 15). Drivers by points: if/else 122 (349 pts), ternaries 50 (168 pts), loops 34 (96 pts), boolean chains 52, error handling 7 (24 pts) (nesting depth added 424). Of this number, 658 points are the body's own statements and 31 belong to 6 function items inside it that branch. 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.
queue.createHeartbeatQueue.enqueueWakeup (cognitive 666) server/src/services/heartbeat/queue.ts:2145— queue.createHeartbeatQueue.enqueueWakeup has cognitive complexity 666 (threshold 15). Drivers by points: if/else 186 (408 pts), ternaries 55 (141 pts), boolean chains 115, loops 1 (2 pts) (nesting depth added 309). Of this number, 181 points are the body's own statements and 485 belong to 16 function items inside it that branch. 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.
IssueProperties.IssueProperties (cognitive 603) ui/src/components/issue-properties/IssueProperties.tsx:233— IssueProperties.IssueProperties has cognitive complexity 603 (threshold 15). Drivers by points: ternaries 243 (397 pts), boolean chains 115, if/else 75 (84 pts), loops 7 (nesting depth added 163). Of this number, 396 points are the body's own statements and 207 belong to 85 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.
ConnectionSetupFlow.StandardConnectionSetupFlow (cognitive 585) ui/src/features/connections/ConnectionSetupFlow.tsx:634— ConnectionSetupFlow.StandardConnectionSetupFlow has cognitive complexity 585 (threshold 15). Drivers by points: ternaries 129 (231 pts), boolean chains 194, if/else 108 (153 pts), error handling 4 (5 pts), loops 2 (nesting depth added 148). Of this number, 249 points are the body's own statements and 336 belong to 71 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.
service.recoveryService.reconcileStrandedAssignedIssues (cognitive 489) REDACTED:4513— service.recoveryService.reconcileStrandedAssignedIssues has cognitive complexity 489 (threshold 15). Drivers by points: if/else 162 (417 pts), ternaries 15 (35 pts), boolean chains 34, loops 2 (3 pts) (nesting depth added 276). 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.
AgentConfigForm.AgentConfigForm (cognitive 484) ui/src/components/AgentConfigForm.tsx:345— AgentConfigForm.AgentConfigForm has cognitive complexity 484 (threshold 15). Drivers by points: ternaries 146 (246 pts), boolean chains 163, if/else 57 (66 pts), error handling 6 (7 pts), loops 2 (nesting depth added 110). Of this number, 322 points are the body's own statements and 162 belong to 62 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.
IssuesList.StreamlinedIssuesList (cognitive 447) ui/src/components/IssuesList.tsx:720— IssuesList.StreamlinedIssuesList has cognitive complexity 447 (threshold 15). Drivers by points: ternaries 95 (175 pts), if/else 90 (145 pts), boolean chains 96, loops 20 (30 pts), match/switch 1 (nesting depth added 145). Of this number, 55 points are the body's own statements and 392 belong to 76 function literals 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.
heartbeat.heartbeatService.executeRunAttempt (cognitive 435) server/src/services/heartbeat.ts:1764— heartbeat.heartbeatService.executeRunAttempt has cognitive complexity 435 (threshold 15). Drivers by points: if/else 119 (185 pts), ternaries 69 (125 pts), boolean chains 98, error handling 13 (25 pts), loops 2 (nesting depth added 134). Of this number, 387 points are the body's own statements and 48 belong to 12 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.
CompanySkills.CompanySkills (cognitive 433) ui/src/pages/CompanySkills.tsx:3923— CompanySkills.CompanySkills has cognitive complexity 433 (threshold 15). Drivers by points: ternaries 122 (232 pts), if/else 91 (121 pts), boolean chains 56, error handling 9 (13 pts), loops 10 (11 pts) (nesting depth added 145). Of this number, 162 points are the body's own statements and 271 belong to 91 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.
LegacyIssuesList.IssuesList (cognitive 404) ui/src/components/LegacyIssuesList.tsx:672— LegacyIssuesList.IssuesList has cognitive complexity 404 (threshold 15). Drivers by points: ternaries 79 (143 pts), if/else 88 (141 pts), boolean chains 89, loops 20 (30 pts), match/switch 1 (nesting depth added 127). Of this number, 49 points are the body's own statements and 355 belong to 77 function literals 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.
server-utils.renderPaperclipWakePromptBody (cognitive 384) REDACTED:2264— server-utils.renderPaperclipWakePromptBody has cognitive complexity 384 (threshold 15). Drivers by points: if/else 89 (163 pts), ternaries 66 (159 pts), boolean chains 38, loops 10 (23 pts), match/switch 1 (nesting depth added 180). Of this number, 344 points are the body's own statements and 40 belong to 14 function items inside it that branch. 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.
CompanySkills.production.CompanySkills (cognitive 381) ui/src/pages/CompanySkills.production.tsx:4001— CompanySkills.production.CompanySkills has cognitive complexity 381 (threshold 15). Drivers by points: ternaries 108 (199 pts), if/else 79 (109 pts), boolean chains 49, error handling 9 (13 pts), loops 10 (11 pts) (nesting depth added 126). Of this number, 142 points are the body's own statements and 239 belong to 86 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.
Inbox.StreamlinedInbox (cognitive 380) ui/src/pages/Inbox.tsx:835— Inbox.StreamlinedInbox has cognitive complexity 380 (threshold 15). Drivers by points: if/else 125 (191 pts), boolean chains 86, ternaries 47 (74 pts), loops 22 (27 pts), error handling 1, match/switch 1 (nesting depth added 98). Of this number, 93 points are the body's own statements and 287 belong to 79 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.
tool-access.toolAccessService.connectGalleryApp (cognitive 373) server/src/services/tool-access.ts:1592— tool-access.toolAccessService.connectGalleryApp has cognitive complexity 373 (threshold 15). Drivers by points: if/else 106 (190 pts), boolean chains 84, ternaries 47 (76 pts), error handling 6 (14 pts), loops 4 (9 pts) (nesting depth added 126). Of this number, 340 points are the body's own statements and 33 belong to 6 function literals 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.
company-portability.companyPortabilityService.exportBundle (cognitive 373) server/src/services/company-portability.ts:3877— company-portability.companyPortabilityService.exportBundle has cognitive complexity 373 (threshold 15). Drivers by points: if/else 71 (144 pts), ternaries 58 (125 pts), loops 37 (56 pts), boolean chains 35, error handling 4 (13 pts) (nesting depth added 168). Of this number, 326 points are the body's own statements and 47 belong to 12 function items inside it that branch. 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.
CompanyEnvironments.CompanyEnvironments (cognitive 348) ui/src/pages/CompanyEnvironments.tsx:1294— CompanyEnvironments.CompanyEnvironments has cognitive complexity 348 (threshold 15). Drivers by points: ternaries 106 (231 pts), if/else 47 (60 pts), boolean chains 54, loops 3 (nesting depth added 138). Of this number, 176 points are the body's own statements and 172 belong to 42 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.
LegacyInbox.Inbox (cognitive 347) ui/src/pages/LegacyInbox.tsx:692— LegacyInbox.Inbox has cognitive complexity 347 (threshold 15). Drivers by points: if/else 124 (188 pts), boolean chains 76, ternaries 37 (54 pts), loops 22 (27 pts), error handling 1, match/switch 1 (nesting depth added 86). Of this number, 67 points are the body's own statements and 280 belong to 76 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.
execution-workspaces.executionWorkspaceService.sweepTerminalWorkspaces (cognitive 333) server/src/services/execution-workspaces.ts:3319— execution-workspaces.executionWorkspaceService.sweepTerminalWorkspaces has cognitive complexity 333 (threshold 15). Drivers by points: if/else 94 (227 pts), ternaries 29 (68 pts), boolean chains 42, error handling 4 (9 pts), loops 3 (8 pts) (nesting depth added 182). 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. This shape REPEATS in the file: one other method here (execution-workspaces.executionWorkspaceService.sweepTerminalWorkspaces::expireTaskDirectory) 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.
testing.createTestHarness (cognitive 320) packages/plugins/sdk/src/testing.ts:491— testing.createTestHarness has cognitive complexity 320 (threshold 15). Drivers by points: if/else 157 (179 pts), boolean chains 67, ternaries 43 (47 pts), loops 25 (27 pts) (nesting depth added 28). Of this number, 271 points are the body's own statements and 49 belong to 35 function items inside it that branch. 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.
native-session-runtime.executeNativeSession (cognitive 317) packages/paperclip-runner/src/native-session-runtime.ts:1923— native-session-runtime.executeNativeSession has cognitive complexity 317 (threshold 15). Drivers by points: if/else 75 (148 pts), ternaries 30 (66 pts), boolean chains 63, error handling 13 (25 pts), loops 8 (15 pts) (nesting depth added 128). Of this number, 203 points are the body's own statements and 114 belong to 18 function items inside it that branch. 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.
IssueDetail.IssueDetailChatTab (cognitive 313) ui/src/pages/IssueDetail.tsx:1372— IssueDetail.IssueDetailChatTab has cognitive complexity 313 (threshold 15). Drivers by points: ternaries 75 (130 pts), if/else 50 (84 pts), boolean chains 71, loops 15 (23 pts), error handling 5 (nesting depth added 97). Of this number, 81 points are the body's own statements and 232 belong to 31 function literals 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.
Costs.Costs (cognitive 290) ui/src/pages/Costs.tsx:173— Costs.Costs has cognitive complexity 290 (threshold 15). Drivers by points: ternaries 64 (173 pts), boolean chains 80, if/else 18 (26 pts), loops 11 (nesting depth added 117). Of this number, 155 points are the body's own statements and 135 belong to 33 function items inside it that branch. 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.
native-session-executor.createRunnerdBackendWithinSessionClaim (cognitive 287) server/src/services/native-runtime/native-session-executor.ts:11789— native-session-executor.createRunnerdBackendWithinSessionClaim has cognitive complexity 287 (threshold 15). Drivers by points: ternaries 94 (138 pts), if/else 46 (73 pts), boolean chains 70, error handling 2 (3 pts), loops 1 (3 pts) (nesting depth added 74). Of this number, 205 points are the body's own statements and 82 belong to 11 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.
IssueDocumentsSection.IssueDocumentsSection (cognitive 286) ui/src/components/IssueDocumentsSection.tsx:245— IssueDocumentsSection.IssueDocumentsSection has cognitive complexity 286 (threshold 15). Drivers by points: ternaries 70 (122 pts), if/else 75 (93 pts), boolean chains 65, error handling 3 (5 pts), loops 1 (nesting depth added 72). Most of this is not in the body itself: 14 of the 286 points are its own statements and the rest belongs to 69 function items inside it that branch (a function literal at line 995, a function literal at line 524, a function literal at line 834, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
execute.createAcpxEngineExecutor (cognitive 285) packages/adapter-utils/src/acpx-engine/execute.ts:4033— execute.createAcpxEngineExecutor has cognitive complexity 285 (threshold 15). Drivers by points: ternaries 56 (101 pts), if/else 67 (92 pts), boolean chains 79, error handling 8 (9 pts), loops 3 (4 pts) (nesting depth added 72). None of this is in the body itself: all 285 points belong to 30 function literals inside it that branch (lines 5256, 4371, 5190, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
sandbox-managed-runtime.prepareSandboxManagedRuntime (cognitive 284) packages/adapter-utils/src/sandbox-managed-runtime.ts:1212— sandbox-managed-runtime.prepareSandboxManagedRuntime has cognitive complexity 284 (threshold 15). Drivers by points: if/else 64 (137 pts), ternaries 37 (65 pts), boolean chains 36, loops 16 (35 pts), error handling 5 (11 pts) (nesting depth added 126). Of this number, 64 points are the body's own statements and 220 belong to 24 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.
ExecutionWorkspaceDetail.ExecutionWorkspaceDetail (cognitive 280) ui/src/pages/ExecutionWorkspaceDetail.tsx:776— ExecutionWorkspaceDetail.ExecutionWorkspaceDetail has cognitive complexity 280 (threshold 15). Drivers by points: ternaries 72 (223 pts), if/else 23 (33 pts), boolean chains 22, error handling 1, loops 1 (nesting depth added 161). Of this number, 187 points are the body's own statements and 93 belong to 30 function items inside it that branch. 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.
authorization.createAuthorizationService.decideBase (cognitive 260) server/src/services/authorization.ts:1741— authorization.createAuthorizationService.decideBase has cognitive complexity 260 (threshold 15). Drivers by points: if/else 100 (189 pts), boolean chains 56, ternaries 9 (15 pts) (nesting depth added 95). Of this number, 231 points are the body's own statements and 29 belong to 7 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.
environment-runtime.createSandboxEnvironmentDriver (cognitive 260) server/src/services/environment-runtime.ts:1307— environment-runtime.createSandboxEnvironmentDriver has cognitive complexity 260 (threshold 15). Drivers by points: if/else 123 (185 pts), boolean chains 89, ternaries 57 (89 pts), error handling 15 (27 pts), loops 8 (11 pts) (nesting depth added 109). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (environment-runtime.createSandboxEnvironmentDriver::releasePluginBackedSandboxLease, environment-runtime.createSandboxEnvironmentDriver::destroyReusableSandboxLease) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
runtime-selection.selectHeartbeatRuntime (cognitive 256) server/src/services/heartbeat/runtime-selection.ts:258— runtime-selection.selectHeartbeatRuntime has cognitive complexity 256 (threshold 15). Drivers by points: ternaries 53 (144 pts), if/else 29 (71 pts), boolean chains 38, error handling 1 (3 pts) (nesting depth added 135). Of this number, 154 points are the body's own statements and 102 belong to 9 function items inside it that branch. 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.
DurablePrpCodexTransport.#pumpEvents (cognitive 255) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:6300— DurablePrpCodexTransport.#pumpEvents has cognitive complexity 255 (threshold 15). Drivers by points: ternaries 27 (123 pts), if/else 35 (89 pts), boolean chains 36, error handling 1 (4 pts), loops 2 (3 pts) (nesting depth added 154). Of this number, 237 points are the body's own statements and 18 belong to 2 function literals inside it that branch. 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.App (cognitive 254) packages/paperclip-runner/devtools/issue-thread/src/App.tsx:298— App.App has cognitive complexity 254 (threshold 15). Drivers by points: ternaries 83 (141 pts), if/else 63 (75 pts), boolean chains 32, error handling 3 (5 pts), loops 1 (nesting depth added 72). Of this number, 114 points are the body's own statements and 140 belong to 58 function literals 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.
native-session-executor.executePaperclipNativeSessionWithinScope (cognitive 251) server/src/services/native-runtime/native-session-executor.ts:7907— native-session-executor.executePaperclipNativeSessionWithinScope has cognitive complexity 251 (threshold 15). Drivers by points: ternaries 78 (235 pts), if/else 111 (204 pts), boolean chains 96, error handling 5 (7 pts), loops 2 (3 pts) (nesting depth added 253). 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. This shape REPEATS in the file: one other method here (native-session-executor.executePaperclipNativeSessionWithinScope::observeAccountingEvent) 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.
OnboardingWizard.OnboardingWizardInner (cognitive 248) ui/src/components/OnboardingWizard.tsx:490— OnboardingWizard.OnboardingWizardInner has cognitive complexity 248 (threshold 15). Drivers by points: boolean chains 280, if/else 161 (216 pts), ternaries 114 (203 pts), error handling 10 (11 pts), loops 1 (nesting depth added 145). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 5 other methods here (OnboardingWizard.OnboardingWizardInner::managedBindingForStep, OnboardingWizard.OnboardingWizardInner::handleLaunchToDashboard, OnboardingWizard.OnboardingWizardInner::buildAdapterConfig, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
GitHubChatSetup.GitHubChatSetup (cognitive 248) ui/src/pages/apps/chat/GitHubChatSetup.tsx:75— GitHubChatSetup.GitHubChatSetup has cognitive complexity 248 (threshold 15). Drivers by points: ternaries 29 (121 pts), if/else 22 (73 pts), boolean chains 51, loops 2, error handling 1 (nesting depth added 143). Of this number, 152 points are the body's own statements and 96 belong to 16 function items inside it that branch. 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.
tool-gateway.createToolGatewayService.executeTool (cognitive 241) server/src/services/tool-gateway.ts:10134— tool-gateway.createToolGatewayService.executeTool has cognitive complexity 241 (threshold 15). Drivers by points: if/else 61 (132 pts), ternaries 36 (65 pts), boolean chains 35, error handling 3 (9 pts) (nesting depth added 106). Of this number, 239 points are the body's own statements and 2 belong to one function literal 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.
ConnectionIntentInteractionBody.ConnectionIntentInteractionBody (cognitive 238) ui/src/features/connections/ConnectionIntentInteractionBody.tsx:44— ConnectionIntentInteractionBody.ConnectionIntentInteractionBody has cognitive complexity 238 (threshold 15). Drivers by points: ternaries 67 (185 pts), boolean chains 29, if/else 18 (24 pts) (nesting depth added 124). Of this number, 206 points are the body's own statements and 32 belong to 8 function items inside it that branch. 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.
environment-task-runtime.executeEnvironmentTask (cognitive 233) server/src/services/environment-task-runtime.ts:32— environment-task-runtime.executeEnvironmentTask has cognitive complexity 233 (threshold 15). Drivers by points: if/else 55 (86 pts), boolean chains 78, ternaries 28 (53 pts), error handling 4 (13 pts), loops 1 (3 pts) (nesting depth added 67). Of this number, 229 points are the body's own statements and 4 belong to 3 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.
PaperclipRunnerToolAuthority.execute (cognitive 229) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:334— PaperclipRunnerToolAuthority.execute has cognitive complexity 229 (threshold 15). Drivers by points: if/else 62 (116 pts), ternaries 30 (70 pts), boolean chains 37, error handling 1 (5 pts), match/switch 1 (nesting depth added 98). Of this number, 207 points are the body's own statements and 22 belong to 9 function items inside it that branch. 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.
workspace-preparation.prepareHeartbeatWorkspaceLocked (cognitive 223) server/src/services/heartbeat/workspace-preparation.ts:168— workspace-preparation.prepareHeartbeatWorkspaceLocked has cognitive complexity 223 (threshold 15). Drivers by points: ternaries 61 (107 pts), boolean chains 62, if/else 34 (45 pts), error handling 5 (8 pts), loops 1 (nesting depth added 60). Of this number, 162 points are the body's own statements and 61 belong to 14 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.
plugin-host-services.buildHostServices (cognitive 220) server/src/services/plugin-host-services.ts:707— plugin-host-services.buildHostServices has cognitive complexity 220 (threshold 15). Drivers by points: if/else 91 (113 pts), ternaries 56 (74 pts), boolean chains 26, loops 5, error handling 1 (2 pts) (nesting depth added 41). Of this number, 186 points are the body's own statements and 34 belong to 8 function items inside it that branch. 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.
explicit-native-continuation.admitExplicitNativeContinuation (cognitive 216) server/src/services/explicit-native-continuation.ts:80— explicit-native-continuation.admitExplicitNativeContinuation has cognitive complexity 216 (threshold 15). Drivers by points: if/else 56 (108 pts), boolean chains 71, ternaries 22 (32 pts), loops 4 (5 pts) (nesting depth added 63). Of this number, 210 points are the body's own statements and 6 belong to 3 function literals 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.
NewAgentSetup.Setup (cognitive 215) ui/src/components/new-agent/NewAgentSetup.tsx:109— NewAgentSetup.Setup has cognitive complexity 215 (threshold 15). Drivers by points: ternaries 107 (204 pts), boolean chains 153, if/else 55 (67 pts), error handling 7 (10 pts), loops 3 (5 pts) (nesting depth added 114). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 5 other methods here (NewAgentSetup.Setup::buildConfig, NewAgentSetup.Setup::preparedConfig, NewAgentSetup.Setup::saveDraft, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
DurablePrpCodexTransport.#resume (cognitive 206) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:5146— DurablePrpCodexTransport.#resume has cognitive complexity 206 (threshold 15). Drivers by points: if/else 61 (91 pts), boolean chains 57, ternaries 29 (47 pts), error handling 4 (9 pts), loops 1 (2 pts) (nesting depth added 54). Of this number, 200 points are the body's own statements and 6 belong to 4 function literals 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.
Secrets.Secrets (cognitive 204) ui/src/pages/Secrets.tsx:652— Secrets.Secrets has cognitive complexity 204 (threshold 15). Drivers by points: ternaries 181 (336 pts), boolean chains 80, if/else 54 (63 pts), error handling 1, loops 1, match/switch 1 (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. This shape REPEATS in the file: one other method here (Secrets.Secrets::renderRowActions) 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.
github-skill-source.scanRepository (cognitive 202) server/src/services/github-skill-source.ts:65— github-skill-source.scanRepository has cognitive complexity 202 (threshold 15). Drivers by points: if/else 36 (77 pts), ternaries 27 (71 pts), boolean chains 29, loops 13 (25 pts) (nesting depth added 97). Of this number, 145 points are the body's own statements and 57 belong to 15 function items inside it that branch. 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.
transcript-adapter.transcriptToTaskChatItems (cognitive 202) ui/src/components/task-chat/transcript-adapter.ts:625— transcript-adapter.transcriptToTaskChatItems has cognitive complexity 202 (threshold 15). Drivers by points: if/else 46 (126 pts), ternaries 11 (37 pts), boolean chains 32, loops 3 (5 pts), match/switch 1 (2 pts) (nesting depth added 109). Of this number, 196 points are the body's own statements and 6 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.
AgentDetail.PromptsTab (cognitive 200) ui/src/pages/AgentDetail.tsx:2231— AgentDetail.PromptsTab has cognitive complexity 200 (threshold 15). Drivers by points: if/else 43 (74 pts), ternaries 32 (63 pts), boolean chains 60, loops 2 (3 pts) (nesting depth added 63). Of this number, 87 points are the body's own statements and 113 belong to 37 function literals 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.
native-run-finalizer.finalizeNativeRun (cognitive 199) server/src/services/native-runtime/native-run-finalizer.ts:1140— native-run-finalizer.finalizeNativeRun has cognitive complexity 199 (threshold 15). Drivers by points: ternaries 50 (107 pts), if/else 25 (46 pts), boolean chains 43, error handling 1 (2 pts), loops 1 (nesting depth added 79). Of this number, 191 points are the body's own statements and 8 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.
InviteLanding.InviteLandingPage (cognitive 198) ui/src/pages/InviteLanding.tsx:209— InviteLanding.InviteLandingPage has cognitive complexity 198 (threshold 15). Drivers by points: ternaries 48 (125 pts), if/else 31 (38 pts), boolean chains 34, error handling 1 (nesting depth added 84). Of this number, 155 points are the body's own statements and 43 belong to 13 function literals inside it that branch. 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.
LiveUpdatesProvider.invalidateActivityQueries (cognitive 198) ui/src/context/LiveUpdatesProvider.tsx:1335— LiveUpdatesProvider.invalidateActivityQueries has cognitive complexity 198 (threshold 15). Drivers by points: if/else 47 (107 pts), boolean chains 40, ternaries 9 (36 pts), loops 5 (15 pts) (nesting depth added 97). Of this number, 195 points are the body's own statements and 3 belong to one function literal 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.
native-run-events.nativeRunEventsToTranscript (cognitive 198) ui/src/components/transcript/native-run-events.ts:585— native-run-events.nativeRunEventsToTranscript has cognitive complexity 198 (threshold 15). Drivers by points: if/else 58 (136 pts), ternaries 11 (33 pts), boolean chains 27, loops 2 (nesting depth added 100). Of this number, 192 points are the body's own statements and 6 belong to 3 function literals 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.
native-execution.parseNativeExecutionInput (cognitive 194) packages/paperclip-runner/src/contracts/native-execution.ts:414— native-execution.parseNativeExecutionInput has cognitive complexity 194 (threshold 15). Drivers by points: if/else 61 (92 pts), boolean chains 54, ternaries 24 (48 pts) (nesting depth added 55). Of this number, 190 points are the body's own statements and 4 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.
chat-interaction-publications.enqueueIssueInteractionChatPublications (cognitive 193) server/src/services/chat-interaction-publications.ts:250— chat-interaction-publications.enqueueIssueInteractionChatPublications has cognitive complexity 193 (threshold 15). Drivers by points: ternaries 42 (130 pts), boolean chains 37, if/else 16 (25 pts), loops 1 (nesting depth added 97). Of this number, 126 points are the body's own statements and 67 belong to 7 function literals inside it that branch. 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.
MarkdownEditor.MarkdownEditor (cognitive 193) REDACTED:730— MarkdownEditor.MarkdownEditor has cognitive complexity 193 (threshold 15). Drivers by points: if/else 97 (122 pts), boolean chains 57, ternaries 6 (9 pts), loops 3, error handling 1 (2 pts) (nesting depth added 29). Of this number, 31 points are the body's own statements and 162 belong to 47 function literals inside it that branch. 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.
IssueRecoveryActionCard.IssueRecoveryActionCard (cognitive 193) ui/src/components/IssueRecoveryActionCard.tsx:986— IssueRecoveryActionCard.IssueRecoveryActionCard has cognitive complexity 193 (threshold 15). Drivers by points: ternaries 54 (153 pts), boolean chains 29, if/else 10, error handling 1 (nesting depth added 99). Of this number, 172 points are the body's own statements and 21 belong to 4 function literals inside it that branch. 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.
attention.attentionService.list (cognitive 189) server/src/services/attention.ts:1167— attention.attentionService.list has cognitive complexity 189 (threshold 15). Drivers by points: ternaries 40 (82 pts), if/else 34 (59 pts), boolean chains 28, loops 17 (20 pts) (nesting depth added 70). Of this number, 173 points are the body's own statements and 16 belong to 5 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.
chat-channels.chatChannelService.processMessage (cognitive 188) server/src/services/chat-channels.ts:1384— chat-channels.chatChannelService.processMessage has cognitive complexity 188 (threshold 15). Drivers by points: ternaries 54 (118 pts), if/else 66 (91 pts), boolean chains 54, error handling 1, loops 1 (nesting depth added 89). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (chat-channels.chatChannelService.processMessage::persistTaskMutation) 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.
native-session-runtime.consumeTurn (cognitive 187) packages/paperclip-runner/src/native-session-runtime.ts:862— native-session-runtime.consumeTurn has cognitive complexity 187 (threshold 15). Drivers by points: if/else 57 (129 pts), boolean chains 29, ternaries 12 (17 pts), error handling 3 (7 pts), loops 4 (5 pts) (nesting depth added 82). Of this number, 29 points are the body's own statements and 158 belong to 10 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.
ChatEndpointSetup.ProviderConnectStep (cognitive 186) ui/src/pages/apps/chat/ChatEndpointSetup.tsx:708— ChatEndpointSetup.ProviderConnectStep has cognitive complexity 186 (threshold 15). Drivers by points: ternaries 47 (105 pts), boolean chains 64, if/else 13 (16 pts), error handling 1 (nesting depth added 61). Of this number, 162 points are the body's own statements and 24 belong to 12 function items inside it that branch. 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.
runnerd-codex-transport.settleRetainedRunnerdSessionOwned (cognitive 185) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:2351— runnerd-codex-transport.settleRetainedRunnerdSessionOwned has cognitive complexity 185 (threshold 15). Drivers by points: if/else 54 (115 pts), boolean chains 36, loops 7 (17 pts), error handling 4 (13 pts), ternaries 2 (4 pts) (nesting depth added 82). Of this number, 150 points are the body's own statements and 35 belong to 7 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.
ExternalAgentInviteContent.ExternalAgentInviteContent (cognitive 185) ui/src/components/new-agent/ExternalAgentInviteContent.tsx:136— ExternalAgentInviteContent.ExternalAgentInviteContent has cognitive complexity 185 (threshold 15). Drivers by points: ternaries 39 (141 pts), boolean chains 32, if/else 2 (12 pts) (nesting depth added 112). Of this number, 172 points are the body's own statements and 13 belong to 2 function literals inside it that branch. 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.
status-decision-committer.commitNativeStatusDecision (cognitive 184) server/src/services/native-runtime/status-decision-committer.ts:1550— status-decision-committer.commitNativeStatusDecision has cognitive complexity 184 (threshold 15). Drivers by points: if/else 57 (91 pts), ternaries 24 (40 pts), boolean chains 37, error handling 5 (10 pts), loops 5 (6 pts) (nesting depth added 56). Most of this is not in the body itself: 7 of the 184 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1592, 1866, 2113). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
company-portability.companyPortabilityService.buildPreview (cognitive 183) server/src/services/company-portability.ts:4862— company-portability.companyPortabilityService.buildPreview has cognitive complexity 183 (threshold 15). Drivers by points: if/else 45 (99 pts), loops 19 (31 pts), ternaries 11 (30 pts), boolean chains 20, error handling 1 (3 pts) (nesting depth added 87). 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.
IssueRow.IssueRow (cognitive 182) ui/src/components/IssueRow.tsx:131— IssueRow.IssueRow has cognitive complexity 182 (threshold 15). Drivers by points: ternaries 73 (152 pts), boolean chains 25, if/else 3 (5 pts) (nesting depth added 81). Of this number, 167 points are the body's own statements and 15 belong to 4 function literals inside it that branch. 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.
agent-runner-selection.resolveAgentRunner (cognitive 180) server/src/services/agent-runner-selection.ts:147— agent-runner-selection.resolveAgentRunner has cognitive complexity 180 (threshold 15). Drivers by points: if/else 49 (90 pts), boolean chains 37, ternaries 13 (33 pts), loops 6 (13 pts), error handling 4 (7 pts) (nesting depth added 71). Of this number, 178 points are the body's own statements and 2 belong to one function literal 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.
native-finalization-reconciler.reconcileNativeFinalizationsPass (cognitive 178) server/src/services/native-runtime/native-finalization-reconciler.ts:706— native-finalization-reconciler.reconcileNativeFinalizationsPass has cognitive complexity 178 (threshold 15). Drivers by points: if/else 24 (70 pts), ternaries 22 (70 pts), boolean chains 26, error handling 3 (9 pts), loops 2 (3 pts) (nesting depth added 101). 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-session-notifications.mapNotificationBody (cognitive 177) packages/paperclip-runner/src/drivers/codex/codex-session-notifications.ts:107— codex-session-notifications.mapNotificationBody has cognitive complexity 177 (threshold 15). Drivers by points: if/else 68 (116 pts), boolean chains 38, ternaries 8 (18 pts), loops 2 (5 pts) (nesting depth added 61). Of this number, 176 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.
index.parsePrpEvent (cognitive 172) ui/src/adapters/paperclip-runner/index.ts:685— index.parsePrpEvent has cognitive complexity 172 (threshold 15). Drivers by points: ternaries 25 (133 pts), if/else 21 (24 pts), boolean chains 15 (nesting depth added 111). 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.
AgentDetail.production.AgentDetail (cognitive 171) ui/src/pages/AgentDetail.production.tsx:760— AgentDetail.production.AgentDetail has cognitive complexity 171 (threshold 15). Drivers by points: ternaries 35 (69 pts), boolean chains 54, if/else 45 (48 pts) (nesting depth added 37). Of this number, 69 points are the body's own statements and 102 belong to 28 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.
run-failure-diagnostics.collectRunFailureDiagnostics (cognitive 167) REDACTED:225— run-failure-diagnostics.collectRunFailureDiagnostics has cognitive complexity 167 (threshold 15). Drivers by points: if/else 66 (129 pts), loops 9 (18 pts), boolean chains 16, ternaries 2 (4 pts) (nesting depth added 74). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Browse.Browse (cognitive 167) ui/src/pages/apps/Browse.tsx:358— Browse.Browse has cognitive complexity 167 (threshold 15). Drivers by points: ternaries 37 (62 pts), boolean chains 49, if/else 34 (47 pts), loops 8, error handling 1 (nesting depth added 38). Of this number, 64 points are the body's own statements and 103 belong to 32 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.
recovery.createHeartbeatRecovery.reapOrphanedRuns (cognitive 166) server/src/services/heartbeat/recovery.ts:1919— recovery.createHeartbeatRecovery.reapOrphanedRuns has cognitive complexity 166 (threshold 15). Drivers by points: if/else 34 (66 pts), ternaries 24 (50 pts), boolean chains 39, error handling 4 (7 pts), loops 4 (nesting depth added 61). Of this number, 151 points are the body's own statements and 15 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.
Routines.production.Routines (cognitive 166) ui/src/pages/Routines.production.tsx:319— Routines.production.Routines has cognitive complexity 166 (threshold 15). Drivers by points: ternaries 63 (106 pts), if/else 35 (39 pts), boolean chains 17, error handling 2 (3 pts), loops 1 (nesting depth added 48). Of this number, 63 points are the body's own statements and 103 belong to 41 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.
DurablePrpCodexTransport.request (cognitive 163) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:3702— DurablePrpCodexTransport.request has cognitive complexity 163 (threshold 15). Drivers by points: if/else 43 (89 pts), ternaries 18 (45 pts), boolean chains 18, loops 4 (11 pts) (nesting depth added 80). Of this number, 161 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
Layout.Layout (cognitive 162) ui/src/components/Layout.tsx:83— Layout.Layout has cognitive complexity 162 (threshold 15). Drivers by points: ternaries 44 (85 pts), boolean chains 45, if/else 30 (32 pts) (nesting depth added 43). Of this number, 120 points are the body's own statements and 42 belong to 20 function literals 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.
ComposerRunSettingsPicker.ComposerRunSettingsPicker (cognitive 161) ui/src/components/task-chat/ComposerRunSettingsPicker.tsx:85— ComposerRunSettingsPicker.ComposerRunSettingsPicker has cognitive complexity 161 (threshold 15). Drivers by points: ternaries 48 (112 pts), boolean chains 32, if/else 11 (17 pts) (nesting depth added 70). Of this number, 103 points are the body's own statements and 58 belong to 17 function items inside it that branch. 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.
callbacks.createChatInteractionCallbacks.handleAction (cognitive 160) server/src/services/chat-channels/interactions/callbacks.ts:552— callbacks.createChatInteractionCallbacks.handleAction has cognitive complexity 160 (threshold 15). Drivers by points: if/else 56 (87 pts), boolean chains 46, ternaries 16 (22 pts), error handling 3 (5 pts) (nesting depth added 39). Of this number, 131 points are the body's own statements and 29 belong to 8 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.
ConnectionSetupFlow.AccessStepContent (cognitive 158) ui/src/features/connections/ConnectionSetupFlow.tsx:4235— ConnectionSetupFlow.AccessStepContent has cognitive complexity 158 (threshold 15). Drivers by points: ternaries 46 (139 pts), boolean chains 10, if/else 2 (9 pts) (nesting depth added 100). Of this number, 146 points are the body's own statements and 12 belong to 2 function literals inside it that branch. 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.
RunTranscriptView.normalizeTranscript (cognitive 156) ui/src/components/transcript/RunTranscriptView.tsx:552— RunTranscriptView.normalizeTranscript has cognitive complexity 156 (threshold 15). Drivers by points: if/else 40 (93 pts), ternaries 13 (42 pts), boolean chains 20, loops 1 (nesting depth added 82). Of this number, 155 points are the body's own statements and 1 belongs to one function literal 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.
case-handoffs.caseHandoffService.handoff (cognitive 155) server/src/services/case-handoffs.ts:337— case-handoffs.caseHandoffService.handoff has cognitive complexity 155 (threshold 15). Drivers by points: if/else 56 (90 pts), ternaries 18 (33 pts), boolean chains 27, error handling 1 (3 pts), loops 1 (2 pts) (nesting depth added 52). Most of this is not in the body itself: 1 of the 155 points is its own statement and the rest belongs to one function literal inside it that branches (line 346). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
execute.execute (cognitive 154) packages/adapters/pi-local/src/server/execute.ts:227— execute.execute has cognitive complexity 154 (threshold 15). Drivers by points: if/else 46 (60 pts), ternaries 32 (45 pts), boolean chains 38, error handling 4 (10 pts), loops 1 (nesting depth added 33). Of this number, 111 points are the body's own statements and 43 belong to 10 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.
company-skills.companySkillRoutes (cognitive 153) REDACTED:101— company-skills.companySkillRoutes has cognitive complexity 153 (threshold 15). Drivers by points: if/else 76 (94 pts), ternaries 26 (33 pts), boolean chains 19, loops 2 (4 pts), error handling 3 (nesting depth added 27). None of this is in the body itself: all 153 points belong to 48 function items inside it that branch (a function literal at line 372, a function literal at line 740, assertCanMutateCompanySkills, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
tool-gateway.toolGatewayRoutes (cognitive 152) REDACTED:350— tool-gateway.toolGatewayRoutes has cognitive complexity 152 (threshold 15). Drivers by points: ternaries 61 (71 pts), if/else 44 (48 pts), boolean chains 18, error handling 15 (nesting depth added 14). None of this is in the body itself: all 152 points belong to 23 function items inside it that branch (a function literal at line 731, a function literal at line 957, assertBoardMutationAccess, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentDetail.AgentDetail (cognitive 152) ui/src/pages/AgentDetail.tsx:772— AgentDetail.AgentDetail has cognitive complexity 152 (threshold 15). Drivers by points: ternaries 33 (56 pts), boolean chains 54, if/else 39 (42 pts) (nesting depth added 26). Of this number, 95 points are the body's own statements and 57 belong to 25 function literals 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.
IssueFiltersPopover.IssueFiltersPopover (cognitive 148) ui/src/components/IssueFiltersPopover.tsx:104— IssueFiltersPopover.IssueFiltersPopover has cognitive complexity 148 (threshold 15). Drivers by points: ternaries 51 (135 pts), boolean chains 10, if/else 3 (nesting depth added 84). Of this number, 77 points are the body's own statements and 71 belong to 9 function literals inside it that branch. 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.
IssueThreadInteractionCard.AskUserQuestionsCard (cognitive 148) ui/src/components/IssueThreadInteractionCard.tsx:1034— IssueThreadInteractionCard.AskUserQuestionsCard has cognitive complexity 148 (threshold 15). Drivers by points: ternaries 38 (125 pts), boolean chains 9, error handling 4 (7 pts), if/else 6 (7 pts) (nesting depth added 91). Of this number, 78 points are the body's own statements and 70 belong to 13 function items inside it that branch. 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.
IssueChatThread.IssueChatThread (cognitive 148) ui/src/components/IssueChatThread.tsx:5760— IssueChatThread.IssueChatThread has cognitive complexity 148 (threshold 15). Drivers by points: if/else 51 (63 pts), ternaries 33 (48 pts), boolean chains 31, loops 5, error handling 1 (nesting depth added 27). Of this number, 39 points are the body's own statements and 109 belong to 27 function items inside it that branch. 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.
Routines.Routines (cognitive 147) ui/src/pages/Routines.tsx:311— Routines.Routines has cognitive complexity 147 (threshold 15). Drivers by points: ternaries 56 (83 pts), if/else 37 (41 pts), boolean chains 19, error handling 2 (3 pts), loops 1 (nesting depth added 32). Of this number, 58 points are the body's own statements and 89 belong to 39 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.
WorkspaceFileBrowser.WorkspaceFileBrowser (cognitive 147) ui/src/components/WorkspaceFileBrowser.tsx:496— WorkspaceFileBrowser.WorkspaceFileBrowser has cognitive complexity 147 (threshold 15). Drivers by points: if/else 55 (58 pts), boolean chains 42, ternaries 32 (42 pts), loops 4 (5 pts) (nesting depth added 14). Of this number, 54 points are the body's own statements and 93 belong to 34 function items inside it that branch. 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.
company-portability.buildManifestFromPackageFiles (cognitive 146) server/src/services/company-portability.ts:3100— company-portability.buildManifestFromPackageFiles has cognitive complexity 146 (threshold 15). Drivers by points: ternaries 43 (86 pts), if/else 18 (29 pts), boolean chains 27, loops 4 (nesting depth added 54). Of this number, 114 points are the body's own statements and 32 belong to 11 function literals 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.
NewAgentWizard.NewAgentWizard (cognitive 145) ui/storybook/prototypes/NewAgentWizard.tsx:97— NewAgentWizard.NewAgentWizard has cognitive complexity 145 (threshold 15). Drivers by points: ternaries 41 (80 pts), boolean chains 46, if/else 12 (18 pts), error handling 1 (nesting depth added 45). Of this number, 96 points are the body's own statements and 49 belong to 11 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.
cases.caseRoutes (cognitive 144) REDACTED:574— cases.caseRoutes has cognitive complexity 144 (threshold 15). Drivers by points: if/else 61 (73 pts), ternaries 31 (39 pts), boolean chains 17, loops 8 (14 pts), error handling 1 (nesting depth added 26). None of this is in the body itself: all 144 points belong to 27 function items inside it that branch (a function literal at line 759, a function literal at line 1576, a function literal at line 1009, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TaskChatComposer.TaskChatComposer (cognitive 143) REDACTED:378— TaskChatComposer.TaskChatComposer has cognitive complexity 143 (threshold 15). Drivers by points: ternaries 103 (161 pts), if/else 91 (125 pts), boolean chains 92, error handling 7 (9 pts), loops 2 (3 pts) (nesting depth added 95). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (TaskChatComposer.TaskChatComposer::submit) 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.
TaskSidePanel.TaskSidePanel (cognitive 143) ui/src/components/task-side-panel/TaskSidePanel.tsx:240— TaskSidePanel.TaskSidePanel has cognitive complexity 143 (threshold 15). Drivers by points: if/else 55 (58 pts), ternaries 31 (44 pts), boolean chains 40, loops 1 (nesting depth added 16). Of this number, 48 points are the body's own statements and 95 belong to 25 function items inside it that branch. 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.
plugin-loader.pluginLoader (cognitive 142) REDACTED:1147— plugin-loader.pluginLoader has cognitive complexity 142 (threshold 15). Drivers by points: if/else 82 (125 pts), error handling 22 (49 pts), ternaries 21 (44 pts), loops 10 (17 pts), boolean chains 11 (nesting depth added 100). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (plugin-loader.pluginLoader::fetchAndValidate, plugin-loader.pluginLoader::activatePlugin) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
configuration.createChatConfiguration.configureWithCredentialLease (cognitive 142) server/src/services/chat-channels/configuration.ts:155— configuration.createChatConfiguration.configureWithCredentialLease has cognitive complexity 142 (threshold 15). Drivers by points: if/else 54 (90 pts), boolean chains 31, ternaries 12 (15 pts), error handling 4 (6 pts) (nesting depth added 41). Of this number, 114 points are the body's own statements and 28 belong to 5 function literals 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.
ChatEndpointSetup.ChatSdkEndpointSetup (cognitive 142) ui/src/pages/apps/chat/ChatEndpointSetup.tsx:177— ChatEndpointSetup.ChatSdkEndpointSetup has cognitive complexity 142 (threshold 15). Drivers by points: boolean chains 61, ternaries 33 (44 pts), if/else 28 (34 pts), error handling 3 (nesting depth added 17). Of this number, 65 points are the body's own statements and 77 belong to 25 function items inside it that branch. 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.
worktree-merge-history-lib.buildWorktreeMergePlan (cognitive 141) cli/src/commands/worktree-merge-history-lib.ts:340— worktree-merge-history-lib.buildWorktreeMergePlan has cognitive complexity 141 (threshold 15). Drivers by points: if/else 29 (64 pts), boolean chains 33, ternaries 15 (32 pts), loops 7 (12 pts) (nesting depth added 57). Of this number, 133 points are the body's own statements and 8 belong to 4 function literals 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.
live-session.assertCapabilityLiveSessionSnapshot (cognitive 141) packages/paperclip-runner/src/live/live-session.ts:588— live-session.assertCapabilityLiveSessionSnapshot has cognitive complexity 141 (threshold 15). Drivers by points: if/else 44 (72 pts), boolean chains 27, ternaries 9 (22 pts), loops 12 (17 pts), error handling 2 (3 pts) (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.
execute.execute (cognitive 139) packages/adapters/codex-local/src/server/execute.ts:578— execute.execute has cognitive complexity 139 (threshold 15). Drivers by points: ternaries 74 (109 pts), if/else 70 (89 pts), boolean chains 54, error handling 5 (10 pts), loops 2 (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (execute.execute::runAttempt, execute.execute::toResult) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
external-chat-question-response.resolveQuestionResponseChain (cognitive 139) server/src/services/native-runtime/external-chat-question-response.ts:206— external-chat-question-response.resolveQuestionResponseChain has cognitive complexity 139 (threshold 15). Drivers by points: if/else 36 (58 pts), boolean chains 49, ternaries 17 (27 pts), error handling 2 (4 pts), loops 1 (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.
retries.createHeartbeatRetries.scheduleBoundedRetryForRun (cognitive 138) server/src/services/heartbeat/retries.ts:397— retries.createHeartbeatRetries.scheduleBoundedRetryForRun has cognitive complexity 138 (threshold 15). Drivers by points: if/else 41 (70 pts), ternaries 36 (48 pts), boolean chains 20 (nesting depth added 41). Of this number, 55 points are the body's own statements and 83 belong to one function literal 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.
RoutineDetail.RoutineDetail (cognitive 136) ui/src/pages/RoutineDetail.tsx:124— RoutineDetail.RoutineDetail has cognitive complexity 136 (threshold 15). Drivers by points: ternaries 48 (58 pts), if/else 39 (41 pts), boolean chains 35, error handling 1, loops 1 (nesting depth added 12). Of this number, 58 points are the body's own statements and 78 belong to 31 function literals inside it that branch. 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.
index.startServerWithDatabaseTeardown (cognitive 135) REDACTED:245— index.startServerWithDatabaseTeardown has cognitive complexity 135 (threshold 15). Drivers by points: if/else 156 (262 pts), boolean chains 81, error handling 22 (45 pts), ternaries 24 (37 pts), loops 5 (9 pts) (nesting depth added 146). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (index.startServerWithDatabaseTeardown::ensureMigrations) 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-runtime-adapter.openQualifiedAcpxRuntime (cognitive 134) packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts:165— codex-runtime-adapter.openQualifiedAcpxRuntime has cognitive complexity 134 (threshold 15). Drivers by points: if/else 32 (60 pts), ternaries 35 (44 pts), boolean chains 28, error handling 2 (nesting depth added 37). Of this number, 55 points are the body's own statements and 79 belong to 17 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.
skill-version-retention.skillVersionRetentionService.pruneCompanyPage (cognitive 134) server/src/services/skill-version-retention.ts:243— skill-version-retention.skillVersionRetentionService.pruneCompanyPage has cognitive complexity 134 (threshold 15). Drivers by points: if/else 48 (101 pts), boolean chains 13, error handling 6 (11 pts), loops 4 (5 pts), ternaries 2 (4 pts) (nesting depth added 61). Of this number, 76 points are the body's own statements and 58 belong to 6 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.
chat-control-recovery-stop.readChatControlRecoveryStop (cognitive 134) server/src/services/chat-control-recovery-stop.ts:175— chat-control-recovery-stop.readChatControlRecoveryStop has cognitive complexity 134 (threshold 15). Drivers by points: if/else 32 (87 pts), boolean chains 21, ternaries 8 (21 pts), loops 3 (5 pts) (nesting depth added 70). Of this number, 126 points are the body's own statements and 8 belong to one function literal 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.
execute.execute (cognitive 133) packages/adapters/claude-local/src/server/execute.ts:409— execute.execute has cognitive complexity 133 (threshold 15). Drivers by points: ternaries 94 (181 pts), boolean chains 62, if/else 45 (56 pts), error handling 3 (9 pts), loops 1 (nesting depth added 104). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (execute.execute::toAdapterResult) 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.
events.createPhotonEvents.processPhotonResponse (cognitive 133) server/src/services/chat-channels/imessage-photon/events.ts:130— events.createPhotonEvents.processPhotonResponse has cognitive complexity 133 (threshold 15). Drivers by points: if/else 44 (75 pts), boolean chains 30, ternaries 12 (26 pts), error handling 2 (nesting depth added 45). Of this number, 116 points are the body's own statements and 17 belong to 7 function literals 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.
app.SettingsBody (cognitive 133) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:5788— app.SettingsBody has cognitive complexity 133 (threshold 15). Drivers by points: ternaries 79 (170 pts), if/else 35 (39 pts), boolean chains 28, error handling 14 (17 pts) (nesting depth added 98). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (app.SettingsBody::fixAllConfigurationErrors) 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.
StatusCardDetailDrawer.StatusCardDetailDrawer (cognitive 133) ui/src/pages/StatusCards/StatusCardDetailDrawer.tsx:42— StatusCardDetailDrawer.StatusCardDetailDrawer has cognitive complexity 133 (threshold 15). Drivers by points: ternaries 50 (107 pts), boolean chains 21, if/else 5 (nesting depth added 57). Of this number, 100 points are the body's own statements and 33 belong to 12 function items inside it that branch. 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.
backup-lib.runDatabaseBackup (cognitive 132) packages/db/src/backup-lib.ts:531— backup-lib.runDatabaseBackup has cognitive complexity 132 (threshold 15). Drivers by points: if/else 30 (50 pts), loops 20 (37 pts), ternaries 6 (19 pts), boolean chains 13, error handling 5 (13 pts) (nesting depth added 58). Of this number, 126 points are the body's own statements and 6 belong to 6 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.
run-completion.createHeartbeatRunCompletion.completeRun (cognitive 132) server/src/services/heartbeat/run-completion.ts:386— run-completion.createHeartbeatRunCompletion.completeRun has cognitive complexity 132 (threshold 15). Drivers by points: if/else 34 (50 pts), ternaries 27 (46 pts), boolean chains 27, error handling 4 (9 pts) (nesting depth added 40). Of this number, 125 points are the body's own statements and 7 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.
plugin.pluginManifestV1Schema (cognitive 130) packages/shared/src/validators/plugin.ts:829— plugin.pluginManifestV1Schema has cognitive complexity 130 (threshold 15). Drivers by points: if/else 62 (96 pts), boolean chains 22, loops 4 (9 pts), ternaries 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.
AppDetail.StandardAppDetail (cognitive 130) ui/src/pages/apps/AppDetail.tsx:88— AppDetail.StandardAppDetail has cognitive complexity 130 (threshold 15). Drivers by points: ternaries 43 (60 pts), boolean chains 53, if/else 14, error handling 2, loops 1 (nesting depth added 17). Of this number, 86 points are the body's own statements and 44 belong to 22 function items inside it that branch. 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.
runtime-execution.executeHeartbeatRuntime (cognitive 129) server/src/services/heartbeat/runtime-execution.ts:229— runtime-execution.executeHeartbeatRuntime has cognitive complexity 129 (threshold 15). Drivers by points: if/else 57 (106 pts), ternaries 38 (92 pts), boolean chains 41, error handling 7 (14 pts), loops 1 (nesting depth added 110). 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. This shape REPEATS in the file: one other method here (runtime-execution.executeHeartbeatRuntime::completeWorkspace) 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.
environments.environmentRoutes (cognitive 129) server/src/routes/environments.ts:329— environments.environmentRoutes has cognitive complexity 129 (threshold 15). Drivers by points: if/else 62 (68 pts), boolean chains 31, ternaries 21 (28 pts), error handling 1 (2 pts) (nesting depth added 14). None of this is in the body itself: all 129 points belong to 31 function items inside it that branch (a function literal at line 1133, a function literal at line 1269, resolveEnvironmentSecretContextCompanyId, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
Cases.Cases (cognitive 129) ui/src/pages/Cases.tsx:41— Cases.Cases has cognitive complexity 129 (threshold 15). Drivers by points: ternaries 41 (92 pts), boolean chains 20, if/else 11 (15 pts), loops 2 (nesting depth added 55). Of this number, 95 points are the body's own statements and 34 belong to 11 function literals inside it that branch. 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.
issue-execution-policy.applyIssueExecutionStageTransition (cognitive 128) server/src/services/issue-execution-policy.ts:659— issue-execution-policy.applyIssueExecutionStageTransition has cognitive complexity 128 (threshold 15). Drivers by points: if/else 35 (87 pts), boolean chains 30, ternaries 7 (10 pts), loops 1 (nesting depth added 55). 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.
CapabilityMockControlPlaneAdapter.#executeCommand (cognitive 127) packages/paperclip-runner/src/mock-core/capability-mock-control-plane-adapter.ts:698— CapabilityMockControlPlaneAdapter.#executeCommand has cognitive complexity 127 (threshold 15). Drivers by points: if/else 39 (82 pts), boolean chains 29, ternaries 5 (11 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 51). Of this number, 122 points are the body's own statements and 5 belong to 5 function literals inside it that branch. 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.
workspace-runtime.spawnLocalRuntimeService (cognitive 127) server/src/services/workspace-runtime.ts:6181— workspace-runtime.spawnLocalRuntimeService has cognitive complexity 127 (threshold 15). Drivers by points: if/else 37 (59 pts), ternaries 26 (44 pts), boolean chains 16, error handling 3 (5 pts), loops 2 (3 pts) (nesting depth added 43). Of this number, 98 points are the body's own statements and 29 belong to one function literal 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.
inbound-attachments.createInboundAttachments.ingestAttachments (cognitive 127) server/src/services/chat-channels/inbound-attachments.ts:85— inbound-attachments.createInboundAttachments.ingestAttachments has cognitive complexity 127 (threshold 15). Drivers by points: if/else 34 (74 pts), boolean chains 20, ternaries 9 (20 pts), error handling 4 (10 pts), loops 3 (nesting depth added 57). Of this number, 91 points are the body's own statements and 36 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.
runner-api-client.executeRunnerApi (cognitive 127) server/src/services/native-runtime/runner-api-client.ts:124— runner-api-client.executeRunnerApi has cognitive complexity 127 (threshold 15). Drivers by points: if/else 35 (55 pts), ternaries 19 (35 pts), boolean chains 25, error handling 4 (6 pts), loops 3 (6 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.
customer-success-inspection.readCustomerSuccessResource (cognitive 127) server/src/services/customer-success-inspection.ts:134— customer-success-inspection.readCustomerSuccessResource has cognitive complexity 127 (threshold 15). Drivers by points: if/else 46 (96 pts), ternaries 6 (15 pts), boolean chains 12, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 61). None of this is in the body itself: all 127 points belong to 2 function literals inside it that branch (lines 140, 216). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
browser-use.browserUseService.reconcile (cognitive 125) server/src/services/browser-use.ts:1078— browser-use.browserUseService.reconcile has cognitive complexity 125 (threshold 15). Drivers by points: if/else 29 (74 pts), boolean chains 27, ternaries 4 (16 pts), loops 4 (8 pts) (nesting depth added 61). Of this number, 104 points are the body's own statements and 21 belong to 2 function literals inside it that branch. 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.
git-workspace-expiration.expireReconstructableGitWorkspace (cognitive 125) server/src/services/git-workspace-expiration.ts:274— git-workspace-expiration.expireReconstructableGitWorkspace has cognitive complexity 125 (threshold 15). Drivers by points: if/else 43 (82 pts), boolean chains 17, loops 5 (12 pts), error handling 5 (10 pts), ternaries 2 (4 pts) (nesting depth added 53). Most of this is not in the body itself: 4 of the 125 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 286, 407, 362). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-interaction-bridge.materializeNativeInteractionResponses (cognitive 125) server/src/services/native-runtime/native-interaction-bridge.ts:155— native-interaction-bridge.materializeNativeInteractionResponses has cognitive complexity 125 (threshold 15). Drivers by points: if/else 29 (71 pts), boolean chains 31, ternaries 7 (22 pts), loops 1 (nesting depth added 57). Of this number, 123 points are the body's own statements and 2 belong to one function literal 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.
native-session-executor.cancelNativeSession (cognitive 124) server/src/services/native-runtime/native-session-executor.ts:6981— native-session-executor.cancelNativeSession has cognitive complexity 124 (threshold 15). Drivers by points: if/else 39 (82 pts), boolean chains 20, ternaries 8 (19 pts), error handling 1 (3 pts) (nesting depth added 56). Of this number, 59 points are the body's own statements and 65 belong to 2 function literals inside it that branch. 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.
onboard.onboard (cognitive 123) cli/src/commands/onboard.ts:383— onboard.onboard has cognitive complexity 123 (threshold 15). Drivers by points: if/else 48 (74 pts), ternaries 11 (19 pts), boolean chains 18, error handling 3 (8 pts), loops 2 (4 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.
native-restart-recovery.claimNativeRestartRecoveries (cognitive 123) server/src/services/native-runtime/native-restart-recovery.ts:462— native-restart-recovery.claimNativeRestartRecoveries has cognitive complexity 123 (threshold 15). Drivers by points: ternaries 19 (47 pts), if/else 17 (39 pts), boolean chains 32, loops 3 (5 pts) (nesting depth added 52). Most of this is not in the body itself: 5 of the 123 points are its own statements and the rest belongs to one function literal inside it that branches (line 521). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
run-preparation.buildPaperclipWakePayload (cognitive 123) server/src/services/heartbeat/run-preparation.ts:2244— run-preparation.buildPaperclipWakePayload has cognitive complexity 123 (threshold 15). Drivers by points: ternaries 51 (78 pts), boolean chains 26, if/else 9 (16 pts), loops 3 (nesting depth added 34). Of this number, 112 points are the body's own statements and 11 belong to 3 function literals 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.
run-control.createHeartbeatRunControl.cancelRun (cognitive 122) server/src/services/heartbeat/run-control.ts:1107— run-control.createHeartbeatRunControl.cancelRun has cognitive complexity 122 (threshold 15). Drivers by points: if/else 31 (53 pts), boolean chains 33, ternaries 18 (31 pts), error handling 3 (5 pts) (nesting depth added 37). Of this number, 47 points are the body's own statements and 75 belong to 3 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.
ProjectDetail.ProjectDetail (cognitive 122) ui/src/pages/ProjectDetail.tsx:327— ProjectDetail.ProjectDetail has cognitive complexity 122 (threshold 15). Drivers by points: if/else 48 (59 pts), boolean chains 34, ternaries 19 (23 pts), error handling 3 (6 pts) (nesting depth added 18). Of this number, 72 points are the body's own statements and 50 belong to 21 function items inside it that branch. 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.
prepare-bundled-package.stageBundledProviderOptionalDependencies (cognitive 121) scripts/prepare-bundled-package.mjs:95— prepare-bundled-package.stageBundledProviderOptionalDependencies has cognitive complexity 121 (threshold 15). Drivers by points: if/else 24 (71 pts), loops 9 (19 pts), ternaries 6 (15 pts), boolean chains 14, error handling 1 (2 pts) (nesting depth added 67). Of this number, 113 points are the body's own statements and 8 belong to 3 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.
AgentChatPrototype.AgentChatPrototype (cognitive 121) ui/storybook/prototypes/agent-chat/AgentChatPrototype.tsx:221— AgentChatPrototype.AgentChatPrototype has cognitive complexity 121 (threshold 15). Drivers by points: ternaries 25 (54 pts), boolean chains 37, if/else 17 (26 pts), loops 3 (4 pts) (nesting depth added 39). Most of this is not in the body itself: 7 of the 121 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 237, 599, 585, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
company.registerCompanyCommands (cognitive 119) cli/src/commands/client/company.ts:1346— company.registerCompanyCommands has cognitive complexity 119 (threshold 15). Drivers by points: if/else 47 (65 pts), boolean chains 20, error handling 16 (20 pts), ternaries 9 (11 pts), loops 2 (3 pts) (nesting depth added 25). None of this is in the body itself: all 119 points belong to 13 function literals inside it that branch (lines 1657, 1930, 1600, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
execute.execute (cognitive 118) packages/adapters/openclaw-gateway/src/server/execute.ts:1048— execute.execute has cognitive complexity 118 (threshold 15). Drivers by points: if/else 29 (58 pts), ternaries 19 (41 pts), boolean chains 16, error handling 1 (2 pts), loops 1 (nesting depth added 52). Of this number, 77 points are the body's own statements and 41 belong to 3 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.
BoardChat.BoardChat (cognitive 118) ui/src/pages/BoardChat.tsx:90— BoardChat.BoardChat has cognitive complexity 118 (threshold 15). Drivers by points: if/else 56 (69 pts), boolean chains 30, ternaries 7 (8 pts), error handling 5 (7 pts), loops 3 (4 pts) (nesting depth added 17). Of this number, 23 points are the body's own statements and 95 belong to 28 function literals inside it that branch. 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.
ComposerModelPickerPreview.ComposerModelPickerPreview (cognitive 118) ui/storybook/prototypes/composer-model-picker/ComposerModelPickerPreview.tsx:66— ComposerModelPickerPreview.ComposerModelPickerPreview has cognitive complexity 118 (threshold 15). Drivers by points: ternaries 39 (85 pts), boolean chains 20, if/else 7 (13 pts) (nesting depth added 52). Of this number, 78 points are the body's own statements and 40 belong to 12 function items inside it that branch. 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.
muse.createMuseBroker (cognitive 117) server/src/modules/external-agents/muse.ts:42— muse.createMuseBroker has cognitive complexity 117 (threshold 15). Drivers by points: if/else 120 (177 pts), ternaries 52 (94 pts), boolean chains 73, loops 11 (16 pts), error handling 4 (7 pts) (nesting depth added 107). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (muse.createMuseBroker::authorizeAssignment, muse.createMuseBroker::detectorEvidence, muse.createMuseBroker::requestWork) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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.
built-in-agents.builtInAgentService.materializeInstructions (cognitive 117) server/src/services/built-in-agents.ts:965— built-in-agents.builtInAgentService.materializeInstructions has cognitive complexity 117 (threshold 15). Drivers by points: if/else 32 (68 pts), loops 7 (16 pts), boolean chains 14, ternaries 5 (13 pts), error handling 2 (6 pts) (nesting depth added 57). Of this number, 38 points are the body's own statements and 79 belong to 2 function literals 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.
environment-selection.selectHeartbeatEnvironment (cognitive 117) server/src/services/heartbeat/environment-selection.ts:85— environment-selection.selectHeartbeatEnvironment has cognitive complexity 117 (threshold 15). Drivers by points: if/else 27 (52 pts), ternaries 21 (36 pts), boolean chains 26, error handling 1 (3 pts) (nesting depth added 42). Of this number, 111 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.
ChatEndpointDetail.Activity (cognitive 117) ui/src/pages/apps/chat/ChatEndpointDetail.tsx:877— ChatEndpointDetail.Activity has cognitive complexity 117 (threshold 15). Drivers by points: boolean chains 56, ternaries 27 (54 pts), if/else 7 (nesting depth added 27). Of this number, 60 points are the body's own statements and 57 belong to 16 function literals 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.
provider-events.canonicalProviderEventsFromCodex (cognitive 116) packages/paperclip-runner/src/provider-events.ts:621— provider-events.canonicalProviderEventsFromCodex has cognitive complexity 116 (threshold 15). Drivers by points: ternaries 28 (56 pts), boolean chains 40, if/else 19 (20 pts) (nesting depth added 29). Of this number, 112 points are the body's own statements and 4 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.
slack.executeSlackTool (cognitive 116) server/src/services/connectors/slack.ts:134— slack.executeSlackTool has cognitive complexity 116 (threshold 15). Drivers by points: if/else 32 (61 pts), ternaries 9 (24 pts), boolean chains 20, loops 3 (8 pts), error handling 1 (3 pts) (nesting depth added 51). Of this number, 108 points are the body's own statements and 8 belong to 4 function items inside it that branch. 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.
issues.resolveChatOriginPublicationBindings (cognitive 116) server/src/services/issues.ts:1146— issues.resolveChatOriginPublicationBindings has cognitive complexity 116 (threshold 15). Drivers by points: if/else 36 (78 pts), boolean chains 20, ternaries 7 (14 pts), loops 3 (4 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProjectProperties.ProjectProperties (cognitive 116) ui/src/components/ProjectProperties.tsx:216— ProjectProperties.ProjectProperties has cognitive complexity 116 (threshold 15). Drivers by points: ternaries 30 (50 pts), boolean chains 43, if/else 20 (22 pts), error handling 1 (nesting depth added 22). Of this number, 67 points are the body's own statements and 49 belong to 25 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.
parse.createPiJsonlParser (cognitive 115) packages/adapters/pi-local/src/server/parse.ts:37— parse.createPiJsonlParser has cognitive complexity 115 (threshold 15). Drivers by points: if/else 34 (92 pts), boolean chains 8, ternaries 3 (8 pts), loops 3 (7 pts) (nesting depth added 67). None of this is in the body itself: all 115 points belong to 2 function items inside it that branch (a function literal at line 60, addCost). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
RoutineRunVariablesDialog.RoutineRunVariablesDialog (cognitive 115) ui/src/components/RoutineRunVariablesDialog.tsx:186— RoutineRunVariablesDialog.RoutineRunVariablesDialog has cognitive complexity 115 (threshold 15). Drivers by points: ternaries 33 (84 pts), boolean chains 16, if/else 11 (14 pts), loops 1 (nesting depth added 54). Of this number, 21 points are the body's own statements and 94 belong to 18 function literals inside it that branch. 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.
RoutineDetail.production.RoutineDetail (cognitive 115) ui/src/pages/RoutineDetail.production.tsx:158— RoutineDetail.production.RoutineDetail has cognitive complexity 115 (threshold 15). Drivers by points: ternaries 40 (47 pts), if/else 40 (42 pts), boolean chains 24, error handling 1, loops 1 (nesting depth added 9). Of this number, 41 points are the body's own statements and 74 belong to 30 function literals inside it that branch. 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.
conversation-type-inventory.measureConversationType (cognitive 115) ui/storybook/support/design-proposals/conversation-type-inventory.ts:38— conversation-type-inventory.measureConversationType has cognitive complexity 115 (threshold 15). Drivers by points: ternaries 9 (63 pts), if/else 11 (36 pts), boolean chains 10, loops 3 (6 pts) (nesting depth added 82). 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.
chat-channels.chatChannelRoutes (cognitive 114) server/src/routes/chat-channels.ts:93— chat-channels.chatChannelRoutes has cognitive complexity 114 (threshold 15). Drivers by points: if/else 79 (82 pts), boolean chains 20, ternaries 11 (12 pts) (nesting depth added 4). None of this is in the body itself: all 114 points belong to 60 function items inside it that branch (a function literal at line 517, a function literal at line 211, a function literal at line 250, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TaskChatBubble.TaskChatBubbleContent (cognitive 114) ui/src/components/task-chat/TaskChatBubble.tsx:136— TaskChatBubble.TaskChatBubbleContent has cognitive complexity 114 (threshold 15). Drivers by points: ternaries 39 (83 pts), boolean chains 19, if/else 7 (12 pts) (nesting depth added 49). Of this number, 84 points are the body's own statements and 30 belong to 9 function literals inside it that branch. 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.
EmailEndpointSetup.EmailEndpointSetupForm (cognitive 114) ui/src/pages/apps/chat/EmailEndpointSetup.tsx:92— EmailEndpointSetup.EmailEndpointSetupForm has cognitive complexity 114 (threshold 15). Drivers by points: boolean chains 70, if/else 22 (24 pts), ternaries 13 (17 pts), error handling 3 (nesting depth added 6). Of this number, 65 points are the body's own statements and 49 belong to 22 function items inside it that branch. 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.
protocol-contract.assertQuestionAdapterFixture (cognitive 113) REDACTED:209— protocol-contract.assertQuestionAdapterFixture has cognitive complexity 113 (threshold 15). Drivers by points: if/else 30 (78 pts), boolean chains 19, error handling 2 (7 pts), loops 5 (7 pts), ternaries 1 (2 pts) (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
company-skills.companySkillService.scanProjectWorkspaces (cognitive 113) server/src/services/company-skills.ts:5156— company-skills.companySkillService.scanProjectWorkspaces has cognitive complexity 113 (threshold 15). Drivers by points: if/else 24 (69 pts), ternaries 7 (18 pts), boolean chains 14, loops 6 (9 pts), error handling 1 (3 pts) (nesting depth added 61). Of this number, 107 points are the body's own statements and 6 belong to 3 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.
GitHubChatPreview.GitHubChatPreview (cognitive 113) ui/storybook/prototypes/github-chat/GitHubChatPreview.tsx:452— GitHubChatPreview.GitHubChatPreview has cognitive complexity 113 (threshold 15). Drivers by points: boolean chains 52, ternaries 21 (47 pts), if/else 9 (10 pts), error handling 4 (nesting depth added 27). Of this number, 89 points are the body's own statements and 24 belong to 12 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.
parse-stdout.parsePiStdoutLine (cognitive 112) packages/adapters/pi-local/src/ui/parse-stdout.ts:46— parse-stdout.parsePiStdoutLine has cognitive complexity 112 (threshold 15). Drivers by points: if/else 45 (101 pts), boolean chains 8, loops 1 (3 pts) (nesting depth added 58). 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.
webhook-ingress.createGitHubWebhookIngress.processFailedGitHubWebhookDeliveries (cognitive 112) server/src/services/chat-channels/github/webhook-ingress.ts:1097— webhook-ingress.createGitHubWebhookIngress.processFailedGitHubWebhookDeliveries has cognitive complexity 112 (threshold 15). Drivers by points: if/else 26 (71 pts), boolean chains 17, loops 5 (10 pts), ternaries 4 (9 pts), error handling 2 (5 pts) (nesting depth added 58). Of this number, 91 points are the body's own statements and 21 belong to 3 function literals 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.
IssueBlockedNotice.IssueBlockedNotice (cognitive 112) ui/src/components/IssueBlockedNotice.tsx:401— IssueBlockedNotice.IssueBlockedNotice has cognitive complexity 112 (threshold 15). Drivers by points: ternaries 31 (69 pts), if/else 12 (19 pts), boolean chains 16, loops 6 (8 pts) (nesting depth added 47). Of this number, 84 points are the body's own statements and 28 belong to 5 function items inside it that branch. 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.
AuditFeed.AuditFeed (cognitive 112) ui/src/pages/audit/AuditFeed.tsx:307— AuditFeed.AuditFeed has cognitive complexity 112 (threshold 15). Drivers by points: ternaries 34 (71 pts), boolean chains 27, if/else 10 (13 pts), error handling 1 (nesting depth added 40). Of this number, 92 points are the body's own statements and 20 belong to 9 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.
heartbeat-run.heartbeatRun (cognitive 111) cli/src/commands/heartbeat-run.ts:58— heartbeat-run.heartbeatRun has cognitive complexity 111 (threshold 15). Drivers by points: if/else 45 (90 pts), ternaries 23 (43 pts), boolean chains 16, loops 4 (7 pts) (nesting depth added 68). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (heartbeat-run.heartbeatRun::printAdapterInvoke, heartbeat-run.heartbeatRun::handleEvent) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
connection-intents.connectionIntentService.search (cognitive 111) server/src/services/connection-intents.ts:416— connection-intents.connectionIntentService.search has cognitive complexity 111 (threshold 15). Drivers by points: if/else 29 (64 pts), ternaries 17 (53 pts), boolean chains 47, loops 7 (17 pts), error handling 1 (2 pts) (nesting depth added 82). 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. This shape REPEATS in the file: one other method here (connection-intents.connectionIntentService.search::aggregatorAlternatives) 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.
company-artifacts.companyArtifactsService.list (cognitive 111) server/src/services/company-artifacts.ts:321— company-artifacts.companyArtifactsService.list has cognitive complexity 111 (threshold 15). Drivers by points: if/else 28 (51 pts), ternaries 19 (42 pts), boolean chains 12, loops 3 (6 pts) (nesting depth added 49). Of this number, 101 points are the body's own statements and 10 belong to one function literal 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.
execute.buildRuntime (cognitive 110) packages/adapter-utils/src/acpx-engine/execute.ts:1824— execute.buildRuntime has cognitive complexity 110 (threshold 15). Drivers by points: if/else 33 (42 pts), boolean chains 37, ternaries 23 (27 pts), loops 2 (3 pts), error handling 1 (nesting depth added 14). Of this number, 107 points are the body's own statements and 3 belong to 5 function literals inside it that branch. 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.
environment-probe.probeEnvironment (cognitive 110) server/src/services/environment-probe.ts:70— environment-probe.probeEnvironment has cognitive complexity 110 (threshold 15). Drivers by points: if/else 20 (54 pts), ternaries 8 (25 pts), boolean chains 19, error handling 4 (12 pts) (nesting depth added 59). 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.
issues.listIssueBlockedInboxAttentionMap (cognitive 110) server/src/services/issues.ts:5621— issues.listIssueBlockedInboxAttentionMap has cognitive complexity 110 (threshold 15). Drivers by points: ternaries 23 (54 pts), if/else 18 (35 pts), boolean chains 14, loops 4, match/switch 1 (3 pts) (nesting depth added 50). Of this number, 98 points are the body's own statements and 12 belong to 6 function literals 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.
native-completion-feedback.nativeCompletionFeedback (cognitive 110) server/src/services/native-runtime/native-completion-feedback.ts:48— native-completion-feedback.nativeCompletionFeedback has cognitive complexity 110 (threshold 15). Drivers by points: if/else 39 (63 pts), boolean chains 30, ternaries 9 (14 pts), loops 2 (3 pts) (nesting depth added 30). Of this number, 104 points are the body's own statements and 6 belong to 3 function literals 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.
AgentConfigForm.SubmittedBrowserCodeLoginPanel (cognitive 110) ui/src/components/AgentConfigForm.tsx:3063— AgentConfigForm.SubmittedBrowserCodeLoginPanel has cognitive complexity 110 (threshold 15). Drivers by points: boolean chains 47, if/else 34 (40 pts), ternaries 13 (20 pts), error handling 3 (nesting depth added 13). Of this number, 37 points are the body's own statements and 73 belong to 24 function items inside it that branch. 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.
parse-stdout.parseClaudeStdoutLine (cognitive 109) packages/adapters/claude-local/src/ui/parse-stdout.ts:38— parse-stdout.parseClaudeStdoutLine has cognitive complexity 109 (threshold 15). Drivers by points: ternaries 18 (52 pts), if/else 20 (46 pts), loops 3 (9 pts), boolean chains 2 (nesting depth added 66). 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.
CapabilitySemanticToolRuntime.#invoke (cognitive 109) packages/paperclip-runner/src/tools/capability-semantic-tool-runtime.ts:284— CapabilitySemanticToolRuntime.#invoke has cognitive complexity 109 (threshold 15). Drivers by points: if/else 34 (84 pts), boolean chains 11, error handling 3 (7 pts), ternaries 6 (7 pts) (nesting depth added 55). 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.
environment-execution-target.resolveEnvironmentExecutionTarget (cognitive 109) server/src/services/environment-execution-target.ts:227— environment-execution-target.resolveEnvironmentExecutionTarget has cognitive complexity 109 (threshold 15). Drivers by points: if/else 18 (37 pts), ternaries 14 (31 pts), error handling 7 (25 pts), boolean chains 16 (nesting depth added 54). Of this number, 67 points are the body's own statements and 42 belong to 3 function literals 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.
ExternalAgentInviteDialog.ExternalAgentInviteDialog (cognitive 109) ui/src/components/new-agent/ExternalAgentInviteDialog.tsx:22— ExternalAgentInviteDialog.ExternalAgentInviteDialog has cognitive complexity 109 (threshold 15). Drivers by points: ternaries 29 (65 pts), boolean chains 27, if/else 12 (17 pts) (nesting depth added 41). Of this number, 82 points are the body's own statements and 27 belong to 8 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.
ChatEndpointSetup.TryStep (cognitive 109) ui/src/pages/apps/chat/ChatEndpointSetup.tsx:1765— ChatEndpointSetup.TryStep has cognitive complexity 109 (threshold 15). Drivers by points: ternaries 33 (96 pts), boolean chains 13 (nesting depth added 63). 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.
issue-thread-interactions.issueThreadInteractionService.create (cognitive 108) server/src/services/issue-thread-interactions.ts:3390— issue-thread-interactions.issueThreadInteractionService.create has cognitive complexity 108 (threshold 15). Drivers by points: if/else 37 (66 pts), boolean chains 28, ternaries 5 (11 pts), loops 2, error handling 1 (nesting depth added 35). Of this number, 67 points are the body's own statements and 41 belong to 2 function literals 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.
IssueThreadInteractionCard.IssueThreadInteractionCard (cognitive 108) ui/src/components/IssueThreadInteractionCard.tsx:3611— IssueThreadInteractionCard.IssueThreadInteractionCard has cognitive complexity 108 (threshold 15). Drivers by points: ternaries 40 (87 pts), boolean chains 18, if/else 3 (nesting depth added 47). 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.
InteractionCard.InteractionCard (cognitive 107) packages/paperclip-runner/devtools/issue-thread/src/InteractionCard.tsx:57— InteractionCard.InteractionCard has cognitive complexity 107 (threshold 15). Drivers by points: ternaries 26 (56 pts), if/else 13 (39 pts), boolean chains 12 (nesting depth added 56). Of this number, 32 points are the body's own statements and 75 belong to 18 function items inside it that branch. 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.
callbacks.createChatInteractionCallbacks.handleModalSubmit (cognitive 107) server/src/services/chat-channels/interactions/callbacks.ts:1425— callbacks.createChatInteractionCallbacks.handleModalSubmit has cognitive complexity 107 (threshold 15). Drivers by points: if/else 38 (64 pts), boolean chains 25, ternaries 9 (14 pts), error handling 2 (4 pts) (nesting depth added 33). Of this number, 90 points are the body's own statements and 17 belong to 9 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.
Artifacts.Artifacts (cognitive 106) ui/src/pages/Artifacts.tsx:39— Artifacts.Artifacts has cognitive complexity 106 (threshold 15). Drivers by points: ternaries 25 (73 pts), if/else 20 (24 pts), boolean chains 9 (nesting depth added 52). Of this number, 70 points are the body's own statements and 36 belong to 14 function literals inside it that branch. 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.
AgentBulkSettingsSheet.AgentBulkSettingsSheet (cognitive 106) ui/src/components/agents/AgentBulkSettingsSheet.tsx:21— AgentBulkSettingsSheet.AgentBulkSettingsSheet has cognitive complexity 106 (threshold 15). Drivers by points: boolean chains 43, ternaries 25 (40 pts), if/else 19 (23 pts) (nesting depth added 19). Of this number, 44 points are the body's own statements and 62 belong to 15 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.
tool-gateway.createToolGatewayService.executeRemoteHttpTool (cognitive 104) server/src/services/tool-gateway.ts:6081— tool-gateway.createToolGatewayService.executeRemoteHttpTool has cognitive complexity 104 (threshold 15). Drivers by points: if/else 38 (56 pts), ternaries 14 (27 pts), boolean chains 19, error handling 2 (nesting depth added 31). Of this number, 85 points are the body's own statements and 19 belong to 7 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.
format-event.printClaudeStreamEvent (cognitive 103) packages/adapters/claude-local/src/cli/format-event.ts:42— format-event.printClaudeStreamEvent has cognitive complexity 103 (threshold 15). Drivers by points: ternaries 21 (49 pts), if/else 19 (40 pts), boolean chains 9, loops 2 (4 pts), error handling 1 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
execute.execute (cognitive 103) packages/plugins/sandbox-providers/createos/src/execute.ts:92— execute.execute has cognitive complexity 103 (threshold 15). Drivers by points: if/else 25 (61 pts), boolean chains 17, ternaries 4 (13 pts), error handling 6 (9 pts), loops 2 (3 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.
chat-control-chronology.readChatControlChronology (cognitive 102) server/src/services/chat-control-chronology.ts:76— chat-control-chronology.readChatControlChronology has cognitive complexity 102 (threshold 15). Drivers by points: if/else 15 (44 pts), ternaries 16 (38 pts), boolean chains 17, loops 2 (3 pts) (nesting depth added 52). Of this number, 93 points are the body's own statements and 9 belong to 3 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.
task-markdown.buildPaperclipTaskMarkdown (cognitive 102) server/src/services/heartbeat/task-markdown.ts:7— task-markdown.buildPaperclipTaskMarkdown has cognitive complexity 102 (threshold 15). Drivers by points: if/else 29 (46 pts), ternaries 14 (34 pts), boolean chains 17, loops 3 (5 pts) (nesting depth added 39). Of this number, 96 points are the body's own statements and 6 belong to 3 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.
native-safe-replacement.reconcileSafeNativeReplacements (cognitive 102) server/src/services/native-runtime/native-safe-replacement.ts:53— native-safe-replacement.reconcileSafeNativeReplacements has cognitive complexity 102 (threshold 15). Drivers by points: if/else 22 (52 pts), boolean chains 21, ternaries 8 (20 pts), loops 3 (5 pts), error handling 2 (4 pts) (nesting depth added 46). Of this number, 34 points are the body's own statements and 68 belong to 5 function literals 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.
InlineEditor.InlineEditor (cognitive 102) ui/src/components/InlineEditor.tsx:58— InlineEditor.InlineEditor has cognitive complexity 102 (threshold 15). Drivers by points: if/else 43 (61 pts), ternaries 10 (22 pts), boolean chains 19 (nesting depth added 30). Of this number, 32 points are the body's own statements and 70 belong to 19 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.
RunnerInspector.RunnerInspector (cognitive 102) ui/src/components/RunnerInspector.tsx:644— RunnerInspector.RunnerInspector has cognitive complexity 102 (threshold 15). Drivers by points: ternaries 58 (131 pts), if/else 45 (50 pts), boolean chains 44, error handling 3 (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (RunnerInspector.RunnerInspector::deleteTrace) 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.
CompanySkills.DiscoveryGrid (cognitive 102) ui/src/pages/CompanySkills.tsx:1029— CompanySkills.DiscoveryGrid has cognitive complexity 102 (threshold 15). Drivers by points: ternaries 34 (79 pts), boolean chains 16, if/else 4 (6 pts), loops 1 (nesting depth added 47). Of this number, 83 points are the body's own statements and 19 belong to 7 function literals inside it that branch. 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.
question-set.parsePaperclipQuestionResponse (cognitive 101) REDACTED:294— question-set.parsePaperclipQuestionResponse has cognitive complexity 101 (threshold 15). Drivers by points: if/else 26 (67 pts), boolean chains 16, ternaries 6 (13 pts), loops 3 (5 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
activity.createChatActivity.listActivity (cognitive 101) server/src/services/chat-channels/activity.ts:164— activity.createChatActivity.listActivity has cognitive complexity 101 (threshold 15). Drivers by points: ternaries 47 (88 pts), boolean chains 6, if/else 3 (6 pts), loops 1 (nesting depth added 44). Most of this is not in the body itself: 10 of the 101 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 468, a function literal at line 412, a function literal at line 336, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TaskChatComposer.TaskChatComposer::submit (cognitive 101) REDACTED:888— TaskChatComposer.TaskChatComposer::submit has cognitive complexity 101 (threshold 15). Drivers by points: if/else 38 (56 pts), boolean chains 20, ternaries 12 (20 pts), error handling 3 (5 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (TaskChatComposer.TaskChatComposer) 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.
Layout.production.Layout (cognitive 101) ui/src/components/Layout.production.tsx:117— Layout.production.Layout has cognitive complexity 101 (threshold 15). Drivers by points: ternaries 31 (53 pts), if/else 29 (31 pts), boolean chains 17 (nesting depth added 24). Of this number, 62 points are the body's own statements and 39 belong to 18 function literals 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.
ConnectionSetupFlow.KeyStep (cognitive 101) ui/src/features/connections/ConnectionSetupFlow.tsx:3581— ConnectionSetupFlow.KeyStep has cognitive complexity 101 (threshold 15). Drivers by points: ternaries 29 (50 pts), boolean chains 39, if/else 9 (12 pts) (nesting depth added 24). Of this number, 77 points are the body's own statements and 24 belong to 10 function literals 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.
OpenCodeHarnessSession.#mapProviderEventValue (cognitive 100) REDACTED:1562— OpenCodeHarnessSession.#mapProviderEventValue has cognitive complexity 100 (threshold 15). Drivers by points: if/else 31 (52 pts), boolean chains 30, ternaries 6 (14 pts), loops 1 (4 pts) (nesting depth added 32). Of this number, 99 points are the body's own statements and 1 belongs to one function literal 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.
authorization-start.createOAuthAuthorizationStart::startOAuth (cognitive 100) server/src/services/tool-access/oauth/authorization-start.ts:41— authorization-start.createOAuthAuthorizationStart::startOAuth has cognitive complexity 100 (threshold 15). Drivers by points: ternaries 23 (43 pts), if/else 28 (39 pts), boolean chains 16, error handling 1 (2 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.
status-decision-committer.materializeDecisionEffect (cognitive 100) server/src/services/native-runtime/status-decision-committer.ts:532— status-decision-committer.materializeDecisionEffect has cognitive complexity 100 (threshold 15). Drivers by points: if/else 59 (92 pts), ternaries 3 (6 pts), boolean chains 2 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Row.EnvironmentVariableRow (cognitive 100) ui/src/components/environment-variables-editor/Row.tsx:70— Row.EnvironmentVariableRow has cognitive complexity 100 (threshold 15). Drivers by points: ternaries 28 (54 pts), boolean chains 24, if/else 17 (21 pts), match/switch 1 (nesting depth added 30). Of this number, 64 points are the body's own statements and 36 belong to 13 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.
generate-daytona-tools.generateDaytonaCatalog (cognitive 99) scripts/generate-daytona-tools.mjs:46— generate-daytona-tools.generateDaytonaCatalog has cognitive complexity 99 (threshold 15). Drivers by points: if/else 13 (55 pts), ternaries 4 (18 pts), loops 5 (14 pts), boolean chains 12 (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.
IssueChatThread.IssueChatAssistantMessage (cognitive 99) ui/src/components/IssueChatThread.tsx:2293— IssueChatThread.IssueChatAssistantMessage has cognitive complexity 99 (threshold 15). Drivers by points: ternaries 48 (77 pts), boolean chains 17, if/else 4 (5 pts) (nesting depth added 30). Of this number, 92 points are the body's own statements and 7 belong to 6 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.
TaskChatTurn.TaskChatTurn (cognitive 99) ui/src/components/task-chat/TaskChatTurn.tsx:72— TaskChatTurn.TaskChatTurn has cognitive complexity 99 (threshold 15). Drivers by points: ternaries 32 (76 pts), boolean chains 17, if/else 5 (6 pts) (nesting depth added 45). Of this number, 97 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
AgentDetail.production.PromptsTab (cognitive 99) ui/src/pages/AgentDetail.production.tsx:2305— AgentDetail.production.PromptsTab has cognitive complexity 99 (threshold 15). Drivers by points: boolean chains 37, if/else 30 (35 pts), ternaries 19 (24 pts), loops 2 (3 pts) (nesting depth added 11). Of this number, 44 points are the body's own statements and 55 belong to 25 function literals inside it that branch. 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.
acpx-runtime-sidecar.dispatch (cognitive 98) packages/paperclip-runner/src/cli/acpx-runtime-sidecar.ts:251— acpx-runtime-sidecar.dispatch has cognitive complexity 98 (threshold 15). Drivers by points: if/else 45 (72 pts), ternaries 5 (13 pts), boolean chains 11, error handling 1 (2 pts) (nesting depth added 36). Of this number, 94 points are the body's own statements and 4 belong to 3 function literals 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.
chat-github-reviews.githubChatReviewService.processPublication (cognitive 98) server/src/services/chat-github-reviews.ts:1009— chat-github-reviews.githubChatReviewService.processPublication has cognitive complexity 98 (threshold 15). Drivers by points: if/else 27 (47 pts), ternaries 14 (29 pts), boolean chains 17, loops 2 (4 pts), error handling 1 (nesting depth added 37). Most of this is not in the body itself: 4 of the 98 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 1064, 1478, 1098, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
execution-workspace-repositories.executionWorkspaceRepositoryService.prepareForAdmission (cognitive 98) server/src/services/execution-workspace-repositories.ts:321— execution-workspace-repositories.executionWorkspaceRepositoryService.prepareForAdmission has cognitive complexity 98 (threshold 15). Drivers by points: if/else 30 (66 pts), boolean chains 18, ternaries 4 (7 pts), error handling 2 (4 pts), loops 2 (3 pts) (nesting depth added 42). Most of this is not in the body itself: 9 of the 98 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 378, 336, 379, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
public-mcp.publicMcpIngressRoutes (cognitive 98) REDACTED:40— public-mcp.publicMcpIngressRoutes has cognitive complexity 98 (threshold 15). Drivers by points: if/else 22 (40 pts), ternaries 19 (36 pts), boolean chains 16, error handling 3 (4 pts), match/switch 1 (2 pts) (nesting depth added 37). Most of this is not in the body itself: 5 of the 98 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 96, 112, 142, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentProviderConnection.AgentProviderConnection (cognitive 98) ui/src/components/new-agent/AgentProviderConnection.tsx:37— AgentProviderConnection.AgentProviderConnection has cognitive complexity 98 (threshold 15). Drivers by points: ternaries 41 (78 pts), boolean chains 46, if/else 26 (36 pts), error handling 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. This shape REPEATS in the file: one other method here (AgentProviderConnection.AgentProviderConnection::connect) 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.
CapabilityLiveSession.#handleNotification (cognitive 97) packages/paperclip-runner/src/live/live-session.ts:2768— CapabilityLiveSession.#handleNotification has cognitive complexity 97 (threshold 15). Drivers by points: if/else 23 (37 pts), boolean chains 26, ternaries 9 (26 pts), error handling 2 (4 pts), loops 2 (4 pts) (nesting depth added 35). Of this number, 81 points are the body's own statements and 16 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.
webhook-ingress.createGitHubWebhookIngress.stageGitHubWebhookIngress (cognitive 97) server/src/services/chat-channels/github/webhook-ingress.ts:245— webhook-ingress.createGitHubWebhookIngress.stageGitHubWebhookIngress has cognitive complexity 97 (threshold 15). Drivers by points: if/else 21 (51 pts), ternaries 8 (25 pts), boolean chains 15, error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 49). Of this number, 33 points are the body's own statements and 64 belong to 2 function literals inside it that branch. 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.
ExecutionWorkspaceCloseDialog.ExecutionWorkspaceCloseDialog (cognitive 97) ui/src/components/ExecutionWorkspaceCloseDialog.tsx:38— ExecutionWorkspaceCloseDialog.ExecutionWorkspaceCloseDialog has cognitive complexity 97 (threshold 15). Drivers by points: ternaries 27 (94 pts), boolean chains 2, if/else 1 (nesting depth added 67). Of this number, 90 points are the body's own statements and 7 belong to 4 function literals inside it that branch. 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.
access.accessService.sweepMemberConnectionAccess (cognitive 96) server/src/services/access.ts:51— access.accessService.sweepMemberConnectionAccess has cognitive complexity 96 (threshold 15). Drivers by points: if/else 21 (48 pts), ternaries 10 (20 pts), loops 8 (18 pts), boolean chains 10 (nesting depth added 47). Of this number, 92 points are the body's own statements and 4 belong to 3 function literals 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.
ProjectWorkspaceDetail.ProjectWorkspaceDetail (cognitive 96) ui/src/pages/ProjectWorkspaceDetail.tsx:248— ProjectWorkspaceDetail.ProjectWorkspaceDetail has cognitive complexity 96 (threshold 15). Drivers by points: ternaries 37 (69 pts), if/else 14, boolean chains 13 (nesting depth added 32). Of this number, 50 points are the body's own statements and 46 belong to 26 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.
status-arbiter.arbitrateNativeStatus (cognitive 95) server/src/services/native-runtime/status-arbiter.ts:95— status-arbiter.arbitrateNativeStatus has cognitive complexity 95 (threshold 15). Drivers by points: if/else 33 (42 pts), ternaries 13 (29 pts), boolean chains 24 (nesting depth added 25). Of this number, 91 points are the body's own statements and 4 belong to one function literal 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.
voice-reply-push.pushVoiceReplies (cognitive 95) server/src/services/voice/voice-reply-push.ts:28— voice-reply-push.pushVoiceReplies has cognitive complexity 95 (threshold 15). Drivers by points: if/else 12 (40 pts), ternaries 12 (38 pts), boolean chains 7, loops 4 (7 pts), error handling 1 (3 pts) (nesting depth added 59). Of this number, 34 points are the body's own statements and 61 belong to 4 function literals 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.
email-channels.emailChannelService.processDelivery (cognitive 95) server/src/services/email-channels.ts:1182— email-channels.emailChannelService.processDelivery has cognitive complexity 95 (threshold 15). Drivers by points: if/else 18 (43 pts), ternaries 11 (36 pts), boolean chains 12, loops 2 (4 pts) (nesting depth added 52). Most of this is not in the body itself: 10 of the 95 points are its own statements and the rest belongs to one function literal inside it that branches (line 1224). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
issues.listIssueBlockerAttentionMap (cognitive 95) server/src/services/issues.ts:3778— issues.listIssueBlockerAttentionMap has cognitive complexity 95 (threshold 15). Drivers by points: if/else 38 (63 pts), loops 21 (41 pts), boolean chains 27, ternaries 5 (9 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. This shape REPEATS in the file: one other method here (issues.listIssueBlockerAttentionMap::classifyPath) 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.
RichWorkProductCard.RichWorkProductCard (cognitive 95) ui/src/components/task-chat/RichWorkProductCard.tsx:136— RichWorkProductCard.RichWorkProductCard has cognitive complexity 95 (threshold 15). Drivers by points: ternaries 40 (71 pts), boolean chains 21, if/else 2, match/switch 1 (nesting depth added 31). Of this number, 93 points are the body's own statements and 2 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.
IssueRunLedger.IssueRunLedgerContent (cognitive 95) ui/src/components/IssueRunLedger.tsx:592— IssueRunLedger.IssueRunLedgerContent has cognitive complexity 95 (threshold 15). Drivers by points: ternaries 38 (76 pts), if/else 8 (10 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 41). Of this number, 35 points are the body's own statements and 60 belong to 6 function literals 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.
CompanyExport.CompanyExport (cognitive 95) ui/src/pages/CompanyExport.tsx:628— CompanyExport.CompanyExport has cognitive complexity 95 (threshold 15). Drivers by points: if/else 38 (43 pts), boolean chains 23, ternaries 16 (21 pts), loops 6 (8 pts) (nesting depth added 12). Of this number, 26 points are the body's own statements and 69 belong to 27 function items inside it that branch. 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.
AsciiArtAnimation.AsciiArtAnimation (cognitive 95) ui/src/components/AsciiArtAnimation.tsx:62— AsciiArtAnimation.AsciiArtAnimation has cognitive complexity 95 (threshold 15). Drivers by points: if/else 25 (49 pts), loops 15 (24 pts), boolean chains 11, ternaries 5 (11 pts) (nesting depth added 39). None of this is in the body itself: all 95 points belong to 9 function literals inside it that branch (lines 114, 208, 188, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Connections.Connections (cognitive 95) ui/src/pages/apps/Connections.tsx:113— Connections.Connections has cognitive complexity 95 (threshold 15). Drivers by points: ternaries 25 (69 pts), boolean chains 14, if/else 7 (8 pts), loops 4 (nesting depth added 45). Of this number, 16 points are the body's own statements and 79 belong to 15 function literals inside it that branch. 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.
publication.createToolCatalogPublication::refreshCatalog (cognitive 94) server/src/services/tool-access/catalog/publication.ts:49— publication.createToolCatalogPublication::refreshCatalog has cognitive complexity 94 (threshold 15). Drivers by points: ternaries 25 (56 pts), boolean chains 22, if/else 9 (13 pts), loops 2, error handling 1 (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.
generate-unikraft-tools.generateUnikraftCatalog (cognitive 94) scripts/generate-unikraft-tools.mjs:49— generate-unikraft-tools.generateUnikraftCatalog has cognitive complexity 94 (threshold 15). Drivers by points: if/else 14 (56 pts), ternaries 4 (17 pts), loops 5 (14 pts), boolean chains 7 (nesting depth added 64). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
skill-sources.skillSourceService.publish (cognitive 94) server/src/services/skill-sources.ts:101— skill-sources.skillSourceService.publish has cognitive complexity 94 (threshold 15). Drivers by points: ternaries 17 (47 pts), if/else 14 (25 pts), boolean chains 19, loops 3 (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.
issue-tree-control.issueTreeControlRoutes (cognitive 94) server/src/routes/issue-tree-control.ts:49— issue-tree-control.issueTreeControlRoutes has cognitive complexity 94 (threshold 15). Drivers by points: if/else 30 (46 pts), ternaries 12 (19 pts), loops 5 (12 pts), boolean chains 9, error handling 3 (8 pts) (nesting depth added 35). None of this is in the body itself: all 94 points belong to 8 function items inside it that branch (a function literal at line 123, a function literal at line 416, a function literal at line 374, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ai-connections.aiConnectionService.save (cognitive 93) server/src/services/ai-connections.ts:568— ai-connections.aiConnectionService.save has cognitive complexity 93 (threshold 15). Drivers by points: if/else 34 (45 pts), ternaries 14 (24 pts), boolean chains 19, error handling 2 (4 pts), loops 1 (nesting depth added 23). Of this number, 23 points are the body's own statements and 70 belong to one function literal 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.
file-receipts.createSlackFileReceipts.processPendingSlackFileUploadReceipts (cognitive 93) server/src/services/chat-channels/slack/file-receipts.ts:486— file-receipts.createSlackFileReceipts.processPendingSlackFileUploadReceipts has cognitive complexity 93 (threshold 15). Drivers by points: if/else 20 (41 pts), ternaries 14 (39 pts), boolean chains 10, error handling 1 (2 pts), loops 1 (nesting depth added 47). Most of this is not in the body itself: 13 of the 93 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 556, 725, 555, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
execution-configuration.prepareHeartbeatExecutionConfiguration (cognitive 93) server/src/services/heartbeat/execution-configuration.ts:87— execution-configuration.prepareHeartbeatExecutionConfiguration has cognitive complexity 93 (threshold 15). Drivers by points: ternaries 32 (48 pts), boolean chains 21, if/else 11 (18 pts), error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 25). Of this number, 70 points are the body's own statements and 23 belong to 6 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.
config-admission.createAcpxConfigAdmission (cognitive 92) packages/paperclip-runner/src/drivers/acpx/config-admission.ts:5— config-admission.createAcpxConfigAdmission has cognitive complexity 92 (threshold 15). Drivers by points: if/else 35 (64 pts), boolean chains 25, ternaries 2, error handling 1 (nesting depth added 29). Most of this is not in the body itself: 1 of the 92 points is its own statement and the rest belongs to 4 function items inside it that branch (a function literal at line 29, readMode, assertReady, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
workspace-runtime.cleanupExecutionWorkspaceArtifacts (cognitive 92) server/src/services/workspace-runtime.ts:4251— workspace-runtime.cleanupExecutionWorkspaceArtifacts has cognitive complexity 92 (threshold 15). Drivers by points: ternaries 15 (38 pts), if/else 18 (31 pts), error handling 5 (14 pts), boolean chains 8, loops 1 (nesting depth added 45). Of this number, 90 points are the body's own statements and 2 belong to one function literal 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.
issue.registerIssueCommands (cognitive 91) cli/src/commands/client/issue.ts:172— issue.registerIssueCommands has cognitive complexity 91 (threshold 15). Drivers by points: error handling 54 (56 pts), if/else 19 (21 pts), ternaries 9 (10 pts), loops 3, boolean chains 1 (nesting depth added 5). Most of this is not in the body itself: 2 of the 91 points are its own statements and the rest belongs to 54 function literals inside it that branch (lines 184, 868, 986, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PiRpcMessageDeltas.normalize (cognitive 91) packages/paperclip-runner/src/drivers/acpx/pi-acp-runtime.ts:45— PiRpcMessageDeltas.normalize has cognitive complexity 91 (threshold 15). Drivers by points: if/else 32 (62 pts), boolean chains 22, ternaries 2 (5 pts), loops 1 (2 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.
chat-publication-text-parts.splitNativePublicationText (cognitive 91) server/src/services/chat-publication-text-parts.ts:198— chat-publication-text-parts.splitNativePublicationText has cognitive complexity 91 (threshold 15). Drivers by points: if/else 20 (57 pts), loops 5 (16 pts), ternaries 6 (11 pts), boolean chains 7 (nesting depth added 53). Of this number, 83 points are the body's own statements and 8 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.
muse.museTransportRoutes::handler (cognitive 90) server/src/routes/muse.ts:42— muse.museTransportRoutes::handler has cognitive complexity 90 (threshold 15). Drivers by points: ternaries 11 (52 pts), if/else 21 (34 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 55). 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.
plugin-lifecycle-delivery.registerPluginLifecycleDelivery (cognitive 90) server/src/services/plugin-lifecycle-delivery.ts:14— plugin-lifecycle-delivery.registerPluginLifecycleDelivery has cognitive complexity 90 (threshold 15). Drivers by points: if/else 17 (51 pts), ternaries 4 (18 pts), boolean chains 8, loops 5 (8 pts), error handling 2 (5 pts) (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.
useLiveRunTranscripts.useLiveRunTranscripts (cognitive 90) ui/src/components/transcript/useLiveRunTranscripts.ts:99— useLiveRunTranscripts.useLiveRunTranscripts has cognitive complexity 90 (threshold 15). Drivers by points: if/else 40 (60 pts), boolean chains 10, loops 10, ternaries 7 (9 pts), error handling 1 (nesting depth added 22). None of this is in the body itself: all 90 points belong to 18 function literals inside it that branch (lines 208, 312, 303, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
managed-config.parseManagedConfigEnv (cognitive 89) server/src/services/managed-config.ts:141— managed-config.parseManagedConfigEnv has cognitive complexity 89 (threshold 15). Drivers by points: if/else 33 (67 pts), loops 6 (9 pts), boolean chains 7, ternaries 2 (5 pts), error handling 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.
workspaces.createHeartbeatWorkspaceResolver.resolveAnchorWorkspaceForRun (cognitive 89) server/src/services/heartbeat/workspaces.ts:3425— workspaces.createHeartbeatWorkspaceResolver.resolveAnchorWorkspaceForRun has cognitive complexity 89 (threshold 15). Drivers by points: ternaries 22 (42 pts), if/else 16 (31 pts), boolean chains 11, error handling 1 (3 pts), loops 1 (2 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
question-response-delivery.questionResponseDeliveryService.deliver (cognitive 88) server/src/services/question-response-delivery.ts:740— question-response-delivery.questionResponseDeliveryService.deliver has cognitive complexity 88 (threshold 15). Drivers by points: if/else 17 (32 pts), ternaries 17 (32 pts), boolean chains 19, error handling 3 (5 pts) (nesting depth added 32). Of this number, 87 points are the body's own statements and 1 belongs to 3 function literals 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.
transport.createChatPublicationTransport.postSafePublication (cognitive 88) server/src/services/chat-channels/publications/transport.ts:193— transport.createChatPublicationTransport.postSafePublication has cognitive complexity 88 (threshold 15). Drivers by points: ternaries 14 (40 pts), if/else 23 (37 pts), boolean chains 11 (nesting depth added 40). Of this number, 70 points are the body's own statements and 18 belong to 7 function literals inside it that branch. 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.
QuestionForm.QuestionFormForRequest (cognitive 88) ui/src/components/task-chat/QuestionForm.tsx:239— QuestionForm.QuestionFormForRequest has cognitive complexity 88 (threshold 15). Drivers by points: ternaries 30 (42 pts), if/else 19 (23 pts), boolean chains 21, error handling 2 (nesting depth added 16). Of this number, 42 points are the body's own statements and 46 belong to 14 function items inside it that branch. 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.
chat-interaction-publications.terminalNativeInteractionCopy (cognitive 87) server/src/services/chat-interaction-publications.ts:41— chat-interaction-publications.terminalNativeInteractionCopy has cognitive complexity 87 (threshold 15). Drivers by points: ternaries 21 (63 pts), if/else 13 (17 pts), boolean chains 7 (nesting depth added 46). Of this number, 82 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
service.createConnectionTokenBroker.mintConnectionTokenForAgent (cognitive 87) server/src/services/tool-access/token-broker/service.ts:46— service.createConnectionTokenBroker.mintConnectionTokenForAgent has cognitive complexity 87 (threshold 15). Drivers by points: if/else 30 (37 pts), ternaries 16 (26 pts), boolean chains 21, error handling 3 (nesting depth added 17). Of this number, 82 points are the body's own statements and 5 belong to 5 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.
AiProviderSetup.AiProviderSetup (cognitive 87) ui/src/components/ai-connections/AiProviderSetup.tsx:68— AiProviderSetup.AiProviderSetup has cognitive complexity 87 (threshold 15). Drivers by points: ternaries 31 (56 pts), boolean chains 29, if/else 2 (nesting depth added 25). Of this number, 75 points are the body's own statements and 12 belong to 8 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.
AgentDetail.RunDetail (cognitive 87) ui/src/pages/AgentDetail.tsx:3456— AgentDetail.RunDetail has cognitive complexity 87 (threshold 15). Drivers by points: boolean chains 57, if/else 20, ternaries 9 (10 pts) (nesting depth added 1). Of this number, 60 points are the body's own statements and 27 belong to 14 function literals inside it that branch. 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.
ai-connection-runtime.prepareManagedAiRuntime (cognitive 86) server/src/services/ai-connection-runtime.ts:225— ai-connection-runtime.prepareManagedAiRuntime has cognitive complexity 86 (threshold 15). Drivers by points: if/else 27 (45 pts), ternaries 11 (16 pts), boolean chains 15, error handling 2 (5 pts), loops 3 (5 pts) (nesting depth added 28). Of this number, 45 points are the body's own statements and 41 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.
chat-github-wizard.githubChatWizardService.advanceOnce (cognitive 86) server/src/services/chat-github-wizard.ts:685— chat-github-wizard.githubChatWizardService.advanceOnce has cognitive complexity 86 (threshold 15). Drivers by points: if/else 27 (44 pts), boolean chains 20, ternaries 7 (18 pts), error handling 2 (4 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.
continuations.createChatInteractionContinuations.processPendingInteractionWakeups (cognitive 86) server/src/services/chat-channels/interactions/continuations.ts:43— continuations.createChatInteractionContinuations.processPendingInteractionWakeups has cognitive complexity 86 (threshold 15). Drivers by points: ternaries 23 (64 pts), if/else 5 (11 pts), boolean chains 8, error handling 1 (2 pts), loops 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.
environment-runtime.environmentRuntimeService.releaseRunLeases (cognitive 86) server/src/services/environment-runtime.ts:4195— environment-runtime.environmentRuntimeService.releaseRunLeases has cognitive complexity 86 (threshold 15). Drivers by points: if/else 19 (44 pts), ternaries 8 (24 pts), boolean chains 12, error handling 2 (5 pts), loops 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
health.healthRoutes (cognitive 86) server/src/routes/health.ts:120— health.healthRoutes has cognitive complexity 86 (threshold 15). Drivers by points: ternaries 34 (57 pts), if/else 13 (16 pts), boolean chains 9, error handling 3 (4 pts) (nesting depth added 27). None of this is in the body itself: all 86 points belong to 2 function literals inside it that branch (lines 233, 140). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
DocumentAnnotationLayer.DocumentAnnotationLayer (cognitive 86) ui/src/components/DocumentAnnotationLayer.tsx:239— DocumentAnnotationLayer.DocumentAnnotationLayer has cognitive complexity 86 (threshold 15). Drivers by points: if/else 36 (48 pts), boolean chains 21, ternaries 12 (13 pts), loops 3 (4 pts) (nesting depth added 14). Most of this is not in the body itself: 6 of the 86 points are its own statements and the rest belongs to 18 function items inside it that branch (a function literal at line 285, a function literal at line 274, a function literal at line 370, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
DesignSandboxTaskThread.PreviewCase (cognitive 86) ui/src/components/design-sandbox/DesignSandboxTaskThread.tsx:82— DesignSandboxTaskThread.PreviewCase has cognitive complexity 86 (threshold 15). Drivers by points: ternaries 31 (64 pts), boolean chains 16, if/else 6 (nesting depth added 33). Of this number, 65 points are the body's own statements and 21 belong to 6 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.
DecisionCard.DecisionCard (cognitive 86) ui/src/components/DecisionCard.tsx:227— DecisionCard.DecisionCard has cognitive complexity 86 (threshold 15). Drivers by points: ternaries 13 (39 pts), boolean chains 38, loops 3 (6 pts), if/else 3 (nesting depth added 29). Of this number, 74 points are the body's own statements and 12 belong to 8 function items inside it that branch. 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.
AuditFeed.production.AuditFeed (cognitive 86) ui/src/pages/audit/AuditFeed.production.tsx:260— AuditFeed.production.AuditFeed has cognitive complexity 86 (threshold 15). Drivers by points: ternaries 26 (58 pts), boolean chains 20, if/else 6 (7 pts), error handling 1 (nesting depth added 33). Of this number, 72 points are the body's own statements and 14 belong to 6 function items inside it that branch. 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.
TeamCatalog.TeamInstallerDialog (cognitive 86) ui/src/pages/TeamCatalog.tsx:1065— TeamCatalog.TeamInstallerDialog has cognitive complexity 86 (threshold 15). Drivers by points: ternaries 18 (33 pts), boolean chains 26, if/else 17 (25 pts), loops 2 (nesting depth added 23). Of this number, 43 points are the body's own statements and 43 belong to 16 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-question-adapter.normalizeCodexQuestionSet (cognitive 85) packages/paperclip-runner/src/drivers/codex/codex-question-adapter.ts:270— codex-question-adapter.normalizeCodexQuestionSet has cognitive complexity 85 (threshold 15). Drivers by points: ternaries 28 (49 pts), if/else 12 (20 pts), boolean chains 11, loops 2 (5 pts) (nesting depth added 32). Of this number, 23 points are the body's own statements and 62 belong to 3 function literals 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.
workspace-runtime.ensurePersistedExecutionWorkspaceAvailable (cognitive 85) server/src/services/workspace-runtime.ts:3783— workspace-runtime.ensurePersistedExecutionWorkspaceAvailable has cognitive complexity 85 (threshold 15). Drivers by points: if/else 32 (48 pts), ternaries 16 (22 pts), boolean chains 14, error handling 1 (nesting depth added 22). Of this number, 60 points are the body's own statements and 25 belong to 5 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.
workspace-recovery.recoverRetainedWorkspace::runAttempt (cognitive 85) server/src/services/workspace-recovery.ts:76— workspace-recovery.recoverRetainedWorkspace::runAttempt has cognitive complexity 85 (threshold 15). Drivers by points: if/else 24 (51 pts), ternaries 5 (16 pts), boolean chains 9, error handling 4 (8 pts), loops 1 (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.
issue-thread-interactions.buildIssueThreadInteractionSummary (cognitive 85) ui/src/lib/issue-thread-interactions.ts:220— issue-thread-interactions.buildIssueThreadInteractionSummary has cognitive complexity 85 (threshold 15). Drivers by points: if/else 30 (54 pts), ternaries 13 (30 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.
copilot-tool-evidence.createCopilotToolEvidence (cognitive 84) packages/paperclip-runner/src/drivers/acpx/copilot-tool-evidence.ts:27— copilot-tool-evidence.createCopilotToolEvidence has cognitive complexity 84 (threshold 15). Drivers by points: if/else 37 (61 pts), boolean chains 19, ternaries 3 (4 pts) (nesting depth added 25). Of this number, 82 points are the body's own statements and 2 belong to one function literal 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.
chat-interaction-presentation.chatInteractionPresentation (cognitive 84) server/src/services/chat-interaction-presentation.ts:3— chat-interaction-presentation.chatInteractionPresentation has cognitive complexity 84 (threshold 15). Drivers by points: if/else 12 (35 pts), ternaries 7 (25 pts), loops 5 (13 pts), boolean chains 10, match/switch 1 (nesting depth added 49). Of this number, 83 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
native-execution-input.buildNativeExecutionInput (cognitive 84) server/src/services/native-runtime/native-execution-input.ts:142— native-execution-input.buildNativeExecutionInput has cognitive complexity 84 (threshold 15). Drivers by points: ternaries 37 (67 pts), boolean chains 16, if/else 1 (nesting depth added 30). Of this number, 80 points are the body's own statements and 4 belong to 3 function literals 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.
company-portability.filterPortableExtensionYaml (cognitive 84) server/src/services/company-portability.ts:2086— company-portability.filterPortableExtensionYaml has cognitive complexity 84 (threshold 15). Drivers by points: if/else 28 (52 pts), loops 9 (27 pts), boolean chains 5 (nesting depth added 42). Of this number, 75 points are the body's own statements and 9 belong to 3 function literals 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.
ExternalAgentInviteContent.MuseConnectionChecks (cognitive 84) ui/src/components/new-agent/ExternalAgentInviteContent.tsx:97— ExternalAgentInviteContent.MuseConnectionChecks has cognitive complexity 84 (threshold 15). Drivers by points: ternaries 16 (82 pts), boolean chains 2 (nesting depth added 66). Of this number, 79 points are the body's own statements and 5 belong to one function literal 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.
lifecycle.createChatMessageLifecycle.processLifecycleDelivery (cognitive 83) server/src/services/chat-channels/inbound/lifecycle.ts:355— lifecycle.createChatMessageLifecycle.processLifecycleDelivery has cognitive complexity 83 (threshold 15). Drivers by points: ternaries 18 (37 pts), boolean chains 25, if/else 15 (20 pts), error handling 1 (nesting depth added 24). Most of this is not in the body itself: 4 of the 83 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 400, 733, 987, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
cursor-mode.createCursorModeAdmission (cognitive 82) packages/paperclip-runner/src/drivers/acpx/cursor-mode.ts:15— cursor-mode.createCursorModeAdmission has cognitive complexity 82 (threshold 15). Drivers by points: if/else 32 (59 pts), boolean chains 20, ternaries 2, error handling 1 (nesting depth added 27). Most of this is not in the body itself: 1 of the 82 points is its own statement and the rest belongs to 4 function items inside it that branch (a function literal at line 38, readMode, assertReady, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
pi-runtime-extension.installPiRuntimeExtension (cognitive 82) packages/paperclip-runner/src/drivers/acpx/pi-runtime-extension.ts:308— pi-runtime-extension.installPiRuntimeExtension has cognitive complexity 82 (threshold 15). Drivers by points: if/else 22 (45 pts), boolean chains 15, ternaries 7 (13 pts), loops 5 (8 pts), error handling 1 (nesting depth added 32). Of this number, 57 points are the body's own statements and 25 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.
native-session-executor.reconcileRetainedNativeSessionCleanup (cognitive 82) server/src/services/native-runtime/native-session-executor.ts:3014— native-session-executor.reconcileRetainedNativeSessionCleanup has cognitive complexity 82 (threshold 15). Drivers by points: boolean chains 37, if/else 21 (30 pts), ternaries 6 (8 pts), error handling 3 (5 pts), loops 2 (nesting depth added 13). Of this number, 58 points are the body's own statements and 24 belong to 9 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.
access.normalizeAgentDefaultsForJoin (cognitive 82) REDACTED:736— access.normalizeAgentDefaultsForJoin has cognitive complexity 82 (threshold 15). Drivers by points: if/else 36 (50 pts), ternaries 7 (12 pts), boolean chains 11, error handling 4 (9 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.
FileViewerSheet.FileViewerSheet (cognitive 82) ui/src/components/FileViewerSheet.tsx:494— FileViewerSheet.FileViewerSheet has cognitive complexity 82 (threshold 15). Drivers by points: ternaries 32 (48 pts), boolean chains 18, if/else 15, error handling 1 (nesting depth added 16). Of this number, 59 points are the body's own statements and 23 belong to 16 function literals 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.
ImportFromVaultDialog.ImportFromVaultDialog (cognitive 82) ui/src/pages/secrets/ImportFromVaultDialog.tsx:331— ImportFromVaultDialog.ImportFromVaultDialog has cognitive complexity 82 (threshold 15). Drivers by points: if/else 32 (38 pts), boolean chains 25, ternaries 6 (12 pts), loops 5 (7 pts) (nesting depth added 14). Most of this is not in the body itself: 15 of the 82 points are its own statements and the rest belongs to 23 function items inside it that branch (a function literal at line 577, a function literal at line 471, handleClose, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
qualify-copilot-acp.runProbe (cognitive 81) packages/paperclip-runner/scripts/qualify-copilot-acp.mjs:43— qualify-copilot-acp.runProbe has cognitive complexity 81 (threshold 15). Drivers by points: if/else 22 (46 pts), ternaries 4 (10 pts), boolean chains 9, error handling 6 (9 pts), loops 5 (7 pts) (nesting depth added 35). Of this number, 21 points are the body's own statements and 60 belong to 6 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.
slack-writes.executeSlackWrite (cognitive 81) server/src/services/connectors/slack-writes.ts:43— slack-writes.executeSlackWrite has cognitive complexity 81 (threshold 15). Drivers by points: if/else 40 (51 pts), boolean chains 18, ternaries 6 (9 pts), loops 1 (2 pts), error handling 1 (nesting depth added 15). Of this number, 76 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
discovery.createToolCatalogDiscovery.remoteTools (cognitive 81) server/src/services/tool-access/catalog/discovery.ts:66— discovery.createToolCatalogDiscovery.remoteTools has cognitive complexity 81 (threshold 15). Drivers by points: if/else 28 (49 pts), boolean chains 15, ternaries 6 (8 pts), error handling 3 (6 pts), loops 2 (3 pts) (nesting depth added 27). Of this number, 78 points are the body's own statements and 3 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.
index.ChangesTab (cognitive 81) packages/plugins/plugin-workspace-diff/src/ui/index.tsx:414— index.ChangesTab has cognitive complexity 81 (threshold 15). Drivers by points: ternaries 23 (49 pts), if/else 22 (24 pts), boolean chains 6, error handling 1, loops 1 (nesting depth added 28). Of this number, 22 points are the body's own statements and 59 belong to 17 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.
file-sync.syncFiles (cognitive 81) packages/plugins/sandbox-providers/createos/src/file-sync.ts:59— file-sync.syncFiles has cognitive complexity 81 (threshold 15). Drivers by points: if/else 14 (39 pts), ternaries 8 (26 pts), loops 6 (10 pts), boolean chains 6 (nesting depth added 47). Of this number, 77 points are the body's own statements and 4 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.
routines.routineRoutes (cognitive 81) server/src/routes/routines.ts:22— routines.routineRoutes has cognitive complexity 81 (threshold 15). Drivers by points: if/else 40, ternaries 25 (28 pts), boolean chains 12, loops 1 (nesting depth added 3). None of this is in the body itself: all 81 points belong to 25 function items inside it that branch (a function literal at line 363, a function literal at line 500, assertCanManageExistingRoutine, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
adapters.adapterRoutes (cognitive 81) server/src/routes/adapters.ts:264— adapters.adapterRoutes has cognitive complexity 81 (threshold 15). Drivers by points: if/else 38 (44 pts), boolean chains 17, error handling 7 (10 pts), ternaries 5 (10 pts) (nesting depth added 14). None of this is in the body itself: all 81 points belong to 10 function literals inside it that branch (lines 324, 278, 669, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
BudgetPolicyCard.BudgetPolicyCard (cognitive 81) ui/src/components/BudgetPolicyCard.tsx:32— BudgetPolicyCard.BudgetPolicyCard has cognitive complexity 81 (threshold 15). Drivers by points: ternaries 36 (63 pts), boolean chains 11, if/else 4 (6 pts), error handling 1 (nesting depth added 29). Of this number, 76 points are the body's own statements and 5 belong to 3 function literals 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.
SummarySlotCard.SummarySlotCard (cognitive 81) ui/src/components/SummarySlotCard.tsx:135— SummarySlotCard.SummarySlotCard has cognitive complexity 81 (threshold 15). Drivers by points: ternaries 40 (61 pts), boolean chains 17, if/else 3 (nesting depth added 21). Of this number, 72 points are the body's own statements and 9 belong to 6 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.
SecretBindingPicker.SecretBindingPicker (cognitive 81) ui/src/components/SecretBindingPicker.tsx:86— SecretBindingPicker.SecretBindingPicker has cognitive complexity 81 (threshold 15). Drivers by points: ternaries 26 (58 pts), boolean chains 14, if/else 6 (9 pts) (nesting depth added 35). Of this number, 67 points are the body's own statements and 14 belong to 8 function items inside it that branch. 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.
format-event.printGeminiStreamEvent (cognitive 80) packages/adapters/gemini-local/src/cli/format-event.ts:110— format-event.printGeminiStreamEvent has cognitive complexity 80 (threshold 15). Drivers by points: if/else 23 (38 pts), ternaries 11 (31 pts), boolean chains 10, error handling 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.
question-set.parsePaperclipQuestionSet.questions (cognitive 80) REDACTED:143— question-set.parsePaperclipQuestionSet.questions has cognitive complexity 80 (threshold 15). Drivers by points: ternaries 19 (29 pts), if/else 20 (28 pts), boolean chains 18, error handling 1 (3 pts), loops 1 (2 pts) (nesting depth added 21). Of this number, 71 points are the body's own statements and 9 belong to one function literal 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.
secrets.secretService.resolveAdapterConfigForRuntime (cognitive 80) server/src/services/secrets.ts:5606— secrets.secretService.resolveAdapterConfigForRuntime has cognitive complexity 80 (threshold 15). Drivers by points: if/else 16 (41 pts), ternaries 8 (34 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 53). 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.
daytona.daytonaClient.execute (cognitive 80) server/src/services/daytona.ts:60— daytona.daytonaClient.execute has cognitive complexity 80 (threshold 15). Drivers by points: if/else 26 (51 pts), loops 4 (11 pts), ternaries 2 (9 pts), boolean chains 7, error handling 1 (2 pts) (nesting depth added 40). 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.
connection-intents.connectionIntentService.requestWithContext (cognitive 80) server/src/services/connection-intents.ts:701— connection-intents.connectionIntentService.requestWithContext has cognitive complexity 80 (threshold 15). Drivers by points: if/else 21 (37 pts), boolean chains 23, ternaries 12 (20 pts) (nesting depth added 24). Of this number, 70 points are the body's own statements and 10 belong to 5 function literals 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.
admission.createInboundAdmission.admitInboundMessage (cognitive 80) server/src/services/chat-channels/inbound/admission.ts:74— admission.createInboundAdmission.admitInboundMessage has cognitive complexity 80 (threshold 15). Drivers by points: ternaries 16 (35 pts), boolean chains 27, if/else 14 (18 pts) (nesting depth added 23). None of this is in the body itself: all 80 points belong to one function literal inside it that branches (line 77). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
tool-access.toolAccessService.finishGalleryAppConnection (cognitive 80) server/src/services/tool-access.ts:3120— tool-access.toolAccessService.finishGalleryAppConnection has cognitive complexity 80 (threshold 15). Drivers by points: if/else 22 (36 pts), ternaries 14 (26 pts), boolean chains 11, loops 3 (7 pts) (nesting depth added 30). Most of this is not in the body itself: 15 of the 80 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 3231, 3404, 3409, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
service.recoveryService.ensureSourceScopedStrandedRecoveryAction (cognitive 80) REDACTED:2555— service.recoveryService.ensureSourceScopedStrandedRecoveryAction has cognitive complexity 80 (threshold 15). Drivers by points: ternaries 18 (80 pts) (nesting depth added 62). 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.
skill-sources.skillSourceService.refresh (cognitive 80) server/src/services/skill-sources.ts:224— skill-sources.skillSourceService.refresh has cognitive complexity 80 (threshold 15). Drivers by points: if/else 20 (29 pts), boolean chains 26, ternaries 12 (22 pts), loops 1 (2 pts), error handling 1 (nesting depth added 20). Of this number, 48 points are the body's own statements and 32 belong to 6 function literals 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.
issue-recovery-actions.issueRecoveryActionService.upsertSourceScopedUnlocked (cognitive 79) server/src/services/issue-recovery-actions.ts:358— issue-recovery-actions.issueRecoveryActionService.upsertSourceScopedUnlocked has cognitive complexity 79 (threshold 15). Drivers by points: ternaries 24 (52 pts), if/else 9 (21 pts), boolean chains 5, error handling 1 (nesting depth added 40). Of this number, 31 points are the body's own statements and 48 belong to 2 function literals inside it that branch. 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.
receipt-reactions.createReceiptReactions.processReceiptReactionWithCredentialLease (cognitive 79) server/src/services/chat-channels/receipt-reactions.ts:193— receipt-reactions.createReceiptReactions.processReceiptReactionWithCredentialLease has cognitive complexity 79 (threshold 15). Drivers by points: if/else 25 (38 pts), ternaries 13 (26 pts), boolean chains 12, error handling 2 (3 pts) (nesting depth added 27). Of this number, 56 points are the body's own statements and 23 belong to 6 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.
native-session-executor.migrateRunnerdStateRootForExecution (cognitive 79) server/src/services/native-runtime/native-session-executor.ts:4897— native-session-executor.migrateRunnerdStateRootForExecution has cognitive complexity 79 (threshold 15). Drivers by points: if/else 25 (59 pts), ternaries 3 (10 pts), boolean chains 9, loops 1 (nesting depth added 41). 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.
SkillSources.SourceDialog (cognitive 79) ui/src/pages/SkillSources.tsx:242— SkillSources.SourceDialog has cognitive complexity 79 (threshold 15). Drivers by points: boolean chains 37, ternaries 19 (31 pts), if/else 10, error handling 1 (nesting depth added 12). Of this number, 58 points are the body's own statements and 21 belong to 10 function literals 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.
update.updateCommand (cognitive 78) cli/src/commands/update.ts:167— update.updateCommand has cognitive complexity 78 (threshold 15). Drivers by points: if/else 27 (45 pts), ternaries 11 (20 pts), boolean chains 7, error handling 4 (6 pts) (nesting depth added 29). Of this number, 75 points are the body's own statements and 3 belong to 2 function literals 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.
copilot-policy.createCopilotProtocolGuard (cognitive 78) packages/paperclip-runner/src/drivers/acpx/copilot-policy.ts:84— copilot-policy.createCopilotProtocolGuard has cognitive complexity 78 (threshold 15). Drivers by points: if/else 27 (53 pts), boolean chains 20, ternaries 2 (4 pts), error handling 1 (nesting depth added 28). None of this is in the body itself: all 78 points belong to 2 function items inside it that branch (a function literal at line 93, modelFrom). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ai-connection-usage.claude (cognitive 78) server/src/services/ai-connection-usage.ts:171— ai-connection-usage.claude has cognitive complexity 78 (threshold 15). Drivers by points: ternaries 25 (47 pts), boolean chains 21, if/else 6 (9 pts), loops 1 (nesting depth added 25). Of this number, 33 points are the body's own statements and 45 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.
chat-github-reviews.githubChatReviewService.execute (cognitive 78) server/src/services/chat-github-reviews.ts:570— chat-github-reviews.githubChatReviewService.execute has cognitive complexity 78 (threshold 15). Drivers by points: if/else 27 (51 pts), boolean chains 14, ternaries 5 (11 pts), loops 1 (2 pts) (nesting depth added 31). Of this number, 69 points are the body's own statements and 9 belong to 4 function literals 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.
git-workspace-contents.restoreGitWorkspaceContents (cognitive 78) server/src/services/git-workspace-contents.ts:203— git-workspace-contents.restoreGitWorkspaceContents has cognitive complexity 78 (threshold 15). Drivers by points: if/else 23 (58 pts), boolean chains 9, ternaries 4 (9 pts), error handling 1, loops 1 (nesting depth added 40). Of this number, 61 points are the body's own statements and 17 belong to 3 function literals 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.
app.PageDetail (cognitive 78) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:3236— app.PageDetail has cognitive complexity 78 (threshold 15). Drivers by points: ternaries 27 (43 pts), if/else 19 (22 pts), boolean chains 12, loops 1 (nesting depth added 19). Of this number, 54 points are the body's own statements and 24 belong to 7 function literals 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.
quota-windows.fetchCompanyQuotaWindows (cognitive 78) server/src/services/quota-windows.ts:18— quota-windows.fetchCompanyQuotaWindows has cognitive complexity 78 (threshold 15). Drivers by points: if/else 14 (35 pts), ternaries 6 (18 pts), boolean chains 16, error handling 3 (8 pts), loops 1 (nesting depth added 38). Most of this is not in the body itself: 1 of the 78 points is its own statement and the rest belongs to 8 function items inside it that branch (a function literal at line 57, a function literal at line 111, readAccount, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SkillImportProgress.SkillImportProgress (cognitive 78) ui/src/pages/skills/SkillImportProgress.tsx:7— SkillImportProgress.SkillImportProgress has cognitive complexity 78 (threshold 15). Drivers by points: ternaries 31 (71 pts), boolean chains 7 (nesting depth added 40). Of this number, 69 points are the body's own statements and 9 belong to 2 function literals inside it that branch. 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.
connection-dialogs.AddConnectionDialog (cognitive 78) ui/src/pages/tools/connection-dialogs.tsx:129— connection-dialogs.AddConnectionDialog has cognitive complexity 78 (threshold 15). Drivers by points: ternaries 32 (66 pts), boolean chains 10, error handling 1, if/else 1 (nesting depth added 34). Of this number, 63 points are the body's own statements and 15 belong to 11 function items inside it that branch. 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.
voice-session-store.voiceSessionStore.runTool (cognitive 77) server/src/services/voice/voice-session-store.ts:321— voice-session-store.voiceSessionStore.runTool has cognitive complexity 77 (threshold 15). Drivers by points: if/else 24 (49 pts), ternaries 7 (17 pts), boolean chains 6, loops 2 (5 pts) (nesting depth added 38). None of this is in the body itself: all 77 points belong to one function literal inside it that branches (line 326). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
runner-goals.applyRunnerGoalPrpEvent (cognitive 77) server/src/services/runner-goals.ts:632— runner-goals.applyRunnerGoalPrpEvent has cognitive complexity 77 (threshold 15). Drivers by points: ternaries 15 (29 pts), boolean chains 24, if/else 19 (24 pts) (nesting depth added 19). Most of this is not in the body itself: 3 of the 77 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 660, 695). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
posthog-live.runSmoke (cognitive 77) scripts/smoke/posthog-live.mjs:530— posthog-live.runSmoke has cognitive complexity 77 (threshold 15). Drivers by points: if/else 38 (41 pts), boolean chains 23, error handling 7 (9 pts), ternaries 3, loops 1 (nesting depth added 5). Of this number, 63 points are the body's own statements and 14 belong to 10 function literals inside it that branch. 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.
ExternallyConnectedTaskBanner.ConnectedTaskComposer (cognitive 77) ui/src/components/chat/ExternallyConnectedTaskBanner.tsx:149— ExternallyConnectedTaskBanner.ConnectedTaskComposer has cognitive complexity 77 (threshold 15). Drivers by points: boolean chains 39, ternaries 9 (14 pts), if/else 12 (13 pts), error handling 5 (8 pts), loops 2 (3 pts) (nesting depth added 10). Of this number, 41 points are the body's own statements and 36 belong to 14 function items inside it that branch. 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.
Search.Search (cognitive 77) ui/src/pages/Search.tsx:133— Search.Search has cognitive complexity 77 (threshold 15). Drivers by points: if/else 31 (33 pts), ternaries 20 (22 pts), boolean chains 21, loops 1 (nesting depth added 4). Of this number, 24 points are the body's own statements and 53 belong to 23 function items inside it that branch. 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.
AiConnectionPoolConnector.PoolConnector (cognitive 77) ui/src/components/ai-connections/AiConnectionPoolConnector.tsx:42— AiConnectionPoolConnector.PoolConnector has cognitive complexity 77 (threshold 15). Drivers by points: boolean chains 30, ternaries 21 (30 pts), if/else 13 (15 pts), error handling 2 (nesting depth added 11). Of this number, 42 points are the body's own statements and 35 belong to 19 function items inside it that branch. 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.
RemoteMcpConnectionReview.RemoteMcpConnectionReview (cognitive 77) ui/storybook/prototypes/RemoteMcpConnectionReview.tsx:14— RemoteMcpConnectionReview.RemoteMcpConnectionReview has cognitive complexity 77 (threshold 15). Drivers by points: ternaries 19 (33 pts), boolean chains 22, if/else 15 (20 pts), error handling 1, loops 1 (nesting depth added 19). Most of this is not in the body itself: 9 of the 77 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 54, a function literal at line 95, a function literal at line 37, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
tool-gateway.createToolGatewayService.resolveCredentialHeadersUnrecorded (cognitive 76) server/src/services/tool-gateway.ts:4133— tool-gateway.createToolGatewayService.resolveCredentialHeadersUnrecorded has cognitive complexity 76 (threshold 15). Drivers by points: ternaries 9 (30 pts), if/else 13 (28 pts), boolean chains 9, error handling 4 (8 pts), loops 1 (nesting depth added 40). 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.
grok-public-install-sandbox.runMacInitialInstallWithDiagnostics (cognitive 76) scripts/grok-public-install-sandbox.mjs:14— grok-public-install-sandbox.runMacInitialInstallWithDiagnostics has cognitive complexity 76 (threshold 15). Drivers by points: if/else 12 (54 pts), loops 3 (10 pts), error handling 3 (5 pts), ternaries 2 (5 pts), boolean chains 2 (nesting depth added 54). Of this number, 74 points are the body's own statements and 2 belong 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.
provider-billing-import.fetchProviderDailyCosts (cognitive 76) server/src/services/provider-billing-import.ts:80— provider-billing-import.fetchProviderDailyCosts has cognitive complexity 76 (threshold 15). Drivers by points: if/else 11 (33 pts), ternaries 13 (30 pts), loops 5 (9 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.
CompanyAccess.CompanyAccess (cognitive 76) ui/src/pages/CompanyAccess.tsx:41— CompanyAccess.CompanyAccess has cognitive complexity 76 (threshold 15). Drivers by points: ternaries 26 (41 pts), boolean chains 24, if/else 11 (nesting depth added 15). Of this number, 33 points are the body's own statements and 43 belong to 17 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.
tool-access-policy.toolAccessPolicyService.decideInternal (cognitive 75) server/src/services/tool-access-policy.ts:1405— tool-access-policy.toolAccessPolicyService.decideInternal has cognitive complexity 75 (threshold 15). Drivers by points: if/else 23 (56 pts), boolean chains 13, loops 4, ternaries 2 (nesting depth added 33). Of this number, 71 points are the body's own statements and 4 belong to 3 function literals 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.
agent-file-checkpoint.captureAgentFiles::walk (cognitive 75) server/src/services/scripts/agent-file-checkpoint.mjs:49— agent-file-checkpoint.captureAgentFiles::walk has cognitive complexity 75 (threshold 15). Drivers by points: if/else 14 (49 pts), loops 4 (14 pts), boolean chains 7, ternaries 2 (5 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
queue.createHeartbeatQueue.dispatchPendingNativeStatusWakeups (cognitive 75) server/src/services/heartbeat/queue.ts:4629— queue.createHeartbeatQueue.dispatchPendingNativeStatusWakeups has cognitive complexity 75 (threshold 15). Drivers by points: ternaries 16 (43 pts), if/else 10 (21 pts), boolean chains 8, error handling 1 (2 pts), loops 1 (nesting depth added 39). 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.
auth.actorMiddleware::authenticate (cognitive 75) server/src/middleware/auth.ts:243— auth.actorMiddleware::authenticate has cognitive complexity 75 (threshold 15). Drivers by points: if/else 27 (46 pts), boolean chains 12, ternaries 4 (11 pts), error handling 2 (6 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.
TaskChatProtocolCard.RuntimeRequestCard (cognitive 75) ui/src/components/task-chat/TaskChatProtocolCard.tsx:686— TaskChatProtocolCard.RuntimeRequestCard has cognitive complexity 75 (threshold 15). Drivers by points: ternaries 15 (37 pts), boolean chains 19, if/else 10 (18 pts), error handling 1 (nesting depth added 30). Of this number, 45 points are the body's own statements and 30 belong to 10 function items inside it that branch. 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.
issue-chat-messages.buildAssistantPartsFromTranscript (cognitive 75) ui/src/lib/issue-chat-messages.ts:900— issue-chat-messages.buildAssistantPartsFromTranscript has cognitive complexity 75 (threshold 15). Drivers by points: if/else 22 (47 pts), ternaries 4 (13 pts), boolean chains 9, loops 3 (6 pts) (nesting depth added 37). Of this number, 74 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.
IssueDocumentAnnotations.IssueDocumentAnnotations (cognitive 75) ui/src/components/IssueDocumentAnnotations.tsx:60— IssueDocumentAnnotations.IssueDocumentAnnotations has cognitive complexity 75 (threshold 15). Drivers by points: if/else 25 (28 pts), ternaries 17 (26 pts), boolean chains 21 (nesting depth added 12). Of this number, 41 points are the body's own statements and 34 belong to 14 function literals inside it that branch. 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.
CompanyImport.CompanyImport::buildFinalAdapterOverrides (cognitive 75) ui/src/pages/CompanyImport.tsx:1733— CompanyImport.CompanyImport::buildFinalAdapterOverrides has cognitive complexity 75 (threshold 15). Drivers by points: if/else 15 (49 pts), boolean chains 14, loops 2 (6 pts), ternaries 3 (6 pts) (nesting depth added 41). 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. This shape REPEATS in the file: one other method here (CompanyImport.CompanyImport) 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.
live-workflow-executor.executeLiveRunnerWorkflow (cognitive 74) packages/paperclip-runner/src/eval/live-workflow-executor.ts:765— live-workflow-executor.executeLiveRunnerWorkflow has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 29 (35 pts), boolean chains 18, if/else 11 (17 pts), error handling 3 (4 pts) (nesting depth added 13). Of this number, 69 points are the body's own statements and 5 belong to 4 function items inside it that branch. 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.
execution-continuation.buildExecutionContinuation (cognitive 74) server/src/services/execution-continuation.ts:145— execution-continuation.buildExecutionContinuation has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 23 (37 pts), boolean chains 30, if/else 6 (7 pts) (nesting depth added 15). Of this number, 50 points are the body's own statements and 24 belong to 9 function literals 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.
postgres.changeLockedAgent (cognitive 74) server/src/modules/agent-lifecycle/adapters/postgres.ts:17— postgres.changeLockedAgent has cognitive complexity 74 (threshold 15). Drivers by points: if/else 24 (32 pts), ternaries 11 (21 pts), boolean chains 19, 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.
failed-run-retry.createChatFailedRunRetry.failedChatRetrySource (cognitive 74) server/src/services/chat-channels/failed-run-retry.ts:643— failed-run-retry.createChatFailedRunRetry.failedChatRetrySource has cognitive complexity 74 (threshold 15). Drivers by points: if/else 24 (35 pts), boolean chains 29, ternaries 6 (7 pts), loops 2 (3 pts) (nesting depth added 13). Of this number, 73 points are the body's own statements and 1 belongs to 3 function literals 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.
worker.createChatPublicationWorker.processSelectedPublication (cognitive 74) server/src/services/chat-channels/publications/worker.ts:351— worker.createChatPublicationWorker.processSelectedPublication has cognitive complexity 74 (threshold 15). Drivers by points: if/else 37 (47 pts), boolean chains 12, ternaries 5 (8 pts), error handling 5 (6 pts), loops 1 (nesting depth added 14). Most of this is not in the body itself: 8 of the 74 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 416, 857, 667, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
FileTree.FileTree (cognitive 74) ui/src/components/FileTree.tsx:270— FileTree.FileTree has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 23 (33 pts), if/else 15 (21 pts), boolean chains 19, match/switch 1 (nesting depth added 16). Most of this is not in the body itself: 5 of the 74 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 415, handleRowKeyDown, toggleNode, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
PluginManager.PluginManager (cognitive 74) ui/src/pages/PluginManager.tsx:88— PluginManager.PluginManager has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 20 (54 pts), boolean chains 12, if/else 7 (8 pts) (nesting depth added 35). Most of this is not in the body itself: 15 of the 74 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 273, 373, 457, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CompanySkills.production.DiscoveryGrid (cognitive 74) ui/src/pages/CompanySkills.production.tsx:1022— CompanySkills.production.DiscoveryGrid has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 25 (52 pts), boolean chains 17, if/else 3 (4 pts), loops 1 (nesting depth added 28). Of this number, 62 points are the body's own statements and 12 belong to 6 function literals 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.
execute.execute (cognitive 73) packages/adapters/opencode-local/src/server/execute.ts:227— execute.execute has cognitive complexity 73 (threshold 15). Drivers by points: ternaries 35 (47 pts), boolean chains 46, if/else 32 (36 pts), error handling 1 (2 pts) (nesting depth added 17). 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. This shape REPEATS in the file: one other method here (execute.execute::toResult) 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.
installation-integrity.verifyQualifiedAcpxInstallation (cognitive 73) packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts:650— installation-integrity.verifyQualifiedAcpxInstallation has cognitive complexity 73 (threshold 15). Drivers by points: if/else 28 (44 pts), boolean chains 12, ternaries 5 (7 pts), error handling 3 (5 pts), loops 3 (5 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.
chat-question-forms.buildChatQuestionFormModal (cognitive 73) server/src/services/chat-question-forms.ts:538— chat-question-forms.buildChatQuestionFormModal has cognitive complexity 73 (threshold 15). Drivers by points: ternaries 11 (29 pts), if/else 14 (25 pts), boolean chains 14, loops 4 (5 pts) (nesting depth added 30). Of this number, 64 points are the body's own statements and 9 belong to 3 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.
connection-intents.connectionIntentService.complete (cognitive 73) server/src/services/connection-intents.ts:966— connection-intents.connectionIntentService.complete has cognitive complexity 73 (threshold 15). Drivers by points: if/else 34 (53 pts), boolean chains 18, ternaries 2 (nesting depth added 19). Most of this is not in the body itself: 5 of the 73 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 988, 1092, 1115, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-session-executor.readRemoteProviderPackIdentity (cognitive 73) server/src/services/native-runtime/native-session-executor.ts:10406— native-session-executor.readRemoteProviderPackIdentity has cognitive complexity 73 (threshold 15). Drivers by points: if/else 14 (32 pts), ternaries 6 (22 pts), boolean chains 14, loops 3 (4 pts), error handling 1 (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.
company-portability.buildLegacyRoutineTriggerFromRecurrence (cognitive 73) server/src/services/company-portability.ts:1642— company-portability.buildLegacyRoutineTriggerFromRecurrence has cognitive complexity 73 (threshold 15). Drivers by points: if/else 24 (36 pts), ternaries 12 (22 pts), boolean chains 15 (nesting depth added 22). Of this number, 69 points are the body's own statements and 4 belong to 4 function literals 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.
board-chat.boardChatRoutes (cognitive 73) REDACTED:67— board-chat.boardChatRoutes has cognitive complexity 73 (threshold 15). Drivers by points: if/else 28 (38 pts), boolean chains 13, ternaries 7 (12 pts), error handling 3 (5 pts), loops 2 (5 pts) (nesting depth added 20). None of this is in the body itself: all 73 points belong to 11 function items inside it that branch (a function literal at line 315, a function literal at line 99, a function literal at line 294, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
IssueThreadInteractionCard.RequestItemVerdictsCard (cognitive 73) ui/src/components/IssueThreadInteractionCard.tsx:3248— IssueThreadInteractionCard.RequestItemVerdictsCard has cognitive complexity 73 (threshold 15). Drivers by points: ternaries 29 (49 pts), boolean chains 14, if/else 6 (7 pts), loops 2, error handling 1 (nesting depth added 21). Of this number, 36 points are the body's own statements and 37 belong to 9 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.
AgentSkillsTab.AgentSkillsTab (cognitive 73) ui/src/pages/agent-skills/AgentSkillsTab.tsx:61— AgentSkillsTab.AgentSkillsTab has cognitive complexity 73 (threshold 15). Drivers by points: ternaries 21 (46 pts), boolean chains 14, if/else 12, match/switch 1 (nesting depth added 25). Of this number, 45 points are the body's own statements and 28 belong to 11 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.
CompanySkills.SkillDetailPage (cognitive 73) ui/src/pages/CompanySkills.tsx:2755— CompanySkills.SkillDetailPage has cognitive complexity 73 (threshold 15). Drivers by points: ternaries 67 (117 pts), boolean chains 22, if/else 4 (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (CompanySkills.SkillDetailPage::renderFilesBody) 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.
CompanySkills.production.SkillDetailPage (cognitive 73) ui/src/pages/CompanySkills.production.tsx:2845— CompanySkills.production.SkillDetailPage has cognitive complexity 73 (threshold 15). Drivers by points: ternaries 66 (116 pts), boolean chains 22, if/else 4 (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (CompanySkills.production.SkillDetailPage::renderFilesBody) 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.
AuditTab.ActivityRow (cognitive 73) ui/src/pages/tools/AuditTab.tsx:159— AuditTab.ActivityRow has cognitive complexity 73 (threshold 15). Drivers by points: ternaries 29 (71 pts), boolean chains 2 (nesting depth added 42). Of this number, 69 points are the body's own statements and 4 belong to one function literal 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.
execute.execute (cognitive 72) packages/adapters/hermes/src/server/execute.ts:345— execute.execute has cognitive complexity 72 (threshold 15). Drivers by points: if/else 31 (34 pts), boolean chains 21, ternaries 6 (10 pts), error handling 4 (7 pts) (nesting depth added 10). Of this number, 68 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
descriptors.classifyRisk (cognitive 72) REDACTED:105— descriptors.classifyRisk has cognitive complexity 72 (threshold 15). Drivers by points: if/else 31 (44 pts), boolean chains 16, ternaries 6 (12 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.
native-run-finalizer.recordRetryableFailure (cognitive 72) server/src/services/native-runtime/native-run-finalizer.ts:240— native-run-finalizer.recordRetryableFailure has cognitive complexity 72 (threshold 15). Drivers by points: ternaries 26 (43 pts), boolean chains 15, if/else 13 (14 pts) (nesting depth added 18). Most of this is not in the body itself: 4 of the 72 points are its own statements and the rest belongs to one function literal inside it that branches (line 263). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
queue.createHeartbeatQueue.claimQueuedRun (cognitive 72) server/src/services/heartbeat/queue.ts:944— queue.createHeartbeatQueue.claimQueuedRun has cognitive complexity 72 (threshold 15). Drivers by points: if/else 54 (94 pts), ternaries 18 (29 pts), boolean chains 27 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (queue.createHeartbeatQueue.claimQueuedRun::lockIssueExecutionClaim) 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.
task-context.prepareHeartbeatTaskContext (cognitive 72) server/src/services/heartbeat/task-context.ts:53— task-context.prepareHeartbeatTaskContext has cognitive complexity 72 (threshold 15). Drivers by points: if/else 31 (37 pts), ternaries 18 (20 pts), boolean chains 15 (nesting depth added 8). Of this number, 68 points are the body's own statements and 4 belong to 2 function items inside it that branch. 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.
prepare-bundled-package.stageBundledEsbuildOptionalDependencies (cognitive 72) scripts/prepare-bundled-package.mjs:215— prepare-bundled-package.stageBundledEsbuildOptionalDependencies has cognitive complexity 72 (threshold 15). Drivers by points: if/else 17 (46 pts), loops 7 (17 pts), boolean chains 9 (nesting depth added 39). Of this number, 68 points are the body's own statements and 4 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.
config-fields.CodexLocalConfigFields (cognitive 72) ui/src/adapters/codex-local/config-fields.tsx:70— config-fields.CodexLocalConfigFields has cognitive complexity 72 (threshold 15). Drivers by points: boolean chains 38, ternaries 21 (32 pts), if/else 2 (nesting depth added 11). Of this number, 69 points are the body's own statements and 3 belong to 16 function items inside it that branch. 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.
AgentConfigForm.DisplayedCodeLoginPanel (cognitive 72) ui/src/components/AgentConfigForm.tsx:2564— AgentConfigForm.DisplayedCodeLoginPanel has cognitive complexity 72 (threshold 15). Drivers by points: boolean chains 28, if/else 21 (22 pts), ternaries 9 (20 pts), error handling 2 (nesting depth added 12). Of this number, 30 points are the body's own statements and 42 belong to 15 function literals 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.
RemoteMcpProductionSetup.RemoteMcpProductionSetup::submit (cognitive 72) ui/src/features/connections/remote-mcp/RemoteMcpProductionSetup.tsx:128— RemoteMcpProductionSetup.RemoteMcpProductionSetup::submit has cognitive complexity 72 (threshold 15). Drivers by points: if/else 20 (29 pts), ternaries 11 (16 pts), boolean chains 15, error handling 6 (10 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. This shape REPEATS in the file: one other method here (RemoteMcpProductionSetup.RemoteMcpProductionSetup) 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.
execute.execute (cognitive 71) packages/adapters/kimi-local/src/server/execute.ts:189— execute.execute has cognitive complexity 71 (threshold 15). Drivers by points: ternaries 31 (47 pts), if/else 35 (39 pts), boolean chains 37, error handling 2 (4 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. This shape REPEATS in the file: one other method here (execute.execute::toResult) 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.
DurablePrpControlPlane.#event (cognitive 71) REDACTED:3112— DurablePrpControlPlane.#event has cognitive complexity 71 (threshold 15). Drivers by points: if/else 24 (35 pts), ternaries 6 (18 pts), boolean chains 14, error handling 2 (4 pts) (nesting depth added 25). Of this number, 45 points are the body's own statements and 26 belong to 3 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.
OpenCodeHarnessSession.#pumpEvents (cognitive 71) REDACTED:1350— OpenCodeHarnessSession.#pumpEvents has cognitive complexity 71 (threshold 15). Drivers by points: if/else 14 (44 pts), ternaries 3 (12 pts), boolean chains 7, error handling 2 (5 pts), loops 2 (3 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.
runnerd-codex-transport.probeNativeRunnerEnvironment (cognitive 71) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:7222— runnerd-codex-transport.probeNativeRunnerEnvironment has cognitive complexity 71 (threshold 15). Drivers by points: if/else 23 (31 pts), ternaries 11 (16 pts), boolean chains 14, error handling 6 (9 pts), loops 1 (nesting depth added 16). Of this number, 39 points are the body's own statements and 32 belong to 3 function literals 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.
runner-api-catalog.dedicatedTools (cognitive 71) server/src/services/native-runtime/runner-api-catalog.ts:43— runner-api-catalog.dedicatedTools has cognitive complexity 71 (threshold 15). Drivers by points: ternaries 15 (36 pts), if/else 22, boolean chains 13 (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.
run-preparation.resolveExecutionRunAdapterConfig (cognitive 71) server/src/services/heartbeat/run-preparation.ts:301— run-preparation.resolveExecutionRunAdapterConfig has cognitive complexity 71 (threshold 15). Drivers by points: if/else 17 (28 pts), ternaries 13 (23 pts), boolean chains 12, loops 4 (8 pts) (nesting depth added 25). Of this number, 66 points are the body's own statements and 5 belong to 2 function literals 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.
error-handler.errorHandler (cognitive 71) server/src/middleware/error-handler.ts:138— error-handler.errorHandler has cognitive complexity 71 (threshold 15). Drivers by points: ternaries 18 (43 pts), boolean chains 15, if/else 10 (13 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
plugin-ui-static.pluginUiStaticRoutes (cognitive 71) REDACTED:210— plugin-ui-static.pluginUiStaticRoutes has cognitive complexity 71 (threshold 15). Drivers by points: if/else 25 (39 pts), ternaries 6 (12 pts), boolean chains 10, error handling 6 (10 pts) (nesting depth added 24). None of this is in the body itself: all 71 points belong to 2 function literals inside it that branch (lines 230, 495). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
IssueShareSheet.IssueShareSheet (cognitive 71) ui/src/components/IssueShareSheet.tsx:160— IssueShareSheet.IssueShareSheet has cognitive complexity 71 (threshold 15). Drivers by points: ternaries 16 (53 pts), boolean chains 9, if/else 9 (nesting depth added 37). Of this number, 22 points are the body's own statements and 49 belong to 11 function items inside it that branch. 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.
OriginatingTasks.TaskPageData (cognitive 71) ui/storybook/prototypes/originating-tasks/OriginatingTasks.tsx:139— OriginatingTasks.TaskPageData has cognitive complexity 71 (threshold 15). Drivers by points: if/else 16 (29 pts), ternaries 14 (29 pts), boolean chains 10, loops 2 (3 pts) (nesting depth added 29). None of this is in the body itself: all 71 points belong to 8 function literals inside it that branch (lines 175, 141, 215, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
execute.execute (cognitive 70) packages/adapters/gemini-local/src/server/execute.ts:210— execute.execute has cognitive complexity 70 (threshold 15). Drivers by points: ternaries 31 (50 pts), if/else 33 (37 pts), boolean chains 35, error handling 2 (4 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. This shape REPEATS in the file: one other method here (execute.execute::toResult) 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.
envelope.createInboundEnvelope.prepareInboundEnvelope (cognitive 70) server/src/services/chat-channels/inbound/envelope.ts:86— envelope.createInboundEnvelope.prepareInboundEnvelope has cognitive complexity 70 (threshold 15). Drivers by points: ternaries 33 (50 pts), boolean chains 13, if/else 4 (7 pts) (nesting depth added 20). Of this number, 60 points are the body's own statements and 10 belong to 2 function literals 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.
chat-channels.chatChannelService.runtimeFor (cognitive 70) server/src/services/chat-channels.ts:893— chat-channels.chatChannelService.runtimeFor has cognitive complexity 70 (threshold 15). Drivers by points: if/else 17 (43 pts), boolean chains 19, error handling 2 (5 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 30). Of this number, 38 points are the body's own statements and 32 belong to one function literal 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.
PaperclipRunnerToolAuthority.#reassignTask (cognitive 70) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:1637— PaperclipRunnerToolAuthority.#reassignTask has cognitive complexity 70 (threshold 15). Drivers by points: if/else 31 (34 pts), boolean chains 18, ternaries 11 (14 pts), error handling 2 (3 pts), loops 1 (nesting depth added 7). Of this number, 20 points are the body's own statements and 50 belong to 7 function items inside it that branch. 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.
trace.buildTrace (cognitive 70) scripts/ci-profile/trace.mjs:8— trace.buildTrace has cognitive complexity 70 (threshold 15). Drivers by points: if/else 21 (28 pts), boolean chains 22, ternaries 9 (15 pts), loops 4 (5 pts) (nesting depth added 14). Of this number, 60 points are the body's own statements and 10 belong to 5 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.
events.createPublicMcpEvents.enqueue (cognitive 70) server/src/services/public-mcp/events.ts:223— events.createPublicMcpEvents.enqueue has cognitive complexity 70 (threshold 15). Drivers by points: ternaries 14 (37 pts), if/else 10 (16 pts), boolean chains 12, loops 3 (5 pts) (nesting depth added 31). Of this number, 63 points are the body's own statements and 7 belong to one function literal 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.
NewIssueDialog.NewIssueDialog (cognitive 70) ui/src/components/NewIssueDialog.tsx:279— NewIssueDialog.NewIssueDialog has cognitive complexity 70 (threshold 15). Drivers by points: ternaries 77 (105 pts), boolean chains 65, if/else 54 (63 pts), error handling 1 (2 pts), loops 2 (nesting depth added 38). 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. This shape REPEATS in the file: one other method here (NewIssueDialog.NewIssueDialog::handleSubmit) 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.
RemoteMcpConnectionSetup.RemoteMcpConnectionSetup (cognitive 70) ui/src/features/connections/remote-mcp/RemoteMcpConnectionSetup.tsx:40— RemoteMcpConnectionSetup.RemoteMcpConnectionSetup has cognitive complexity 70 (threshold 15). Drivers by points: ternaries 21 (43 pts), boolean chains 25, if/else 2 (nesting depth added 22). Of this number, 62 points are the body's own statements and 8 belong to 9 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.
AgentDetail.production.RunDetail (cognitive 70) ui/src/pages/AgentDetail.production.tsx:3249— AgentDetail.production.RunDetail has cognitive complexity 70 (threshold 15). Drivers by points: boolean chains 51, if/else 15, ternaries 4. Of this number, 49 points are the body's own statements and 21 belong to 10 function literals inside it that branch. 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.
runner-provider-launch.createRunnerProviderLaunch (cognitive 69) packages/paperclip-runner/src/live/runner-provider-launch.ts:170— runner-provider-launch.createRunnerProviderLaunch has cognitive complexity 69 (threshold 15). Drivers by points: ternaries 19 (55 pts), if/else 6 (10 pts), boolean chains 4 (nesting depth added 40). 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.
eval-session.runEvalSessionCli (cognitive 69) packages/paperclip-runner/src/cli/eval-session.ts:369— eval-session.runEvalSessionCli has cognitive complexity 69 (threshold 15). Drivers by points: ternaries 29 (42 pts), if/else 8 (14 pts), error handling 4 (9 pts), boolean chains 4 (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.
session-stop.createSlackSessionStop.processSlackSessionStop (cognitive 69) server/src/services/chat-channels/slack/session-stop.ts:317— session-stop.createSlackSessionStop.processSlackSessionStop has cognitive complexity 69 (threshold 15). Drivers by points: if/else 20 (24 pts), ternaries 20 (24 pts), boolean chains 20, error handling 1 (nesting depth added 8). Of this number, 20 points are the body's own statements and 49 belong to 4 function literals inside it that branch. 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.
execution-projection.projectExecution (cognitive 69) server/src/services/execution-projection.ts:213— execution-projection.projectExecution has cognitive complexity 69 (threshold 15). Drivers by points: if/else 18 (25 pts), ternaries 9 (21 pts), boolean chains 20, error handling 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.
runtime-mode.resolveHeartbeatNativeRuntimeMode (cognitive 69) server/src/services/native-runtime/runtime-mode.ts:282— runtime-mode.resolveHeartbeatNativeRuntimeMode has cognitive complexity 69 (threshold 15). Drivers by points: ternaries 9 (55 pts), if/else 5 (12 pts), boolean chains 2 (nesting depth added 53). 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.
notion-generic-live.runSmoke (cognitive 69) scripts/smoke/notion-generic-live.mjs:545— notion-generic-live.runSmoke has cognitive complexity 69 (threshold 15). Drivers by points: if/else 35 (37 pts), boolean chains 25, error handling 3 (4 pts), ternaries 2, loops 1 (nesting depth added 3). Of this number, 54 points are the body's own statements and 15 belong to 12 function literals inside it that branch. 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.
WhatNeedsMe.WhatNeedsMe (cognitive 69) ui/src/pages/WhatNeedsMe.tsx:87— WhatNeedsMe.WhatNeedsMe has cognitive complexity 69 (threshold 15). Drivers by points: ternaries 16 (25 pts), boolean chains 23, if/else 20, loops 1 (nesting depth added 9). Of this number, 16 points are the body's own statements and 53 belong to 26 function items inside it that branch. 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.
execution-target.startAdapterExecutionTargetPaperclipBridge (cognitive 68) REDACTED:4328— execution-target.startAdapterExecutionTargetPaperclipBridge has cognitive complexity 68 (threshold 15). Drivers by points: if/else 14 (28 pts), ternaries 9 (19 pts), boolean chains 13, error handling 3 (8 pts) (nesting depth added 29). Of this number, 51 points are the body's own statements and 17 belong to 2 function items inside it that branch. 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.
execute.execute (cognitive 68) packages/adapters/cursor-local/src/server/execute.ts:194— execute.execute has cognitive complexity 68 (threshold 15). Drivers by points: if/else 39 (43 pts), ternaries 28 (39 pts), boolean chains 35, error handling 2 (4 pts), loops 1 (nesting depth added 17). 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. This shape REPEATS in the file: one other method here (execute.execute::toResult) 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.
runnerd-codex-transport.bridgedCodexQuestionParams (cognitive 68) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:1014— runnerd-codex-transport.bridgedCodexQuestionParams has cognitive complexity 68 (threshold 15). Drivers by points: ternaries 24 (60 pts), if/else 4 (5 pts), boolean chains 3 (nesting depth added 37). Most of this is not in the body itself: 15 of the 68 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1044, 1053). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
runner-protocol-eval-campaign.aggregateProtocolEvalCampaign (cognitive 68) packages/paperclip-runner/scripts/runner-protocol-eval-campaign.mjs:392— runner-protocol-eval-campaign.aggregateProtocolEvalCampaign has cognitive complexity 68 (threshold 15). Drivers by points: if/else 16 (42 pts), boolean chains 11, ternaries 5 (8 pts), loops 4 (7 pts) (nesting depth added 32). Of this number, 61 points are the body's own statements and 7 belong to 4 function literals 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.
index.vercelClient.invoke (cognitive 68) server/src/services/connectors/vercel/index.ts:119— index.vercelClient.invoke has cognitive complexity 68 (threshold 15). Drivers by points: if/else 19 (39 pts), ternaries 6 (12 pts), boolean chains 11, loops 2 (5 pts), match/switch 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.
chat-github-receipt-reactions.applyGitHubReceiptReaction (cognitive 68) server/src/services/chat-github-receipt-reactions.ts:66— chat-github-receipt-reactions.applyGitHubReceiptReaction has cognitive complexity 68 (threshold 15). Drivers by points: if/else 27 (49 pts), boolean chains 20, ternaries 7 (10 pts), loops 4 (7 pts), error handling 3 (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. This shape REPEATS in the file: one other method here (chat-github-receipt-reactions.applyGitHubReceiptReaction::request) 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.
chat-github-checks.githubReviewCheckService.dispatch (cognitive 68) server/src/services/chat-github-checks.ts:64— chat-github-checks.githubReviewCheckService.dispatch has cognitive complexity 68 (threshold 15). Drivers by points: ternaries 21 (42 pts), if/else 10 (13 pts), boolean chains 12, error handling 1 (nesting depth added 24). Most of this is not in the body itself: 2 of the 68 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 86, 324, 355, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
isolated-repository-rehome.sweepOrphanedIsolatedRepositorySources (cognitive 68) server/src/services/isolated-repository-rehome.ts:719— isolated-repository-rehome.sweepOrphanedIsolatedRepositorySources has cognitive complexity 68 (threshold 15). Drivers by points: if/else 15 (47 pts), boolean chains 9, loops 3 (6 pts), error handling 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 39). Of this number, 27 points are the body's own statements and 41 belong to 3 function literals 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.
workspace-runtime.realizeExecutionWorkspace (cognitive 68) server/src/services/workspace-runtime.ts:3323— workspace-runtime.realizeExecutionWorkspace has cognitive complexity 68 (threshold 15). Drivers by points: if/else 22 (35 pts), ternaries 11 (19 pts), boolean chains 9, error handling 3 (5 pts) (nesting depth added 23). Of this number, 57 points are the body's own statements and 11 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.
stopped-codex-turn.stoppedCodexTurnIsTextOnly (cognitive 68) server/src/services/native-runtime/stopped-codex-turn.ts:62— stopped-codex-turn.stoppedCodexTurnIsTextOnly has cognitive complexity 68 (threshold 15). Drivers by points: if/else 15 (46 pts), boolean chains 11, match/switch 2 (5 pts), error handling 1 (4 pts), loops 1, ternaries 1 (nesting depth added 37). Of this number, 66 points are the body's own statements and 2 belong to one function literal 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.
ai-connection-router.aiConnectionRouterService.resolve (cognitive 68) server/src/services/ai-connection-router.ts:205— ai-connection-router.aiConnectionRouterService.resolve has cognitive complexity 68 (threshold 15). Drivers by points: if/else 20 (42 pts), boolean chains 9, ternaries 3 (8 pts), loops 3 (6 pts), error handling 1 (3 pts) (nesting depth added 32). Of this number, 59 points are the body's own statements and 9 belong to one function literal 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.
approvals.approvalRoutes (cognitive 68) server/src/routes/approvals.ts:44— approvals.approvalRoutes has cognitive complexity 68 (threshold 15). Drivers by points: if/else 29 (32 pts), ternaries 11 (20 pts), boolean chains 9, error handling 3 (6 pts), loops 1 (nesting depth added 15). None of this is in the body itself: all 68 points belong to 15 function items inside it that branch (a function literal at line 296, queueAdditionalApprovalReviewPathWakes, a function literal at line 232, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
app.createApp (cognitive 68) REDACTED:504— app.createApp has cognitive complexity 68 (threshold 15). Drivers by points: if/else 23 (32 pts), ternaries 12 (17 pts), boolean chains 13, error handling 3 (5 pts), loops 1 (nesting depth added 16). Of this number, 39 points are the body's own statements and 29 belong to 20 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.
workspace-access-state.resolveWorkspaceAccessState (cognitive 68) ui/src/lib/workspace-access-state.ts:134— workspace-access-state.resolveWorkspaceAccessState has cognitive complexity 68 (threshold 15). Drivers by points: ternaries 14 (33 pts), boolean chains 21, if/else 11 (14 pts) (nesting depth added 22). Of this number, 65 points are the body's own statements and 3 belong to 3 function literals 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.
qualify-cursor-denial.runDenial (cognitive 67) packages/paperclip-runner/scripts/qualify-cursor-denial.mjs:63— qualify-cursor-denial.runDenial has cognitive complexity 67 (threshold 15). Drivers by points: if/else 21 (37 pts), boolean chains 9, ternaries 3 (8 pts), loops 5 (7 pts), error handling 5 (6 pts) (nesting depth added 24). Of this number, 16 points are the body's own statements and 51 belong to 8 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.
native-workspace-finalization-ownership.withNativeWorkspaceFinalizationOwnership (cognitive 67) server/src/services/native-runtime/native-workspace-finalization-ownership.ts:65— native-workspace-finalization-ownership.withNativeWorkspaceFinalizationOwnership has cognitive complexity 67 (threshold 15). Drivers by points: if/else 25 (41 pts), boolean chains 11, ternaries 8 (11 pts), error handling 3 (4 pts) (nesting depth added 20). Most of this is not in the body itself: 5 of the 67 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 85, 94, 127, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-session-executor.createRunnerdBackendWithinSessionClaim.ensureRemoteRunner (cognitive 67) server/src/services/native-runtime/native-session-executor.ts:12704— native-session-executor.createRunnerdBackendWithinSessionClaim.ensureRemoteRunner has cognitive complexity 67 (threshold 15). Drivers by points: if/else 19 (39 pts), ternaries 4 (14 pts), boolean chains 10, loops 1 (3 pts), error handling 1 (nesting depth added 32). None of this is in the body itself: all 67 points belong to 4 function literals inside it that branch (lines 12732, 12708, 12818, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
live-events-ws.setupLiveEventsWebSocketServer (cognitive 67) server/src/realtime/live-events-ws.ts:242— live-events-ws.setupLiveEventsWebSocketServer has cognitive complexity 67 (threshold 15). Drivers by points: if/else 32 (39 pts), ternaries 8 (14 pts), boolean chains 11, error handling 1 (2 pts), loops 1 (nesting depth added 14). None of this is in the body itself: all 67 points belong to 8 function literals inside it that branch (lines 279, 260, 399, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TriggerWizard.RoutineTriggerWizard (cognitive 67) ui/src/components/routine-triggers/TriggerWizard.tsx:104— TriggerWizard.RoutineTriggerWizard has cognitive complexity 67 (threshold 15). Drivers by points: ternaries 16 (38 pts), boolean chains 25, if/else 3, error handling 1 (nesting depth added 22). Of this number, 57 points are the body's own statements and 10 belong to 6 function literals inside it that branch. 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.
env.collectDeploymentEnvRows (cognitive 66) cli/src/commands/env.ts:112— env.collectDeploymentEnvRows has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 41 (60 pts), boolean chains 2, error handling 1 (2 pts), if/else 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.
parse.createGeminiJsonlParser (cognitive 66) packages/adapters/gemini-local/src/server/parse.ts:81— parse.createGeminiJsonlParser has cognitive complexity 66 (threshold 15). Drivers by points: if/else 21 (52 pts), boolean chains 7, loops 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 35). None of this is in the body itself: all 66 points belong to 3 function items inside it that branch (a function literal at line 106, recordAccounting, a function literal at line 97). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
provider-profile.resolvePaperclipRunnerNativeProviderInput (cognitive 66) server/src/services/native-runtime/provider-profile.ts:591— provider-profile.resolvePaperclipRunnerNativeProviderInput has cognitive complexity 66 (threshold 15). Drivers by points: if/else 26 (39 pts), boolean chains 17, ternaries 6 (10 pts) (nesting depth added 17). Of this number, 64 points are the body's own statements and 2 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.
remote-mcp-pending.extractRemoteMcpPending (cognitive 66) server/src/services/remote-mcp-pending.ts:10— remote-mcp-pending.extractRemoteMcpPending has cognitive complexity 66 (threshold 15). Drivers by points: if/else 20 (41 pts), boolean chains 13, loops 3 (6 pts), error handling 1 (3 pts), ternaries 2 (3 pts) (nesting depth added 27). Of this number, 47 points are the body's own statements and 19 belong to 3 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.
failures.createChatPublicationFailures.finalizePublicationFailure (cognitive 66) server/src/services/chat-channels/publications/failures.ts:52— failures.createChatPublicationFailures.finalizePublicationFailure has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 18 (42 pts), boolean chains 13, if/else 9 (11 pts) (nesting depth added 26). Of this number, 21 points are the body's own statements and 45 belong to one function literal 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.
health.createConnectionHealth.checkConnectionHealth (cognitive 66) server/src/services/tool-access/catalog/health.ts:75— health.createConnectionHealth.checkConnectionHealth has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 14 (45 pts), if/else 9 (11 pts), boolean chains 7, loops 1 (2 pts), error handling 1 (nesting depth added 34). Of this number, 65 points are the body's own statements and 1 belongs to one function literal 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.
recovery.createHeartbeatRecovery.sweepPendingCleanupLeases (cognitive 66) server/src/services/heartbeat/recovery.ts:1555— recovery.createHeartbeatRecovery.sweepPendingCleanupLeases has cognitive complexity 66 (threshold 15). Drivers by points: if/else 20 (44 pts), ternaries 8 (13 pts), boolean chains 5, error handling 2 (3 pts), loops 1 (nesting depth added 30). Of this number, 61 points are the body's own statements and 5 belong to 3 function literals 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.
work-timeline.workTimelineService.getTimeline (cognitive 66) server/src/services/work-timeline.ts:464— work-timeline.workTimelineService.getTimeline has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 15 (44 pts), if/else 6 (12 pts), loops 6, boolean chains 4 (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.
response-capture.installDatabaseResponseCapture (cognitive 65) packages/db/src/response-capture.ts:179— response-capture.installDatabaseResponseCapture has cognitive complexity 65 (threshold 15). Drivers by points: if/else 20 (25 pts), error handling 10 (14 pts), boolean chains 11, ternaries 7 (11 pts), loops 4 (nesting depth added 13). Most of this is not in the body itself: 3 of the 65 points are its own statements and the rest belongs to 20 function items inside it that branch (a function literal at line 274, sqlMetadata, tableName, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CodexAppServerDriver.recoverSession (cognitive 65) packages/paperclip-runner/src/drivers/codex/codex-app-server-driver-impl.ts:367— CodexAppServerDriver.recoverSession has cognitive complexity 65 (threshold 15). Drivers by points: if/else 23 (34 pts), boolean chains 19, ternaries 8 (11 pts), error handling 1 (nesting depth added 14). Of this number, 63 points are the body's own statements and 2 belong to one function literal 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.
case-handoff-authority.restoreCaseHandoffActor (cognitive 65) server/src/services/case-handoff-authority.ts:57— case-handoff-authority.restoreCaseHandoffActor has cognitive complexity 65 (threshold 15). Drivers by points: if/else 24 (47 pts), boolean chains 16, ternaries 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.
serve-config.parseServeStatus (cognitive 65) packages/tailscale-https-broker/src/serve-config.ts:58— serve-config.parseServeStatus has cognitive complexity 65 (threshold 15). Drivers by points: if/else 18 (48 pts), loops 3 (8 pts), ternaries 1 (5 pts), boolean chains 4 (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.
ConnectedAggregatorApps.ConnectedAggregatorApps (cognitive 65) ui/src/pages/apps/app-detail/ConnectedAggregatorApps.tsx:15— ConnectedAggregatorApps.ConnectedAggregatorApps has cognitive complexity 65 (threshold 15). Drivers by points: ternaries 20 (47 pts), boolean chains 14, if/else 2 (3 pts), loops 1 (nesting depth added 28). Of this number, 29 points are the body's own statements and 36 belong to 4 function literals inside it that branch. 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.
commands.createDiscordCommands.handleDiscordNativeCommand (cognitive 64) server/src/services/chat-channels/discord/commands.ts:250— commands.createDiscordCommands.handleDiscordNativeCommand has cognitive complexity 64 (threshold 15). Drivers by points: boolean chains 24, if/else 23 (24 pts), ternaries 10 (15 pts), error handling 1 (nesting depth added 6). Most of this is not in the body itself: 8 of the 64 points are its own statements and the rest belongs to one function literal inside it that branches (line 293). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
RoutineTriggers.RoutineTriggers (cognitive 64) ui/src/components/routine-triggers/RoutineTriggers.tsx:65— RoutineTriggers.RoutineTriggers has cognitive complexity 64 (threshold 15). Drivers by points: ternaries 22 (47 pts), boolean chains 10, if/else 4 (6 pts), error handling 1 (nesting depth added 27). Most of this is not in the body itself: 14 of the 64 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 211, change, a function literal at line 158, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentObservabilitySettings.AgentObservabilitySettingsView (cognitive 64) ui/src/components/observability/AgentObservabilitySettings.tsx:40— AgentObservabilitySettings.AgentObservabilitySettingsView has cognitive complexity 64 (threshold 15). Drivers by points: boolean chains 32, ternaries 15 (29 pts), if/else 3 (nesting depth added 14). Of this number, 33 points are the body's own statements and 31 belong to 8 function items inside it that branch. 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.
GitHubBotConfiguration.GitHubAccessEditor (cognitive 64) ui/src/pages/apps/chat/GitHubBotConfiguration.tsx:574— GitHubBotConfiguration.GitHubAccessEditor has cognitive complexity 64 (threshold 15). Drivers by points: boolean chains 29, ternaries 18 (27 pts), if/else 3 (5 pts), error handling 2 (3 pts) (nesting depth added 12). Of this number, 26 points are the body's own statements and 38 belong to 13 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.
acp.testClaudeAcpEnvironment (cognitive 63) packages/adapters/claude-local/src/server/acp.ts:739— acp.testClaudeAcpEnvironment has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 19 (26 pts), if/else 12 (19 pts), boolean chains 15, loops 1 (2 pts), error handling 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.
build-config.buildPaperclipRunnerConfig (cognitive 63) packages/adapters/codex-local/src/ui/build-config.ts:76— build-config.buildPaperclipRunnerConfig has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 23 (33 pts), boolean chains 19, if/else 9, loops 2 (nesting depth added 10). Of this number, 59 points are the body's own statements and 4 belong to one function item inside it that branches. 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-turn-diff.parseCodexTurnDiff (cognitive 63) packages/paperclip-runner/src/drivers/codex/codex-turn-diff.ts:73— codex-turn-diff.parseCodexTurnDiff has cognitive complexity 63 (threshold 15). Drivers by points: if/else 25 (42 pts), boolean chains 24, ternaries 9 (16 pts), loops 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. This shape REPEATS in the file: one other method here (codex-turn-diff.parseCodexTurnDiff::finish) 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-session-server-requests.handleServerRequestBody (cognitive 63) packages/paperclip-runner/src/drivers/codex/codex-session-server-requests.ts:82— codex-session-server-requests.handleServerRequestBody has cognitive complexity 63 (threshold 15). Drivers by points: if/else 16 (30 pts), ternaries 6 (16 pts), error handling 4 (9 pts), boolean chains 8 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DurablePrpCodexTransport.#closeOnce (cognitive 63) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:4524— DurablePrpCodexTransport.#closeOnce has cognitive complexity 63 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 17, ternaries 5 (10 pts), error handling 4 (8 pts), loops 2 (6 pts) (nesting depth added 20). Of this number, 61 points are the body's own statements and 2 belong to one function literal 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.
runner-tool-bridge.handleRequest (cognitive 63) packages/paperclip-runner/src/drivers/runner-tool-bridge.ts:206— runner-tool-bridge.handleRequest has cognitive complexity 63 (threshold 15). Drivers by points: if/else 27 (32 pts), boolean chains 12, ternaries 8 (10 pts), error handling 6 (7 pts), loops 1 (2 pts) (nesting depth added 9). Of this number, 48 points are the body's own statements and 15 belong to 6 function items inside it that branch. 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.
task-repository-acquisition.assertSelectedWorkspaceTrust (cognitive 63) server/src/services/task-repository-acquisition.ts:59— task-repository-acquisition.assertSelectedWorkspaceTrust has cognitive complexity 63 (threshold 15). Drivers by points: if/else 15 (27 pts), ternaries 14 (19 pts), boolean chains 13, loops 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.
approvals.hireApprovalService.decide (cognitive 63) server/src/modules/agent-lifecycle/adapters/approvals.ts:21— approvals.hireApprovalService.decide has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 16 (37 pts), if/else 12 (17 pts), boolean chains 9 (nesting depth added 26). Most of this is not in the body itself: 5 of the 63 points are its own statements and the rest belongs to one function literal inside it that branches (line 29). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
task-start.createSlackTaskStart.processSlackTaskStart (cognitive 63) server/src/services/chat-channels/slack/task-start.ts:527— task-start.createSlackTaskStart.processSlackTaskStart has cognitive complexity 63 (threshold 15). Drivers by points: if/else 23 (31 pts), ternaries 12 (18 pts), boolean chains 10, error handling 3 (4 pts) (nesting depth added 15). Of this number, 27 points are the body's own statements and 36 belong to 4 function literals 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.
persisted-workspace-source.resolvePersistedGitWorkspaceSource (cognitive 63) server/src/services/persisted-workspace-source.ts:102— persisted-workspace-source.resolvePersistedGitWorkspaceSource has cognitive complexity 63 (threshold 15). Drivers by points: if/else 25 (41 pts), boolean chains 16, loops 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 18). Of this number, 58 points are the body's own statements and 5 belong to 3 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.
fast-response-provider.runFastResponseProvider (cognitive 63) server/src/services/fast-response-provider.ts:161— fast-response-provider.runFastResponseProvider has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 12 (36 pts), boolean chains 12, if/else 6 (11 pts), error handling 2 (4 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
confirmation-actions.createChatConfirmationActions.handleChatConfirmation (cognitive 63) server/src/services/chat-channels/interactions/confirmation-actions.ts:65— confirmation-actions.createChatConfirmationActions.handleChatConfirmation has cognitive complexity 63 (threshold 15). Drivers by points: if/else 22 (32 pts), boolean chains 18, ternaries 6 (11 pts), error handling 1, loops 1 (nesting depth added 15). Of this number, 61 points are the body's own statements and 2 belong to one function literal 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.
workspace-file-resources.workspaceFileResourceService.availability (cognitive 63) server/src/services/workspace-file-resources.ts:1292— workspace-file-resources.workspaceFileResourceService.availability has cognitive complexity 63 (threshold 15). Drivers by points: if/else 17 (34 pts), boolean chains 8, error handling 4 (8 pts), ternaries 5 (8 pts), loops 4 (5 pts) (nesting depth added 25). Most of this is not in the body itself: 12 of the 63 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1330, 1307). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-session-executor.recoverQuiescentRunnerdState (cognitive 63) server/src/services/native-runtime/native-session-executor.ts:5073— native-session-executor.recoverQuiescentRunnerdState has cognitive complexity 63 (threshold 15). Drivers by points: if/else 20 (35 pts), boolean chains 15, ternaries 5 (9 pts), error handling 1 (2 pts), loops 2 (nesting depth added 20). Of this number, 58 points are the body's own statements and 5 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.
PropertiesPanel.ResizablePropertiesPanel (cognitive 63) ui/src/components/PropertiesPanel.tsx:172— PropertiesPanel.ResizablePropertiesPanel has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 23 (32 pts), if/else 20, boolean chains 11 (nesting depth added 9). Of this number, 34 points are the body's own statements and 29 belong to 16 function literals inside it that branch. 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.
AgentConversationSidebar.AgentConversationSidebar (cognitive 63) ui/src/components/AgentConversationSidebar.tsx:31— AgentConversationSidebar.AgentConversationSidebar has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 15 (46 pts), if/else 6 (9 pts), boolean chains 8 (nesting depth added 34). Of this number, 32 points are the body's own statements and 31 belong to 4 function literals inside it that branch. 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.
TaskBrowserPanel.TaskBrowserPanel (cognitive 63) ui/src/components/task-side-panel/TaskBrowserPanel.tsx:10— TaskBrowserPanel.TaskBrowserPanel has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 11 (34 pts), boolean chains 17, if/else 10 (11 pts), error handling 1 (nesting depth added 24). Of this number, 45 points are the body's own statements and 18 belong to 7 function literals inside it that branch. 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.
RoutineVariablesEditor.RoutineVariablesEditor (cognitive 63) ui/src/components/RoutineVariablesEditor.tsx:53— RoutineVariablesEditor.RoutineVariablesEditor has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 17 (56 pts), boolean chains 5, if/else 2 (nesting depth added 39). Most of this is not in the body itself: 2 of the 63 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 94, 190, 72, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentCommentary.AgentCommentary (cognitive 63) ui/src/pages/audit/AgentCommentary.tsx:78— AgentCommentary.AgentCommentary has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 14 (48 pts), boolean chains 8, if/else 5 (6 pts), loops 1 (nesting depth added 35). Of this number, 55 points are the body's own statements and 8 belong to 3 function literals inside it that branch. 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.
CompanyEnvironments.EnvironmentImageTemplatePanel (cognitive 63) ui/src/pages/CompanyEnvironments.tsx:856— CompanyEnvironments.EnvironmentImageTemplatePanel has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 26 (42 pts), if/else 8 (11 pts), boolean chains 9, error handling 1 (nesting depth added 19). Of this number, 46 points are the body's own statements and 17 belong to 7 function literals 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.
capability-issue-thread-server.harnessConfiguration (cognitive 62) packages/paperclip-runner/scripts/capability-issue-thread-server.mjs:206— capability-issue-thread-server.harnessConfiguration has cognitive complexity 62 (threshold 15). Drivers by points: boolean chains 22, ternaries 18 (21 pts), if/else 16 (19 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.
live-projection.projectCapabilityIssueThread (cognitive 62) packages/paperclip-runner/src/issue-thread/live-projection.ts:752— live-projection.projectCapabilityIssueThread has cognitive complexity 62 (threshold 15). Drivers by points: ternaries 10 (24 pts), if/else 12 (20 pts), boolean chains 10, loops 8 (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.
native-execution.parsePaperclipNativeExecution (cognitive 62) packages/paperclip-runner/src/evals/native-execution.ts:203— native-execution.parsePaperclipNativeExecution has cognitive complexity 62 (threshold 15). Drivers by points: if/else 26 (41 pts), boolean chains 11, loops 5 (6 pts), ternaries 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.
conversation-queue.createChatConversationDeliveryQueue.drainConversationDeliveries (cognitive 62) server/src/services/chat-channels/inbound/conversation-queue.ts:391— conversation-queue.createChatConversationDeliveryQueue.drainConversationDeliveries has cognitive complexity 62 (threshold 15). Drivers by points: if/else 23 (47 pts), boolean chains 9, ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 27). Of this number, 53 points are the body's own statements and 9 belong to 4 function literals 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.
issues.listIssueReviewAttentionMap (cognitive 62) server/src/services/issues.ts:4535— issues.listIssueReviewAttentionMap has cognitive complexity 62 (threshold 15). Drivers by points: ternaries 12 (32 pts), if/else 8 (15 pts), boolean chains 10, loops 5 (nesting depth added 27). Of this number, 27 points are the body's own statements and 35 belong to 2 function literals inside it that branch. 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.
native-finalization-reconciler.claimNativeSessionResumptions (cognitive 62) server/src/services/native-runtime/native-finalization-reconciler.ts:346— native-finalization-reconciler.claimNativeSessionResumptions has cognitive complexity 62 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 22, ternaries 4 (8 pts), loops 1 (nesting depth added 19). Most of this is not in the body itself: 7 of the 62 points are its own statements and the rest belongs to one function literal inside it that branches (line 390). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
ExternalAgentInviteContent.DotConnectionChecks (cognitive 62) ui/src/components/new-agent/ExternalAgentInviteContent.tsx:51— ExternalAgentInviteContent.DotConnectionChecks has cognitive complexity 62 (threshold 15). Drivers by points: ternaries 20 (55 pts), boolean chains 7 (nesting depth added 35). Of this number, 40 points are the body's own statements and 22 belong to one function literal 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.
AgentSecretAccessEditor.AgentSecretAccessEditor (cognitive 62) ui/src/components/AgentSecretAccessEditor.tsx:194— AgentSecretAccessEditor.AgentSecretAccessEditor has cognitive complexity 62 (threshold 15). Drivers by points: ternaries 15 (27 pts), if/else 10 (19 pts), boolean chains 15, loops 1 (nesting depth added 21). Most of this is not in the body itself: 4 of the 62 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 340, 352, 253, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentActionButtons.AgentActionButtons (cognitive 62) ui/src/components/AgentActionButtons.tsx:158— AgentActionButtons.AgentActionButtons has cognitive complexity 62 (threshold 15). Drivers by points: ternaries 14 (24 pts), boolean chains 18, if/else 14 (18 pts), error handling 1, match/switch 1 (nesting depth added 14). Of this number, 21 points are the body's own statements and 41 belong to 15 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.
GatewaysTab.GatewaysTab (cognitive 62) ui/src/pages/tools/GatewaysTab.tsx:115— GatewaysTab.GatewaysTab has cognitive complexity 62 (threshold 15). Drivers by points: ternaries 23 (49 pts), boolean chains 7, if/else 5, error handling 1 (nesting depth added 26). Most of this is not in the body itself: 13 of the 62 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 345, a function literal at line 533, copyText, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
JsonSchemaForm.validateField (cognitive 62) REDACTED:191— JsonSchemaForm.validateField has cognitive complexity 62 (threshold 15). Drivers by points: if/else 22 (39 pts), boolean chains 19, error handling 1 (4 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.
LiveConsoleDemoServer.#handle (cognitive 61) REDACTED:589— LiveConsoleDemoServer.#handle has cognitive complexity 61 (threshold 15). Drivers by points: if/else 23 (30 pts), boolean chains 14, ternaries 6 (13 pts), error handling 1 (2 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.
workspace-runtime.reconcilePersistedRuntimeServicesOnStartup (cognitive 61) server/src/services/workspace-runtime.ts:8540— workspace-runtime.reconcilePersistedRuntimeServicesOnStartup has cognitive complexity 61 (threshold 15). Drivers by points: if/else 15 (33 pts), boolean chains 16, loops 3 (5 pts), ternaries 3 (5 pts), error handling 1 (2 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.
execution-workspaces.executionWorkspaceService.getCloseReadiness (cognitive 61) server/src/services/execution-workspaces.ts:3046— execution-workspaces.executionWorkspaceService.getCloseReadiness has cognitive complexity 61 (threshold 15). Drivers by points: ternaries 17 (28 pts), if/else 20 (23 pts), boolean chains 9, 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.
agent-directory-probe.probeAgentDirectory::walk (cognitive 61) server/src/services/agent-directory-probe.ts:45— agent-directory-probe.probeAgentDirectory::walk has cognitive complexity 61 (threshold 15). Drivers by points: if/else 19 (49 pts), boolean chains 5, loops 2 (5 pts), ternaries 1 (2 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. This shape REPEATS in the file: one other method here (agent-directory-probe.probeAgentDirectory) 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.
environment-run-orchestrator.environmentRunOrchestrator.realizeForRun (cognitive 61) server/src/services/environment-run-orchestrator.ts:398— environment-run-orchestrator.environmentRunOrchestrator.realizeForRun has cognitive complexity 61 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 18, ternaries 8 (14 pts), error handling 3 (5 pts) (nesting depth added 16). Of this number, 60 points are the body's own statements and 1 belongs to one function literal 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.
assets.assetRoutes (cognitive 61) server/src/routes/assets.ts:91— assets.assetRoutes has cognitive complexity 61 (threshold 15). Drivers by points: if/else 23 (31 pts), boolean chains 20, ternaries 8, error handling 2 (nesting depth added 8). None of this is in the body itself: all 61 points belong to 4 function literals inside it that branch (lines 327, 116, 225, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WorkTimelineChart.WorkTimelineChart (cognitive 61) ui/src/components/timeline/WorkTimelineChart.tsx:252— WorkTimelineChart.WorkTimelineChart has cognitive complexity 61 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 19, ternaries 14 (16 pts), loops 3 (4 pts) (nesting depth added 7). Most of this is not in the body itself: 6 of the 61 points are its own statements and the rest belongs to 18 function items inside it that branch (a function literal at line 301, a function literal at line 591, a function literal at line 339, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
parse-stdout.parseCursorStdoutLine (cognitive 60) packages/adapters/cursor-local/src/ui/parse-stdout.ts:249— parse-stdout.parseCursorStdoutLine has cognitive complexity 60 (threshold 15). Drivers by points: if/else 22 (36 pts), ternaries 7 (14 pts), boolean chains 10 (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.
provider-profile.resolvePaperclipRunnerProviderProfile (cognitive 60) server/src/services/native-runtime/provider-profile.ts:407— provider-profile.resolvePaperclipRunnerProviderProfile has cognitive complexity 60 (threshold 15). Drivers by points: if/else 24 (34 pts), boolean chains 12, ternaries 4 (8 pts), error handling 5 (6 pts) (nesting depth added 15). Of this number, 59 points are the body's own statements and 1 belongs to one function literal 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.
chat-teams-inline-images.gif (cognitive 60) server/src/services/chat-teams-inline-images.ts:201— chat-teams-inline-images.gif has cognitive complexity 60 (threshold 15). Drivers by points: if/else 19 (41 pts), boolean chains 13, ternaries 2 (4 pts), loops 2 (nesting depth added 24). Of this number, 54 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.
connection-intents.connectionIntentService.directSearchResult (cognitive 60) server/src/services/connection-intents.ts:620— connection-intents.connectionIntentService.directSearchResult has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 11 (55 pts), boolean chains 5 (nesting depth added 44). 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.WikiPage (cognitive 60) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:1589— app.WikiPage has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 16 (46 pts), if/else 11 (12 pts), boolean chains 2 (nesting depth added 31). Of this number, 47 points are the body's own statements and 13 belong to 9 function literals inside it that branch. 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.
MarkdownBody.MarkdownBodyImpl (cognitive 60) REDACTED:781— MarkdownBody.MarkdownBodyImpl has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 16 (28 pts), if/else 17 (18 pts), boolean chains 13, loops 1 (nesting depth added 13). Most of this is not in the body itself: 2 of the 60 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 891, 845, 826, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
config-fields.OpenClawGatewayConfigFields (cognitive 60) ui/src/adapters/openclaw-gateway/config-fields.tsx:104— config-fields.OpenClawGatewayConfigFields has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 31 (35 pts), boolean chains 14, if/else 10, error handling 1 (nesting depth added 4). Of this number, 26 points are the body's own statements and 34 belong to 15 function items inside it that branch. 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.
index.EnvironmentVariablesEditor (cognitive 60) ui/src/components/environment-variables-editor/index.tsx:150— index.EnvironmentVariablesEditor has cognitive complexity 60 (threshold 15). Drivers by points: if/else 26 (29 pts), boolean chains 14, ternaries 12 (14 pts), loops 3 (nesting depth added 5). Most of this is not in the body itself: 12 of the 60 points are its own statements and the rest belongs to 20 function items inside it that branch (a function literal at line 313, bulkImport, a function literal at line 211, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CloudAccessGate.CloudAccessGate (cognitive 60) ui/src/components/CloudAccessGate.tsx:68— CloudAccessGate.CloudAccessGate has cognitive complexity 60 (threshold 15). Drivers by points: boolean chains 21, ternaries 11 (19 pts), if/else 15 (18 pts), loops 1 (2 pts) (nesting depth added 12). Of this number, 37 points are the body's own statements and 23 belong to 8 function literals 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.
IssueChatThread.IssueChatUserMessage (cognitive 60) ui/src/components/IssueChatThread.tsx:1995— IssueChatThread.IssueChatUserMessage has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 32 (50 pts), boolean chains 8, if/else 2 (nesting depth added 18). Of this number, 55 points are the body's own statements and 5 belong to 3 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.
ChatComposer.ChatComposer (cognitive 60) ui/src/components/ChatComposer.tsx:111— ChatComposer.ChatComposer has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 21 (33 pts), boolean chains 15, if/else 12 (nesting depth added 12). Of this number, 18 points are the body's own statements and 42 belong to 11 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.
AcpxRuntimeHost.open (cognitive 59) packages/paperclip-runner/src/drivers/acpx/runtime-host.ts:331— AcpxRuntimeHost.open has cognitive complexity 59 (threshold 15). Drivers by points: if/else 27 (31 pts), ternaries 11 (15 pts), boolean chains 12, error handling 1 (nesting depth added 8). Of this number, 44 points are the body's own statements and 15 belong to 7 function items inside it that branch. 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.
CodexAcpxSession.#pumpTurn (cognitive 59) REDACTED:1471— CodexAcpxSession.#pumpTurn has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 16 (36 pts), if/else 13 (18 pts), boolean chains 2, error handling 2, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
worker.createLifecycleWorker.process (cognitive 59) server/src/modules/agent-lifecycle/application/worker.ts:17— worker.createLifecycleWorker.process has cognitive complexity 59 (threshold 15). Drivers by points: if/else 17 (47 pts), boolean chains 5, loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 33). Of this number, 57 points are the body's own statements and 2 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.
connection-methods.normalizeConnectionMethodConfig (cognitive 59) REDACTED:86— connection-methods.normalizeConnectionMethodConfig has cognitive complexity 59 (threshold 15). Drivers by points: if/else 18 (36 pts), boolean chains 12, ternaries 5 (7 pts), loops 4 (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.
railway.createRailwayClient.call (cognitive 59) server/src/services/railway.ts:258— railway.createRailwayClient.call has cognitive complexity 59 (threshold 15). Drivers by points: if/else 17 (41 pts), ternaries 3 (8 pts), boolean chains 5, loops 1 (3 pts), match/switch 1 (2 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.
session-status.createSlackSessionStatus.processPendingSlackSessionSyncs (cognitive 59) server/src/services/chat-channels/slack/session-status.ts:65— session-status.createSlackSessionStatus.processPendingSlackSessionSyncs has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 13 (30 pts), if/else 8 (17 pts), boolean chains 9, error handling 1 (2 pts), loops 1 (nesting depth added 27). Of this number, 17 points are the body's own statements and 42 belong to 4 function literals 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.
McpConnect.McpConnectRequest (cognitive 59) ui/src/pages/McpConnect.tsx:48— McpConnect.McpConnectRequest has cognitive complexity 59 (threshold 15). Drivers by points: boolean chains 35, ternaries 12 (17 pts), if/else 7 (nesting depth added 5). Of this number, 42 points are the body's own statements and 17 belong to 7 function literals inside it that branch. 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.
TaskChatMarker.TaskChatMarker (cognitive 59) ui/src/components/task-chat/TaskChatMarker.tsx:21— TaskChatMarker.TaskChatMarker has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 22 (48 pts), boolean chains 9, if/else 2 (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.
ConnectorCatalogNavigation.ConnectorCatalogNavigation (cognitive 59) ui/storybook/prototypes/ConnectorCatalogNavigation.tsx:74— ConnectorCatalogNavigation.ConnectorCatalogNavigation has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 20 (44 pts), boolean chains 13, if/else 2 (nesting depth added 24). Of this number, 44 points are the body's own statements and 15 belong to 7 function items inside it that branch. 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.
execution-target.startAdapterExecutionTargetProcessSessionBridge (cognitive 58) REDACTED:1988— execution-target.startAdapterExecutionTargetProcessSessionBridge has cognitive complexity 58 (threshold 15). Drivers by points: if/else 16 (29 pts), ternaries 5 (10 pts), boolean chains 9, error handling 3 (6 pts), loops 2 (4 pts) (nesting depth added 23). Of this number, 19 points are the body's own statements and 39 belong to 7 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.
publish-runner-protocol-eval-history.validatePublicProtocolEvalReport (cognitive 58) packages/paperclip-runner/scripts/publish-runner-protocol-eval-history.mjs:140— publish-runner-protocol-eval-history.validatePublicProtocolEvalReport has cognitive complexity 58 (threshold 15). Drivers by points: if/else 15 (36 pts), loops 5 (11 pts), boolean chains 6, ternaries 3 (5 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.
chat-question-forms.validateChatQuestionFormSubmission (cognitive 58) server/src/services/chat-question-forms.ts:665— chat-question-forms.validateChatQuestionFormSubmission has cognitive complexity 58 (threshold 15). Drivers by points: if/else 19 (40 pts), boolean chains 11, ternaries 3 (6 pts), loops 1 (nesting depth added 24). Of this number, 57 points are the body's own statements and 1 belongs to one function literal 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.
tool-gateway.createToolGatewayService.executeBuiltinTool (cognitive 58) server/src/services/tool-gateway.ts:3195— tool-gateway.createToolGatewayService.executeBuiltinTool has cognitive complexity 58 (threshold 15). Drivers by points: if/else 21 (35 pts), ternaries 4 (10 pts), boolean chains 7, error handling 3 (6 pts) (nesting depth added 23). Of this number, 53 points are the body's own statements and 5 belong to one function literal 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.
nested-clone-migration.migrateNestedRepositoryClone (cognitive 58) server/src/services/nested-clone-migration.ts:396— nested-clone-migration.migrateNestedRepositoryClone has cognitive complexity 58 (threshold 15). Drivers by points: if/else 30 (38 pts), boolean chains 12, ternaries 4 (5 pts), loops 2, error handling 1 (nesting depth added 9). Most of this is not in the body itself: 8 of the 58 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 402, 441, 483). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-runtime.startRuntimeServicesForWorkspaceControlInvocation (cognitive 58) server/src/services/workspace-runtime.ts:7978— workspace-runtime.startRuntimeServicesForWorkspaceControlInvocation has cognitive complexity 58 (threshold 15). Drivers by points: if/else 11 (36 pts), loops 5 (11 pts), boolean chains 6, error handling 2 (4 pts), ternaries 1 (nesting depth added 33). Of this number, 53 points are the body's own statements and 5 belong to 2 function literals 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.
resource-reconciliation.createChatResourceReconciliation.applyProviderAvailability (cognitive 58) server/src/services/chat-channels/resource-reconciliation.ts:364— resource-reconciliation.createChatResourceReconciliation.applyProviderAvailability has cognitive complexity 58 (threshold 15). Drivers by points: ternaries 12 (34 pts), if/else 9 (17 pts), boolean chains 7 (nesting depth added 30). None of this is in the body itself: all 58 points belong to one function literal inside it that branches (line 373). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
agent-file-store.agentFileStore.apply (cognitive 58) server/src/services/agent-file-store.ts:242— agent-file-store.agentFileStore.apply has cognitive complexity 58 (threshold 15). Drivers by points: if/else 17 (39 pts), loops 9 (15 pts), ternaries 3, boolean chains 1 (nesting depth added 28). None of this is in the body itself: all 58 points belong to one function literal inside it that branches (line 243). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
company-skills.auditInstalledSkillBytes (cognitive 58) server/src/services/company-skills.ts:2544— company-skills.auditInstalledSkillBytes has cognitive complexity 58 (threshold 15). Drivers by points: if/else 19 (39 pts), boolean chains 10, loops 4 (6 pts), ternaries 2 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
native-maintenance-no-launch.verifyRetainedMaintenanceNoLaunch (cognitive 58) server/src/services/native-runtime/native-maintenance-no-launch.ts:116— native-maintenance-no-launch.verifyRetainedMaintenanceNoLaunch has cognitive complexity 58 (threshold 15). Drivers by points: boolean chains 43, loops 10 (11 pts), if/else 2 (3 pts), error handling 1 (nesting depth added 2). Of this number, 51 points are the body's own statements and 7 belong to 2 function items inside it that branch. 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.
routes.handleBridgeRequest (cognitive 58) packages/plugins/sandbox-providers/cloudflare/bridge-template/src/routes.ts:199— routes.handleBridgeRequest has cognitive complexity 58 (threshold 15). Drivers by points: if/else 17 (27 pts), ternaries 5 (14 pts), boolean chains 9, error handling 3 (8 pts) (nesting depth added 24). Of this number, 55 points are the body's own statements and 3 belong to one function literal 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.
decisions.decisionService.executeEffect (cognitive 58) server/src/services/decisions.ts:392— decisions.decisionService.executeEffect has cognitive complexity 58 (threshold 15). Drivers by points: if/else 24 (30 pts), boolean chains 12, ternaries 7 (12 pts), loops 2 (3 pts), error handling 1 (nesting depth added 12). Most of this is not in the body itself: 5 of the 58 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 413, 395, 461). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
transcript-adapter.deriveRunStatusLabel (cognitive 58) ui/src/components/task-chat/transcript-adapter.ts:2104— transcript-adapter.deriveRunStatusLabel has cognitive complexity 58 (threshold 15). Drivers by points: if/else 12 (42 pts), loops 3 (8 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 37). 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.
SkillStudio.InputPane (cognitive 58) ui/src/pages/SkillStudio.tsx:1894— SkillStudio.InputPane has cognitive complexity 58 (threshold 15). Drivers by points: if/else 12 (24 pts), ternaries 14 (24 pts), boolean chains 10 (nesting depth added 22). Of this number, 29 points are the body's own statements and 29 belong to 11 function literals 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.
connect-flow-preview-main.ConnectFlowPreview (cognitive 58) ui/src/connect-flow-preview-main.tsx:117— connect-flow-preview-main.ConnectFlowPreview has cognitive complexity 58 (threshold 15). Drivers by points: ternaries 14 (30 pts), if/else 15, boolean chains 13 (nesting depth added 16). Of this number, 37 points are the body's own statements and 21 belong to 8 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.
agent.registerAgentCommands (cognitive 57) cli/src/commands/client/agent.ts:225— agent.registerAgentCommands has cognitive complexity 57 (threshold 15). Drivers by points: error handling 28 (29 pts), if/else 14 (15 pts), loops 5 (8 pts), ternaries 5 (nesting depth added 5). Most of this is not in the body itself: 1 of the 57 points is its own statement and the rest belongs to 28 function literals inside it that branch (lines 788, 247, 296, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
codex-home.seedManagedCodexHome (cognitive 57) packages/adapters/codex-local/src/server/codex-home.ts:658— codex-home.seedManagedCodexHome has cognitive complexity 57 (threshold 15). Drivers by points: if/else 16 (37 pts), ternaries 3 (9 pts), boolean chains 7, loops 2 (4 pts) (nesting depth added 29). Of this number, 52 points are the body's own statements and 5 belong to one function literal 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.
capability-inventory.validateInventories (cognitive 57) packages/paperclip-runner/scripts/lib/capability-inventory.mjs:248— capability-inventory.validateInventories has cognitive complexity 57 (threshold 15). Drivers by points: if/else 19 (39 pts), loops 6 (8 pts), boolean chains 7, ternaries 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.
legacy-execution-recovery.terminalizeLegacyExecution (cognitive 57) server/src/services/legacy-execution-recovery.ts:89— legacy-execution-recovery.terminalizeLegacyExecution has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 14 (24 pts), if/else 14 (18 pts), boolean chains 15 (nesting depth added 14). None of this is in the body itself: all 57 points belong to one function literal inside it that branches (line 108). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
run-cost-accounting.accountRunCost (cognitive 57) server/src/services/run-cost-accounting.ts:20— run-cost-accounting.accountRunCost has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 9 (19 pts), if/else 14 (18 pts), boolean chains 14, loops 3 (4 pts), error handling 1 (2 pts) (nesting depth added 16). Most of this is not in the body itself: 7 of the 57 points are its own statements and the rest belongs to one function literal inside it that branches (line 31). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
runner-api-catalog.buildRunnerApiCatalog (cognitive 57) server/src/services/native-runtime/runner-api-catalog.ts:71— runner-api-catalog.buildRunnerApiCatalog has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 10 (33 pts), if/else 7 (12 pts), boolean chains 8, loops 3 (4 pts) (nesting depth added 29). Of this number, 45 points are the body's own statements and 12 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.
agent-directory-working-copies.agentDirectoryWorkingCopyService.prepareCopy (cognitive 57) server/src/services/agent-directory-working-copies.ts:93— agent-directory-working-copies.agentDirectoryWorkingCopyService.prepareCopy has cognitive complexity 57 (threshold 15). Drivers by points: if/else 21 (32 pts), ternaries 9 (11 pts), boolean chains 9, error handling 4 (5 pts) (nesting depth added 14). Of this number, 41 points are the body's own statements and 16 belong to 3 function literals 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.
routines.routineService.firePublicTrigger (cognitive 57) server/src/services/routines.ts:2945— routines.routineService.firePublicTrigger has cognitive complexity 57 (threshold 15). Drivers by points: if/else 27 (36 pts), boolean chains 10, ternaries 7 (10 pts), error handling 1 (nesting depth added 12). Most of this is not in the body itself: 14 of the 57 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 2957, 2970). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
built-in-agents.builtInAgentService.ensure (cognitive 57) server/src/services/built-in-agents.ts:1728— built-in-agents.builtInAgentService.ensure has cognitive complexity 57 (threshold 15). Drivers by points: if/else 12 (28 pts), boolean chains 13, ternaries 5 (11 pts), loops 1 (4 pts), error handling 1 (nesting depth added 25). 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.
scheduling.createHeartbeatScheduling.dispatchClaimedIssueMonitor (cognitive 57) server/src/services/heartbeat/scheduling.ts:592— scheduling.createHeartbeatScheduling.dispatchClaimedIssueMonitor has cognitive complexity 57 (threshold 15). Drivers by points: if/else 15 (26 pts), ternaries 13 (24 pts), boolean chains 6, error handling 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.
agent-execution-stop.agentExecutionsHaveStopped (cognitive 57) server/src/services/agent-execution-stop.ts:10— agent-execution-stop.agentExecutionsHaveStopped has cognitive complexity 57 (threshold 15). Drivers by points: if/else 17 (35 pts), boolean chains 18, loops 3, error handling 1 (nesting depth added 18). Of this number, 56 points are the body's own statements and 1 belongs to 3 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.
secrets.secretRoutes (cognitive 57) server/src/routes/secrets.ts:109— secrets.secretRoutes has cognitive complexity 57 (threshold 15). Drivers by points: if/else 34, ternaries 13 (14 pts), boolean chains 9 (nesting depth added 1). None of this is in the body itself: all 57 points belong to 25 function items inside it that branch (boardProposalView, a function literal at line 1032, a function literal at line 992, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
search-query-parser.parseSearchQuery (cognitive 57) ui/src/lib/search-query-parser.ts:187— search-query-parser.parseSearchQuery has cognitive complexity 57 (threshold 15). Drivers by points: if/else 21 (56 pts), loops 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.
AiConnectionField.AiConnectionField (cognitive 57) ui/src/components/ai-connections/AiConnectionField.tsx:44— AiConnectionField.AiConnectionField has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 14 (24 pts), boolean chains 23, if/else 9 (10 pts) (nesting depth added 11). Of this number, 43 points are the body's own statements and 14 belong to 9 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.
AgentToolsTab.AgentToolsTab (cognitive 57) ui/src/pages/AgentToolsTab.tsx:335— AgentToolsTab.AgentToolsTab has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 12 (20 pts), if/else 13 (19 pts), boolean chains 13, loops 4 (5 pts) (nesting depth added 15). Of this number, 20 points are the body's own statements and 37 belong to 15 function literals 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.
CompanyImport.CompanyImport (cognitive 57) ui/src/pages/CompanyImport.tsx:921— CompanyImport.CompanyImport has cognitive complexity 57 (threshold 15). Drivers by points: if/else 97 (169 pts), ternaries 47 (75 pts), boolean chains 66, loops 15 (30 pts), error handling 5 (10 pts) (nesting depth added 120). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (CompanyImport.CompanyImport::buildFinalAdapterOverrides) 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.
local-process-sandbox.buildLocalProcessSandboxSpawnTarget (cognitive 56) packages/adapter-utils/src/local-process-sandbox.ts:341— local-process-sandbox.buildLocalProcessSandboxSpawnTarget has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (29 pts), loops 8 (17 pts), boolean chains 8, ternaries 1 (2 pts) (nesting depth added 23). Of this number, 50 points are the body's own statements and 6 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.
chat-github-attachments.prepareGitHubPublicAttachment (cognitive 56) REDACTED:723— chat-github-attachments.prepareGitHubPublicAttachment has cognitive complexity 56 (threshold 15). Drivers by points: if/else 14 (31 pts), ternaries 5 (12 pts), boolean chains 9, loops 2 (3 pts), error handling 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.
chat-github-events.githubExplicitMentionEvent (cognitive 56) server/src/services/chat-github-events.ts:90— chat-github-events.githubExplicitMentionEvent has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 21 (35 pts), if/else 10 (11 pts), boolean chains 10 (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.
tool-access-policy.toolAccessPolicyService.loadContext (cognitive 56) server/src/services/tool-access-policy.ts:973— tool-access-policy.toolAccessPolicyService.loadContext has cognitive complexity 56 (threshold 15). Drivers by points: if/else 23 (37 pts), boolean chains 15, ternaries 4 (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.
managed-repository-checkout.materializeManagedProjectWorkspace (cognitive 56) server/src/services/managed-repository-checkout.ts:17— managed-repository-checkout.materializeManagedProjectWorkspace has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (26 pts), ternaries 13 (21 pts), error handling 4, boolean chains 3, loops 1 (2 pts) (nesting depth added 19). Of this number, 50 points are the body's own statements and 6 belong to 3 function literals 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.
email-channels.emailChannelService.setup (cognitive 56) server/src/services/email-channels.ts:625— email-channels.emailChannelService.setup has cognitive complexity 56 (threshold 15). Drivers by points: if/else 25 (32 pts), boolean chains 15, ternaries 3 (5 pts), error handling 2 (4 pts) (nesting depth added 11). Of this number, 22 points are the body's own statements and 34 belong to 3 function literals inside it that branch. 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.
routines.routineService.dispatchRoutineRun (cognitive 56) server/src/services/routines.ts:1697— routines.routineService.dispatchRoutineRun has cognitive complexity 56 (threshold 15). Drivers by points: if/else 14 (22 pts), ternaries 11 (17 pts), boolean chains 13, error handling 3 (4 pts) (nesting depth added 15). Of this number, 16 points are the body's own statements and 40 belong to 2 function literals 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.
worker-rpc-host.startWorkerRpcHost.buildContext (cognitive 56) packages/plugins/sdk/src/worker-rpc-host.ts:481— worker-rpc-host.startWorkerRpcHost.buildContext has cognitive complexity 56 (threshold 15). Drivers by points: if/else 27 (33 pts), boolean chains 12, ternaries 6, loops 1 (4 pts), error handling 1 (nesting depth added 9). Of this number, 54 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
check-maps.checkMaps (cognitive 56) REDACTED:31— check-maps.checkMaps has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (36 pts), loops 7 (12 pts), boolean chains 5, error handling 2 (3 pts) (nesting depth added 22). Of this number, 31 points are the body's own statements and 25 belong to 7 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.
company-search.companySearchService.search::fetchIssueSearchData (cognitive 56) server/src/services/company-search.ts:610— company-search.companySearchService.search::fetchIssueSearchData has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (25 pts), boolean chains 15, ternaries 5 (11 pts), loops 3 (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.
AgentConfigForm.ModelDropdown (cognitive 56) ui/src/components/AgentConfigForm.tsx:3903— AgentConfigForm.ModelDropdown has cognitive complexity 56 (threshold 15). Drivers by points: boolean chains 25, ternaries 8 (17 pts), if/else 10 (12 pts), loops 2 (nesting depth added 11). Of this number, 32 points are the body's own statements and 24 belong to 11 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.
ProviderTraceStatusBadge.ProviderTraceStatusBadge (cognitive 56) ui/src/components/ProviderTraceStatusBadge.tsx:18— ProviderTraceStatusBadge.ProviderTraceStatusBadge has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 15 (53 pts), boolean chains 2, if/else 1 (nesting depth added 38). 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.
CompanySkills.NewSkillWizard (cognitive 56) ui/src/pages/CompanySkills.tsx:1394— CompanySkills.NewSkillWizard has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 19 (46 pts), boolean chains 10 (nesting depth added 27). Of this number, 32 points are the body's own statements and 24 belong to 5 function literals inside it that branch. 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.
CompanySkills.production.NewSkillWizard (cognitive 56) ui/src/pages/CompanySkills.production.tsx:1484— CompanySkills.production.NewSkillWizard has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 19 (46 pts), boolean chains 10 (nesting depth added 27). Of this number, 32 points are the body's own statements and 24 belong to 5 function literals inside it that branch. 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.
ProviderConnectionPreview.ProviderConnectionPreview (cognitive 56) ui/storybook/prototypes/ProviderConnectionPreview.tsx:16— ProviderConnectionPreview.ProviderConnectionPreview has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 23 (37 pts), boolean chains 15, if/else 4 (nesting depth added 14). Of this number, 39 points are the body's own statements and 17 belong to 7 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.
cases-read-only-api.installReadOnlyCaseFixtures (cognitive 56) ui/storybook/support/cases-read-only-api.ts:80— cases-read-only-api.installReadOnlyCaseFixtures has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 17 (37 pts), boolean chains 11, if/else 7, match/switch 1 (nesting depth added 20). Most of this is not in the body itself: 1 of the 56 points is its own statement and the rest belongs to 13 function literals inside it that branch (lines 113, 107, 141, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
parse.createOpenCodeJsonlParser (cognitive 55) packages/adapters/opencode-local/src/server/parse.ts:27— parse.createOpenCodeJsonlParser has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (40 pts), ternaries 5 (11 pts), boolean chains 3, loops 1 (nesting depth added 29). None of this is in the body itself: all 55 points belong to 2 function literals inside it that branch (lines 42, 67). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
pi-provider-config.piProviderConfiguration (cognitive 55) packages/paperclip-runner/src/drivers/acpx/pi-provider-config.ts:71— pi-provider-config.piProviderConfiguration has cognitive complexity 55 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 12, loops 5 (9 pts), ternaries 4 (9 pts), error handling 1 (nesting depth added 18). Of this number, 30 points are the body's own statements and 25 belong to 3 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.
runner-prp-outbound.connectRunnerPrpIngress (cognitive 55) server/src/realtime/runner-prp-outbound.ts:260— runner-prp-outbound.connectRunnerPrpIngress has cognitive complexity 55 (threshold 15). Drivers by points: if/else 10 (30 pts), ternaries 4 (14 pts), error handling 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 34). None of this is in the body itself: all 55 points belong to one function literal inside it that branches (line 296). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
environments.environmentService.ensureManagedSandboxEnvironment (cognitive 55) REDACTED:349— environments.environmentService.ensureManagedSandboxEnvironment has cognitive complexity 55 (threshold 15). Drivers by points: if/else 18 (28 pts), ternaries 9 (16 pts), boolean chains 8, loops 1 (3 pts) (nesting depth added 19). Most of this is not in the body itself: 12 of the 55 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 369, 408, 571). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-github-response-comments.writeGitHubResponseComment (cognitive 55) server/src/services/chat-github-response-comments.ts:86— chat-github-response-comments.writeGitHubResponseComment has cognitive complexity 55 (threshold 15). Drivers by points: boolean chains 21, if/else 13 (18 pts), ternaries 11 (16 pts) (nesting depth added 10). Of this number, 52 points are the body's own statements and 3 belong to one function literal 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.
chat-teams-file-publication.projectTeamsFilePublication (cognitive 55) server/src/services/chat-teams-file-publication.ts:93— chat-teams-file-publication.projectTeamsFilePublication has cognitive complexity 55 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 21, ternaries 7 (11 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.
queue.createChatPublicationQueue.processPendingPublications (cognitive 55) server/src/services/chat-channels/publications/queue.ts:182— queue.createChatPublicationQueue.processPendingPublications has cognitive complexity 55 (threshold 15). Drivers by points: if/else 21 (45 pts), loops 3 (5 pts), boolean chains 4, error handling 1 (nesting depth added 26). Of this number, 45 points are the body's own statements and 10 belong to 3 function literals 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.
recovery.createHeartbeatRecovery.reconcileHotRestartAdoption (cognitive 55) server/src/services/heartbeat/recovery.ts:608— recovery.createHeartbeatRecovery.reconcileHotRestartAdoption has cognitive complexity 55 (threshold 15). Drivers by points: if/else 21 (34 pts), ternaries 6 (11 pts), boolean chains 7, loops 2, error handling 1 (nesting depth added 18). Of this number, 51 points are the body's own statements and 4 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.
recovery.createHeartbeatRecovery.recoverNativeRunsAfterRestart (cognitive 55) server/src/services/heartbeat/recovery.ts:910— recovery.createHeartbeatRecovery.recoverNativeRunsAfterRestart has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 14 (45 pts), if/else 2 (4 pts), boolean chains 3, loops 3 (nesting depth added 33). 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.
ai-connection-router.poolMemberRuntimeConfig (cognitive 55) server/src/services/ai-connection-router.ts:27— ai-connection-router.poolMemberRuntimeConfig has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 17 (34 pts), boolean chains 9, if/else 8 (9 pts), error handling 1 (3 pts) (nesting depth added 20). Of this number, 47 points are the body's own statements and 8 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.
slack-native-search.fetchTransientSlackSearch (cognitive 55) server/src/services/connectors/slack-native-search.ts:19— slack-native-search.fetchTransientSlackSearch has cognitive complexity 55 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 18, ternaries 6 (12 pts), loops 3 (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.
activity.activityRoutes (cognitive 55) server/src/routes/activity.ts:122— activity.activityRoutes has cognitive complexity 55 (threshold 15). Drivers by points: if/else 25 (29 pts), ternaries 11 (12 pts), boolean chains 11, loops 2 (3 pts) (nesting depth added 6). None of this is in the body itself: all 55 points belong to 13 function items inside it that branch (a function literal at line 285, a function literal at line 247, a function literal at line 353, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SkillSources.SkillSources (cognitive 55) ui/src/pages/SkillSources.tsx:34— SkillSources.SkillSources has cognitive complexity 55 (threshold 15). Drivers by points: boolean chains 47, ternaries 6, if/else 1, loops 1. Of this number, 17 points are the body's own statements and 38 belong to 5 function literals inside it that branch. 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.
execute.execute (cognitive 54) packages/adapters/cursor-cloud/src/server/execute.ts:350— execute.execute has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 29 (36 pts), if/else 7 (9 pts), boolean chains 6, error handling 2 (3 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.
native-distribution-integrity.createNativeAcpxDistributionSnapshot (cognitive 54) packages/paperclip-runner/src/drivers/acpx/native-distribution-integrity.ts:84— native-distribution-integrity.createNativeAcpxDistributionSnapshot has cognitive complexity 54 (threshold 15). Drivers by points: if/else 18 (25 pts), loops 10 (13 pts), boolean chains 12, ternaries 3, error handling 1 (nesting depth added 10). Of this number, 38 points are the body's own statements and 16 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.
runner-console-app.RunnerConsoleApp (cognitive 54) packages/paperclip-runner/src/react/runner-console-app.tsx:43— runner-console-app.RunnerConsoleApp has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 27 (32 pts), if/else 12 (16 pts), boolean chains 6 (nesting depth added 9). Of this number, 26 points are the body's own statements and 28 belong to 10 function items inside it that branch. 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.
chat-github-response-comments.githubResponseCommentService.acknowledge (cognitive 54) server/src/services/chat-github-response-comments.ts:188— chat-github-response-comments.githubResponseCommentService.acknowledge has cognitive complexity 54 (threshold 15). Drivers by points: boolean chains 21, if/else 11 (21 pts), ternaries 5 (12 pts) (nesting depth added 17). None of this is in the body itself: all 54 points belong to 2 function literals inside it that branch (lines 194, 195). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-discord-command-registration.reconcileDiscordCommandRegistration (cognitive 54) server/src/services/chat-discord-command-registration.ts:412— chat-discord-command-registration.reconcileDiscordCommandRegistration has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (19 pts), ternaries 10 (19 pts), boolean chains 12, error handling 4 (nesting depth added 14). Of this number, 50 points are the body's own statements and 4 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.
wakeups.createInboundWakeups.processInboundWakeup (cognitive 54) server/src/services/chat-channels/inbound/wakeups.ts:203— wakeups.createInboundWakeups.processInboundWakeup has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 13 (26 pts), if/else 13 (16 pts), boolean chains 11, error handling 1 (nesting depth added 16). Of this number, 44 points are the body's own statements and 10 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.
native-plan-wait.planWaitFromFacts (cognitive 54) server/src/services/native-runtime/native-plan-wait.ts:66— native-plan-wait.planWaitFromFacts has cognitive complexity 54 (threshold 15). Drivers by points: if/else 23 (30 pts), boolean chains 20, loops 2, error handling 1, ternaries 1 (nesting depth added 7). Of this number, 52 points are the body's own statements and 2 belong to 3 function literals inside it that branch. 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.QueryTab (cognitive 54) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4349— app.QueryTab has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 22 (29 pts), if/else 10 (12 pts), boolean chains 9, error handling 2, loops 2 (nesting depth added 9). Most of this is not in the body itself: 13 of the 54 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 4482, fileAnswer, a function literal at line 4385, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
frontmatter.parseYamlBlock (cognitive 54) REDACTED:443— frontmatter.parseYamlBlock has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (41 pts), boolean chains 9, loops 3 (4 pts) (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.
BreadcrumbBar.BreadcrumbBar (cognitive 54) ui/src/components/BreadcrumbBar.tsx:55— BreadcrumbBar.BreadcrumbBar has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 16 (33 pts), boolean chains 17, if/else 4 (nesting depth added 17). Of this number, 22 points are the body's own statements and 32 belong to one function literal 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.
completed-activity-summary.completedActivitySummary (cognitive 54) ui/src/components/task-chat/completed-activity-summary.ts:29— completed-activity-summary.completedActivitySummary has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 10 (23 pts), if/else 12 (22 pts), boolean chains 7, loops 2 (nesting depth added 23). Of this number, 51 points are the body's own statements and 3 belong to 2 function items inside it that branch. 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.
interaction-audience.describeResolverAudience (cognitive 54) ui/src/lib/interaction-audience.ts:169— interaction-audience.describeResolverAudience has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 20 (49 pts), boolean chains 5 (nesting depth added 29). Of this number, 53 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.
SidePanelTab.SidePanelTab (cognitive 54) ui/src/components/side-panel/SidePanelTab.tsx:26— SidePanelTab.SidePanelTab has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 23 (30 pts), boolean chains 16, if/else 7 (8 pts) (nesting depth added 8). Of this number, 44 points are the body's own statements and 10 belong to 5 function literals inside it that branch. 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.
OrgChart.OrgChart (cognitive 54) ui/src/pages/OrgChart.tsx:208— OrgChart.OrgChart has cognitive complexity 54 (threshold 15). Drivers by points: if/else 25 (27 pts), boolean chains 16, ternaries 7 (9 pts), loops 2 (nesting depth added 4). Of this number, 17 points are the body's own statements and 37 belong to 17 function literals inside it that branch. 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.
StatusCardTile.StatusCardTile (cognitive 54) ui/src/pages/StatusCards/StatusCardTile.tsx:51— StatusCardTile.StatusCardTile has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 24 (37 pts), boolean chains 16, if/else 1 (nesting depth added 13). Of this number, 49 points are the body's own statements and 5 belong to 2 function literals 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.
ProjectAccessProposal.Proposal (cognitive 54) ui/storybook/support/design-proposals/ProjectAccessProposal.tsx:33— ProjectAccessProposal.Proposal has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 14 (29 pts), boolean chains 20, if/else 5 (nesting depth added 15). Of this number, 43 points are the body's own statements and 11 belong to 6 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.
sandbox-callback-bridge.startSandboxCallbackBridgeWorker.loop (cognitive 53) REDACTED:1487— sandbox-callback-bridge.startSandboxCallbackBridgeWorker.loop has cognitive complexity 53 (threshold 15). Drivers by points: if/else 13 (23 pts), error handling 5 (12 pts), ternaries 3 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 26). None of this is in the body itself: all 53 points belong to 2 function literals inside it that branch (lines 1487, 1492). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
format-event.printItemCompleted (cognitive 53) packages/adapters/codex-local/src/cli/format-event.ts:59— format-event.printItemCompleted has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 12 (26 pts), if/else 13 (19 pts), boolean chains 5, error handling 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.
format-event.printCodexStreamEvent (cognitive 53) packages/adapters/codex-local/src/cli/format-event.ts:143— format-event.printCodexStreamEvent has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 10 (28 pts), if/else 14 (21 pts), boolean chains 3, error handling 1 (nesting depth added 25). 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.
parse.createCursorJsonlParser (cognitive 53) packages/adapters/cursor-local/src/server/parse.ts:68— parse.createCursorJsonlParser has cognitive complexity 53 (threshold 15). Drivers by points: if/else 20 (45 pts), boolean chains 6, loops 1, ternaries 1 (nesting depth added 25). None of this is in the body itself: all 53 points belong to 4 function items inside it that branch (a function literal at line 112, addCost, addUsage, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
opencode-server-driver.startRuntime (cognitive 53) REDACTED:2263— opencode-server-driver.startRuntime has cognitive complexity 53 (threshold 15). Drivers by points: if/else 18 (22 pts), ternaries 9 (10 pts), boolean chains 9, error handling 6 (9 pts), loops 2 (3 pts) (nesting depth added 9). Of this number, 31 points are the body's own statements and 22 belong to 4 function items inside it that branch. 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.
HarnessNativeSession.events (cognitive 53) packages/paperclip-runner/src/backends/harness-driver-backend.ts:512— HarnessNativeSession.events has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (21 pts), ternaries 6 (18 pts), boolean chains 10, loops 2 (3 pts), error handling 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.
pi-runtime-extension.askPiNativeQuestion (cognitive 53) packages/paperclip-runner/src/drivers/acpx/pi-runtime-extension.ts:205— pi-runtime-extension.askPiNativeQuestion has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (24 pts), ternaries 9 (18 pts), boolean chains 11 (nesting depth added 17). Of this number, 48 points are the body's own statements and 5 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.
execution-blocker.getExecutionBlocker (cognitive 53) server/src/services/execution-blocker.ts:108— execution-blocker.getExecutionBlocker has cognitive complexity 53 (threshold 15). Drivers by points: boolean chains 23, ternaries 15 (16 pts), if/else 12 (14 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.
chat-github-attachments.githubPublicAttachmentsFromMessage (cognitive 53) REDACTED:288— chat-github-attachments.githubPublicAttachmentsFromMessage has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 18, loops 4 (8 pts), ternaries 3 (nesting depth added 12). Of this number, 47 points are the body's own statements and 6 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.
chat-sdk-runtime.registerCallbacks (cognitive 53) server/src/services/chat-sdk-runtime.ts:1841— chat-sdk-runtime.registerCallbacks has cognitive complexity 53 (threshold 15). Drivers by points: if/else 22 (35 pts), ternaries 7 (14 pts), boolean chains 4 (nesting depth added 20). Most of this is not in the body itself: 8 of the 53 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 1923, 1988, 1855, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tool-access-policy.evaluatePolicyConditions (cognitive 53) server/src/services/tool-access-policy.ts:510— tool-access-policy.evaluatePolicyConditions has cognitive complexity 53 (threshold 15). Drivers by points: if/else 24 (40 pts), boolean chains 13 (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.
fast-responses.fastResponseService.process (cognitive 53) server/src/services/fast-responses.ts:664— fast-responses.fastResponseService.process has cognitive complexity 53 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 10 (17 pts), boolean chains 12, error handling 4 (5 pts), loops 1 (2 pts) (nesting depth added 15). Of this number, 33 points are the body's own statements and 20 belong to 3 function literals 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.
access-finalization.createOAuthAccessFinalization::finalizeOAuthAccess (cognitive 53) server/src/services/tool-access/oauth/access-finalization.ts:34— access-finalization.createOAuthAccessFinalization::finalizeOAuthAccess has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (28 pts), ternaries 9 (11 pts), boolean chains 8, loops 2 (4 pts), error handling 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.
agent-instruction-working-copies.agentInstructionWorkingCopyService.prepare (cognitive 53) server/src/services/agent-instruction-working-copies.ts:104— agent-instruction-working-copies.agentInstructionWorkingCopyService.prepare has cognitive complexity 53 (threshold 15). Drivers by points: if/else 20 (32 pts), boolean chains 13, ternaries 6 (7 pts), loops 1 (nesting depth added 13). Of this number, 49 points are the body's own statements and 4 belong to one function literal 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.
native-runner-file-handoff.scrubNativeRunnerStagingResidue (cognitive 53) server/src/services/native-runtime/native-runner-file-handoff.ts:491— native-runner-file-handoff.scrubNativeRunnerStagingResidue has cognitive complexity 53 (threshold 15). Drivers by points: if/else 18 (44 pts), boolean chains 5, loops 2 (3 pts), error handling 1 (nesting depth added 27). Of this number, 51 points are the body's own statements and 2 belong to one function literal 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.
PaperclipRunnerToolAuthority.#createTask (cognitive 53) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:1434— PaperclipRunnerToolAuthority.#createTask has cognitive complexity 53 (threshold 15). Drivers by points: if/else 19 (25 pts), ternaries 16 (18 pts), boolean chains 10 (nesting depth added 8). Of this number, 20 points are the body's own statements and 33 belong to 2 function items inside it that branch. 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.
plugin.executeInSession (cognitive 53) packages/plugins/sandbox-providers/daytona/src/plugin.ts:2218— plugin.executeInSession has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 13 (30 pts), if/else 10 (16 pts), boolean chains 3, error handling 3, loops 1 (nesting depth added 23). Of this number, 47 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.
storybook-catalog.validateCatalog (cognitive 53) scripts/storybook-catalog.mjs:83— storybook-catalog.validateCatalog has cognitive complexity 53 (threshold 15). Drivers by points: if/else 19 (40 pts), boolean chains 10, loops 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.
GrokBotSetupContent.GrokBotSetupContent (cognitive 53) ui/src/components/new-agent/GrokBotSetupContent.tsx:27— GrokBotSetupContent.GrokBotSetupContent has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 12 (28 pts), boolean chains 25 (nesting depth added 16). Of this number, 51 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
SidebarAgents.SidebarAgents (cognitive 53) ui/src/components/SidebarAgents.tsx:297— SidebarAgents.SidebarAgents has cognitive complexity 53 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 13, ternaries 9 (10 pts), loops 6 (nesting depth added 7). Most of this is not in the body itself: 10 of the 53 points are its own statements and the rest belongs to 22 function items inside it that branch (a function literal at line 481, a function literal at line 327, a function literal at line 409, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SidebarAgents.production.SidebarAgents (cognitive 53) ui/src/components/SidebarAgents.production.tsx:297— SidebarAgents.production.SidebarAgents has cognitive complexity 53 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 13, ternaries 9 (10 pts), loops 6 (nesting depth added 7). Most of this is not in the body itself: 10 of the 53 points are its own statements and the rest belongs to 22 function items inside it that branch (a function literal at line 481, a function literal at line 327, a function literal at line 409, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TaskMessageScroller.TaskMessageScroller (cognitive 53) ui/src/components/task-chat/TaskMessageScroller.tsx:47— TaskMessageScroller.TaskMessageScroller has cognitive complexity 53 (threshold 15). Drivers by points: if/else 34 (38 pts), ternaries 6 (9 pts), boolean chains 6 (nesting depth added 7). Most of this is not in the body itself: 6 of the 53 points are its own statements and the rest belongs to 16 function literals inside it that branch (lines 127, 146, 244, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SkillSourceTree.SkillSourceTree (cognitive 53) ui/src/pages/skills/SkillSourceTree.tsx:55— SkillSourceTree.SkillSourceTree has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 11 (20 pts), if/else 13 (16 pts), boolean chains 15, loops 1 (2 pts) (nesting depth added 13). Most of this is not in the body itself: 8 of the 53 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 138, toggleCheck, a function literal at line 122, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
InstanceAccess.InstanceAccess (cognitive 53) ui/src/pages/InstanceAccess.tsx:14— InstanceAccess.InstanceAccess has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 11 (29 pts), if/else 10 (13 pts), boolean chains 11 (nesting depth added 21). Of this number, 36 points are the body's own statements and 17 belong to 7 function literals 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.
TeamCatalog.TeamCatalog (cognitive 53) ui/src/pages/TeamCatalog.tsx:2260— TeamCatalog.TeamCatalog has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 12 (22 pts), boolean chains 20, if/else 9 (10 pts), loops 1 (nesting depth added 11). Of this number, 35 points are the body's own statements and 18 belong to 9 function literals 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.
LiveConsole.LiveConsole (cognitive 52) packages/paperclip-runner/devtools/browser/src/live/LiveConsole.tsx:65— LiveConsole.LiveConsole has cognitive complexity 52 (threshold 15). Drivers by points: ternaries 26 (34 pts), if/else 12, boolean chains 6 (nesting depth added 8). Of this number, 25 points are the body's own statements and 27 belong to 9 function items inside it that branch. 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.
provider-events.canonicalProviderEventsFromOpenCodePart (cognitive 52) packages/paperclip-runner/src/provider-events.ts:1006— provider-events.canonicalProviderEventsFromOpenCodePart has cognitive complexity 52 (threshold 15). Drivers by points: ternaries 17 (44 pts), boolean chains 4, if/else 4 (nesting depth added 27). 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.
authorization.createAuthorizationService.decideLowTrustAccess (cognitive 52) server/src/services/authorization.ts:1256— authorization.createAuthorizationService.decideLowTrustAccess has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (33 pts), boolean chains 10, ternaries 4 (9 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
voice-session-service.voiceSessionService.start (cognitive 52) server/src/services/voice/voice-session-service.ts:48— voice-session-service.voiceSessionService.start has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (21 pts), ternaries 8 (12 pts), boolean chains 9, error handling 4 (7 pts), loops 1 (3 pts) (nesting depth added 16). Of this number, 29 points are the body's own statements and 23 belong to one function literal 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.
maintenance.createTelegramMaintenance.processTelegramMaintenance (cognitive 52) server/src/services/chat-channels/telegram/maintenance.ts:212— maintenance.createTelegramMaintenance.processTelegramMaintenance has cognitive complexity 52 (threshold 15). Drivers by points: if/else 25 (34 pts), boolean chains 9, ternaries 4 (8 pts), error handling 1 (nesting depth added 13). Of this number, 48 points are the body's own statements and 4 belong to 3 function literals 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.
git-workspace-restoration.assertReproducibleGitFiles (cognitive 52) server/src/services/git-workspace-restoration.ts:488— git-workspace-restoration.assertReproducibleGitFiles has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (30 pts), boolean chains 8, loops 6 (8 pts), ternaries 3 (6 pts) (nesting depth added 18). Of this number, 39 points are the body's own statements and 13 belong to 5 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.
speko-tool-setup.configureSpekoSessionTools (cognitive 52) server/src/services/voice/speko-tool-setup.ts:9— speko-tool-setup.configureSpekoSessionTools has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 16, ternaries 2 (6 pts), error handling 2 (3 pts), loops 2 (nesting depth added 17). Of this number, 51 points are the body's own statements and 1 belongs to one function literal 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.
webhook-authentication.createGitHubWebhookAuthentication.authenticateGitHubWebhook (cognitive 52) server/src/services/chat-channels/github/webhook-authentication.ts:56— webhook-authentication.createGitHubWebhookAuthentication.authenticateGitHubWebhook has cognitive complexity 52 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 12, error handling 6 (9 pts), ternaries 2 (4 pts) (nesting depth added 13). Of this number, 25 points are the body's own statements and 27 belong to 2 function literals 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.
runner-goals.runnerGoalService.act (cognitive 52) server/src/services/runner-goals.ts:351— runner-goals.runnerGoalService.act has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (23 pts), ternaries 12 (21 pts), boolean chains 5, loops 1 (2 pts), error handling 1 (nesting depth added 13). Of this number, 28 points are the body's own statements and 24 belong to 2 function literals 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.
native-session-executor.nativeFailedRunRetryStateIsSafe (cognitive 52) server/src/services/native-runtime/native-session-executor.ts:4125— native-session-executor.nativeFailedRunRetryStateIsSafe has cognitive complexity 52 (threshold 15). Drivers by points: if/else 18 (33 pts), boolean chains 10, loops 2 (4 pts), error handling 2 (3 pts), ternaries 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.
ExternalAgentInviteDialog.MuseInvitationController (cognitive 52) ui/src/components/new-agent/ExternalAgentInviteDialog.tsx:152— ExternalAgentInviteDialog.MuseInvitationController has cognitive complexity 52 (threshold 15). Drivers by points: boolean chains 21, ternaries 13 (16 pts), if/else 14 (15 pts) (nesting depth added 4). Of this number, 31 points are the body's own statements and 21 belong to 9 function items inside it that branch. 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.
workflow-sort.workflowSort (cognitive 52) ui/src/lib/workflow-sort.ts:19— workflow-sort.workflowSort has cognitive complexity 52 (threshold 15). Drivers by points: if/else 18 (38 pts), loops 10 (12 pts), boolean chains 2 (nesting depth added 22). Of this number, 37 points are the body's own statements and 15 belong to 3 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.
Agents.Agents (cognitive 52) ui/src/pages/Agents.tsx:188— Agents.Agents has cognitive complexity 52 (threshold 15). Drivers by points: boolean chains 29, if/else 7 (10 pts), ternaries 9, loops 4 (nesting depth added 3). Of this number, 22 points are the body's own statements and 30 belong to 10 function items inside it that branch. 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.
TrustPresetSection.TrustPresetSection (cognitive 52) ui/src/components/TrustPresetSection.tsx:53— TrustPresetSection.TrustPresetSection has cognitive complexity 52 (threshold 15). Drivers by points: ternaries 18 (43 pts), boolean chains 7, if/else 2 (nesting depth added 25). Of this number, 48 points are the body's own statements and 4 belong to 3 function items inside it that branch. 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.
PasteConfigTab.PasteConfigTab (cognitive 52) ui/src/pages/tools/PasteConfigTab.tsx:103— PasteConfigTab.PasteConfigTab has cognitive complexity 52 (threshold 15). Drivers by points: ternaries 17 (28 pts), if/else 9 (11 pts), boolean chains 7, loops 3 (4 pts), error handling 2 (nesting depth added 14). Of this number, 23 points are the body's own statements and 29 belong to 10 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.
ManagedSlackSetup.ManagedSlackSetup (cognitive 52) ui/src/pages/apps/chat/slack/ManagedSlackSetup.tsx:14— ManagedSlackSetup.ManagedSlackSetup has cognitive complexity 52 (threshold 15). Drivers by points: boolean chains 22, ternaries 12 (22 pts), if/else 7, error handling 1 (nesting depth added 10). Of this number, 35 points are the body's own statements and 17 belong to 5 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.
CompanyExport.filterPaperclipYaml (cognitive 52) ui/src/pages/CompanyExport.tsx:95— CompanyExport.filterPaperclipYaml has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (41 pts), boolean chains 10, loops 1 (nesting depth added 24). Of this number, 48 points are the body's own statements and 4 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.
server.promptServer (cognitive 51) cli/src/prompts/server.ts:15— server.promptServer has cognitive complexity 51 (threshold 15). Drivers by points: if/else 19 (26 pts), boolean chains 11, ternaries 3 (8 pts), error handling 3 (6 pts) (nesting depth added 15). Of this number, 26 points are the body's own statements and 25 belong to 5 function literals 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.
git-workspace-sync.integrateImportedGitHead (cognitive 51) packages/adapter-utils/src/git-workspace-sync.ts:936— git-workspace-sync.integrateImportedGitHead has cognitive complexity 51 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 10, error handling 4 (10 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 24). Of this number, 49 points are the body's own statements and 2 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.
ui.parseAcpxStdoutLine (cognitive 51) packages/adapter-utils/src/acpx-engine/ui.ts:56— ui.parseAcpxStdoutLine has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 8 (21 pts), if/else 13 (17 pts), boolean chains 13 (nesting depth added 17). Of this number, 29 points are the body's own statements and 22 belong to one function literal 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.
execute.buildClaudeRuntimeConfig (cognitive 51) packages/adapters/claude-local/src/server/execute.ts:177— execute.buildClaudeRuntimeConfig has cognitive complexity 51 (threshold 15). Drivers by points: boolean chains 22, if/else 17 (20 pts), ternaries 8, loops 1 (nesting depth added 3). Of this number, 46 points are the body's own statements and 5 belong to 5 function literals inside it that branch. 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.
materialize-copilot-binary.writeCopilotMaterialization (cognitive 51) packages/paperclip-runner/scripts/materialize-copilot-binary.mjs:64— materialize-copilot-binary.writeCopilotMaterialization has cognitive complexity 51 (threshold 15). Drivers by points: if/else 11 (27 pts), error handling 4 (10 pts), boolean chains 7, loops 3 (5 pts), ternaries 1 (2 pts) (nesting depth added 25). Of this number, 48 points are the body's own statements and 3 belong to 3 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.
CodexAcpxSession.dispatchTool (cognitive 51) REDACTED:1125— CodexAcpxSession.dispatchTool has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 12, ternaries 3 (10 pts), error handling 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.
voice-inbound-service.voiceInboundService.lifecycle (cognitive 51) server/src/services/voice/voice-inbound-service.ts:93— voice-inbound-service.voiceInboundService.lifecycle has cognitive complexity 51 (threshold 15). Drivers by points: if/else 18 (29 pts), boolean chains 13, ternaries 4 (9 pts) (nesting depth added 16). Of this number, 25 points are the body's own statements and 26 belong to 2 function literals 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.
tool-gateway.createToolGatewayService.writeAudit (cognitive 51) server/src/services/tool-gateway.ts:1810— tool-gateway.createToolGatewayService.writeAudit has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 21 (44 pts), boolean chains 6, error handling 1 (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.
completion.createSlackCompletion.resumeLocked (cognitive 51) server/src/services/connectors/slack/setup/completion.ts:102— completion.createSlackCompletion.resumeLocked has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 8 (29 pts), if/else 9 (12 pts), boolean chains 8, error handling 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.
setup-probes.createSetupProbes.test (cognitive 51) server/src/services/chat-channels/setup-probes.ts:97— setup-probes.createSetupProbes.test has cognitive complexity 51 (threshold 15). Drivers by points: if/else 18 (29 pts), boolean chains 11, ternaries 5 (8 pts), loops 1 (3 pts) (nesting depth added 16). Most of this is not in the body itself: 1 of the 51 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 102, 291, 243). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspaces.prepareProjectRepositoryWorkspaces (cognitive 51) server/src/services/heartbeat/workspaces.ts:499— workspaces.prepareProjectRepositoryWorkspaces has cognitive complexity 51 (threshold 15). Drivers by points: if/else 13 (24 pts), ternaries 7 (14 pts), boolean chains 11, loops 2 (nesting depth added 18). Of this number, 49 points are the body's own statements and 2 belong to one function literal 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.
connection-intents.connectionIntentService.search::aggregatorAlternatives (cognitive 51) server/src/services/connection-intents.ts:530— connection-intents.connectionIntentService.search::aggregatorAlternatives has cognitive complexity 51 (threshold 15). Drivers by points: if/else 6 (19 pts), ternaries 5 (16 pts), loops 3 (9 pts), boolean chains 7 (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. This shape REPEATS in the file: one other method here (connection-intents.connectionIntentService.search) 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.
workspace-file-resources.workspaceFileResourceService.list (cognitive 51) server/src/services/workspace-file-resources.ts:1452— workspace-file-resources.workspaceFileResourceService.list has cognitive complexity 51 (threshold 15). Drivers by points: if/else 13 (32 pts), boolean chains 9, ternaries 4 (7 pts), error handling 1 (2 pts), 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.
company-skills.readUrlSkillImports (cognitive 51) server/src/services/company-skills.ts:1631— company-skills.readUrlSkillImports has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 14 (36 pts), if/else 5 (9 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 27). Of this number, 41 points are the body's own statements and 10 belong to 4 function literals 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.
native-workspace-sync.prepareNativeWorkspaceSync (cognitive 51) server/src/services/native-runtime/native-workspace-sync.ts:890— native-workspace-sync.prepareNativeWorkspaceSync has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 9, ternaries 4 (8 pts), error handling 2 (5 pts) (nesting depth added 21). Of this number, 50 points are the body's own statements and 1 belongs to one function literal 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.
queue.createHeartbeatQueue.withChatControlRecoveryGate (cognitive 51) server/src/services/heartbeat/queue.ts:695— queue.createHeartbeatQueue.withChatControlRecoveryGate has cognitive complexity 51 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 13, ternaries 7 (13 pts), error handling 1 (nesting depth added 13). Of this number, 22 points are the body's own statements and 29 belong to one function literal 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.
decision-models.decisionModelService.resolve (cognitive 51) server/src/services/decision-models.ts:86— decision-models.decisionModelService.resolve has cognitive complexity 51 (threshold 15). Drivers by points: if/else 19 (25 pts), ternaries 9 (17 pts), boolean chains 9 (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.
check-module-boundaries.scanModuleBoundaries (cognitive 51) scripts/check-module-boundaries.mjs:92— check-module-boundaries.scanModuleBoundaries has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 12, loops 2 (3 pts), ternaries 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.
file-resources.fileResourceRoutes (cognitive 51) server/src/routes/file-resources.ts:351— file-resources.fileResourceRoutes has cognitive complexity 51 (threshold 15). Drivers by points: error handling 19 (20 pts), if/else 13 (20 pts), boolean chains 7, ternaries 4 (nesting depth added 8). None of this is in the body itself: all 51 points belong to 5 function items inside it that branch (a function literal at line 529, a function literal at line 774, a function literal at line 661, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
execution-workspaces.executionWorkspaceRoutes::handleExecutionWorkspaceRuntimeCommand (cognitive 51) server/src/routes/execution-workspaces.ts:286— execution-workspaces.executionWorkspaceRoutes::handleExecutionWorkspaceRuntimeCommand has cognitive complexity 51 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 13, ternaries 9 (12 pts), error handling 2 (4 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.
IssueThreadInteractionCard.SuggestTasksCard (cognitive 51) ui/src/components/IssueThreadInteractionCard.tsx:717— IssueThreadInteractionCard.SuggestTasksCard has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 17 (35 pts), boolean chains 6, if/else 4, loops 3 (4 pts), error handling 2 (nesting depth added 19). Of this number, 40 points are the body's own statements and 11 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.
IssueChatThread.IssueChatChainOfThought (cognitive 51) ui/src/components/IssueChatThread.tsx:1204— IssueChatThread.IssueChatChainOfThought has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 20 (36 pts), if/else 6 (8 pts), boolean chains 7 (nesting depth added 18). Of this number, 48 points are the body's own statements and 3 belong to 3 function literals 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.
run.runControlledEval (cognitive 50) packages/paperclip-runner/scripts/controlled-evals/run.mjs:64— run.runControlledEval has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 11, error handling 7 (8 pts), ternaries 7 (8 pts), loops 3 (nesting depth added 7). Of this number, 47 points are the body's own statements and 3 belong to 3 function literals inside it that branch. 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.
evidence-classifier.classifyEvidenceRef (cognitive 50) server/src/services/native-runtime/evidence-classifier.ts:105— evidence-classifier.classifyEvidenceRef has cognitive complexity 50 (threshold 15). Drivers by points: if/else 18 (30 pts), ternaries 6 (14 pts), boolean chains 6 (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.
execution-workspaces.executionWorkspaceService.assessDelivery (cognitive 50) server/src/services/execution-workspaces.ts:1925— execution-workspaces.executionWorkspaceService.assessDelivery has cognitive complexity 50 (threshold 15). Drivers by points: if/else 9 (26 pts), boolean chains 12, loops 3 (6 pts), ternaries 3 (6 pts) (nesting depth added 23). Of this number, 49 points are the body's own statements and 1 belongs to one function literal 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.
execution-workspaces.executionWorkspaceService.reconcileExecutionWorkspaceBranch (cognitive 50) server/src/services/execution-workspaces.ts:4775— execution-workspaces.executionWorkspaceService.reconcileExecutionWorkspaceBranch has cognitive complexity 50 (threshold 15). Drivers by points: if/else 18 (28 pts), ternaries 9 (13 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 15). Most of this is not in the body itself: 9 of the 50 points are its own statements and the rest belongs to one function literal inside it that branches (line 4846). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
chat-teams-inline-images.jpeg (cognitive 50) server/src/services/chat-teams-inline-images.ts:110— chat-teams-inline-images.jpeg has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (28 pts), boolean chains 13, loops 4 (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.
authorization.createChatPublicationAuthorization.claimPublicationTransportAuthorization (cognitive 50) server/src/services/chat-channels/publications/authorization.ts:58— authorization.createChatPublicationAuthorization.claimPublicationTransportAuthorization has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 15, error handling 2 (4 pts), ternaries 4 (nesting depth added 12). None of this is in the body itself: all 50 points belong to one function literal inside it that branches (line 69). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
chat-telegram-photo.supportedJpeg (cognitive 50) server/src/services/chat-telegram-photo.ts:103— chat-telegram-photo.supportedJpeg has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (28 pts), boolean chains 13, loops 4 (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.
chat-channels.chatChannelService.handleWebhook (cognitive 50) server/src/services/chat-channels.ts:2873— chat-channels.chatChannelService.handleWebhook has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (31 pts), ternaries 6 (12 pts), boolean chains 5, error handling 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.
agent-auth-jwt.verifyLocalAgentJwt (cognitive 50) server/src/agent-auth-jwt.ts:166— agent-auth-jwt.verifyLocalAgentJwt has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 21 (23 pts), if/else 15, boolean chains 12 (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.
workspace-file-resources.enumerateWorkspaceFiles (cognitive 50) server/src/services/workspace-file-resources.ts:877— workspace-file-resources.enumerateWorkspaceFiles has cognitive complexity 50 (threshold 15). Drivers by points: if/else 13 (37 pts), boolean chains 5, loops 2 (3 pts), ternaries 1 (3 pts), error handling 1 (2 pts) (nesting depth added 28). Of this number, 49 points are the body's own statements and 1 belongs to one function literal 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.
plugin.createPlugin (cognitive 50) packages/plugins/sandbox-providers/createos/src/plugin.ts:55— plugin.createPlugin has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (27 pts), boolean chains 12, error handling 5 (6 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 8). Of this number, 25 points are the body's own statements and 25 belong to 3 function items inside it that branch. 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.
skill-repository-dependencies.skillRepositoryDependencies (cognitive 50) server/src/services/skill-repository-dependencies.ts:8— skill-repository-dependencies.skillRepositoryDependencies has cognitive complexity 50 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 6 (15 pts), boolean chains 6, ternaries 1 (5 pts) (nesting depth added 26). Of this number, 42 points are the body's own statements and 8 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.
native-harness-backup-expiration.nativeHarnessBackupExpirationService.tick (cognitive 50) server/src/services/native-runtime/native-harness-backup-expiration.ts:480— native-harness-backup-expiration.nativeHarnessBackupExpirationService.tick has cognitive complexity 50 (threshold 15). Drivers by points: if/else 13 (30 pts), error handling 3 (8 pts), boolean chains 5, ternaries 2 (5 pts), loops 1 (2 pts) (nesting depth added 26). Of this number, 48 points are the body's own statements and 2 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.
transcript-adapter.phaseSummary (cognitive 50) ui/src/components/task-chat/transcript-adapter.ts:1463— transcript-adapter.phaseSummary has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (24 pts), ternaries 9 (17 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 19). Of this number, 41 points are the body's own statements and 9 belong to 5 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.
IssueScheduledRetryCard.IssueScheduledRetryCard (cognitive 50) ui/src/components/IssueScheduledRetryCard.tsx:27— IssueScheduledRetryCard.IssueScheduledRetryCard has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 23 (35 pts), boolean chains 9, if/else 6 (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.
IssuePropertiesArtifactsTab.IssuePropertiesArtifactsTab (cognitive 50) ui/src/components/issue-properties/IssuePropertiesArtifactsTab.tsx:408— IssuePropertiesArtifactsTab.IssuePropertiesArtifactsTab has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 14 (28 pts), if/else 10 (18 pts), boolean chains 4 (nesting depth added 22). Most of this is not in the body itself: 10 of the 50 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 587, a function literal at line 676, a function literal at line 657, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
acp.testCodexAcpEnvironment (cognitive 49) packages/adapters/codex-local/src/server/acp.ts:520— acp.testCodexAcpEnvironment has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 16 (26 pts), if/else 11 (16 pts), boolean chains 4, loops 1 (2 pts), error handling 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.
replay-contract.bindingIssues (cognitive 49) packages/paperclip-runner/src/protocol/replay-contract.ts:256— replay-contract.bindingIssues has cognitive complexity 49 (threshold 15). Drivers by points: if/else 19 (35 pts), loops 5 (12 pts), boolean chains 2 (nesting depth added 23). Of this number, 32 points are the body's own statements and 17 belong to 2 function literals 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-runner.runCodexCodexTracer (cognitive 49) packages/paperclip-runner/src/mock-core/codex-runner.ts:334— codex-runner.runCodexCodexTracer has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 14 (17 pts), boolean chains 15, if/else 9 (11 pts), error handling 2 (6 pts) (nesting depth added 9). Of this number, 41 points are the body's own statements and 8 belong to 5 function items inside it that branch. 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.
CapabilityLiveSession.#connect (cognitive 49) packages/paperclip-runner/src/live/live-session.ts:2354— CapabilityLiveSession.#connect has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 15 (22 pts), if/else 10 (20 pts), boolean chains 7 (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.
execution-recovery-resolution.settleUnrecoverableExecutions (cognitive 49) server/src/services/execution-recovery-resolution.ts:415— execution-recovery-resolution.settleUnrecoverableExecutions has cognitive complexity 49 (threshold 15). Drivers by points: if/else 10 (23 pts), ternaries 6 (13 pts), boolean chains 9, error handling 1 (2 pts), loops 2 (nesting depth added 21). Most of this is not in the body itself: 8 of the 49 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 460, 423). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tool-gateway.createToolGatewayService.namedGatewayContextProtocol (cognitive 49) server/src/services/tool-gateway.ts:5603— tool-gateway.createToolGatewayService.namedGatewayContextProtocol has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 9 (22 pts), if/else 6 (12 pts), loops 4 (10 pts), boolean chains 5 (nesting depth added 25). Of this number, 46 points are the body's own statements and 3 belong to one function literal 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.
native-broker.createNativeExternalBroker.port.dispatch (cognitive 49) server/src/modules/external-agents/native-broker.ts:227— native-broker.createNativeExternalBroker.port.dispatch has cognitive complexity 49 (threshold 15). Drivers by points: if/else 20 (38 pts), boolean chains 10, ternaries 1 (nesting depth added 18). None of this is in the body itself: all 49 points belong to one function literal inside it that branches (line 229). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
setup-readiness.testNativeRunnerAuthentication (cognitive 49) server/src/services/native-runtime/setup-readiness.ts:189— setup-readiness.testNativeRunnerAuthentication has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 11 (20 pts), if/else 10 (17 pts), boolean chains 9, error handling 2 (3 pts) (nesting depth added 17). Of this number, 47 points are the body's own statements and 2 belong to 3 function literals 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.
service.recoveryService.reconcileActiveRecoveryActions (cognitive 49) REDACTED:3492— service.recoveryService.reconcileActiveRecoveryActions has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (34 pts), boolean chains 7, ternaries 2 (7 pts), loops 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.
service.recoveryService.sweepStaleIssueLocks (cognitive 49) REDACTED:6308— service.recoveryService.sweepStaleIssueLocks has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (21 pts), ternaries 7 (14 pts), loops 7 (9 pts), boolean chains 5 (nesting depth added 19). Of this number, 47 points are the body's own statements and 2 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.
LiveUpdatesProvider.buildActivityToast (cognitive 49) ui/src/context/LiveUpdatesProvider.tsx:979— LiveUpdatesProvider.buildActivityToast has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 19 (35 pts), boolean chains 8, if/else 5 (6 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.
AttentionQueueRow.AttentionQueueRow (cognitive 49) ui/src/components/AttentionQueueRow.tsx:109— AttentionQueueRow.AttentionQueueRow has cognitive complexity 49 (threshold 15). Drivers by points: boolean chains 32, ternaries 9 (13 pts), if/else 4 (nesting depth added 4). Of this number, 38 points are the body's own statements and 11 belong to 3 function items inside it that branch. 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.
GatewaysList.GatewaysList (cognitive 49) ui/src/pages/apps/gateways/GatewaysList.tsx:31— GatewaysList.GatewaysList has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 17 (47 pts), boolean chains 1, if/else 1 (nesting depth added 30). Most of this is not in the body itself: 8 of the 49 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 97, 172, 222, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TaskChatCompactInteractionCard.ConfirmationCard (cognitive 49) ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx:797— TaskChatCompactInteractionCard.ConfirmationCard has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 17 (28 pts), boolean chains 12, if/else 6 (8 pts), error handling 1 (nesting depth added 13). Of this number, 35 points are the body's own statements and 14 belong to 5 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.
BulkAgentSettingsProposal.BulkEditor (cognitive 49) ui/storybook/support/design-proposals/BulkAgentSettingsProposal.tsx:33— BulkAgentSettingsProposal.BulkEditor has cognitive complexity 49 (threshold 15). Drivers by points: boolean chains 30, ternaries 15 (16 pts), if/else 3 (nesting depth added 1). Of this number, 34 points are the body's own statements and 15 belong to 5 function items inside it that branch. 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.
capability-mock-control-plane-adapter.isSemanticToolRuntimeSnapshot (cognitive 48) packages/paperclip-runner/src/mock-core/capability-mock-control-plane-adapter.ts:1897— capability-mock-control-plane-adapter.isSemanticToolRuntimeSnapshot has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 21, ternaries 1 (nesting depth added 8). Most of this is not in the body itself: 6 of the 48 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1923, 2026, 2032). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CapabilityLiveSession.sendMessage (cognitive 48) packages/paperclip-runner/src/live/live-session.ts:1514— CapabilityLiveSession.sendMessage has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (24 pts), boolean chains 9, error handling 5 (8 pts), ternaries 4 (6 pts), loops 1 (nesting depth added 8). Of this number, 46 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
materialize-pi-distribution.materializePiDistribution (cognitive 48) packages/paperclip-runner/scripts/materialize-pi-distribution.mjs:136— materialize-pi-distribution.materializePiDistribution has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (30 pts), ternaries 7 (8 pts), boolean chains 4, loops 3 (4 pts), error handling 2 (nesting depth added 11). Of this number, 42 points are the body's own statements and 6 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.
task-workspace-access.assertTaskWorkspaceExecutionAccess (cognitive 48) server/src/services/task-workspace-access.ts:111— task-workspace-access.assertTaskWorkspaceExecutionAccess has cognitive complexity 48 (threshold 15). Drivers by points: boolean chains 20, ternaries 13 (15 pts), if/else 12, loops 1 (nesting depth added 2). None of this is in the body itself: all 48 points belong to 2 function literals inside it that branch (lines 117, 186). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
evidence-classifier.classifyNativeEvidence (cognitive 48) server/src/services/native-runtime/evidence-classifier.ts:248— evidence-classifier.classifyNativeEvidence has cognitive complexity 48 (threshold 15). Drivers by points: if/else 15 (18 pts), ternaries 13 (16 pts), boolean chains 13, loops 1 (nesting depth added 6). Of this number, 28 points are the body's own statements and 20 belong to 3 function literals inside it that branch. 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.
attachments.downloadPhotonAttachment (cognitive 48) server/src/services/photon/attachments.ts:70— attachments.downloadPhotonAttachment has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 14, error handling 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.
slack-delivery.slackDelivery (cognitive 48) server/src/services/connectors/slack-delivery.ts:18— slack-delivery.slackDelivery has cognitive complexity 48 (threshold 15). Drivers by points: if/else 11 (24 pts), ternaries 5 (14 pts), boolean chains 7, loops 1 (3 pts) (nesting depth added 24). Of this number, 47 points are the body's own statements and 1 belongs to one function literal 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.
plugin-workspaces.preparePluginWorkspace (cognitive 48) server/src/services/plugin-workspaces.ts:165— plugin-workspaces.preparePluginWorkspace has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 17, ternaries 12 (13 pts) (nesting depth added 2). Of this number, 36 points are the body's own statements and 12 belong to 3 function items inside it that branch. 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.
isolated-task-directory-retention.inspectTaskDirectoryFolder (cognitive 48) server/src/services/isolated-task-directory-retention.ts:457— isolated-task-directory-retention.inspectTaskDirectoryFolder has cognitive complexity 48 (threshold 15). Drivers by points: if/else 25 (32 pts), boolean chains 13, ternaries 2, error handling 1 (nesting depth added 7). Of this number, 34 points are the body's own statements and 14 belong to 3 function items inside it that branch. 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.
isolated-repository-rehome.rehomeIsolatedRepositoryWorkspace (cognitive 48) server/src/services/isolated-repository-rehome.ts:382— isolated-repository-rehome.rehomeIsolatedRepositoryWorkspace has cognitive complexity 48 (threshold 15). Drivers by points: if/else 26 (30 pts), boolean chains 11, ternaries 3, error handling 2, loops 1 (2 pts) (nesting depth added 5). Most of this is not in the body itself: 4 of the 48 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 389, 475, 459). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-deliverable-feedback.validateNativeDeliverableEvidence (cognitive 48) server/src/services/native-runtime/native-deliverable-feedback.ts:191— native-deliverable-feedback.validateNativeDeliverableEvidence has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 16, ternaries 2 (5 pts), loops 1 (nesting depth added 16). Of this number, 41 points are the body's own statements and 7 belong to one function literal 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.
company-skills.companySkillService.createLocalSkill (cognitive 48) server/src/services/company-skills.ts:4524— company-skills.companySkillService.createLocalSkill has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (20 pts), ternaries 14 (18 pts), boolean chains 5, loops 2 (4 pts), error handling 1 (nesting depth added 13). Most of this is not in the body itself: 11 of the 48 points are its own statements and the rest belongs to one function literal inside it that branches (line 4563). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-session-executor.verifyStoppedNativeSessionForContinuation (cognitive 48) server/src/services/native-runtime/native-session-executor.ts:2783— native-session-executor.verifyStoppedNativeSessionForContinuation has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 16, loops 4 (5 pts), error handling 2 (nesting depth added 9). Of this number, 44 points are the body's own statements and 4 belong to 5 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.
events.createPublicMcpEvents.subscribe (cognitive 48) server/src/services/public-mcp/events.ts:100— events.createPublicMcpEvents.subscribe has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (24 pts), ternaries 8 (12 pts), boolean chains 10, loops 1 (2 pts) (nesting depth added 12). Most of this is not in the body itself: 14 of the 48 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 157, 113). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
muse-qualification.collect (cognitive 48) scripts/smoke/muse-qualification.ts:81— muse-qualification.collect has cognitive complexity 48 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 13, loops 2 (3 pts), ternaries 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.
IssueChatThread.IssueChatProviderActivity (cognitive 48) ui/src/components/IssueChatThread.tsx:1726— IssueChatThread.IssueChatProviderActivity has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 25 (38 pts), boolean chains 10 (nesting depth added 13). Of this number, 27 points are the body's own statements and 21 belong to 3 function literals 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.
IssueChatThread.IssueChatSystemMessage (cognitive 48) ui/src/components/IssueChatThread.tsx:3722— IssueChatThread.IssueChatSystemMessage has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 22 (32 pts), boolean chains 10, if/else 5 (6 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.
IssueChatThread.IssueChatComposer (cognitive 48) ui/src/components/IssueChatThread.tsx:4649— IssueChatThread.IssueChatComposer has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 67 (114 pts), if/else 67 (94 pts), boolean chains 62, error handling 3 (4 pts), loops 1 (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. This shape REPEATS in the file: 2 other methods here (IssueChatThread.IssueChatComposer::submitComment, IssueChatThread.IssueChatComposer::attachFile) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
FeedCard.resolveContent (cognitive 48) ui/src/components/FeedCard.tsx:287— FeedCard.resolveContent has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 13 (35 pts), if/else 7 (8 pts), boolean chains 5 (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.
CompanyImport.importAdapterValues (cognitive 48) ui/src/pages/CompanyImport.tsx:573— CompanyImport.importAdapterValues has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 23 (38 pts), boolean chains 10 (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.
Agents.production.Agents (cognitive 48) ui/src/pages/Agents.production.tsx:175— Agents.production.Agents has cognitive complexity 48 (threshold 15). Drivers by points: boolean chains 27, if/else 7 (10 pts), ternaries 6, loops 5 (nesting depth added 3). Of this number, 20 points are the body's own statements and 28 belong to 9 function items inside it that branch. 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.
format-event.printCursorStreamEvent (cognitive 47) packages/adapters/cursor-local/src/cli/format-event.ts:198— format-event.printCursorStreamEvent has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19 (25 pts), ternaries 6 (16 pts), boolean chains 5, error handling 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.
report.summarizeControlledCampaign (cognitive 47) packages/paperclip-runner/scripts/controlled-evals/report.mjs:7— report.summarizeControlledCampaign has cognitive complexity 47 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 6 (12 pts), boolean chains 8, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 20). Of this number, 38 points are the body's own statements and 9 belong to 3 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.
provider-assets-root.resolveRunnerProviderAssetsRoot (cognitive 47) REDACTED:19— provider-assets-root.resolveRunnerProviderAssetsRoot has cognitive complexity 47 (threshold 15). Drivers by points: if/else 23 (40 pts), boolean chains 4, error handling 1 (2 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.
PaperclipSemanticDispatcher.dispatch (cognitive 47) packages/paperclip-runner/src/semantic-tools/paperclip-dispatcher.ts:156— PaperclipSemanticDispatcher.dispatch has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (23 pts), error handling 6 (10 pts), boolean chains 7, ternaries 5 (7 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.
interactions.publishPhotonPrompt (cognitive 47) server/src/services/photon/interactions.ts:145— interactions.publishPhotonPrompt has cognitive complexity 47 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 15, ternaries 9, loops 2 (3 pts) (nesting depth added 10). Of this number, 37 points are the body's own statements and 10 belong to 4 function literals 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.
chat-run-publications.enqueueSafeNativeChatProgress (cognitive 47) server/src/services/chat-run-publications.ts:283— chat-run-publications.enqueueSafeNativeChatProgress has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (40 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 28). Most of this is not in the body itself: 12 of the 47 points are its own statements and the rest belongs to one function literal inside it that branches (line 421). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
tool-gateway.createToolGatewayService.approveActionRequest (cognitive 47) server/src/services/tool-gateway.ts:9837— tool-gateway.createToolGatewayService.approveActionRequest has cognitive complexity 47 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 12, error handling 3 (6 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.
isolated-task-directory-retention.expireIsolatedTaskDirectory (cognitive 47) server/src/services/isolated-task-directory-retention.ts:186— isolated-task-directory-retention.expireIsolatedTaskDirectory has cognitive complexity 47 (threshold 15). Drivers by points: if/else 27 (40 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1 (nesting depth added 14). Most of this is not in the body itself: 13 of the 47 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 207, 265). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
failures.sanitizeHttpFailure (cognitive 47) server/src/services/tool-access/catalog/failures.ts:46— failures.sanitizeHttpFailure has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (32 pts), boolean chains 9, ternaries 2 (6 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.
workspace-file-resources.workspaceFileResourceService.visibleCandidates (cognitive 47) server/src/services/workspace-file-resources.ts:1045— workspace-file-resources.workspaceFileResourceService.visibleCandidates has cognitive complexity 47 (threshold 15). Drivers by points: if/else 11 (36 pts), boolean chains 5, error handling 1 (3 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 28). 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.
native-workspace-finalizer.resumeNativeWorkspaceFinalization (cognitive 47) server/src/services/native-runtime/native-workspace-finalizer.ts:52— native-workspace-finalizer.resumeNativeWorkspaceFinalization has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (21 pts), ternaries 8 (14 pts), boolean chains 9, error handling 2 (3 pts) (nesting depth added 13). Most of this is not in the body itself: 3 of the 47 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 153, 82). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
service.recoveryService.reconcileResolvedDependencyWakeBackstop (cognitive 47) REDACTED:5759— service.recoveryService.reconcileResolvedDependencyWakeBackstop has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (31 pts), ternaries 4 (5 pts), boolean chains 4, loops 3 (4 pts), error handling 1 (3 pts) (nesting depth added 20). Of this number, 44 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.
queue.createHeartbeatQueue.startNextQueuedRunForAgent (cognitive 47) server/src/services/heartbeat/queue.ts:1960— queue.createHeartbeatQueue.startNextQueuedRunForAgent has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (22 pts), ternaries 14 (20 pts), error handling 1 (2 pts), loops 2, boolean chains 1 (nesting depth added 14). Most of this is not in the body itself: 1 of the 47 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 1969, 2031, 2115). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
status-cards.statusCardRoutes (cognitive 47) server/src/routes/status-cards.ts:19— status-cards.statusCardRoutes has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19, ternaries 16 (18 pts), boolean chains 5, error handling 3 (5 pts) (nesting depth added 4). None of this is in the body itself: all 47 points belong to 17 function items inside it that branch (enqueueRefresh, enqueueCompile, a function literal at line 181, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
Dashboard.Dashboard (cognitive 47) ui/src/pages/Dashboard.tsx:76— Dashboard.Dashboard has cognitive complexity 47 (threshold 15). Drivers by points: loops 13 (15 pts), if/else 10 (11 pts), boolean chains 10, ternaries 6 (9 pts), error handling 1 (2 pts) (nesting depth added 7). Of this number, 20 points are the body's own statements and 27 belong to 14 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.
cron-fires.parseField (cognitive 47) ui/src/lib/cron-fires.ts:45— cron-fires.parseField has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (33 pts), loops 4 (10 pts), boolean chains 4 (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.
SubscriptionCostCard.SubscriptionCostCard (cognitive 47) ui/src/components/SubscriptionCostCard.tsx:66— SubscriptionCostCard.SubscriptionCostCard has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 16 (31 pts), boolean chains 15, if/else 1 (nesting depth added 15). Of this number, 23 points are the body's own statements and 24 belong to 2 function literals 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.
Browse.ConnectorCard (cognitive 47) ui/src/pages/apps/Browse.tsx:1053— Browse.ConnectorCard has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 21 (33 pts), boolean chains 14 (nesting depth added 12). Of this number, 23 points are the body's own statements and 24 belong to 11 function literals 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.
CompanySkills.SkillPane (cognitive 47) ui/src/pages/CompanySkills.tsx:3605— CompanySkills.SkillPane has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 15 (25 pts), boolean chains 19, if/else 2 (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.
CompanySkills.production.SkillPane (cognitive 47) ui/src/pages/CompanySkills.production.tsx:3683— CompanySkills.production.SkillPane has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 15 (25 pts), boolean chains 19, if/else 2 (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.
TaskChatCompactInteractionCard.ItemVerdictsCard (cognitive 47) ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx:1561— TaskChatCompactInteractionCard.ItemVerdictsCard has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 16 (19 pts), boolean chains 14, if/else 11 (12 pts), error handling 1, loops 1 (nesting depth added 4). Of this number, 23 points are the body's own statements and 24 belong to 11 function items inside it that branch. 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.
agent.installSkillsForTarget (cognitive 46) cli/src/commands/client/agent.ts:126— agent.installSkillsForTarget has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 4 (20 pts), if/else 6 (13 pts), error handling 3 (11 pts), boolean chains 1, 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.
cli.printAcpxStreamEvent (cognitive 46) packages/adapter-utils/src/acpx-engine/cli.ts:51— cli.printAcpxStreamEvent has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (25 pts), ternaries 8 (16 pts), boolean chains 5 (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.
format-event.printAssistantMessage (cognitive 46) packages/adapters/cursor-local/src/cli/format-event.ts:51— format-event.printAssistantMessage has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (27 pts), ternaries 4 (11 pts), error handling 1 (4 pts), boolean chains 3, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
codex-security-config.normalizedCodexPlatformManifest (cognitive 46) packages/paperclip-runner/src/drivers/codex/codex-security-config.ts:78— codex-security-config.normalizedCodexPlatformManifest has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (32 pts), boolean chains 9, error handling 1 (4 pts), loops 1 (nesting depth added 25). Of this number, 40 points are the body's own statements and 6 belong to one function literal 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.
stage-release-runner-binaries.main (cognitive 46) packages/paperclip-runner/scripts/stage-release-runner-binaries.mjs:87— stage-release-runner-binaries.main has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (31 pts), boolean chains 11, loops 3, ternaries 1 (nesting depth added 13). Of this number, 42 points are the body's own statements and 4 belong to one function literal 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.
runtime-sandbox.prepareAcpxRuntimeSandbox (cognitive 46) packages/paperclip-runner/src/drivers/acpx/runtime-sandbox.ts:342— runtime-sandbox.prepareAcpxRuntimeSandbox has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 16 (24 pts), if/else 11 (13 pts), boolean chains 9 (nesting depth added 10). Of this number, 38 points are the body's own statements and 8 belong to 3 function literals 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.
cron.parseField (cognitive 46) server/src/services/cron.ts:70— cron.parseField has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (33 pts), loops 4 (10 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.
tool-gateway.createToolGatewayService.findToolForSession (cognitive 46) server/src/services/tool-gateway.ts:2883— tool-gateway.createToolGatewayService.findToolForSession has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (30 pts), boolean chains 8, error handling 1 (4 pts), loops 1 (3 pts), ternaries 1 (nesting depth added 25). Of this number, 43 points are the body's own statements and 3 belong to 2 function literals 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.
tool-gateway.createToolGatewayService.resolveConnectionGrant (cognitive 46) server/src/services/tool-gateway.ts:4563— tool-gateway.createToolGatewayService.resolveConnectionGrant has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (29 pts), boolean chains 10, ternaries 6 (7 pts) (nesting depth added 12). Of this number, 41 points are the body's own statements and 5 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.
workspace-runtime.ensureGitWorktreeBranchCoherent (cognitive 46) server/src/services/workspace-runtime.ts:2123— workspace-runtime.ensureGitWorktreeBranchCoherent has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 8, ternaries 4 (7 pts), error handling 3 (6 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.
installation-lifecycle.createGitHubInstallationLifecycle.applyGitHubInstallationLifecycle (cognitive 46) server/src/services/chat-channels/github/installation-lifecycle.ts:81— installation-lifecycle.createGitHubInstallationLifecycle.applyGitHubInstallationLifecycle has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (18 pts), ternaries 8 (16 pts), boolean chains 11, error handling 1 (nesting depth added 13). Of this number, 23 points are the body's own statements and 23 belong to 3 function literals 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.
aggregator-app-discovery.discoverExecutorApps (cognitive 46) server/src/services/aggregator-app-discovery.ts:96— aggregator-app-discovery.discoverExecutorApps has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 8, ternaries 3 (7 pts), loops 3 (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.
runner-goals.capabilityForAgent (cognitive 46) server/src/services/runner-goals.ts:51— runner-goals.capabilityForAgent has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 15 (34 pts), boolean chains 7, if/else 3 (5 pts) (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.
native-session-executor.verifyWarmTransitionRestart (cognitive 46) server/src/services/native-runtime/native-session-executor.ts:4538— native-session-executor.verifyWarmTransitionRestart has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 17, error handling 3 (4 pts), loops 1, ternaries 1 (nesting depth added 6). Most of this is not in the body itself: 3 of the 46 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 4565, 4839, 4859). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
run-control.createHeartbeatRunControl.resumeSavedLegacyComments (cognitive 46) server/src/services/heartbeat/run-control.ts:620— run-control.createHeartbeatRunControl.resumeSavedLegacyComments has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 11, ternaries 5 (6 pts), loops 1 (2 pts) (nesting depth added 12). Of this number, 26 points are the body's own statements and 20 belong to one function literal 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.
core.assemblePaperclipSourceBundle (cognitive 46) packages/plugins/plugin-llm-wiki/src/wiki/core.ts:2609— core.assemblePaperclipSourceBundle has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 10 (20 pts), if/else 5 (16 pts), loops 3 (7 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.
AgentSetupPrompt.AgentSetupPrompt (cognitive 46) ui/src/components/AgentSetupPrompt.tsx:67— AgentSetupPrompt.AgentSetupPrompt has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 14 (18 pts), if/else 15 (16 pts), boolean chains 11, error handling 1 (nesting depth added 5). Of this number, 22 points are the body's own statements and 24 belong to 11 function items inside it that branch. 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.
ChatEndpointDetail.ChatEndpointDetail (cognitive 46) ui/src/pages/apps/chat/ChatEndpointDetail.tsx:245— ChatEndpointDetail.ChatEndpointDetail has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 28, ternaries 12 (13 pts), if/else 5 (nesting depth added 1). Of this number, 43 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
IdentitiesSection.IdentitiesSection (cognitive 46) ui/src/pages/apps/app-detail/IdentitiesSection.tsx:77— IdentitiesSection.IdentitiesSection has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 18 (36 pts), boolean chains 5, if/else 5 (nesting depth added 18). Of this number, 43 points are the body's own statements and 3 belong to 3 function literals 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.
ImportSkillsFromProjectDialog.ImportSkillsFromProjectDialog (cognitive 46) ui/src/pages/skills/ImportSkillsFromProjectDialog.tsx:278— ImportSkillsFromProjectDialog.ImportSkillsFromProjectDialog has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 15, if/else 15, ternaries 10 (15 pts), error handling 1 (nesting depth added 5). Most of this is not in the body itself: 13 of the 46 points are its own statements and the rest belongs to 14 function items inside it that branch (addBrowsedSkill, a function literal at line 361, a function literal at line 406, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CommentThread.CommentThread (cognitive 46) ui/src/components/CommentThread.tsx:718— CommentThread.CommentThread has cognitive complexity 46 (threshold 15). Drivers by points: if/else 23 (25 pts), boolean chains 10, ternaries 7 (9 pts), error handling 1, loops 1 (nesting depth added 4). Most of this is not in the body itself: 10 of the 46 points are its own statements and the rest belongs to 16 function items inside it that branch (a function literal at line 869, handleSubmit, handleAttachFile, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
RunnerActivityPreview.RunnerActivityPreview (cognitive 46) ui/storybook/prototypes/runner-activity/RunnerActivityPreview.tsx:162— RunnerActivityPreview.RunnerActivityPreview has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 16 (25 pts), if/else 6 (10 pts), boolean chains 9, loops 1 (2 pts) (nesting depth added 14). Of this number, 25 points are the body's own statements and 21 belong to 4 function literals 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.
plugin.registerPluginCommands (cognitive 45) cli/src/commands/client/plugin.ts:321— plugin.registerPluginCommands has cognitive complexity 45 (threshold 15). Drivers by points: if/else 20 (21 pts), ternaries 7 (12 pts), error handling 10, loops 2 (nesting depth added 6). None of this is in the body itself: all 45 points belong to 10 function literals inside it that branch (lines 414, 516, 369, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
skills.registerSkillsCommands (cognitive 45) cli/src/commands/client/skills.ts:92— skills.registerSkillsCommands has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16, error handling 15, boolean chains 7, ternaries 4 (6 pts), loops 1 (nesting depth added 2). None of this is in the body itself: all 45 points belong to 15 function literals inside it that branch (lines 379, 235, 405, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
worktree.applyMergePlan (cognitive 45) cli/src/commands/worktree.ts:3733— worktree.applyMergePlan has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 7 (9 pts), ternaries 5 (6 pts), boolean chains 2 (nesting depth added 17). None of this is in the body itself: all 45 points belong to 2 function literals inside it that branch (lines 3742, 3920). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ssh.integrateImportedGitHead (cognitive 45) REDACTED:920— ssh.integrateImportedGitHead has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (23 pts), error handling 4 (10 pts), ternaries 3 (6 pts), boolean chains 5, loops 1 (nesting depth added 23). Of this number, 43 points are the body's own statements and 2 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.
OpenCodeHarnessSession.dispatchTool (cognitive 45) REDACTED:1024— OpenCodeHarnessSession.dispatchTool has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 10, ternaries 3 (7 pts), error handling 2 (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.
copilot-tool-evidence.createCopilotToolEvidence.notice (cognitive 45) packages/paperclip-runner/src/drivers/acpx/copilot-tool-evidence.ts:50— copilot-tool-evidence.createCopilotToolEvidence.notice has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 10 (40 pts), if/else 3 (4 pts), boolean chains 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-acpx-driver.validateRecoverySnapshot (cognitive 45) REDACTED:2129— codex-acpx-driver.validateRecoverySnapshot has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 19, 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.
eval-session-contract.parseEvalSessionRequest (cognitive 45) packages/paperclip-runner/src/cli/eval-session-contract.ts:225— eval-session-contract.parseEvalSessionRequest has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18, boolean chains 15, ternaries 12. 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.
config.loadConfig (cognitive 45) server/src/config.ts:150— config.loadConfig has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 21 (22 pts), boolean chains 19, error handling 1 (2 pts), if/else 2 (nesting depth added 2). Of this number, 40 points are the body's own statements and 5 belong to 3 function items inside it that branch. 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.
chat-telegram-media-intake.mp4Kind::scan (cognitive 45) server/src/services/chat-telegram-media-intake.ts:453— chat-telegram-media-intake.mp4Kind::scan has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 10, 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.
browser-use.browserUseService.execute (cognitive 45) server/src/services/browser-use.ts:319— browser-use.browserUseService.execute has cognitive complexity 45 (threshold 15). Drivers by points: if/else 39 (53 pts), boolean chains 31, ternaries 12 (25 pts), loops 3 (4 pts), error handling 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. This shape REPEATS in the file: one other method here (browser-use.browserUseService.execute::admissionCheck) 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.
email-channels.emailChannelService.processSend (cognitive 45) server/src/services/email-channels.ts:1671— email-channels.emailChannelService.processSend has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 14, ternaries 6 (9 pts), loops 2 (3 pts), error handling 2 (nesting depth added 8). Of this number, 41 points are the body's own statements and 4 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.
git-credentials.resolveManagedGitHubIdentitySelection (cognitive 45) server/src/services/git-credentials.ts:310— git-credentials.resolveManagedGitHubIdentitySelection has cognitive complexity 45 (threshold 15). Drivers by points: boolean chains 23, ternaries 12 (15 pts), if/else 7 (nesting depth added 3). Of this number, 22 points are the body's own statements and 23 belong to 11 function items inside it that branch. 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.
agent-identity-redaction.createAgentIdentityRedactor (cognitive 45) server/src/services/agent-identity-redaction.ts:5— agent-identity-redaction.createAgentIdentityRedactor has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (25 pts), loops 6 (8 pts), ternaries 6 (8 pts), boolean chains 4 (nesting depth added 14). Of this number, 36 points are the body's own statements and 9 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.
native-workspace-sync.readDescriptor (cognitive 45) server/src/services/native-runtime/native-workspace-sync.ts:451— native-workspace-sync.readDescriptor has cognitive complexity 45 (threshold 15). Drivers by points: boolean chains 19, ternaries 10 (13 pts), if/else 8 (9 pts), loops 3 (4 pts) (nesting depth added 5). Of this number, 44 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.WikiRouteSidebar (cognitive 45) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:2405— app.WikiRouteSidebar has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (22 pts), ternaries 11 (13 pts), boolean chains 8, loops 2 (nesting depth added 6). Most of this is not in the body itself: 5 of the 45 points are its own statements and the rest belongs to 15 function items inside it that branch (renderToolLink, a function literal at line 2485, a function literal at line 2470, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
subscription-report.subscriptionCostReport (cognitive 45) server/src/services/subscription-report.ts:25— subscription-report.subscriptionCostReport has cognitive complexity 45 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 7 (14 pts), boolean chains 7, loops 2 (nesting depth added 17). None of this is in the body itself: all 45 points belong to 2 function literals inside it that branch (lines 26, 110). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
idle-sleep-safety.readIdleSleepSafety (cognitive 45) server/src/services/idle-sleep-safety.ts:251— idle-sleep-safety.readIdleSleepSafety has cognitive complexity 45 (threshold 15). Drivers by points: if/else 22 (31 pts), boolean chains 12, error handling 1, ternaries 1 (nesting depth added 9). Of this number, 26 points are the body's own statements and 19 belong to 2 function literals 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.
case-handoff-delivery.caseHandoffDeliveryService.sweepPending (cognitive 45) server/src/services/case-handoff-delivery.ts:124— case-handoff-delivery.caseHandoffDeliveryService.sweepPending has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 8 (27 pts), if/else 7 (12 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
execution-control-reconciliation.reconcileAbandonedExecutionControl (cognitive 45) server/src/services/execution-control-reconciliation.ts:19— execution-control-reconciliation.reconcileAbandonedExecutionControl has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 6 (11 pts), boolean chains 10, error handling 1 (2 pts), loops 1 (nesting depth added 17). None of this is in the body itself: all 45 points belong to 3 function literals inside it that branch (lines 77, 69, 55). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
task-chat-adapter.commentsToTaskChatItems (cognitive 45) ui/src/components/task-chat/task-chat-adapter.ts:68— task-chat-adapter.commentsToTaskChatItems has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 15 (33 pts), if/else 4 (7 pts), boolean chains 4, 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.
FileViewerSheet.FileContentViewer (cognitive 45) ui/src/components/FileViewerSheet.tsx:248— FileViewerSheet.FileContentViewer has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 12 (17 pts), boolean chains 15, if/else 11 (13 pts) (nesting depth added 7). Of this number, 33 points are the body's own statements and 12 belong to 5 function literals inside it that branch. 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.
RunTranscriptView.TranscriptProviderActivity (cognitive 45) ui/src/components/transcript/RunTranscriptView.tsx:864— RunTranscriptView.TranscriptProviderActivity has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 22 (42 pts), boolean chains 3 (nesting depth added 20). Of this number, 27 points are the body's own statements and 18 belong to 3 function literals 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.
ProfileWizard.ProfileWizard (cognitive 45) ui/src/pages/tools/profiles/ProfileWizard.tsx:46— ProfileWizard.ProfileWizard has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 15 (18 pts), boolean chains 16, if/else 10 (11 pts) (nesting depth added 4). Of this number, 22 points are the body's own statements and 23 belong to 9 function items inside it that branch. 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.
AggregatorConnectDialog.AggregatorConnectDialog (cognitive 45) ui/src/pages/apps/AggregatorConnectDialog.tsx:19— AggregatorConnectDialog.AggregatorConnectDialog has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 20 (37 pts), boolean chains 5, if/else 3 (nesting depth added 17). Of this number, 30 points are the body's own statements and 15 belong to 7 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.
AiConnectionAuth.AuthAttempt (cognitive 45) ui/src/components/ai-connections/AiConnectionAuth.tsx:43— AiConnectionAuth.AuthAttempt has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 9 (35 pts), boolean chains 9, if/else 1 (nesting depth added 26). Of this number, 43 points are the body's own statements and 2 belong 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.
ConnectionSetupFlow.GalleryStep (cognitive 45) ui/src/features/connections/ConnectionSetupFlow.tsx:3001— ConnectionSetupFlow.GalleryStep has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 11 (21 pts), boolean chains 17, if/else 6 (7 pts) (nesting depth added 11). Of this number, 36 points are the body's own statements and 9 belong to 8 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.
database.promptDatabase (cognitive 44) cli/src/prompts/database.ts:9— database.promptDatabase has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 20, ternaries 1 (nesting depth added 6). Of this number, 25 points are the body's own statements and 19 belong to 5 function literals 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.
parse.createClaudeStreamParser (cognitive 44) packages/adapters/claude-local/src/server/parse.ts:74— parse.createClaudeStreamParser has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (27 pts), boolean chains 7, ternaries 3 (6 pts), loops 2 (4 pts) (nesting depth added 22). None of this is in the body itself: all 44 points belong to one function literal inside it that branches (line 83). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
format-event.printTextMessage (cognitive 44) packages/adapters/gemini-local/src/cli/format-event.ts:44— format-event.printTextMessage has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (27 pts), ternaries 4 (11 pts), boolean chains 5, 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.
DurablePrpCodexTransport.#prepareLaunch (cognitive 44) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:4805— DurablePrpCodexTransport.#prepareLaunch has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 12 (15 pts), boolean chains 12, 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.
safe-locations.safeAcpxLocations (cognitive 44) packages/paperclip-runner/src/drivers/acpx/safe-locations.ts:33— safe-locations.safeAcpxLocations has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (21 pts), error handling 4 (11 pts), boolean chains 8, ternaries 4 (nesting depth added 16). Most of this is not in the body itself: 1 of the 44 points is its own statement and the rest belongs to one function literal inside it that branches (line 42). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
public-view.publicProviderPayload (cognitive 44) packages/paperclip-runner/src/issue-thread/public-view.ts:175— public-view.publicProviderPayload has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 17 (32 pts), boolean chains 6, if/else 3 (5 pts), match/switch 1 (nesting depth added 17). Of this number, 18 points are the body's own statements and 26 belong to 6 function literals 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.
logger.createHttpLogger (cognitive 44) server/src/middleware/logger.ts:86— logger.createHttpLogger has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (24 pts), ternaries 6 (12 pts), boolean chains 8 (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.
chat-interaction-publications.enqueueTerminalIssueInteractionChatPublications (cognitive 44) server/src/services/chat-interaction-publications.ts:556— chat-interaction-publications.enqueueTerminalIssueInteractionChatPublications has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 8 (20 pts), boolean chains 14, if/else 7 (9 pts), loops 1 (nesting depth added 14). Of this number, 42 points are the body's own statements and 2 belong to 2 function literals 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.
chat-telegram-media-intake.bindTelegramRichAttachment (cognitive 44) server/src/services/chat-telegram-media-intake.ts:131— chat-telegram-media-intake.bindTelegramRichAttachment has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 10 (16 pts), boolean chains 14, if/else 8 (13 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.
prompt-injection-provider.runPromptInjectionProvider (cognitive 44) server/src/services/prompt-injection-provider.ts:66— prompt-injection-provider.runPromptInjectionProvider has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 8 (23 pts), if/else 5 (9 pts), boolean chains 8, error handling 2 (4 pts) (nesting depth added 21). Of this number, 42 points are the body's own statements and 2 belong to one function literal 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.
tool-access-policy.toolAccessPolicyService.recordInvocation (cognitive 44) server/src/services/tool-access-policy.ts:1653— tool-access-policy.toolAccessPolicyService.recordInvocation has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 11 (17 pts), boolean chains 7, 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.
browser-use.browserUseService.execute::admissionCheck (cognitive 44) server/src/services/browser-use.ts:430— browser-use.browserUseService.execute::admissionCheck has cognitive complexity 44 (threshold 15). Drivers by points: boolean chains 22, if/else 16 (19 pts), loops 2, ternaries 1 (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. This shape REPEATS in the file: one other method here (browser-use.browserUseService.execute) 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.
workspace-runtime.inspectGitWorktreeBranchIncoherence (cognitive 44) server/src/services/workspace-runtime.ts:1408— workspace-runtime.inspectGitWorktreeBranchIncoherence has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 17 (38 pts), boolean chains 6 (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.
resource-reconciliation.createChatResourceReconciliation.updateResourceSelection (cognitive 44) server/src/services/chat-channels/resource-reconciliation.ts:175— resource-reconciliation.createChatResourceReconciliation.updateResourceSelection has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (16 pts), ternaries 8 (13 pts), boolean chains 10, loops 4 (5 pts) (nesting depth added 8). Most of this is not in the body itself: 7 of the 44 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 193, 273, 248, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
confirmation-actions.createChatConfirmationActions.settleTerminalConfirmationAction (cognitive 44) server/src/services/chat-channels/interactions/confirmation-actions.ts:275— confirmation-actions.createChatConfirmationActions.settleTerminalConfirmationAction has cognitive complexity 44 (threshold 15). Drivers by points: boolean chains 22, if/else 13 (15 pts), ternaries 5 (7 pts) (nesting depth added 4). Of this number, 34 points are the body's own statements and 10 belong to one function literal inside it that branches. 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.
workspace-file-resources.workspaceFileResourceService.readContent (cognitive 44) server/src/services/workspace-file-resources.ts:1666— workspace-file-resources.workspaceFileResourceService.readContent has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (25 pts), ternaries 4 (10 pts), boolean chains 6, error handling 1 (2 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.
built-in-agents.validateBuiltInAgentDefinitions (cognitive 44) server/src/services/built-in-agents.ts:562— built-in-agents.validateBuiltInAgentDefinitions has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (36 pts), boolean chains 4, ternaries 3, loops 1 (nesting depth added 20). Of this number, 41 points are the body's own statements and 3 belong to one function literal 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.
native-session-executor.createRemoteRunnerProcessLauncher (cognitive 44) server/src/services/native-runtime/native-session-executor.ts:11302— native-session-executor.createRemoteRunnerProcessLauncher has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 11 (22 pts), if/else 10 (14 pts), boolean chains 6, error handling 1, loops 1 (nesting depth added 15). None of this is in the body itself: all 44 points belong to 2 function literals inside it that branch (lines 11372, 11333). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
instruction-working-copy.createHeartbeatInstructionWorkingCopy.prepare (cognitive 44) server/src/services/heartbeat/instruction-working-copy.ts:126— instruction-working-copy.createHeartbeatInstructionWorkingCopy.prepare has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 8, loops 2 (6 pts), error handling 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 21). Of this number, 43 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.
worker-rpc-host.startWorkerRpcHost.handleInitialize (cognitive 44) packages/plugins/sdk/src/worker-rpc-host.ts:1799— worker-rpc-host.startWorkerRpcHost.handleInitialize has cognitive complexity 44 (threshold 15). Drivers by points: if/else 42, 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.
task-interruption-presentation.projectTaskInterruption (cognitive 44) server/src/services/task-interruption-presentation.ts:41— task-interruption-presentation.projectTaskInterruption has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 8 (24 pts), if/else 10 (12 pts), boolean chains 8 (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.
InlineEntitySelector.InlineEntitySelector (cognitive 44) ui/src/components/InlineEntitySelector.tsx:71— InlineEntitySelector.InlineEntitySelector has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (18 pts), ternaries 11 (16 pts), boolean chains 10 (nesting depth added 6). Most of this is not in the body itself: 4 of the 44 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 134, a function literal at line 245, a function literal at line 287, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SidebarAgents.SidebarAgentItem (cognitive 44) ui/src/components/SidebarAgents.tsx:109— SidebarAgents.SidebarAgentItem has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 21 (28 pts), boolean chains 10, if/else 5 (6 pts) (nesting depth added 8). Of this number, 38 points are the body's own statements and 6 belong to 4 function literals inside it that branch. 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.
SidebarAgents.production.SidebarAgentItem (cognitive 44) ui/src/components/SidebarAgents.production.tsx:109— SidebarAgents.production.SidebarAgentItem has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 21 (28 pts), boolean chains 10, if/else 5 (6 pts) (nesting depth added 8). Of this number, 38 points are the body's own statements and 6 belong to 4 function literals inside it that branch. 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.
LiveUpdatesProvider.resolveVisibleIssueRouteContext (cognitive 44) ui/src/context/LiveUpdatesProvider.tsx:352— LiveUpdatesProvider.resolveVisibleIssueRouteContext has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (33 pts), loops 5 (7 pts), boolean chains 4 (nesting depth added 17). Of this number, 36 points are the body's own statements and 8 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.
transcript-adapter.buildTurnTimelineRows (cognitive 44) ui/src/components/task-chat/transcript-adapter.ts:1706— transcript-adapter.buildTurnTimelineRows has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 13, ternaries 1 (4 pts), loops 3 (nesting depth added 12). Of this number, 37 points are the body's own statements and 7 belong to 3 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.
IssueThreadInteractionCard.RequestConnectionAuthorizationCard (cognitive 44) ui/src/components/IssueThreadInteractionCard.tsx:2380— IssueThreadInteractionCard.RequestConnectionAuthorizationCard has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 15 (40 pts), boolean chains 2, error handling 1, if/else 1 (nesting depth added 25). Of this number, 42 points are the body's own statements and 2 belong 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.
ProfilesTab.ProfilesTab (cognitive 44) ui/src/pages/tools/ProfilesTab.tsx:639— ProfilesTab.ProfilesTab has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 19 (23 pts), if/else 12, boolean chains 9 (nesting depth added 4). Of this number, 16 points are the body's own statements and 28 belong to 14 function items inside it that branch. 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.
useMuseConnection.museConnectionState (cognitive 44) ui/src/hooks/useMuseConnection.ts:8— useMuseConnection.museConnectionState has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 8 (36 pts), boolean chains 8 (nesting depth added 28). 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.
DurablePrpControlPlane.queueCommand (cognitive 43) REDACTED:1932— DurablePrpControlPlane.queueCommand has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 9, loops 2 (6 pts), ternaries 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.
EvidencePanel.EvidencePanel (cognitive 43) packages/paperclip-runner/devtools/issue-thread/src/EvidencePanel.tsx:335— EvidencePanel.EvidencePanel has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 17 (37 pts), boolean chains 3, if/else 3 (nesting depth added 20). Most of this is not in the body itself: 12 of the 43 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 479, 615, 367, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
cursor-tool-evidence.createCursorToolEvidence.tool (cognitive 43) packages/paperclip-runner/src/drivers/acpx/cursor-tool-evidence.ts:77— cursor-tool-evidence.createCursorToolEvidence.tool has cognitive complexity 43 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 10, ternaries 4 (6 pts) (nesting depth added 10). None of this is in the body itself: all 43 points belong to one function literal inside it that branches (line 77). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
chat-run-publications.enqueueChatRunMilestones (cognitive 43) server/src/services/chat-run-publications.ts:661— chat-run-publications.enqueueChatRunMilestones has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (35 pts), boolean chains 3, loops 2 (3 pts), ternaries 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.
run-origin.chatRunSourceMessageId (cognitive 43) server/src/services/chat-channels/run-origin.ts:11— run-origin.chatRunSourceMessageId has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (36 pts), boolean chains 5, loops 1, ternaries 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.
projects.projectService.updateWorkspace (cognitive 43) server/src/services/projects.ts:1198— projects.projectService.updateWorkspace has cognitive complexity 43 (threshold 15). Drivers by points: if/else 27 (28 pts), boolean chains 10, ternaries 5 (nesting depth added 1). None of this is in the body itself: all 43 points belong to 2 function literals inside it that branch (lines 1202, 1274). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
issue-thread-interactions.issueThreadInteractionService.expireRequestConfirmationsSupersededByHistoricalComments (cognitive 43) server/src/services/issue-thread-interactions.ts:4463— issue-thread-interactions.issueThreadInteractionService.expireRequestConfirmationsSupersededByHistoricalComments has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (30 pts), loops 6 (12 pts), boolean chains 1 (nesting depth added 22). Of this number, 34 points are the body's own statements and 9 belong to 3 function literals 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.
runner-api-response.captureRunnerApiResponse (cognitive 43) server/src/services/native-runtime/runner-api-response.ts:13— runner-api-response.captureRunnerApiResponse has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (29 pts), loops 3 (7 pts), boolean chains 3, error handling 2, ternaries 2 (nesting depth added 19). Of this number, 41 points are the body's own statements and 2 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.
company-skills.companySkillService.readLoadedSkillFile (cognitive 43) server/src/services/company-skills.ts:4397— company-skills.companySkillService.readLoadedSkillFile has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (20 pts), ternaries 5 (11 pts), boolean chains 10, error handling 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.
use-cases.runReleaseDrain (cognitive 43) server/src/modules/wake-queue/application/use-cases.ts:135— use-cases.runReleaseDrain has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (32 pts), boolean chains 5, ternaries 2 (5 pts), 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.
connection-intent-delivery.connectionIntentDeliveryService.deliver (cognitive 43) server/src/services/connection-intent-delivery.ts:118— connection-intent-delivery.connectionIntentDeliveryService.deliver has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 8, ternaries 2 (4 pts), error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 13). Of this number, 36 points are the body's own statements and 7 belong to one function literal 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.
AiConnectionSelect.AiConnectionSelect (cognitive 43) ui/src/components/ai-connections/AiConnectionSelect.tsx:31— AiConnectionSelect.AiConnectionSelect has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 15 (26 pts), boolean chains 14, if/else 3 (nesting depth added 11). Of this number, 31 points are the body's own statements and 12 belong to 6 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.
index.parseItemEvent (cognitive 43) ui/src/adapters/paperclip-runner/index.ts:210— index.parseItemEvent has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (25 pts), ternaries 7 (14 pts), boolean chains 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.
transcript-adapter.providerActivityItem (cognitive 43) ui/src/components/task-chat/transcript-adapter.ts:355— transcript-adapter.providerActivityItem has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 15, ternaries 10 (15 pts), if/else 5 (10 pts), loops 2 (3 pts) (nesting depth added 11). Of this number, 37 points are the body's own statements and 6 belong to 3 function literals 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.
AgentProviderConnection.AgentProviderConnection::connect (cognitive 43) ui/src/components/new-agent/AgentProviderConnection.tsx:163— AgentProviderConnection.AgentProviderConnection::connect has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (20 pts), ternaries 8 (17 pts), boolean chains 5, error handling 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. This shape REPEATS in the file: one other method here (AgentProviderConnection.AgentProviderConnection) 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.
RunnerGoalWidget.RunnerGoalWidget (cognitive 43) ui/src/components/task-chat/RunnerGoalWidget.tsx:183— RunnerGoalWidget.RunnerGoalWidget has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 22 (29 pts), boolean chains 11, if/else 3 (nesting depth added 7). Of this number, 36 points are the body's own statements and 7 belong to 4 function items inside it that branch. 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.
ConnectionSetupFlow.OAuthConnectStateScreen (cognitive 43) ui/src/features/connections/ConnectionSetupFlow.tsx:2792— ConnectionSetupFlow.OAuthConnectStateScreen has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 22 (38 pts), boolean chains 5 (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.
configure.configure (cognitive 42) cli/src/commands/configure.ts:84— configure.configure has cognitive complexity 42 (threshold 15). Drivers by points: if/else 18 (31 pts), boolean chains 4, loops 2, match/switch 1 (2 pts), ternaries 1 (2 pts), error handling 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.
execute.consumeEvents (cognitive 42) packages/adapters/hermes/src/gateway/server/execute.ts:641— execute.consumeEvents has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (26 pts), loops 4 (11 pts), boolean chains 3, error handling 1 (2 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.
format-event.printOpenCodeStreamEvent (cognitive 42) packages/adapters/opencode-local/src/cli/format-event.ts:42— format-event.printOpenCodeStreamEvent has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (26 pts), ternaries 4 (10 pts), loops 1 (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.
provider-events.canonicalProviderEventsFromAcpxRuntimeEvent (cognitive 42) packages/paperclip-runner/src/provider-events.ts:1125— provider-events.canonicalProviderEventsFromAcpxRuntimeEvent has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 13 (28 pts), boolean chains 9, if/else 5 (nesting depth added 15). Of this number, 40 points are the body's own statements and 2 belong to one function literal 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.
OpenCodeHarnessSession.#emitAssistantPart (cognitive 42) REDACTED:1848— OpenCodeHarnessSession.#emitAssistantPart has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 8 (18 pts), if/else 10 (14 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 15). Of this number, 39 points are the body's own statements and 3 belong to one function literal 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.
EvidencePanel.ToolsBrowser (cognitive 42) packages/paperclip-runner/devtools/issue-thread/src/EvidencePanel.tsx:169— EvidencePanel.ToolsBrowser has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 13 (26 pts), if/else 5 (6 pts), boolean chains 4, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 17). Of this number, 16 points are the body's own statements and 26 belong to 10 function literals 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.
authorization.createAuthorizationService.decideReadsForActors (cognitive 42) server/src/services/authorization.ts:768— authorization.createAuthorizationService.decideReadsForActors has cognitive complexity 42 (threshold 15). Drivers by points: loops 11 (20 pts), ternaries 7 (14 pts), boolean chains 4, if/else 2 (4 pts) (nesting depth added 18). Of this number, 32 points are the body's own statements and 10 belong to 3 function literals inside it that branch. 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.
secrets.secretService.rotateUnlocked (cognitive 42) server/src/services/secrets.ts:2402— secrets.secretService.rotateUnlocked has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 9, ternaries 4 (5 pts), error handling 3 (nesting depth added 10). Of this number, 37 points are the body's own statements and 5 belong to one function literal 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.
records.agentRecords.create (cognitive 42) server/src/modules/agent-lifecycle/adapters/records.ts:13— records.agentRecords.create has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 15 (23 pts), if/else 10 (12 pts), boolean chains 7 (nesting depth added 10). Most of this is not in the body itself: 1 of the 42 points is its own statement and the rest belongs to one function literal inside it that branches (line 15). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
PhotonReceiver.catchUp (cognitive 42) server/src/services/photon/receiver.ts:87— PhotonReceiver.catchUp has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 10, 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.
chat-github-attachments.resolveCanonicalAttachmentTargetOrThrow (cognitive 42) REDACTED:560— chat-github-attachments.resolveCanonicalAttachmentTargetOrThrow has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 18, ternaries 2, loops 1 (nesting depth added 5). Of this number, 37 points are the body's own statements and 5 belong to 3 function items inside it that branch. 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.
ChatSdkEndpointRuntime.rehydrateAttachment (cognitive 42) server/src/services/chat-sdk-runtime.ts:2922— ChatSdkEndpointRuntime.rehydrateAttachment has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 7 (14 pts), boolean chains 11, error handling 1 (2 pts), match/switch 1 (nesting depth added 12). Of this number, 32 points are the body's own statements and 10 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.
tool-action-review.commitToolActionReview (cognitive 42) server/src/services/tool-action-review.ts:22— tool-action-review.commitToolActionReview has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 12, ternaries 6 (9 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 8 of the 42 points are its own statements and the rest belongs to one function literal inside it that branches (line 52). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
postgres.createPostgresRunDispatchAdapter.dispatchResolvedInteractionIfCurrent (cognitive 42) server/src/modules/run-dispatch/adapters/postgres.ts:1153— postgres.createPostgresRunDispatchAdapter.dispatchResolvedInteractionIfCurrent has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 10, ternaries 4 (10 pts), error handling 1 (nesting depth added 11). Most of this is not in the body itself: 1 of the 42 points is its own statement and the rest belongs to 3 function items inside it that branch (a function literal at line 1243, dispatchLockedRun, a function literal at line 1174). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
file-transfer-authority.createTeamsFileAuthority.deriveTeamsFileTransferAuthority (cognitive 42) server/src/services/chat-channels/microsoft-teams/file-transfer-authority.ts:784— file-transfer-authority.createTeamsFileAuthority.deriveTeamsFileTransferAuthority has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 10, error handling 1 (2 pts), 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.
publication-policy.createGitHubPublicationPolicy.githubCurrentOmissionPreparedText (cognitive 42) server/src/services/chat-channels/github/publication-policy.ts:74— publication-policy.createGitHubPublicationPolicy.githubCurrentOmissionPreparedText has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 9 (17 pts), if/else 11 (13 pts), boolean chains 11, error handling 1 (nesting depth added 10). Of this number, 41 points are the body's own statements and 1 belongs to one function literal 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.
github-access-discovery.loadGitHubGrantMetadata (cognitive 42) server/src/services/tool-access/github-access-discovery.ts:64— github-access-discovery.loadGitHubGrantMetadata has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 11 (19 pts), if/else 8 (15 pts), boolean chains 5, loops 2 (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.
tool-access.toolAccessService.listGitHubRepositories (cognitive 42) server/src/services/tool-access.ts:4262— tool-access.toolAccessService.listGitHubRepositories has cognitive complexity 42 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 10, ternaries 3 (8 pts), loops 3 (6 pts), error handling 1 (3 pts) (nesting depth added 19). None of this is in the body itself: all 42 points belong to 5 function literals inside it that branch (lines 4266, 4316, 4363, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
agent-directory-working-copies.agentDirectoryWorkingCopyService.release (cognitive 42) server/src/services/agent-directory-working-copies.ts:414— agent-directory-working-copies.agentDirectoryWorkingCopyService.release has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 17, ternaries 7 (14 pts), if/else 8 (9 pts), error handling 1 (2 pts) (nesting depth added 9). Of this number, 41 points are the body's own statements and 1 belongs to one function literal 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.
asset-content-access.canActorReadAssetContent (cognitive 42) server/src/services/asset-content-access.ts:21— asset-content-access.canActorReadAssetContent has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 18, loops 3, ternaries 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.
company-skills.companySkillService.listRuntimeSkillEntriesLocked (cognitive 42) server/src/services/company-skills.ts:6181— company-skills.companySkillService.listRuntimeSkillEntriesLocked has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 6 (18 pts), if/else 6 (14 pts), boolean chains 9, 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.
postgres.createPostgresWakeQueueAdapter.withIssueExecutionLock (cognitive 42) server/src/modules/wake-queue/adapters/postgres.ts:1051— postgres.createPostgresWakeQueueAdapter.withIssueExecutionLock has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 18, if/else 14 (15 pts), ternaries 8 (9 pts) (nesting depth added 2). None of this is in the body itself: all 42 points belong to one function literal inside it that branches (line 1052). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
run-control.createHeartbeatRunControl.resumeRemoteStopComments (cognitive 42) server/src/services/heartbeat/run-control.ts:513— run-control.createHeartbeatRunControl.resumeRemoteStopComments has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 10, ternaries 4, 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.
tool-action-delivery.toolActionDeliveryService.deliver (cognitive 42) server/src/services/tool-action-delivery.ts:39— tool-action-delivery.toolActionDeliveryService.deliver has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (17 pts), ternaries 7 (16 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 12). None of this is in the body itself: all 42 points belong to 4 function literals inside it that branch (lines 40, 219, 331, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
issue-references.stripMarkdownCode (cognitive 42) packages/shared/src/issue-references.ts:16— issue-references.stripMarkdownCode has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 5 (15 pts), boolean chains 7 (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.
external-objects-server.stripMarkdownCode (cognitive 42) packages/shared/src/external-objects-server.ts:17— external-objects-server.stripMarkdownCode has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 5 (15 pts), boolean chains 7 (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.
IssueWorkspaceCard.IssueWorkspaceCard (cognitive 42) ui/src/components/IssueWorkspaceCard.tsx:187— IssueWorkspaceCard.IssueWorkspaceCard has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 32, if/else 5, ternaries 5. Of this number, 35 points are the body's own statements and 7 belong to 6 function literals inside it that branch. 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.
ConversationPlayback.ConversationPlayback (cognitive 42) ui/src/components/design-sandbox/ConversationPlayback.tsx:15— ConversationPlayback.ConversationPlayback has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 21 (32 pts), boolean chains 5, if/else 3 (4 pts), loops 1 (nesting depth added 12). Of this number, 34 points are the body's own statements and 8 belong to 6 function literals 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.
AgentDetail.ConfigurationTab (cognitive 42) ui/src/pages/AgentDetail.tsx:1993— AgentDetail.ConfigurationTab has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 17 (27 pts), boolean chains 12, if/else 3 (nesting depth added 10). Of this number, 29 points are the body's own statements and 13 belong to 6 function literals 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.
SearchResultRow.SearchResultRowImpl (cognitive 42) ui/src/components/search/SearchResultRow.tsx:59— SearchResultRow.SearchResultRowImpl has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 16 (30 pts), boolean chains 6, if/else 5 (6 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.
AuditHub.AuditHub (cognitive 42) ui/src/pages/audit/AuditHub.tsx:22— AuditHub.AuditHub has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 12 (30 pts), if/else 9, boolean chains 3 (nesting depth added 18). Of this number, 31 points are the body's own statements and 11 belong to 5 function literals 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.
ChatExecutionDefaults.ChatExecutionDefaults (cognitive 42) ui/src/pages/apps/chat/ChatExecutionDefaults.tsx:18— ChatExecutionDefaults.ChatExecutionDefaults has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 14, ternaries 10 (13 pts), if/else 6 (7 pts), loops 4 (7 pts), error handling 1 (nesting depth added 7). Of this number, 26 points are the body's own statements and 16 belong to 4 function literals inside it that branch. 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.
InstanceExperimentalSettings.InstanceExperimentalSettings (cognitive 42) ui/src/pages/InstanceExperimentalSettings.tsx:122— InstanceExperimentalSettings.InstanceExperimentalSettings has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 12 (23 pts), boolean chains 12, if/else 5 (7 pts) (nesting depth added 13). Of this number, 33 points are the body's own statements and 9 belong to 5 function literals 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.
OrgChart.production.OrgChart (cognitive 42) ui/src/pages/OrgChart.production.tsx:176— OrgChart.production.OrgChart has cognitive complexity 42 (threshold 15). Drivers by points: if/else 22 (24 pts), boolean chains 13, ternaries 3, loops 2 (nesting depth added 2). Most of this is not in the body itself: 8 of the 42 points are its own statements and the rest belongs to 16 function literals inside it that branch (lines 369, 341, 419, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
OnboardingChat.OnboardingChat (cognitive 42) ui/src/components/OnboardingChat.tsx:82— OnboardingChat.OnboardingChat has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 14, ternaries 8, error handling 2, loops 2 (nesting depth added 3). Most of this is not in the body itself: 11 of the 42 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 143, 226, 276, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ConnectionSetup.ConnectionSetup (cognitive 42) ui/storybook/prototypes/provider-routing/ConnectionSetup.tsx:38— ConnectionSetup.ConnectionSetup has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 34 (50 pts), boolean chains 19, if/else 6 (8 pts), error handling 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. This shape REPEATS in the file: one other method here (ConnectionSetup.ConnectionSetup::connect) 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.
harness-driver.parseHarnessRuntimeRequestResolution (cognitive 41) packages/paperclip-runner/src/contracts/harness-driver.ts:202— harness-driver.parseHarnessRuntimeRequestResolution has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 8, ternaries 1 (3 pts), error handling 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.
local-runner-browser-server.createLocalRunnerBrowserMiddleware (cognitive 41) REDACTED:233— local-runner-browser-server.createLocalRunnerBrowserMiddleware has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 5 (9 pts), error handling 4 (7 pts), boolean chains 5 (nesting depth added 13). None of this is in the body itself: all 41 points belong to 5 function items inside it that branch (a function literal at line 253, pruneFinishedRuns, a function literal at line 286, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
PiUiBridge.handle (cognitive 41) packages/paperclip-runner/src/drivers/acpx/pi-acp-runtime.ts:437— PiUiBridge.handle has cognitive complexity 41 (threshold 15). Drivers by points: if/else 18 (23 pts), ternaries 6 (11 pts), boolean chains 6, error handling 1 (nesting depth added 10). Of this number, 39 points are the body's own statements and 2 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.
plugin-task-credential-writeback.settlePluginTaskCredentialHandoff (cognitive 41) server/src/services/plugin-task-credential-writeback.ts:59— plugin-task-credential-writeback.settlePluginTaskCredentialHandoff has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 7, error handling 1 (4 pts), loops 1 (3 pts) (nesting depth added 17). Of this number, 27 points are the body's own statements and 14 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.
execution-recovery-resolution.validateExecutionReconciliation (cognitive 41) server/src/services/execution-recovery-resolution.ts:33— execution-recovery-resolution.validateExecutionReconciliation has cognitive complexity 41 (threshold 15). Drivers by points: boolean chains 18, if/else 10 (14 pts), ternaries 3 (6 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.
native-review-participant.validateNativeReviewAssignmentFacts (cognitive 41) server/src/services/native-runtime/native-review-participant.ts:84— native-review-participant.validateNativeReviewAssignmentFacts has cognitive complexity 41 (threshold 15). Drivers by points: if/else 22 (28 pts), boolean chains 13 (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.
index.supabaseClient.send (cognitive 41) server/src/services/connectors/supabase/index.ts:123— index.supabaseClient.send has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 6 (18 pts), if/else 8 (13 pts), boolean chains 6, error handling 3, loops 1 (nesting depth added 17). 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.
index.vercelClient.send (cognitive 41) server/src/services/connectors/vercel/index.ts:56— index.vercelClient.send has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 6 (17 pts), if/else 9 (14 pts), boolean chains 5, error handling 3, loops 2 (nesting depth added 16). 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.
tool-gateway.createToolGatewayService.callLocalStdioMcp (cognitive 41) server/src/services/tool-gateway.ts:5176— tool-gateway.createToolGatewayService.callLocalStdioMcp has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 5 (8 pts), error handling 2 (5 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 19). Most of this is not in the body itself: 9 of the 41 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 5252, 5196, 5319, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tool-gateway.createToolGatewayService.runTestToolInvocation (cognitive 41) server/src/services/tool-gateway.ts:7404— tool-gateway.createToolGatewayService.runTestToolInvocation has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 17 (35 pts), boolean chains 3, if/else 2, error handling 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.
resolution.createChatPublicationResolution.resolveProviderEffect (cognitive 41) server/src/services/chat-channels/publications/resolution.ts:327— resolution.createChatPublicationResolution.resolveProviderEffect has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 8, ternaries 5 (7 pts) (nesting depth added 11). Most of this is not in the body itself: 2 of the 41 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 474, 352, 339). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
task-start-resolution.createSlackTaskStartResolution.resolveSlackTaskStart (cognitive 41) server/src/services/chat-channels/slack/task-start-resolution.ts:15— task-start-resolution.createSlackTaskStartResolution.resolveSlackTaskStart has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (23 pts), boolean chains 11, ternaries 5 (6 pts), error handling 1 (nesting depth added 3). Most of this is not in the body itself: 4 of the 41 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 133, 278, 37). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
endpoints.createChatEndpoints.update (cognitive 41) server/src/services/chat-channels/endpoints.ts:379— endpoints.createChatEndpoints.update has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (28 pts), boolean chains 11, ternaries 1 (2 pts) (nesting depth added 8). Most of this is not in the body itself: 3 of the 41 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 389, 445). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
oauth.createPublicMcpOAuth.token (cognitive 41) server/src/services/public-mcp/oauth.ts:633— oauth.createPublicMcpOAuth.token has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 8, ternaries 2 (nesting depth added 15). Of this number, 23 points are the body's own statements and 18 belong to one function literal 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.
native-session-executor.verifyStoppedNativeSessionForReplacement (cognitive 41) server/src/services/native-runtime/native-session-executor.ts:2891— native-session-executor.verifyStoppedNativeSessionForReplacement has cognitive complexity 41 (threshold 15). Drivers by points: boolean chains 21, if/else 16 (17 pts), error handling 1, loops 1, ternaries 1 (nesting depth added 1). Of this number, 37 points are the body's own statements and 4 belong to 9 function items inside it that branch. 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.
service.recoveryService.reconcileDispositionRepair (cognitive 41) REDACTED:3882— service.recoveryService.reconcileDispositionRepair has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (16 pts), ternaries 10 (13 pts), boolean chains 12 (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.
service.recoveryService.applyStrandedAssignedIssueEscalation (cognitive 41) REDACTED:4083— service.recoveryService.applyStrandedAssignedIssueEscalation has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 11 (19 pts), if/else 10 (13 pts), boolean chains 9 (nesting depth added 11). Of this number, 38 points are the body's own statements and 3 belong to one function literal 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.
app.ProvenanceDrawer (cognitive 41) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:3737— app.ProvenanceDrawer has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 23 (35 pts), boolean chains 6 (nesting depth added 12). Of this number, 22 points are the body's own statements and 19 belong to one function literal 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.
file-sync.syncInFileMappings (cognitive 41) packages/plugins/sandbox-providers/daytona/src/file-sync.ts:726— file-sync.syncInFileMappings has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 5 (6 pts), ternaries 3 (5 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 18). Of this number, 25 points are the body's own statements and 16 belong to 2 function literals 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.
generate-company-assets.parseCompanyPackage (cognitive 41) scripts/generate-company-assets.ts:136— generate-company-assets.parseCompanyPackage has cognitive complexity 41 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 3 (12 pts), boolean chains 9, loops 2 (4 pts) (nesting depth added 20). 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.
companies.companyService.update (cognitive 41) server/src/services/companies.ts:295— companies.companyService.update has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (23 pts), boolean chains 12, ternaries 5 (6 pts) (nesting depth added 4). Most of this is not in the body itself: 6 of the 41 points are its own statements and the rest belongs to one function literal inside it that branches (line 301). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
managed-environments.applyManagedEnvironments (cognitive 41) server/src/services/managed-environments.ts:134— managed-environments.applyManagedEnvironments has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 5, error handling 3 (5 pts), loops 1 (nesting depth added 11). Of this number, 31 points are the body's own statements and 10 belong to 3 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.
company-portability.parseYamlBlock (cognitive 41) server/src/services/company-portability.ts:2774— company-portability.parseYamlBlock has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (31 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 20). 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.
events.createPublicMcpEvents.start (cognitive 41) server/src/services/public-mcp/events.ts:378— events.createPublicMcpEvents.start has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 7, ternaries 3 (5 pts), loops 1 (2 pts) (nesting depth added 14). Of this number, 33 points are the body's own statements and 8 belong to 2 function literals 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.
muse-qualification-report.qualificationReport (cognitive 41) scripts/smoke/muse-qualification-report.mjs:19— muse-qualification-report.qualificationReport has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 15 (16 pts), boolean chains 13, if/else 12 (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.
GrokBotSetup.GrokBotSetup (cognitive 41) ui/src/components/new-agent/GrokBotSetup.tsx:9— GrokBotSetup.GrokBotSetup has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (23 pts), boolean chains 9, ternaries 6 (9 pts) (nesting depth added 5). Most of this is not in the body itself: 5 of the 41 points are its own statements and the rest belongs to 9 function items inside it that branch (next, a function literal at line 25, a function literal at line 85, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
IssueThreadInteractionCard.RequestCheckboxConfirmationCard (cognitive 41) ui/src/components/IssueThreadInteractionCard.tsx:2896— IssueThreadInteractionCard.RequestCheckboxConfirmationCard has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 14 (21 pts), boolean chains 12, if/else 6, error handling 2 (nesting depth added 7). Of this number, 30 points are the body's own statements and 11 belong to 6 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.
profile-model.parseEntries (cognitive 41) ui/src/pages/tools/profiles/profile-model.ts:258— profile-model.parseEntries has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 6, loops 5 (6 pts), ternaries 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.
TaskChatCompactInteractionCard.TaskChatCompactInteractionCard (cognitive 41) ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx:1879— TaskChatCompactInteractionCard.TaskChatCompactInteractionCard has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 15 (35 pts), boolean chains 4, if/else 2 (nesting depth added 20). 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.
chat-publication-errors.classifyChatPublicationError (cognitive 40) server/src/services/chat-publication-errors.ts:145— chat-publication-errors.classifyChatPublicationError has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 17, ternaries 3 (4 pts) (nesting depth added 4). Of this number, 38 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
execution-workspaces.inspectGitCloseReadiness (cognitive 40) server/src/services/execution-workspaces.ts:900— execution-workspaces.inspectGitCloseReadiness has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 5 (11 pts), error handling 4 (7 pts), boolean chains 6, 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.
workspace-recovery-source.inspectWorkspaceRecoverySource (cognitive 40) server/src/services/workspace-recovery-source.ts:33— workspace-recovery-source.inspectWorkspaceRecoverySource has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 16, ternaries 3 (5 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.
task-retry.requestTaskRetry (cognitive 40) server/src/services/task-retry.ts:56— task-retry.requestTaskRetry has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 10, ternaries 5 (10 pts), loops 1 (2 pts) (nesting depth added 12). None of this is in the body itself: all 40 points belong to one function literal inside it that branches (line 62). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
conversation-queue.createChatConversationDeliveryQueue.messageFromDelivery (cognitive 40) server/src/services/chat-channels/inbound/conversation-queue.ts:196— conversation-queue.createChatConversationDeliveryQueue.messageFromDelivery has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 14 (21 pts), boolean chains 13, if/else 6 (nesting depth added 7). Of this number, 23 points are the body's own statements and 17 belong to one function literal 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.
discovery.createOAuthDiscovery.endpointsFromMetadataUrl (cognitive 40) server/src/services/tool-access/oauth/discovery.ts:66— discovery.createOAuthDiscovery.endpointsFromMetadataUrl has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 13, ternaries 3 (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.
discovery.createOAuthDiscovery.discoverOAuthEndpoints (cognitive 40) server/src/services/tool-access/oauth/discovery.ts:213— discovery.createOAuthDiscovery.discoverOAuthEndpoints has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 14 (21 pts), if/else 6 (10 pts), boolean chains 8, 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.
usage-receipts.recoverPendingRunUsageReceipts (cognitive 40) server/src/services/usage-receipts.ts:181— usage-receipts.recoverPendingRunUsageReceipts has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (28 pts), error handling 2 (5 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
company-skills.companySkillService.installFromCatalog (cognitive 40) server/src/services/company-skills.ts:5763— company-skills.companySkillService.installFromCatalog has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (21 pts), ternaries 6 (12 pts), boolean chains 6, error handling 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.
company-skills.companySkillService.resolveRuntimeSkillSource (cognitive 40) server/src/services/company-skills.ts:6064— company-skills.companySkillService.resolveRuntimeSkillSource has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (20 pts), ternaries 4 (9 pts), error handling 4 (7 pts), boolean chains 4 (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.DistillationSettingsPanel (cognitive 40) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:5433— app.DistillationSettingsPanel has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 18 (24 pts), if/else 8 (9 pts), boolean chains 3, error handling 3, loops 1 (nesting depth added 7). Most of this is not in the body itself: 15 of the 40 points are its own statements and the rest belongs to 5 function items inside it that branch (enableForActiveProjects, runBackfill, runDistillNow, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
pod-exec.execInPod (cognitive 40) packages/plugins/sandbox-providers/kubernetes/src/pod-exec.ts:57— pod-exec.execInPod has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19 (21 pts), ternaries 6 (9 pts), boolean chains 6, error handling 4 (nesting depth added 5). Most of this is not in the body itself: 6 of the 40 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 173, 197, 149, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
BrokerCore.doExpose (cognitive 40) packages/tailscale-https-broker/src/broker-core.ts:371— BrokerCore.doExpose has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 6 (8 pts), boolean chains 3, error handling 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.
status-cards.statusCardService.requestRefresh (cognitive 40) server/src/services/status-cards.ts:625— status-cards.statusCardService.requestRefresh has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 9 (13 pts), boolean chains 10 (nesting depth added 9). Of this number, 39 points are the body's own statements and 1 belongs to one function literal 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.
muse-maintenance.startMuseMaintenance (cognitive 40) server/src/services/muse-maintenance.ts:9— muse-maintenance.startMuseMaintenance has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (22 pts), error handling 2 (6 pts), loops 4 (6 pts), ternaries 3 (5 pts), boolean chains 1 (nesting depth added 21). Of this number, 39 points are the body's own statements and 1 belongs to one function literal 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.
skill-source-sync.skillSourceSyncService.importBinding (cognitive 40) server/src/services/skill-source-sync.ts:188— skill-source-sync.skillSourceSyncService.importBinding has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 7 (15 pts), boolean chains 7, error handling 2 (3 pts) (nesting depth added 14). Of this number, 31 points are the body's own statements and 9 belong to one function literal 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.
confirmation-comment-resolution.resolveConfirmationFromComment (cognitive 40) server/src/services/confirmation-comment-resolution.ts:18— confirmation-comment-resolution.resolveConfirmationFromComment has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 14, ternaries 2, loops 1 (nesting depth added 5). Most of this is not in the body itself: 2 of the 40 points are its own statements and the rest belongs to one function literal inside it that branches (line 28). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
SearchableSelect.SearchableSelect (cognitive 40) ui/src/components/SearchableSelect.tsx:93— SearchableSelect.SearchableSelect has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 10 (16 pts), if/else 14 (15 pts), boolean chains 8, loops 1 (nesting depth added 7). Most of this is not in the body itself: 12 of the 40 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 149, selectOption, a function literal at line 130, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
OutputFeedbackButtons.OutputFeedbackButtons (cognitive 40) ui/src/components/OutputFeedbackButtons.tsx:16— OutputFeedbackButtons.OutputFeedbackButtons has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 14 (18 pts), boolean chains 11, if/else 10, error handling 1 (nesting depth added 4). Of this number, 17 points are the body's own statements and 23 belong to 8 function items inside it that branch. 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.
TaskChatThreadView.renderItem (cognitive 40) ui/src/components/task-chat/TaskChatThreadView.tsx:82— TaskChatThreadView.renderItem has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 16 (37 pts), boolean chains 2, match/switch 1 (nesting depth added 21). Of this number, 35 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
CompanySkills.SkillDetailPage::renderFilesBody (cognitive 40) ui/src/pages/CompanySkills.tsx:2941— CompanySkills.SkillDetailPage::renderFilesBody has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 14 (36 pts), boolean chains 4 (nesting depth added 22). 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. This shape REPEATS in the file: one other method here (CompanySkills.SkillDetailPage) 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.
CompanySkills.production.SkillDetailPage::renderFilesBody (cognitive 40) ui/src/pages/CompanySkills.production.tsx:3026— CompanySkills.production.SkillDetailPage::renderFilesBody has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 14 (36 pts), boolean chains 4 (nesting depth added 22). 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. This shape REPEATS in the file: one other method here (CompanySkills.production.SkillDetailPage) 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.
ExternalCommandExecutor::operation (cognitive 40) packages/paperclip-runner/runner/crates/runner-core/src/external_provider_backend.rs:538— ExternalCommandExecutor::operation has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 10, 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.
sandbox-callback-bridge.startSandboxCallbackBridgeWorker.processRequestFile (cognitive 39) REDACTED:959— sandbox-callback-bridge.startSandboxCallbackBridgeWorker.processRequestFile has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 6, error handling 4 (5 pts), ternaries 4 (5 pts), loops 1 (nesting depth added 6). Of this number, 29 points are the body's own statements and 10 belong to 2 function items inside it that branch. 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.
parse.createCodexJsonlParser (cognitive 39) packages/adapters/codex-local/src/server/parse.ts:34— parse.createCodexJsonlParser has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (34 pts), boolean chains 4, loops 1 (nesting depth added 20). None of this is in the body itself: all 39 points belong to 2 function literals inside it that branch (lines 48, 61). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
durable-prp-control-plane.spawnRunner (cognitive 39) REDACTED:3519— durable-prp-control-plane.spawnRunner has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (21 pts), ternaries 8 (11 pts), boolean chains 4, error handling 2 (3 pts) (nesting depth added 10). Of this number, 32 points are the body's own statements and 7 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.
BoundedJsonCompactor.#endString (cognitive 39) packages/paperclip-runner/src/drivers/opencode/sse-frames.ts:311— BoundedJsonCompactor.#endString has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 5, ternaries 3 (5 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.
copilot-inner-distribution.readCopilotInnerTar (cognitive 39) packages/paperclip-runner/scripts/copilot-inner-distribution.mjs:45— copilot-inner-distribution.readCopilotInnerTar has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 10, loops 3 (4 pts), ternaries 2 (3 pts) (nesting depth added 11). Of this number, 32 points are the body's own statements and 7 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.
copilot-metadata-probe.probeCopilotMetadata (cognitive 39) packages/paperclip-runner/src/drivers/copilot-metadata-probe.ts:19— copilot-metadata-probe.probeCopilotMetadata has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 10, ternaries 5 (9 pts), error handling 3, loops 1 (nesting depth added 8). Of this number, 24 points are the body's own statements and 15 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.
pi-runtime-extension.checkPiNativeTool (cognitive 39) packages/paperclip-runner/src/drivers/acpx/pi-runtime-extension.ts:170— pi-runtime-extension.checkPiNativeTool has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 4 (8 pts), boolean chains 7, ternaries 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.
provider-fresh-workspace.stageProviderFreshWorkspace (cognitive 39) server/src/services/provider-fresh-workspace.ts:20— provider-fresh-workspace.stageProviderFreshWorkspace has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (20 pts), ternaries 2 (9 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 23). Of this number, 35 points are the body's own statements and 4 belong to one function literal 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.
chat-completion-delivery.chatCompletionDeliveryService.deliver (cognitive 39) server/src/services/chat-completion-delivery.ts:164— chat-completion-delivery.chatCompletionDeliveryService.deliver has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (21 pts), ternaries 5 (11 pts), boolean chains 6, error handling 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.
tool-access-policy.argumentFiltersMatch (cognitive 39) server/src/services/tool-access-policy.ts:226— tool-access-policy.argumentFiltersMatch has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 4 (8 pts), boolean chains 4, error handling 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.
isolated-repository-rehome.cleanupRehomedSource (cognitive 39) server/src/services/isolated-repository-rehome.ts:605— isolated-repository-rehome.cleanupRehomedSource has cognitive complexity 39 (threshold 15). Drivers by points: if/else 21 (33 pts), boolean chains 5, ternaries 1 (nesting depth added 12). Of this number, 36 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.
email-connections.emailConnectionService.listCredentials (cognitive 39) server/src/services/email-connections.ts:78— email-connections.emailConnectionService.listCredentials has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 7 (18 pts), if/else 3 (8 pts), boolean chains 7, error handling 2 (5 pts), loops 1 (nesting depth added 19). None of this is in the body itself: all 39 points belong to 4 function items inside it that branch (a function literal at line 92, a function literal at line 125, a function literal at line 84, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
chat-channels.chatChannelService.authorizeRetainedChatSourcePublication (cognitive 39) server/src/services/chat-channels.ts:1226— chat-channels.chatChannelService.authorizeRetainedChatSourcePublication has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 13, error handling 2 (3 pts), ternaries 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.
runner-bridge-tools.executeWorkspaceToolInLane (cognitive 39) server/src/services/native-runtime/runner-bridge-tools.ts:147— runner-bridge-tools.executeWorkspaceToolInLane has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 6 (13 pts), boolean chains 4, error handling 2 (4 pts) (nesting depth added 15). Of this number, 20 points are the body's own statements and 19 belong to 6 function literals 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.
routines.routineService.update (cognitive 39) server/src/services/routines.ts:2324— routines.routineService.update has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (22 pts), ternaries 11 (12 pts), boolean chains 5 (nesting depth added 5). Of this number, 20 points are the body's own statements and 19 belong to one function literal inside it that branches. 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.
recovery.createHeartbeatRecovery.drainRunningRunsForShutdown (cognitive 39) server/src/services/heartbeat/recovery.ts:1061— recovery.createHeartbeatRecovery.drainRunningRunsForShutdown has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 8, ternaries 7, error handling 1, loops 1 (nesting depth added 4). Most of this is not in the body itself: 7 of the 39 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1096, 1212). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
customer-success.parseInspectionQuery (cognitive 39) packages/shared/src/customer-success.ts:132— customer-success.parseInspectionQuery has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 19, if/else 15 (18 pts), loops 2 (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.
app-definition.connectionMethodDefSchema (cognitive 39) packages/shared/src/validators/app-definition.ts:11— app-definition.connectionMethodDefSchema has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 17, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
eval-schedule-monitor.inspectEvalSchedule (cognitive 39) scripts/eval-schedule-monitor.mjs:32— eval-schedule-monitor.inspectEvalSchedule has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 8, ternaries 2 (5 pts), error handling 1, loops 1 (nesting depth added 11). Of this number, 37 points are the body's own statements and 2 belong to 2 function literals 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.
billing-reconciliation.billingReconciliationService.reconcile (cognitive 39) server/src/services/billing-reconciliation.ts:87— billing-reconciliation.billingReconciliationService.reconcile has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 9 (28 pts), if/else 3 (5 pts), boolean chains 3, loops 3 (nesting depth added 21). None of this is in the body itself: all 39 points belong to one function literal inside it that branches (line 87). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
company-search-extract.companySearchExtractService.extract (cognitive 39) server/src/services/company-search-extract.ts:154— company-search-extract.companySearchExtractService.extract has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 3 (6 pts), ternaries 3 (6 pts), boolean chains 5 (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.
skill-source-sync.skillSourceSyncService.sweep (cognitive 39) server/src/services/skill-source-sync.ts:249— skill-source-sync.skillSourceSyncService.sweep has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (19 pts), ternaries 2 (8 pts), error handling 2 (5 pts), loops 4, 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.
posthog-live.completePosthogAuthorization (cognitive 39) scripts/smoke/posthog-live.mjs:277— posthog-live.completePosthogAuthorization has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 5, error handling 2 (4 pts), loops 1 (nesting depth added 19). Of this number, 37 points are the body's own statements and 2 belong to one function literal 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.
NewIssueDialog.NewIssueDialog::handleSubmit (cognitive 39) ui/src/components/NewIssueDialog.tsx:792— NewIssueDialog.NewIssueDialog::handleSubmit has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 26 (28 pts), boolean chains 9, if/else 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (NewIssueDialog.NewIssueDialog) 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.
GrokBotConnection.GrokBotConnection (cognitive 39) ui/src/components/GrokBotConnection.tsx:13— GrokBotConnection.GrokBotConnection has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 24, ternaries 6 (10 pts), if/else 5 (nesting depth added 4). Of this number, 33 points are the body's own statements and 6 belong to 5 function items inside it that branch. 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.
issue-timeline-events.extractIssueTimelineEvents (cognitive 39) ui/src/lib/issue-timeline-events.ts:158— issue-timeline-events.extractIssueTimelineEvents has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (28 pts), ternaries 2 (6 pts), boolean chains 4, 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.
DecisionHistory.DecisionHistoryTable (cognitive 39) ui/src/components/decision-models/DecisionHistory.tsx:8— DecisionHistory.DecisionHistoryTable has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 18 (33 pts), boolean chains 5, if/else 1 (nesting depth added 15). Most of this is not in the body itself: 13 of the 39 points are its own statements and the rest belongs to one function literal inside it that branches (line 14). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
OwnSlackAppSetup.OwnSlackAppSetup (cognitive 39) ui/src/pages/apps/chat/slack/OwnSlackAppSetup.tsx:13— OwnSlackAppSetup.OwnSlackAppSetup has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 29, ternaries 7 (17 pts), if/else 12 (14 pts), error handling 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. This shape REPEATS in the file: one other method here (OwnSlackAppSetup.OwnSlackAppSetup::create) 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.
CompanySkills.InstallPreviewDialog (cognitive 39) ui/src/pages/CompanySkills.tsx:1948— CompanySkills.InstallPreviewDialog has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 22 (28 pts), if/else 7, boolean chains 4 (nesting depth added 6). Of this number, 24 points are the body's own statements and 15 belong to 7 function literals inside it that branch. 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.
ImportFromVaultDialog.SelectStep (cognitive 39) ui/src/pages/secrets/ImportFromVaultDialog.tsx:853— ImportFromVaultDialog.SelectStep has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 8 (22 pts), boolean chains 16, if/else 1 (nesting depth added 14). Of this number, 20 points are the body's own statements and 19 belong to 2 function literals inside it that branch. 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.
CompanySkills.production.InstallPreviewDialog (cognitive 39) ui/src/pages/CompanySkills.production.tsx:2038— CompanySkills.production.InstallPreviewDialog has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 22 (28 pts), if/else 7, boolean chains 4 (nesting depth added 6). Of this number, 24 points are the body's own statements and 15 belong to 7 function literals inside it that branch. 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.
useRecentTasks.useRecentTasks (cognitive 39) ui/src/hooks/useRecentTasks.ts:24— useRecentTasks.useRecentTasks has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 16, if/else 15, ternaries 6 (7 pts), loops 1 (nesting depth added 1). Most of this is not in the body itself: 8 of the 39 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 102, 122, 46, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Management.Management (cognitive 39) ui/storybook/prototypes/provider-routing/Management.tsx:30— Management.Management has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 18 (26 pts), boolean chains 9, if/else 4 (nesting depth added 8). Of this number, 27 points are the body's own statements and 12 belong to 7 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.
execution-target.runAdapterExecutionTargetShellCommand (cognitive 38) REDACTED:950— execution-target.runAdapterExecutionTargetShellCommand has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (35 pts), error handling 1 (3 pts) (nesting depth added 27). 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.
format-event.printKimiStreamEvent (cognitive 38) packages/adapters/kimi-local/src/cli/format-event.ts:23— format-event.printKimiStreamEvent has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (25 pts), error handling 2 (5 pts), boolean chains 4, loops 1 (2 pts), ternaries 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.
CapabilityLiveSession.#handleServerRequest (cognitive 38) packages/paperclip-runner/src/live/live-session.ts:2574— CapabilityLiveSession.#handleServerRequest has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (18 pts), ternaries 5 (9 pts), boolean chains 7, error handling 1 (2 pts), loops 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.
eval-observability-runtime.prepareEvalObservabilityRuntime (cognitive 38) packages/paperclip-runner/src/cli/eval-observability-runtime.ts:48— eval-observability-runtime.prepareEvalObservabilityRuntime has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 9, loops 4 (5 pts), ternaries 4 (5 pts), error handling 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.
plugin-worker-manager.createPluginWorkerHandle (cognitive 38) server/src/services/plugin-worker-manager.ts:879— plugin-worker-manager.createPluginWorkerHandle has cognitive complexity 38 (threshold 15). Drivers by points: if/else 205 (229 pts), ternaries 40 (58 pts), boolean chains 56, error handling 21 (29 pts), loops 14 (18 pts) (nesting depth added 54). 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. This shape REPEATS in the file: 4 other methods here (plugin-worker-manager.createPluginWorkerHandle::routeExecuteLogNotification, plugin-worker-manager.createPluginWorkerHandle::openDuplexChannel, plugin-worker-manager.createPluginWorkerHandle::handleWorkerNotification, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
installs.createConnectionInstalls.putConnectionInstalls (cognitive 38) server/src/services/tool-access/connections/installs.ts:145— installs.createConnectionInstalls.putConnectionInstalls has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 5 (12 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 16). Most of this is not in the body itself: 9 of the 38 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 178, 262). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
voice-session-service.voiceSessionService.reconcileReports (cognitive 38) server/src/services/voice/voice-session-service.ts:277— voice-session-service.voiceSessionService.reconcileReports has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 7 (19 pts), if/else 5 (13 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 21). Of this number, 22 points are the body's own statements and 16 belong to 2 function literals 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.
subscriptions.subscriptionService.register (cognitive 38) server/src/services/subscriptions.ts:99— subscriptions.subscriptionService.register has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 12, ternaries 5 (7 pts) (nesting depth added 7). Most of this is not in the body itself: 4 of the 38 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 105, 129). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
codemod-extract-misc.main (cognitive 38) scripts/codemod-extract-misc.mjs:453— codemod-extract-misc.main has cognitive complexity 38 (threshold 15). Drivers by points: loops 15 (28 pts), if/else 4 (5 pts), boolean chains 3, ternaries 2 (nesting depth added 14). 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.
costs.costRoutes (cognitive 38) server/src/routes/costs.ts:69— costs.costRoutes has cognitive complexity 38 (threshold 15). Drivers by points: if/else 32, boolean chains 5, ternaries 1. None of this is in the body itself: all 38 points belong to 28 function items inside it that branch (a function literal at line 232, a function literal at line 436, a function literal at line 105, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
issues.queueResolvedInteractionContinuationWakeup (cognitive 38) server/src/routes/issues.ts:2438— issues.queueResolvedInteractionContinuationWakeup has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 22 (23 pts), boolean chains 12, if/else 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.
tool-access.toolAccessRoutes::handlePaperclipCloudConnectorCallback (cognitive 38) REDACTED:1124— tool-access.toolAccessRoutes::handlePaperclipCloudConnectorCallback has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 14 (20 pts), if/else 7 (9 pts), boolean chains 8, error handling 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.
AgentChats.AgentChatsContent (cognitive 38) ui/src/pages/AgentChats.tsx:20— AgentChats.AgentChatsContent has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 13, if/else 8 (11 pts), ternaries 5 (11 pts), error handling 1 (3 pts) (nesting depth added 11). Of this number, 19 points are the body's own statements and 19 belong to 5 function literals 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.
inbox.buildInboxIssueGroupCreateDefaults (cognitive 38) ui/src/lib/inbox.ts:1015— inbox.buildInboxIssueGroupCreateDefaults has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (20 pts), ternaries 6 (17 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.
TaskChatRunnerTurn.TaskChatRunnerTurn (cognitive 38) ui/src/components/task-chat/TaskChatRunnerTurn.tsx:117— TaskChatRunnerTurn.TaskChatRunnerTurn has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 13 (23 pts), boolean chains 12, if/else 3 (nesting depth added 10). Of this number, 24 points are the body's own statements and 14 belong to 3 function literals 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.
activity-format.formatActivityVerb (cognitive 38) ui/src/lib/activity-format.ts:462— activity-format.formatActivityVerb has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (23 pts), ternaries 6 (15 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.
RoutineList.RoutineListRow (cognitive 38) ui/src/components/RoutineList.tsx:55— RoutineList.RoutineListRow has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 24 (32 pts), boolean chains 6 (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.
AppNotConnected.AppNotConnected (cognitive 38) ui/src/pages/apps/AppNotConnected.tsx:25— AppNotConnected.AppNotConnected has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 15, ternaries 9 (13 pts), if/else 10 (nesting depth added 4). Of this number, 34 points are the body's own statements and 4 belong to 3 function literals inside it that branch. 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.
ImportSkillsFromProjectDialog.ProjectSkillBrowser (cognitive 38) ui/src/pages/skills/ImportSkillsFromProjectDialog.tsx:780— ImportSkillsFromProjectDialog.ProjectSkillBrowser has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 9 (33 pts), boolean chains 5 (nesting depth added 24). Most of this is not in the body itself: 8 of the 38 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 862, 845, 877, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Secrets.AgentAccessSection (cognitive 38) ui/src/pages/Secrets.tsx:4379— Secrets.AgentAccessSection has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 13 (29 pts), boolean chains 4, if/else 3, loops 2 (nesting depth added 16). Of this number, 23 points are the body's own statements and 15 belong to 5 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.
AdapterManager.AdapterManager (cognitive 38) ui/src/pages/AdapterManager.tsx:257— AdapterManager.AdapterManager has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 19 (27 pts), boolean chains 7, if/else 4 (nesting depth added 8). Most of this is not in the body itself: 12 of the 38 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 550, 290, 342, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
JoinRequestQueue.JoinRequestQueue (cognitive 38) ui/src/pages/JoinRequestQueue.tsx:14— JoinRequestQueue.JoinRequestQueue has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 14 (29 pts), boolean chains 6, if/else 3 (nesting depth added 15). Most of this is not in the body itself: 10 of the 38 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 126, 32). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TaskChatQueuedMessages.TaskChatQueuedMessages::runRowAction (cognitive 38) ui/src/components/task-chat/TaskChatQueuedMessages.tsx:306— TaskChatQueuedMessages.TaskChatQueuedMessages::runRowAction has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 10 (23 pts), if/else 7 (8 pts), boolean chains 3, loops 2 (3 pts), error handling 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.
AgentSetup.AgentRoutingFields (cognitive 38) ui/storybook/prototypes/provider-routing/AgentSetup.tsx:94— AgentSetup.AgentRoutingFields has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 20, ternaries 10 (13 pts), if/else 3 (5 pts) (nesting depth added 5). Of this number, 34 points are the body's own statements and 4 belong to 3 function literals inside it that branch. 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.
CredentialTaskPage.CredentialTaskPage (cognitive 38) ui/storybook/support/credential-access/CredentialTaskPage.tsx:13— CredentialTaskPage.CredentialTaskPage has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (24 pts), ternaries 9 (11 pts), boolean chains 2, loops 1 (nesting depth added 9). None of this is in the body itself: all 38 points belong to 3 function literals inside it that branch (lines 70, 17, 99). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-checkpoint.validateCheckpointPayload (cognitive 37) packages/adapter-utils/src/workspace-checkpoint.ts:134— workspace-checkpoint.validateCheckpointPayload has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 5 (11 pts), boolean chains 6 (nesting depth added 17). Of this number, 35 points are the body's own statements and 2 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.
DurablePrpCodexTransport.#startTurn (cognitive 37) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:6010— DurablePrpCodexTransport.#startTurn has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 9, ternaries 9, loops 1 (nesting depth added 5). Of this number, 31 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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.
DurablePrpCodexTransport.#watchRunner (cognitive 37) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:6942— DurablePrpCodexTransport.#watchRunner has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 13 (25 pts), boolean chains 6, if/else 6 (nesting depth added 12). None of this is in the body itself: all 37 points belong to 2 function literals inside it that branch (lines 6944, 6993). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CapabilityLiveSessionService.create (cognitive 37) packages/paperclip-runner/src/live/live-session.ts:908— CapabilityLiveSessionService.create has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 15 (28 pts), boolean chains 5, if/else 4 (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.
chat-telegram-ephemeral.sendTelegramCallbackNotice (cognitive 37) server/src/services/chat-telegram-ephemeral.ts:239— chat-telegram-ephemeral.sendTelegramCallbackNotice has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 9, ternaries 1 (3 pts), error handling 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.
chat-teams-file-consent.classifyTeamsUploadResponse (cognitive 37) server/src/services/chat-teams-file-consent.ts:1006— chat-teams-file-consent.classifyTeamsUploadResponse has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 10, ternaries 2 (4 pts), loops 2 (3 pts), error handling 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.
plugin-database.splitSqlStatements (cognitive 37) server/src/services/plugin-database.ts:57— plugin-database.splitSqlStatements has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (32 pts), boolean chains 4, 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.
tool-gateway.createToolGatewayService.maybeRefreshPaperclipCloudGrant (cognitive 37) server/src/services/tool-gateway.ts:3834— tool-gateway.createToolGatewayService.maybeRefreshPaperclipCloudGrant has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 8 (12 pts), boolean chains 10, error handling 1 (nesting depth added 6). Of this number, 24 points are the body's own statements and 13 belong to one function literal inside it that branches. 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.
customer-owned.createCustomerOwnedSetup.create (cognitive 37) server/src/services/connectors/slack/setup/customer-owned.ts:11— customer-owned.createCustomerOwnedSetup.create has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 7, ternaries 4 (7 pts), error handling 3 (nesting depth added 9). None of this is in the body itself: all 37 points belong to one function literal inside it that branches (line 12). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
connection-intents.connectionIntentService.setupOptions (cognitive 37) server/src/services/connection-intents.ts:861— connection-intents.connectionIntentService.setupOptions has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 12, if/else 7 (10 pts), error handling 1 (2 pts) (nesting depth added 6). Of this number, 26 points are the body's own statements and 11 belong to 3 function literals inside it that branch. 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.
aggregator-app-discovery.pages (cognitive 37) server/src/services/aggregator-app-discovery.ts:31— aggregator-app-discovery.pages has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 7, ternaries 3 (7 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.
tool-connection-activity.listConnectionLifecycleEvents (cognitive 37) server/src/services/tool-connection-activity.ts:74— tool-connection-activity.listConnectionLifecycleEvents has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (23 pts), ternaries 5 (6 pts), boolean chains 5, loops 3 (nesting depth added 8). Of this number, 30 points are the body's own statements and 7 belong to 3 function literals 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.
native-harness-backup-stamp.verifyNativeHarnessBackupStamp (cognitive 37) server/src/services/native-runtime/native-harness-backup-stamp.ts:145— native-harness-backup-stamp.verifyNativeHarnessBackupStamp has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 8, loops 2 (3 pts), error handling 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.
copilot-connection-probe.probeCopilotExecutionTarget (cognitive 37) server/src/services/copilot-connection-probe.ts:80— copilot-connection-probe.probeCopilotExecutionTarget has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 7, ternaries 2 (4 pts), error handling 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.
agent-file-checkpoints.validateAgentFileCheckpoint (cognitive 37) server/src/services/agent-file-checkpoints.ts:34— agent-file-checkpoints.validateAgentFileCheckpoint has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 8, loops 3 (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.
agent-observability.agentObservabilityService.configure (cognitive 37) server/src/services/agent-observability.ts:74— agent-observability.agentObservabilityService.configure has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 10, ternaries 2 (5 pts) (nesting depth added 12). None of this is in the body itself: all 37 points belong to 2 function literals inside it that branch (lines 77, 100). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
feature-map.featureIndex (cognitive 37) scripts/feature-map.mjs:6— feature-map.featureIndex has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 7, loops 3 (5 pts) (nesting depth added 15). Of this number, 36 points are the body's own statements and 1 belongs to one function literal 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.
billing-reconciliation.billingReconciliationService.importInvoice (cognitive 37) server/src/services/billing-reconciliation.ts:26— billing-reconciliation.billingReconciliationService.importInvoice has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 4 (9 pts), boolean chains 3, loops 3 (nesting depth added 17). None of this is in the body itself: all 37 points belong to one function literal inside it that branches (line 26). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
company-portability.extractPortableScopedEnvInputs (cognitive 37) server/src/services/company-portability.ts:602— company-portability.extractPortableScopedEnvInputs has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 6 (18 pts), if/else 7 (15 pts), boolean chains 3, 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.
IssueColumns.InboxIssueTrailingColumns (cognitive 37) ui/src/components/IssueColumns.tsx:268— IssueColumns.InboxIssueTrailingColumns has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (25 pts), ternaries 5 (11 pts), boolean chains 1 (nesting depth added 15). Most of this is not in the body itself: 1 of the 37 points is its own statement and the rest belongs to one function literal inside it that branches (line 322). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
IssueThreadInteractionCard.RequestConfirmationCard (cognitive 37) ui/src/components/IssueThreadInteractionCard.tsx:2564— IssueThreadInteractionCard.RequestConfirmationCard has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 9 (20 pts), if/else 7 (8 pts), boolean chains 5, error handling 3, loops 1 (nesting depth added 12). Of this number, 19 points are the body's own statements and 18 belong to 6 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.
TaskChatStatusPill.TaskChatStatusPill (cognitive 37) ui/src/components/task-chat/TaskChatStatusPill.tsx:286— TaskChatStatusPill.TaskChatStatusPill has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 18 (32 pts), boolean chains 4, if/else 1 (nesting depth added 14). Of this number, 35 points are the body's own statements and 2 belong to one function literal 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.
CompanyEnvironments.EnvironmentCustomImageBrowserTerminal (cognitive 37) ui/src/pages/CompanyEnvironments.tsx:465— CompanyEnvironments.EnvironmentCustomImageBrowserTerminal has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15, boolean chains 12, ternaries 5 (7 pts), error handling 2, loops 1 (nesting depth added 2). Most of this is not in the body itself: 5 of the 37 points are its own statements and the rest belongs to 17 function literals inside it that branch (lines 638, 551, 500, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
profile-model.buildEntries (cognitive 37) ui/src/pages/tools/profiles/profile-model.ts:203— profile-model.buildEntries has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 5 (12 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.
setup-state.slackSetupState (cognitive 37) ui/src/pages/apps/chat/slack/setup-state.ts:16— setup-state.slackSetupState has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 9 (27 pts), boolean chains 10 (nesting depth added 18). 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.
AdvancedPanel.ReconnectCard (cognitive 37) ui/src/pages/apps/app-detail/AdvancedPanel.tsx:147— AdvancedPanel.ReconnectCard has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 13 (30 pts), boolean chains 5, error handling 1, if/else 1 (nesting depth added 17). Of this number, 29 points are the body's own statements and 8 belong to 4 function literals inside it that branch. 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.
AgentMultiSelect.AgentMultiSelect (cognitive 37) ui/src/components/AgentMultiSelect.tsx:115— AgentMultiSelect.AgentMultiSelect has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 13 (23 pts), if/else 8 (10 pts), boolean chains 4 (nesting depth added 12). Of this number, 18 points are the body's own statements and 19 belong to 7 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.
SkillStudio.RunTemplateAdvancedPanel (cognitive 37) ui/src/pages/SkillStudio.tsx:2630— SkillStudio.RunTemplateAdvancedPanel has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 10 (26 pts), boolean chains 11 (nesting depth added 16). Of this number, 31 points are the body's own statements and 6 belong to 6 function literals inside it that branch. 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.
TaskChatCompactInteractionCard.CheckboxConfirmationCard (cognitive 37) ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx:1061— TaskChatCompactInteractionCard.CheckboxConfirmationCard has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 13 (18 pts), boolean chains 10, if/else 8, error handling 1 (nesting depth added 5). Of this number, 21 points are the body's own statements and 16 belong to 6 function items inside it that branch. 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.
ConnectionSetupFlow.ConnectionSetupFlow (cognitive 37) ui/src/features/connections/ConnectionSetupFlow.tsx:584— ConnectionSetupFlow.ConnectionSetupFlow has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 18, if/else 11 (16 pts), error handling 1 (2 pts), ternaries 1 (nesting depth added 6). Of this number, 33 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
wizard-preview-main.respond (cognitive 37) ui/src/wizard-preview-main.tsx:50— wizard-preview-main.respond has cognitive complexity 37 (threshold 15). Drivers by points: if/else 21 (28 pts), ternaries 4 (9 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.
worktree.worktreeCleanupCommand (cognitive 36) cli/src/commands/worktree.ts:2882— worktree.worktreeCleanupCommand has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 6, error handling 2 (5 pts), loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 10). Of this number, 35 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
parse-stdout.parseAssistantMessage (cognitive 36) packages/adapters/cursor-local/src/ui/parse-stdout.ts:101— parse-stdout.parseAssistantMessage has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 4 (9 pts), boolean chains 7, 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.
parse.parseKimiJsonl (cognitive 36) packages/adapters/kimi-local/src/server/parse.ts:79— parse.parseKimiJsonl has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (25 pts), boolean chains 4, loops 2 (4 pts), ternaries 1 (3 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.
DurablePrpControlPlane.#authResponse (cognitive 36) REDACTED:2593— DurablePrpControlPlane.#authResponse has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 10, 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.
single-read-evidence.updateSingleReadEvidence (cognitive 36) packages/paperclip-runner/src/drivers/acpx/single-read-evidence.ts:33— single-read-evidence.updateSingleReadEvidence has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 15, if/else 10 (15 pts), ternaries 3 (6 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.
native-session-runtime.retryQuarantinedSessionCleanups (cognitive 36) packages/paperclip-runner/src/native-session-runtime.ts:759— native-session-runtime.retryQuarantinedSessionCleanups has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 3 (5 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.
worktree-config.collectSiblingWorktreePorts (cognitive 36) server/src/worktree-config.ts:232— worktree-config.collectSiblingWorktreePorts has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 4 (6 pts), boolean chains 5, error handling 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.
worktree-config.maybeRepairLegacyWorktreeConfigAndEnvFiles (cognitive 36) server/src/worktree-config.ts:450— worktree-config.maybeRepairLegacyWorktreeConfigAndEnvFiles has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 6 (19 pts), if/else 6 (10 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 18). Most of this is not in the body itself: 9 of the 36 points are its own statements and the rest belongs to one function literal inside it that branches (line 470). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
ai-connections.aiConnectionService.select (cognitive 36) server/src/services/ai-connections.ts:248— ai-connections.aiConnectionService.select has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 18, if/else 15 (16 pts), ternaries 2 (nesting depth added 1). Of this number, 34 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
ChatSdkEndpointRuntime.constructor (cognitive 36) server/src/services/chat-sdk-runtime.ts:2054— ChatSdkEndpointRuntime.constructor has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 14, error handling 2 (3 pts), ternaries 2 (nesting depth added 7). Of this number, 20 points are the body's own statements and 16 belong to 7 function literals 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.
workspace-runtime.spawnLocalRuntimeService.readiness (cognitive 36) server/src/services/workspace-runtime.ts:6844— workspace-runtime.spawnLocalRuntimeService.readiness has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 9 (15 pts), boolean chains 10, if/else 6 (7 pts), 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.
chat-teams-inline-images.png (cognitive 36) server/src/services/chat-teams-inline-images.ts:36— chat-teams-inline-images.png has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 10, 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.
chat-telegram-photo.supportedPng (cognitive 36) server/src/services/chat-telegram-photo.ts:21— chat-telegram-photo.supportedPng has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 10, 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.
events.createPhotonEvents.handlePhotonEvent (cognitive 36) server/src/services/chat-channels/imessage-photon/events.ts:712— events.createPhotonEvents.handlePhotonEvent has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 16, if/else 13 (15 pts), ternaries 4 (5 pts) (nesting depth added 3). Of this number, 22 points are the body's own statements and 14 belong to 2 function literals inside it that branch. 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.
connection-refresh.createLegacyOAuthRefresh::refreshOAuthCredentials (cognitive 36) server/src/services/tool-access/oauth/connection-refresh.ts:98— connection-refresh.createLegacyOAuthRefresh::refreshOAuthCredentials has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 10, ternaries 7 (9 pts), error handling 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.
exchange.createConnectionTokenExchange::mintExchangeConnectionToken (cognitive 36) server/src/services/tool-access/token-broker/exchange.ts:135— exchange.createConnectionTokenExchange::mintExchangeConnectionToken has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 15 (25 pts), if/else 5 (6 pts), boolean chains 5 (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.
routine.grokRoutineService.acknowledge (cognitive 36) server/src/services/grok-bot/routine.ts:276— routine.grokRoutineService.acknowledge has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 9, ternaries 4 (5 pts) (nesting depth added 8). Most of this is not in the body itself: 3 of the 36 points are its own statements and the rest belongs to one function literal inside it that branches (line 280). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-codex-runner.executeNativeCodexRunner (cognitive 36) server/src/services/native-runtime/native-codex-runner.ts:323— native-codex-runner.executeNativeCodexRunner has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 12 (14 pts), if/else 10 (11 pts), boolean chains 8, loops 1 (2 pts), error handling 1 (nesting depth added 4). Of this number, 31 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
setup-readiness.probeRemoteNativeCodex (cognitive 36) server/src/services/native-runtime/setup-readiness.ts:84— setup-readiness.probeRemoteNativeCodex has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 11, ternaries 5 (7 pts), error handling 1 (2 pts), loops 1 (nesting depth added 8). Most of this is not in the body itself: 14 of the 36 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 158, a function literal at line 170, a function literal at line 123, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
usage-receipts.persistUsageReceipt (cognitive 36) server/src/services/usage-receipts.ts:67— usage-receipts.persistUsageReceipt has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 10 (14 pts), boolean chains 11, if/else 8 (9 pts), error handling 1 (2 pts) (nesting depth added 6). None of this is in the body itself: all 36 points belong to one function literal inside it that branches (line 70). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-failed-workspace-recovery.preserveNativeFailedWorkspace (cognitive 36) server/src/services/native-runtime/native-failed-workspace-recovery.ts:13— native-failed-workspace-recovery.preserveNativeFailedWorkspace has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 20, if/else 12 (13 pts), ternaries 2 (3 pts) (nesting depth added 2). Most of this is not in the body itself: 2 of the 36 points are its own statements and the rest belongs to one function literal inside it that branches (line 17). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
agent-instruction-working-copies.agentInstructionWorkingCopyService.recoverStopped (cognitive 36) server/src/services/agent-instruction-working-copies.ts:328— agent-instruction-working-copies.agentInstructionWorkingCopyService.recoverStopped has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 8, ternaries 1 (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.
native-runner-file-handoff.stageNativeRunnerWakeAttachments (cognitive 36) server/src/services/native-runtime/native-runner-file-handoff.ts:812— native-runner-file-handoff.stageNativeRunnerWakeAttachments has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 3 (7 pts), boolean chains 6, ternaries 3 (4 pts), error handling 2 (3 pts) (nesting depth added 11). Of this number, 19 points are the body's own statements and 17 belong to 4 function literals 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.
native-session-executor.resolveNativeBilling (cognitive 36) server/src/services/native-runtime/native-session-executor.ts:10188— native-session-executor.resolveNativeBilling has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 8 (17 pts), if/else 9 (10 pts), boolean chains 9 (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.
native-interaction-bridge.applyNativeAttentionStatusDecision (cognitive 36) server/src/services/native-runtime/native-interaction-bridge.ts:55— native-interaction-bridge.applyNativeAttentionStatusDecision has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (22 pts), ternaries 4 (12 pts), boolean chains 1, loops 1 (nesting depth added 21). Most of this is not in the body itself: 1 of the 36 points is its own statement and the rest belongs to one function literal inside it that branches (line 67). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
run-preparation.attestReviewedExternalChatRun (cognitive 36) server/src/services/heartbeat/run-preparation.ts:2052— run-preparation.attestReviewedExternalChatRun has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 10, error handling 2 (3 pts), ternaries 2, loops 1 (nesting depth added 10). Most of this is not in the body itself: 12 of the 36 points are its own statements and the rest belongs to one function literal inside it that branches (line 2064). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
provider-trace-store.assessProviderTraceEntries (cognitive 36) server/src/services/provider-trace-store.ts:171— provider-trace-store.assessProviderTraceEntries has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (21 pts), ternaries 4 (8 pts), loops 4 (5 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.
run-completion.createHeartbeatRunCompletion.failRunSetup (cognitive 36) server/src/services/heartbeat/run-completion.ts:1283— run-completion.createHeartbeatRunCompletion.failRunSetup has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 12 (16 pts), if/else 8 (14 pts), boolean chains 6 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
plugin-local-folders.inspectPluginLocalFolder (cognitive 36) server/src/services/plugin-local-folders.ts:134— plugin-local-folders.inspectPluginLocalFolder has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (18 pts), error handling 3 (6 pts), ternaries 3 (5 pts), loops 2 (4 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.
SidebarNavItem.SidebarNavItem (cognitive 36) ui/src/components/SidebarNavItem.tsx:71— SidebarNavItem.SidebarNavItem has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 17, ternaries 10 (17 pts), if/else 2 (nesting depth added 7). Of this number, 34 points are the body's own statements and 2 belong to 2 function literals 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.
CommandPalette.CommandPalette (cognitive 36) ui/src/components/CommandPalette.tsx:92— CommandPalette.CommandPalette has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 19, if/else 8 (9 pts), ternaries 8 (nesting depth added 1). Of this number, 18 points are the body's own statements and 18 belong to 12 function items inside it that branch. 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.
OnboardingCharacter.OnboardingCharacter (cognitive 36) ui/src/components/onboarding/OnboardingCharacter.tsx:42— OnboardingCharacter.OnboardingCharacter has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 8, ternaries 5, error handling 2, loops 2 (nesting depth added 3). Most of this is not in the body itself: 5 of the 36 points are its own statements and the rest belongs to 9 function items inside it that branch (mount, wake, a function literal at line 164, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TaskChatThreadView.TaskChatThreadView (cognitive 36) ui/src/components/task-chat/TaskChatThreadView.tsx:299— TaskChatThreadView.TaskChatThreadView has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 20 (30 pts), boolean chains 5, if/else 1 (nesting depth added 10). Most of this is not in the body itself: 10 of the 36 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 336, 357, 378, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
IssueDetail.IssueDetailActivityTab (cognitive 36) ui/src/pages/IssueDetail.tsx:2799— IssueDetail.IssueDetailActivityTab has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 15, if/else 6 (12 pts), ternaries 5 (7 pts), error handling 1, loops 1 (nesting depth added 8). Most of this is not in the body itself: 13 of the 36 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 2864, 2837, 3079, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ConfigureBuiltInAgentModal.ConfigureBuiltInAgentModal (cognitive 36) ui/src/components/ConfigureBuiltInAgentModal.tsx:60— ConfigureBuiltInAgentModal.ConfigureBuiltInAgentModal has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 18, ternaries 14 (15 pts), if/else 3 (nesting depth added 1). Most of this is not in the body itself: 14 of the 36 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 134, 77, 71, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
activity-format.formatStructuredIssueChange (cognitive 36) ui/src/lib/activity-format.ts:420— activity-format.formatStructuredIssueChange has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 8 (20 pts), if/else 7 (11 pts), boolean chains 5 (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.
ApprovalDetail.ApprovalDetail (cognitive 36) ui/src/pages/ApprovalDetail.tsx:20— ApprovalDetail.ApprovalDetail has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 15, ternaries 13 (15 pts), if/else 5, loops 1 (nesting depth added 2). Of this number, 24 points are the body's own statements and 12 belong to 11 function items inside it that branch. 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.
AppLogo.AppLogo (cognitive 36) ui/src/pages/apps/AppLogo.tsx:38— AppLogo.AppLogo has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 13 (29 pts), boolean chains 4, if/else 3 (nesting depth added 16). Of this number, 34 points are the body's own statements and 2 belong to 2 function literals 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.
TokensPanel.TokensPanel (cognitive 36) ui/src/pages/apps/gateways/panels/TokensPanel.tsx:77— TokensPanel.TokensPanel has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 18 (28 pts), boolean chains 5, if/else 2, error handling 1 (nesting depth added 10). Of this number, 17 points are the body's own statements and 19 belong to 8 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.
PluginPage.PluginPage (cognitive 36) ui/src/pages/PluginPage.tsx:25— PluginPage.PluginPage has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 8, ternaries 2 (3 pts) (nesting depth added 6). Of this number, 17 points are the body's own statements and 19 belong to 9 function literals inside it that branch. 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.
JsonSchemaForm.SecretField (cognitive 36) REDACTED:583— JsonSchemaForm.SecretField has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 16 (28 pts), boolean chains 5, if/else 3 (nesting depth added 12). Of this number, 33 points are the body's own statements and 3 belong to 2 function literals 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.
useAnnouncement.useAnnouncement (cognitive 36) ui/src/hooks/useAnnouncement.ts:14— useAnnouncement.useAnnouncement has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 11, error handling 2, loops 2, ternaries 2 (nesting depth added 3). Most of this is not in the body itself: 2 of the 36 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 35, 54, 79, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentDetail.production.ConfigurationTab (cognitive 36) ui/src/pages/AgentDetail.production.tsx:2080— AgentDetail.production.ConfigurationTab has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 15 (24 pts), boolean chains 10, if/else 2 (nesting depth added 9). Of this number, 26 points are the body's own statements and 10 belong to 5 function literals 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.
sandbox-callback-bridge.startSandboxCallbackBridgeWorker.failPendingRequests (cognitive 35) REDACTED:1313— sandbox-callback-bridge.startSandboxCallbackBridgeWorker.failPendingRequests has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 5, error handling 2 (5 pts), loops 3 (5 pts), ternaries 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.
execution-target.createDuplexReadinessGate (cognitive 35) REDACTED:4035— execution-target.createDuplexReadinessGate has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (33 pts), boolean chains 1, loops 1 (nesting depth added 15). None of this is in the body itself: all 35 points belong to 4 function literals inside it that branch (lines 4116, 4252, 4268, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
format-event.printPiStreamEvent (cognitive 35) packages/adapters/pi-local/src/cli/format-event.ts:29— format-event.printPiStreamEvent has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (27 pts), ternaries 2 (5 pts), error handling 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.
client.reconcilePendingMigrationHistory (cognitive 35) REDACTED:938— client.reconcilePendingMigrationHistory has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (25 pts), ternaries 3 (5 pts), boolean chains 4, 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.
DurablePrpControlPlane.#authorizeHello (cognitive 35) REDACTED:2310— DurablePrpControlPlane.#authorizeHello has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 17, if/else 9 (13 pts), ternaries 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.
mcp-bridge.handleRequest (cognitive 35) packages/paperclip-runner/src/drivers/opencode/mcp-bridge.ts:135— mcp-bridge.handleRequest has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 7 (9 pts), boolean chains 6, error handling 2 (nesting depth added 4). Of this number, 34 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
DevtoolsInspector.DevtoolsInspector (cognitive 35) packages/paperclip-runner/devtools/issue-thread/src/DevtoolsInspector.tsx:346— DevtoolsInspector.DevtoolsInspector has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 20 (30 pts), boolean chains 4, if/else 1 (nesting depth added 10). Of this number, 29 points are the body's own statements and 6 belong to 4 function literals 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.
harness-driver-backend.isBoundedPersistedJson::visit (cognitive 35) packages/paperclip-runner/src/backends/harness-driver-backend.ts:281— harness-driver-backend.isBoundedPersistedJson::visit has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (20 pts), ternaries 3 (6 pts), boolean chains 5, loops 2 (3 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.
runtime-context.nativeTaskConstraints (cognitive 35) packages/paperclip-runner/src/backends/runtime-context.ts:45— runtime-context.nativeTaskConstraints has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 8 (12 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 12). Most of this is not in the body itself: 10 of the 35 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 51, 114, 88). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
environments.environmentService.acquireLease (cognitive 35) REDACTED:1425— environments.environmentService.acquireLease has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 9, ternaries 3 (7 pts) (nesting depth added 13). Most of this is not in the body itself: 13 of the 35 points are its own statements and the rest belongs to one function literal inside it that branches (line 1506). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
workspace-recovery-snapshot.attachPreservedWorkspaceSnapshots (cognitive 35) server/src/services/workspace-recovery-snapshot.ts:144— workspace-recovery-snapshot.attachPreservedWorkspaceSnapshots has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (25 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 20). Of this number, 29 points are the body's own statements and 6 belong to 2 function literals 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.
budgets.budgetServiceInTransaction.reconcileScope (cognitive 35) server/src/services/budgets.ts:574— budgets.budgetServiceInTransaction.reconcileScope has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 4 (12 pts), boolean chains 5, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
chat-publication-projection.projectCard (cognitive 35) server/src/services/chat-publication-projection.ts:301— chat-publication-projection.projectCard has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 9 (14 pts), boolean chains 4, loops 1 (nesting depth added 12). Of this number, 31 points are the body's own statements and 4 belong to 2 function literals 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.
chat-sdk-runtime.scopeMicrosoftTeamsEgress (cognitive 35) server/src/services/chat-sdk-runtime.ts:1024— chat-sdk-runtime.scopeMicrosoftTeamsEgress has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 15, loops 2, ternaries 1 (nesting depth added 3). Of this number, 31 points are the body's own statements and 4 belong to 6 function items inside it that branch. 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.
chat-sdk-runtime.createAttachmentRecoveryDescriptor (cognitive 35) server/src/services/chat-sdk-runtime.ts:1565— chat-sdk-runtime.createAttachmentRecoveryDescriptor has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (24 pts), ternaries 5 (10 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.
tool-gateway.createToolGatewayService.executePluginTool (cognitive 35) server/src/services/tool-gateway.ts:11243— tool-gateway.createToolGatewayService.executePluginTool has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 9 (19 pts), if/else 10 (14 pts), boolean chains 1, error handling 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.
failed-run-retry.createChatFailedRunRetry.claimFailedChatRunRetry (cognitive 35) server/src/services/chat-channels/failed-run-retry.ts:1521— failed-run-retry.createChatFailedRunRetry.claimFailedChatRunRetry has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 7 (10 pts), boolean chains 8, error handling 1 (nesting depth added 11). Of this number, 33 points are the body's own statements and 2 belong to one function literal 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.
media.validateHeifDimensions::visit (cognitive 35) server/src/services/photon/media.ts:21— media.validateHeifDimensions::visit has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 4, 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.
messages.githubLifecycleEventFromRequest (cognitive 35) server/src/services/chat-channels/github/messages.ts:18— messages.githubLifecycleEventFromRequest has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 13 (14 pts), boolean chains 12, if/else 7 (9 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.
native-broker.createNativeExternalBroker.reserveNativeOperation (cognitive 35) server/src/modules/external-agents/native-broker.ts:122— native-broker.createNativeExternalBroker.reserveNativeOperation has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 6, ternaries 2 (nesting depth added 12). None of this is in the body itself: all 35 points belong to one function literal inside it that branches (line 124). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
copilot-connection-probe.probeCopilotConnection (cognitive 35) server/src/services/copilot-connection-probe.ts:15— copilot-connection-probe.probeCopilotConnection has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 6, error handling 2 (3 pts), ternaries 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.
PaperclipRunnerToolAuthority.#withInstructionMutationReceipt (cognitive 35) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:2260— PaperclipRunnerToolAuthority.#withInstructionMutationReceipt has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 4 (7 pts), boolean chains 5, error handling 2 (4 pts) (nesting depth added 13). Most of this is not in the body itself: 3 of the 35 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 2278, a function literal at line 2283, a function literal at line 2330, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
native-session-executor.runtimeInputLifecycleMetric (cognitive 35) server/src/services/native-runtime/native-session-executor.ts:1047— native-session-executor.runtimeInputLifecycleMetric has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 12 (27 pts), boolean chains 5, if/else 3 (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.
native-session-executor.semanticProviderPlanMarkdown (cognitive 35) server/src/services/native-runtime/native-session-executor.ts:1148— native-session-executor.semanticProviderPlanMarkdown has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (26 pts), ternaries 4 (5 pts), boolean chains 3, loops 1 (nesting depth added 15). Of this number, 33 points are the body's own statements and 2 belong to one function literal 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.
native-session-executor.createRunnerdBackendWithinSessionClaim.bindManagedSession (cognitive 35) server/src/services/native-runtime/native-session-executor.ts:13660— native-session-executor.createRunnerdBackendWithinSessionClaim.bindManagedSession has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 9, ternaries 3 (6 pts), loops 1 (2 pts) (nesting depth added 12). Most of this is not in the body itself: 7 of the 35 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 13684, readAuth, a function literal at line 13703, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
runtime-mode.resolveHeartbeatRuntimeMode (cognitive 35) server/src/services/native-runtime/runtime-mode.ts:195— runtime-mode.resolveHeartbeatRuntimeMode has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 7 (28 pts), if/else 4 (6 pts), error handling 1 (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.
native-continuation.buildNativeContinuationPrompt (cognitive 35) server/src/services/native-runtime/native-continuation.ts:8— native-continuation.buildNativeContinuationPrompt has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 21, ternaries 9, if/else 5. Of this number, 34 points are the body's own statements and 1 belongs to 3 function literals inside it that branch. 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.
native-interaction-bridge.routePersistedNativeResultAttention (cognitive 35) server/src/services/native-runtime/native-interaction-bridge.ts:561— native-interaction-bridge.routePersistedNativeResultAttention has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 6 (19 pts), if/else 8 (14 pts), boolean chains 1, loops 1 (nesting depth added 19). Of this number, 33 points are the body's own statements and 2 belong to one function literal 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.
run-preparation.buildPaperclipRuntimeMcpServers (cognitive 35) server/src/services/heartbeat/run-preparation.ts:935— run-preparation.buildPaperclipRuntimeMcpServers has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 15, if/else 9 (13 pts), error handling 2 (4 pts), ternaries 3 (nesting depth added 6). Of this number, 24 points are the body's own statements and 11 belong to 5 function literals 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.
run-vitest-stable.parseCliOptions (cognitive 35) scripts/run-vitest-stable.mjs:250— run-vitest-stable.parseCliOptions has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (29 pts), boolean chains 5, 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.
billing-reconciliation.billingReconciliationService.adjust (cognitive 35) server/src/services/billing-reconciliation.ts:109— billing-reconciliation.billingReconciliationService.adjust has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 8, ternaries 1 (nesting depth added 9). None of this is in the body itself: all 35 points belong to one function literal inside it that branches (line 111). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
decisions.decisionService.sweepExpired (cognitive 35) server/src/services/decisions.ts:721— decisions.decisionService.sweepExpired has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 10 (19 pts), if/else 4 (8 pts), boolean chains 5, 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.
agent-harness-verification.assertHarnessTestPassed (cognitive 35) server/src/services/agent-harness-verification.ts:18— agent-harness-verification.assertHarnessTestPassed has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 6 (27 pts), boolean chains 7, if/else 1 (nesting depth added 21). Of this number, 32 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
skill-package-inspection.inspectSkillPackage (cognitive 35) server/src/services/skill-package-inspection.ts:44— skill-package-inspection.inspectSkillPackage has cognitive complexity 35 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 8, ternaries 3 (7 pts), error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 16). Of this number, 34 points are the body's own statements and 1 belongs to 2 function literals 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.
skill-source-git-snapshot.runGit (cognitive 35) server/src/services/skill-source-git-snapshot.ts:76— skill-source-git-snapshot.runGit has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (19 pts), ternaries 6 (10 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 8). None of this is in the body itself: all 35 points belong to 13 function literals inside it that branch (lines 139, 78, 91, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
instance-settings.instanceSettingsRoutes (cognitive 35) server/src/routes/instance-settings.ts:135— instance-settings.instanceSettingsRoutes has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 11, ternaries 6 (8 pts) (nesting depth added 5). None of this is in the body itself: all 35 points belong to 11 function literals inside it that branch (lines 310, 149, 213, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
notion-generic-live.fetchNotionVerificationCodeFromAgentMail (cognitive 35) scripts/smoke/notion-generic-live.mjs:212— notion-generic-live.fetchNotionVerificationCodeFromAgentMail has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 3 (6 pts), error handling 3 (4 pts), boolean chains 3, ternaries 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.
MuseRunnerConnection.MuseConnectionDetails (cognitive 35) ui/src/components/MuseRunnerConnection.tsx:31— MuseRunnerConnection.MuseConnectionDetails has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 31, ternaries 3 (4 pts) (nesting depth added 1). Of this number, 34 points are the body's own statements and 1 belongs to 4 function items inside it that branch. 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.
IssueThreadInteractionCard.RequestConfirmationResolution (cognitive 35) ui/src/components/IssueThreadInteractionCard.tsx:1555— IssueThreadInteractionCard.RequestConfirmationResolution has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 10 (25 pts), if/else 6 (7 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DocumentAnnotationPanel.AnnotationPanelBody (cognitive 35) ui/src/components/DocumentAnnotationPanel.tsx:105— DocumentAnnotationPanel.AnnotationPanelBody has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 9 (13 pts), boolean chains 8 (nesting depth added 8). Most of this is not in the body itself: 11 of the 35 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 162, 268, 216, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
index.StatusCards (cognitive 35) ui/src/pages/StatusCards/index.tsx:21— index.StatusCards has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 20 (30 pts), boolean chains 5 (nesting depth added 10). Of this number, 26 points are the body's own statements and 9 belong to 8 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.
editable-sections.production.OverviewSection (cognitive 35) ui/src/components/routine-sections/editable-sections.production.tsx:110— editable-sections.production.OverviewSection has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 18 (21 pts), if/else 6 (8 pts), boolean chains 6 (nesting depth added 5). Most of this is not in the body itself: 14 of the 35 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 178, 171, 192, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CommentThread.TimelineList (cognitive 35) ui/src/components/CommentThread.tsx:547— CommentThread.TimelineList has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 12 (30 pts), if/else 4, boolean chains 1 (nesting depth added 18). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to one function literal inside it that branches (line 593). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
MemberMultiSelect.MemberMultiSelect (cognitive 35) ui/src/components/MemberMultiSelect.tsx:32— MemberMultiSelect.MemberMultiSelect has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 12 (20 pts), if/else 8 (10 pts), boolean chains 5 (nesting depth added 10). Of this number, 18 points are the body's own statements and 17 belong to 7 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.
AgentSettingsPreview.SettingsPage (cognitive 35) ui/storybook/prototypes/agent-settings/AgentSettingsPreview.tsx:162— AgentSettingsPreview.SettingsPage has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 23, ternaries 6 (8 pts), if/else 3, error handling 1 (nesting depth added 2). Of this number, 29 points are the body's own statements and 6 belong to 3 function items inside it that branch. 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.
work-journey.GrokWorkJourney (cognitive 35) ui/storybook/stories/agents/grok-bot/work-journey.tsx:35— work-journey.GrokWorkJourney has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 13 (24 pts), boolean chains 10, loops 1 (nesting depth added 11). Of this number, 34 points are the body's own statements and 1 belongs to one function literal 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.
ManagedDurableState::validate (cognitive 35) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:535— ManagedDurableState::validate has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 16, if/else 7 (11 pts), match/switch 4 (6 pts), loops 2 (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.
onboard.quickstartDefaultsFromEnv (cognitive 34) cli/src/commands/onboard.ts:173— onboard.quickstartDefaultsFromEnv has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 12 (13 pts), boolean chains 9, if/else 6 (8 pts), error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 5). Of this number, 32 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
server-utils.runChildProcess (cognitive 34) REDACTED:4711— server-utils.runChildProcess has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 6, ternaries 6, error handling 1 (2 pts), loops 2 (nesting depth added 4). None of this is in the body itself: all 34 points belong to 11 function literals inside it that branch (lines 4820, 4766, 4736, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
setup-token-runner.runSetupTokenLogin (cognitive 34) packages/adapters/claude-local/src/server/setup-token-runner.ts:200— setup-token-runner.runSetupTokenLogin has cognitive complexity 34 (threshold 15). Drivers by points: if/else 22 (27 pts), error handling 4, boolean chains 3 (nesting depth added 5). Most of this is not in the body itself: 12 of the 34 points are its own statements and the rest belongs to 4 function items inside it that branch (onData, submitCode, captureCredential, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
durable-prp-control-plane.runnerEnvironment (cognitive 34) REDACTED:3472— durable-prp-control-plane.runnerEnvironment has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 4 (9 pts), error handling 1 (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.
DurablePrpCodexTransport.#attachRun (cognitive 34) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:4092— DurablePrpCodexTransport.#attachRun has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 8 (13 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 10). Of this number, 32 points are the body's own statements and 2 belong to one function literal 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.
manifest.validateManifest (cognitive 34) packages/paperclip-runner/scripts/controlled-evals/manifest.mjs:35— manifest.validateManifest has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 14, if/else 8 (12 pts), ternaries 2 (5 pts), loops 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.
acpx-runtime-sidecar.sanitizeRuntimeEvent (cognitive 34) packages/paperclip-runner/src/cli/acpx-runtime-sidecar.ts:1019— acpx-runtime-sidecar.sanitizeRuntimeEvent has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 11 (22 pts), if/else 7 (8 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.
plugin-runner-task.createPluginRunnerTaskOwner.launcher (cognitive 34) server/src/services/native-runtime/plugin-runner-task.ts:127— plugin-runner-task.createPluginRunnerTaskOwner.launcher has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 9, ternaries 4, error handling 1, loops 1 (nesting depth added 6). Most of this is not in the body itself: 11 of the 34 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 167, 154, 200, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-operations.workspaceOperationService.sweepRuntimeControlOperations (cognitive 34) server/src/services/workspace-operations.ts:290— workspace-operations.workspaceOperationService.sweepRuntimeControlOperations has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 6 (12 pts), boolean chains 5, error handling 1 (3 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.
issue-thread-interaction-resolution.evaluateIssueThreadInteractionResolverAudience (cognitive 34) server/src/services/issue-thread-interaction-resolution.ts:155— issue-thread-interaction-resolution.evaluateIssueThreadInteractionResolverAudience has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 6 (10 pts), boolean chains 9 (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.
chat-telegram-media-intake.normalizeTelegramMediaAttachments (cognitive 34) server/src/services/chat-telegram-media-intake.ts:243— chat-telegram-media-intake.normalizeTelegramMediaAttachments has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 15, if/else 10 (12 pts), ternaries 4 (7 pts) (nesting depth added 5). Of this number, 29 points are the body's own statements and 5 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.
chat-telegram-media-intake.oggOpus (cognitive 34) server/src/services/chat-telegram-media-intake.ts:518— chat-telegram-media-intake.oggOpus has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 7, loops 3 (5 pts), ternaries 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.
chat-github-review-policy.githubReviewSchedulingDecision (cognitive 34) server/src/services/chat-github-review-policy.ts:91— chat-github-review-policy.githubReviewSchedulingDecision has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16, boolean chains 11, ternaries 4 (7 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.
heartbeat-run-summary.resolveHeartbeatRunResponse (cognitive 34) server/src/services/heartbeat-run-summary.ts:403— heartbeat-run-summary.resolveHeartbeatRunResponse has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (19 pts), ternaries 5 (10 pts), boolean chains 5 (nesting depth added 10). Of this number, 26 points are the body's own statements and 8 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.
external-chat-question-response.completedQuestionFormMatchesInteraction (cognitive 34) server/src/services/native-runtime/external-chat-question-response.ts:95— external-chat-question-response.completedQuestionFormMatchesInteraction has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 9, ternaries 3 (6 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.
chat-receipt-reactions.stageReceiptReactionRemovals (cognitive 34) server/src/services/chat-receipt-reactions.ts:52— chat-receipt-reactions.stageReceiptReactionRemovals has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 10, ternaries 5 (6 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 10 of the 34 points are its own statements and the rest belongs to one function literal inside it that branches (line 127). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
managed.createManagedSlackSetup.provision (cognitive 34) server/src/services/connectors/slack/setup/managed.ts:14— managed.createManagedSlackSetup.provision has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 14, if/else 11 (12 pts), ternaries 5 (7 pts), error handling 1 (nesting depth added 3). Most of this is not in the body itself: 2 of the 34 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 21, 29, 44). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-github-management.githubChatManagementService.verification (cognitive 34) server/src/services/chat-github-management.ts:352— chat-github-management.githubChatManagementService.verification has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 11 (16 pts), boolean chains 9, if/else 3 (5 pts), error handling 1 (2 pts), loops 2 (nesting depth added 8). Of this number, 33 points are the body's own statements and 1 belongs to one function literal 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.
git-connection-failure.classifyTransportLine (cognitive 34) server/src/services/git-connection-failure.ts:59— git-connection-failure.classifyTransportLine has cognitive complexity 34 (threshold 15). Drivers by points: if/else 19 (30 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.
effective-run-config-fingerprints.canonicalizeValue (cognitive 34) server/src/services/effective-run-config-fingerprints.ts:305— effective-run-config-fingerprints.canonicalizeValue has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (24 pts), ternaries 3 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 15). Of this number, 32 points are the body's own statements and 2 belong to one function literal 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.
workspaces.resolveRunReferencedProjects (cognitive 34) server/src/services/heartbeat/workspaces.ts:1668— workspaces.resolveRunReferencedProjects has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 6 (8 pts), boolean chains 5, ternaries 3 (4 pts), error handling 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.
execution-workspaces.executionWorkspaceService.reopenClosedIsolatedExecutionWorkspaceForIssue::reopen (cognitive 34) server/src/services/execution-workspaces.ts:4080— execution-workspaces.executionWorkspaceService.reopenClosedIsolatedExecutionWorkspaceForIssue::reopen has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 7 (10 pts), boolean chains 7, error handling 4 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
webhook-ingress.createGitHubWebhookIngress.processGitHubWebhookIngress (cognitive 34) server/src/services/chat-channels/github/webhook-ingress.ts:708— webhook-ingress.createGitHubWebhookIngress.processGitHubWebhookIngress has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 9, ternaries 4 (6 pts), error handling 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.
task-authority.createSlackTaskAuthorityRegistration.authorize (cognitive 34) server/src/services/chat-channels/slack/task-authority.ts:57— task-authority.createSlackTaskAuthorityRegistration.authorize has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 5, ternaries 3 (5 pts) (nesting depth added 11). Most of this is not in the body itself: 4 of the 34 points are its own statements and the rest belongs to one function literal inside it that branches (line 64). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
chat-channels.chatChannelService.processMessage::persistTaskMutation (cognitive 34) server/src/services/chat-channels.ts:2082— chat-channels.chatChannelService.processMessage::persistTaskMutation has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 9 (13 pts), boolean chains 12, if/else 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. This shape REPEATS in the file: one other method here (chat-channels.chatChannelService.processMessage) 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.
tool-access.toolAccessService.reconnectGalleryApp (cognitive 34) server/src/services/tool-access.ts:3547— tool-access.toolAccessService.reconnectGalleryApp has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 9 (11 pts), boolean chains 4, loops 1 (nesting depth added 8). Most of this is not in the body itself: 9 of the 34 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 3623, 3577, 3576). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
company-skills.discoverProjectWorkspaceSkillDirectories (cognitive 34) server/src/services/company-skills.ts:1475— company-skills.discoverProjectWorkspaceSkillDirectories has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 5 (12 pts), loops 3 (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.
company-skills.companySkillService.reconcileLocalPathSkillSources (cognitive 34) server/src/services/company-skills.ts:3161— company-skills.companySkillService.reconcileLocalPathSkillSources has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 6 (17 pts), if/else 6 (14 pts), boolean chains 2, loops 1 (nesting depth added 19). Of this number, 33 points are the body's own statements and 1 belongs to one function literal 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.
native-session-executor.detachNativeSessionsForRestart (cognitive 34) server/src/services/native-runtime/native-session-executor.ts:304— native-session-executor.detachNativeSessionsForRestart has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 4, error handling 1 (3 pts), ternaries 1 (3 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.
native-session-executor.synchronizeCompletedProviderPlan (cognitive 34) server/src/services/native-runtime/native-session-executor.ts:1469— native-session-executor.synchronizeCompletedProviderPlan has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 7, error handling 3 (4 pts), ternaries 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.
successful-run-handoff.decideSuccessfulRunHandoff (cognitive 34) server/src/services/recovery/successful-run-handoff.ts:462— successful-run-handoff.decideSuccessfulRunHandoff has cognitive complexity 34 (threshold 15). Drivers by points: if/else 28, boolean chains 5, ternaries 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.
app.SpaceEditCard (cognitive 34) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6698— app.SpaceEditCard has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 14 (20 pts), boolean chains 7, if/else 4, error handling 3 (nesting depth added 6). Of this number, 17 points are the body's own statements and 17 belong to 3 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.
CreateosClient.request (cognitive 34) packages/plugins/sandbox-providers/createos/src/client.ts:39— CreateosClient.request has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 6 (27 pts), if/else 3 (5 pts), boolean chains 1, error handling 1 (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.
export.main (cognitive 34) scripts/ci-profile/export.mjs:49— export.main has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 10, ternaries 4, loops 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.
AgentBasicsDialog.AgentBasicsDialog::submit (cognitive 34) ui/src/components/new-agent/AgentBasicsDialog.tsx:110— AgentBasicsDialog.AgentBasicsDialog::submit has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 6 (12 pts), boolean chains 6, error handling 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. This shape REPEATS in the file: one other method here (AgentBasicsDialog.AgentBasicsDialog) 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.
SecretPicker.SecretPicker (cognitive 34) ui/src/components/environment-variables-editor/SecretPicker.tsx:147— SecretPicker.SecretPicker has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 13, ternaries 10 (13 pts), if/else 8 (nesting depth added 3). Most of this is not in the body itself: 5 of the 34 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 286, 265, 166, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SwipeToArchive.SwipeToArchive (cognitive 34) ui/src/components/SwipeToArchive.tsx:17— SwipeToArchive.SwipeToArchive has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (19 pts), ternaries 8 (9 pts), boolean chains 6 (nesting depth added 3). Most of this is not in the body itself: 8 of the 34 points are its own statements and the rest belongs to 9 function items inside it that branch (handleTouchMove, handleTouchEnd, a function literal at line 37, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
Inbox.FailedRunInboxRow (cognitive 34) ui/src/pages/Inbox.tsx:357— Inbox.FailedRunInboxRow has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 14 (24 pts), boolean chains 10 (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.
WorkspaceBaseRefRecovery.WorkspaceBaseRefRecoveryProvider (cognitive 34) ui/src/components/WorkspaceBaseRefRecovery.tsx:35— WorkspaceBaseRefRecovery.WorkspaceBaseRefRecoveryProvider has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 17, if/else 4 (7 pts), ternaries 4 (7 pts), error handling 1 (3 pts) (nesting depth added 8). 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.
TaskChatActivityPhase.TaskChatActivityPhase (cognitive 34) ui/src/components/task-chat/TaskChatActivityPhase.tsx:26— TaskChatActivityPhase.TaskChatActivityPhase has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 13 (21 pts), boolean chains 12, if/else 1 (nesting depth added 8). Of this number, 32 points are the body's own statements and 2 belong to 2 function literals 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.
AppsConnect.AppsConnect (cognitive 34) ui/src/pages/apps/AppsConnect.tsx:20— AppsConnect.AppsConnect has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 19, if/else 11 (13 pts), ternaries 2 (nesting depth added 2). Of this number, 31 points are the body's own statements and 3 belong to 3 function items inside it that branch. 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.
CompanySkills.SkillCard (cognitive 34) ui/src/pages/CompanySkills.tsx:806— CompanySkills.SkillCard has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 18 (25 pts), boolean chains 7, if/else 2 (nesting depth added 7). Of this number, 31 points are the body's own statements and 3 belong to one function literal 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.
SkillStudio.SkillPane (cognitive 34) ui/src/pages/SkillStudio.tsx:1270— SkillStudio.SkillPane has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 12, if/else 9 (12 pts), ternaries 8 (10 pts) (nesting depth added 5). Of this number, 22 points are the body's own statements and 12 belong to 6 function literals inside it that branch. 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.
InvitesSection.InvitesSection (cognitive 34) ui/src/components/access/InvitesSection.tsx:49— InvitesSection.InvitesSection has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 16 (26 pts), if/else 4, boolean chains 3, error handling 1 (nesting depth added 10). Of this number, 19 points are the body's own statements and 15 belong to 8 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.
AgentWorkPanels.AgentTasksPanel (cognitive 34) ui/src/components/chat/AgentWorkPanels.tsx:107— AgentWorkPanels.AgentTasksPanel has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 11 (28 pts), if/else 4, boolean chains 2 (nesting depth added 17). Of this number, 20 points are the body's own statements and 14 belong to 3 function literals inside it that branch. 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.
useNativeRunTranscripts.useNativeRunTranscripts (cognitive 34) ui/src/components/transcript/useNativeRunTranscripts.ts:27— useNativeRunTranscripts.useNativeRunTranscripts has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 6 (9 pts), loops 5, boolean chains 2, error handling 1 (nesting depth added 9). None of this is in the body itself: all 34 points belong to 10 function literals inside it that branch (lines 74, 49, 115, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
service-health-check.serviceHealthChecks (cognitive 33) cli/src/checks/service-health-check.ts:43— service-health-check.serviceHealthChecks has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 11 (25 pts), if/else 4, boolean chains 2, error handling 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.
workspace-seed-cache.cachedGenerations (cognitive 33) packages/adapter-utils/src/workspace-seed-cache.ts:76— workspace-seed-cache.cachedGenerations has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (23 pts), loops 3 (6 pts), boolean chains 3, ternaries 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.
sandbox-callback-bridge.createFileSystemSandboxCallbackBridgeQueueClient.writeResponseFile (cognitive 33) REDACTED:555— sandbox-callback-bridge.createFileSystemSandboxCallbackBridgeQueueClient.writeResponseFile has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (22 pts), error handling 3 (9 pts), boolean chains 1, 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.
detect-model.parseModelFromConfig (cognitive 33) packages/adapters/hermes/src/server/detect-model.ts:53— detect-model.parseModelFromConfig has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (30 pts), boolean chains 2, 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.
cursor-extensions.createCursorNotificationNormalizer (cognitive 33) packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts:289— cursor-extensions.createCursorNotificationNormalizer has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 6 (9 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 13). None of this is in the body itself: all 33 points belong to 2 function literals inside it that branch (lines 293, 305). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
DurablePrpCodexTransport.#recoverRunnerProcess (cognitive 33) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:7023— DurablePrpCodexTransport.#recoverRunnerProcess has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 6, ternaries 2 (5 pts), loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 13). Of this number, 25 points are the body's own statements and 8 belong to 3 function literals 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.
ThreadItems.ProviderActivity (cognitive 33) packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx:157— ThreadItems.ProviderActivity has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 19 (30 pts), boolean chains 3 (nesting depth added 11). Of this number, 19 points are the body's own statements and 14 belong to 2 function literals 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.
pi-verified-runtime.discoverPiRuntimeFiles::visit (cognitive 33) packages/paperclip-runner/src/drivers/acpx/pi-verified-runtime.ts:42— pi-verified-runtime.discoverPiRuntimeFiles::visit has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (28 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.
operation-groups-doc.validateOperationGroupsInput (cognitive 33) packages/paperclip-runner/src/catalog/operation-groups-doc.ts:107— operation-groups-doc.validateOperationGroupsInput has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (27 pts), loops 3 (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.
operation-groups-doc.renderOperationGroupsDocument (cognitive 33) packages/paperclip-runner/src/catalog/operation-groups-doc.ts:258— operation-groups-doc.renderOperationGroupsDocument has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 10 (21 pts), loops 11 (12 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.
public-eval-viewer.validatePublicChatPayload (cognitive 33) packages/paperclip-runner/scripts/public-eval-viewer.mjs:59— public-eval-viewer.validatePublicChatPayload has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (32 pts), loops 8 (11 pts), boolean chains 9 (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. This shape REPEATS in the file: one other method here (public-eval-viewer.validatePublicChatPayload::visit) 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.
CodexAcpxSession.#mapRuntimeEvent (cognitive 33) REDACTED:1676— CodexAcpxSession.#mapRuntimeEvent has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (17 pts), ternaries 4 (8 pts), boolean chains 7, loops 1 (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.
live-projection.derivedRecordItems (cognitive 33) packages/paperclip-runner/src/issue-thread/live-projection.ts:416— live-projection.derivedRecordItems has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 4 (7 pts), boolean chains 3, ternaries 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.
chat-github-client.githubBotRequestOnce (cognitive 33) server/src/services/chat-github-client.ts:45— chat-github-client.githubBotRequestOnce has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (20 pts), error handling 4 (6 pts), loops 2 (4 pts), boolean chains 2, ternaries 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.
costs.createCostEventInTransaction (cognitive 33) server/src/services/costs.ts:85— costs.createCostEventInTransaction has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 6, ternaries 2, error handling 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.
native-rest-client.nativeRestSender.send (cognitive 33) server/src/services/native-rest-client.ts:68— native-rest-client.nativeRestSender.send has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 4 (9 pts), error handling 3 (4 pts), boolean chains 3, 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.
browser-use-client.browserUseClient.call (cognitive 33) server/src/services/browser-use-client.ts:116— browser-use-client.browserUseClient.call has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 8 (17 pts), if/else 7 (10 pts), boolean chains 3, error handling 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.
slack-access.authorizeSlackChannel (cognitive 33) server/src/services/connectors/slack-access.ts:13— slack-access.authorizeSlackChannel has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 8, ternaries 1 (3 pts), loops 1 (2 pts), error handling 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.
tool-gateway.createToolGatewayService.namedGatewaySessionFromBearer (cognitive 33) server/src/services/tool-gateway.ts:7163— tool-gateway.createToolGatewayService.namedGatewaySessionFromBearer has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 10, error handling 1 (2 pts), ternaries 2 (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.
commands.createSlackCommands.handleSlackSlashCommand (cognitive 33) server/src/services/chat-channels/slack/commands.ts:90— commands.createSlackCommands.handleSlackSlashCommand has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 5, ternaries 4 (nesting depth added 8). Of this number, 22 points are the body's own statements and 11 belong to 3 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.
execution-workspaces.executionWorkspaceService.terminalWorkspaceWorkSettled (cognitive 33) server/src/services/execution-workspaces.ts:3990— execution-workspaces.executionWorkspaceService.terminalWorkspaceWorkSettled has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
publications.createPhotonPublicationDelivery.deliverPhotonPublication (cognitive 33) server/src/services/chat-channels/imessage-photon/publications.ts:53— publications.createPhotonPublicationDelivery.deliverPhotonPublication has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 8, ternaries 2 (5 pts), loops 1 (3 pts) (nesting depth added 11). Of this number, 24 points are the body's own statements and 9 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.
resolution.createChatPublicationResolution.resolvePublication (cognitive 33) server/src/services/chat-channels/publications/resolution.ts:141— resolution.createChatPublicationResolution.resolvePublication has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 10 (12 pts), boolean chains 5 (nesting depth added 10). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to one function literal inside it that branches (line 156). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
aggregator-app-discovery.discoverArcadeApps (cognitive 33) server/src/services/aggregator-app-discovery.ts:57— aggregator-app-discovery.discoverArcadeApps has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 3 (12 pts), boolean chains 5, 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.
native-broker.createNativeExternalBroker.port.settle (cognitive 33) server/src/modules/external-agents/native-broker.ts:284— native-broker.createNativeExternalBroker.port.settle has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 10, ternaries 4 (5 pts) (nesting depth added 5). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 289, 287). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
file-transfers.createPublicMcpTransfers (cognitive 33) server/src/services/public-mcp/file-transfers.ts:32— file-transfers.createPublicMcpTransfers has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 12 (14 pts), boolean chains 10, if/else 9 (nesting depth added 2). None of this is in the body itself: all 33 points belong to 3 function literals inside it that branch (lines 133, 178, 128). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
task-watchdogs.classifyTaskWatchdogSubtree (cognitive 33) server/src/services/task-watchdogs.ts:371— task-watchdogs.classifyTaskWatchdogSubtree has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 7, loops 4 (nesting depth added 8). Of this number, 25 points are the body's own statements and 8 belong to 3 function literals 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.
issues.freshChatSourceAfterPublishedControl (cognitive 33) server/src/services/issues.ts:772— issues.freshChatSourceAfterPublishedControl has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 14, if/else 9 (13 pts), error handling 2 (3 pts), 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.
issues.listPendingFinalizeBlockerIssueIds (cognitive 33) server/src/services/issues.ts:2488— issues.listPendingFinalizeBlockerIssueIds has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 7, 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.
native-deliverable-feedback.hasCurrentPublicationReceipt (cognitive 33) server/src/services/native-runtime/native-deliverable-feedback.ts:19— native-deliverable-feedback.hasCurrentPublicationReceipt has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 10, 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.
routines.routineService.tickScheduledTriggers (cognitive 33) server/src/services/routines.ts:3213— routines.routineService.tickScheduledTriggers has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (7 pts), boolean chains 6, ternaries 3 (6 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.
native-session-executor.executePaperclipNativeSession (cognitive 33) server/src/services/native-runtime/native-session-executor.ts:7646— native-session-executor.executePaperclipNativeSession has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 7, error handling 2, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
service.recoveryService.enqueueStrandedIssueRecovery (cognitive 33) REDACTED:1995— service.recoveryService.enqueueStrandedIssueRecovery has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 6, ternaries 3 (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.
run-completion.createHeartbeatRunCompletion.failRun (cognitive 33) server/src/services/heartbeat/run-completion.ts:1048— run-completion.createHeartbeatRunCompletion.failRun has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 10, boolean chains 9, error handling 2 (4 pts) (nesting depth added 5). Of this number, 27 points are the body's own statements and 6 belong to 3 function items inside it that branch. 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.
app.PaperclipIngestionSpaceCard (cognitive 33) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6912— app.PaperclipIngestionSpaceCard has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 15 (19 pts), boolean chains 12, error handling 1, if/else 1 (nesting depth added 4). Of this number, 20 points are the body's own statements and 13 belong to 6 function items inside it that branch. 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.
core.validatePaperclipIngestionProfile (cognitive 33) packages/plugins/plugin-llm-wiki/src/wiki/core.ts:978— core.validatePaperclipIngestionProfile has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (7 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.
bridge-client.consumeExecuteEventStream (cognitive 33) packages/plugins/sandbox-providers/cloudflare/src/bridge-client.ts:222— bridge-client.consumeExecuteEventStream has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (17 pts), ternaries 3 (10 pts), boolean chains 3, 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.
lease-lifecycle.checkLeaseResumable (cognitive 33) packages/plugins/sandbox-providers/kubernetes/src/lease-lifecycle.ts:63— lease-lifecycle.checkLeaseResumable has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (17 pts), error handling 4 (7 pts), ternaries 3 (7 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.
generate-company-assets.parseFrontmatter (cognitive 33) scripts/generate-company-assets.ts:22— generate-company-assets.parseFrontmatter has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 10, 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.
status-cards.statusCardService.writeSummary (cognitive 33) server/src/services/status-cards.ts:792— status-cards.statusCardService.writeSummary has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 7, ternaries 5, loops 2 (4 pts) (nesting depth added 6). Most of this is not in the body itself: 3 of the 33 points are its own statements and the rest belongs to one function literal inside it that branches (line 799). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
attention.blockedWorkCountMap (cognitive 33) server/src/services/attention.ts:995— attention.blockedWorkCountMap has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 5 (8 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 16). Of this number, 30 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.
dashboard.dashboardService.summary (cognitive 33) server/src/services/dashboard.ts:30— dashboard.dashboardService.summary has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 3 (7 pts), boolean chains 4, loops 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
company-portability.collectAgentSafeImportPolicyErrors (cognitive 33) server/src/services/company-portability.ts:269— company-portability.collectAgentSafeImportPolicyErrors has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 4 (10 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.
company-portability.buildPortableProjectWorkspaces (cognitive 33) server/src/services/company-portability.ts:1491— company-portability.buildPortableProjectWorkspaces has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (19 pts), ternaries 4 (7 pts), boolean chains 6, 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.
provider-trace-workspace-diff-reprojection.projectCodexWorkspaceDiffsFromTrace (cognitive 33) server/src/services/provider-trace-workspace-diff-reprojection.ts:52— provider-trace-workspace-diff-reprojection.projectCodexWorkspaceDiffsFromTrace has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 7 (17 pts), if/else 5 (10 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 16). Of this number, 32 points are the body's own statements and 1 belongs to one function literal 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.
tool-gateway.handleMcpGatewayProtocol (cognitive 33) REDACTED:73— tool-gateway.handleMcpGatewayProtocol has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 5 (12 pts), boolean chains 3, error handling 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.
issues.issueListSearchParams (cognitive 33) ui/src/api/issues.ts:123— issues.issueListSearchParams has cognitive complexity 33 (threshold 15). Drivers by points: if/else 31, ternaries 1 (2 pts) (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.
assignees.suggestedCommentAssigneeValue (cognitive 33) ui/src/lib/assignees.ts:30— assignees.suggestedCommentAssigneeValue has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 10, loops 1 (2 pts), ternaries 1 (nesting depth added 11). Of this number, 18 points are the body's own statements and 15 belong to one function literal 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.
Auth.AuthPage (cognitive 33) ui/src/pages/Auth.tsx:19— Auth.AuthPage has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 15 (16 pts), boolean chains 10, if/else 7 (nesting depth added 1). Of this number, 26 points are the body's own statements and 7 belong to 6 function literals inside it that branch. 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.
DispositionRecoveryNotice.DispositionRecoveryNotice (cognitive 33) ui/src/components/DispositionRecoveryNotice.tsx:71— DispositionRecoveryNotice.DispositionRecoveryNotice has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 15 (20 pts), boolean chains 11, error handling 1, if/else 1 (nesting depth added 5). Of this number, 28 points are the body's own statements and 5 belong to one function item inside it that branches. 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.
IssueThreadInteractionCard.ConfirmationActionRow (cognitive 33) ui/src/components/IssueThreadInteractionCard.tsx:2120— IssueThreadInteractionCard.ConfirmationActionRow has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 15 (20 pts), boolean chains 12, if/else 1 (nesting depth added 5). Of this number, 29 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
IssueChatThread.SystemNoticeCommentContent (cognitive 33) ui/src/components/IssueChatThread.tsx:3490— IssueChatThread.SystemNoticeCommentContent has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 15 (16 pts), if/else 10 (11 pts), boolean chains 6 (nesting depth added 2). Of this number, 21 points are the body's own statements and 12 belong to 4 function items inside it that branch. 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.
WorkspaceRuntimeControls.CommandActionButtons (cognitive 33) ui/src/components/WorkspaceRuntimeControls.tsx:348— WorkspaceRuntimeControls.CommandActionButtons has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 17 (27 pts), boolean chains 6 (nesting depth added 10). Most of this is not in the body itself: 8 of the 33 points are its own statements and the rest belongs to one function literal inside it that branches (line 372). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
RunnerInspector.JsonNode (cognitive 33) ui/src/components/RunnerInspector.tsx:392— RunnerInspector.JsonNode has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 18 (25 pts), boolean chains 8 (nesting depth added 7). Of this number, 29 points are the body's own statements and 4 belong to 3 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.
task-side-panel-state.parsePayload (cognitive 33) ui/src/lib/task-side-panel-state.ts:90— task-side-panel-state.parsePayload has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (17 pts), ternaries 5 (10 pts), boolean chains 6 (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.
editable-sections.OverviewSection (cognitive 33) ui/src/components/routine-sections/editable-sections.tsx:94— editable-sections.OverviewSection has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 16 (19 pts), if/else 6 (8 pts), boolean chains 6 (nesting depth added 5). Most of this is not in the body itself: 12 of the 33 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 161, 154, 175, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AuditRuns.AuditRuns (cognitive 33) ui/src/pages/audit/AuditRuns.tsx:129— AuditRuns.AuditRuns has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 11 (26 pts), boolean chains 4, if/else 3 (nesting depth added 15). Of this number, 25 points are the body's own statements and 8 belong to 4 function literals inside it that branch. 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.
CostDataQualityNotice.CostDataQualityNotice (cognitive 33) ui/src/components/CostDataQualityNotice.tsx:40— CostDataQualityNotice.CostDataQualityNotice has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 17, ternaries 7 (9 pts), loops 3 (4 pts), if/else 1 (3 pts) (nesting depth added 5). Of this number, 25 points are the body's own statements and 8 belong to 5 function items inside it that branch. 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.
ImportSkillsFromProjectDialog.PickProjectStep (cognitive 33) ui/src/pages/skills/ImportSkillsFromProjectDialog.tsx:652— ImportSkillsFromProjectDialog.PickProjectStep has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 8 (30 pts), boolean chains 3 (nesting depth added 22). Most of this is not in the body itself: 10 of the 33 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 693, 707). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SkillFolderTree.SkillFolderRail (cognitive 33) ui/src/components/folders/SkillFolderTree.tsx:125— SkillFolderTree.SkillFolderRail has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 9 (16 pts), if/else 12 (13 pts), boolean chains 3, loops 1 (nesting depth added 8). Of this number, 16 points are the body's own statements and 17 belong to 7 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.
SkillStudio.RunsPane (cognitive 33) ui/src/pages/SkillStudio.tsx:2300— SkillStudio.RunsPane has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 12 (15 pts), if/else 10, boolean chains 8 (nesting depth added 3). Of this number, 16 points are the body's own statements and 17 belong to 8 function literals inside it that branch. 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.
TaskChatInteractionCard.TaskChatInteractionCard (cognitive 33) ui/src/components/task-chat/TaskChatInteractionCard.tsx:38— TaskChatInteractionCard.TaskChatInteractionCard has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 16, if/else 10 (13 pts), ternaries 2 (4 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.
(anonymous) (cognitive 33) ui/public/sw.js:101— (anonymous) has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 5 (9 pts), boolean chains 5, ternaries 1 (3 pts), other 2 (nesting depth added 10). Most of this is not in the body itself: 10 of the 33 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 137, 154, 146, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
board-auth.loginBoardCli (cognitive 32) cli/src/client/board-auth.ts:208— board-auth.loginBoardCli has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 7, ternaries 4 (7 pts), error handling 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.
worktree.collectClaimedWorktreePorts (cognitive 32) cli/src/commands/worktree.ts:600— worktree.collectClaimedWorktreePorts has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 4 (6 pts), boolean chains 4, error handling 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.
worktree.ensureWorktreeSeeded (cognitive 32) cli/src/commands/worktree.ts:2218— worktree.ensureWorktreeSeeded has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 9, ternaries 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.
response-capture.responseValueSize (cognitive 32) packages/db/src/response-capture.ts:35— response-capture.responseValueSize has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 5 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 14). Of this number, 26 points are the body's own statements and 6 belong to 2 function literals 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.
DurablePrpCodexTransport.#applyProviderIdentityEvent (cognitive 32) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:6691— DurablePrpCodexTransport.#applyProviderIdentityEvent has cognitive complexity 32 (threshold 15). Drivers by points: if/else 22 (26 pts), boolean chains 5, ternaries 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.
materialize-cursor-distribution.materializePinnedCursorDistribution (cognitive 32) packages/paperclip-runner/scripts/materialize-cursor-distribution.mjs:63— materialize-cursor-distribution.materializePinnedCursorDistribution has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 5, loops 3 (4 pts), 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.
install-copilot-assets.installCopilotAssets (cognitive 32) packages/paperclip-runner/scripts/install-copilot-assets.mjs:16— install-copilot-assets.installCopilotAssets has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 4 (5 pts), ternaries 2 (4 pts), boolean chains 3, 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.
ai-connections.aiConnectionService.refreshQuotaCredential (cognitive 32) server/src/services/ai-connections.ts:1052— ai-connections.aiConnectionService.refreshQuotaCredential has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 11, ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 8). None of this is in the body itself: all 32 points belong to 2 function literals inside it that branch (lines 1056, 1053). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PhotonChatAdapter.sendPart (cognitive 32) server/src/services/photon/adapter.ts:465— PhotonChatAdapter.sendPart has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 8, ternaries 3 (6 pts), error handling 2 (3 pts) (nesting depth added 9). Of this number, 29 points are the body's own statements and 3 belong to 3 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.
chat-telegram-media-intake.gif (cognitive 32) server/src/services/chat-telegram-media-intake.ts:621— chat-telegram-media-intake.gif has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 7, loops 2 (nesting depth added 12). Of this number, 26 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.
chat-slack-receipts.applySlackReceiptReaction (cognitive 32) server/src/services/chat-slack-receipts.ts:52— chat-slack-receipts.applySlackReceiptReaction has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 11, error handling 2 (3 pts), ternaries 3, 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.
chat-run-publications.githubRunReplyState (cognitive 32) server/src/services/chat-run-publications.ts:132— chat-run-publications.githubRunReplyState has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 8, loops 1, ternaries 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.
tool-access-policy.scopeAllowsTool (cognitive 32) server/src/services/tool-access-policy.ts:754— tool-access-policy.scopeAllowsTool has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 11, ternaries 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.
plugin-capability-validator.pluginCapabilityValidator.validateManifestCapabilities (cognitive 32) server/src/services/plugin-capability-validator.ts:466— plugin-capability-validator.pluginCapabilityValidator.validateManifestCapabilities has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 4 (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.
git-workspace-restoration.assertReproducibleBaseGitStorage (cognitive 32) server/src/services/git-workspace-restoration.ts:170— git-workspace-restoration.assertReproducibleBaseGitStorage has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 7, loops 4 (5 pts), ternaries 2 (4 pts) (nesting depth added 10). Of this number, 21 points are the body's own statements and 11 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.
isolated-task-directory-retention.sweepIsolatedTaskDirectories (cognitive 32) server/src/services/isolated-task-directory-retention.ts:555— isolated-task-directory-retention.sweepIsolatedTaskDirectories has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (24 pts), boolean chains 5, loops 2 (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.
ai-connection-runtime.assertManagedAiProjectAuth (cognitive 32) server/src/services/ai-connection-runtime.ts:83— ai-connection-runtime.assertManagedAiProjectAuth has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 5 (6 pts), boolean chains 4, error handling 1 (3 pts), 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.
email-channels.emailChannelService.authorize (cognitive 32) server/src/services/email-channels.ts:474— email-channels.emailChannelService.authorize has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 12 (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.
root-threads.createDiscordRootThreads.reconcileDiscordRootThread (cognitive 32) server/src/services/chat-channels/discord/root-threads.ts:391— root-threads.createDiscordRootThreads.reconcileDiscordRootThread has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 9 (18 pts), if/else 6 (9 pts), boolean chains 4, error handling 1 (nesting depth added 12). Most of this is not in the body itself: 9 of the 32 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 493, 420, 448). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
review-queue.createToolActionReviewQueue.listActionRequests (cognitive 32) server/src/services/tool-access/activity/review-queue.ts:14— review-queue.createToolActionReviewQueue.listActionRequests has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 6, error handling 1 (3 pts), loops 1 (2 pts) (nesting depth added 14). Of this number, 29 points are the body's own statements and 3 belong to one function literal 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.
agent-runner-selection.resolveClaudeRunnerConfig (cognitive 32) server/src/services/agent-runner-selection.ts:103— agent-runner-selection.resolveClaudeRunnerConfig has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 10, loops 3 (4 pts), ternaries 2 (nesting depth added 7). Of this number, 31 points are the body's own statements and 1 belongs to one function literal 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.
issues.deriveIssueCommentRunLogAttribution (cognitive 32) server/src/services/issues.ts:1771— issues.deriveIssueCommentRunLogAttribution has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 3 (5 pts), boolean chains 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.
issues.blockedInboxIssueConditions (cognitive 32) server/src/services/issues.ts:6297— issues.blockedInboxIssueConditions has cognitive complexity 32 (threshold 15). Drivers by points: if/else 25 (26 pts), boolean chains 4, ternaries 1 (2 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.
heartbeat-run-privacy.getHeartbeatRunReadDecisions (cognitive 32) server/src/services/heartbeat-run-privacy.ts:64— heartbeat-run-privacy.getHeartbeatRunReadDecisions has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 5 (14 pts), boolean chains 4 (nesting depth added 17). Of this number, 29 points are the body's own statements and 3 belong to 2 function literals 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.
native-runner-file-handoff.readVerifiedWorkspaceFile (cognitive 32) server/src/services/native-runtime/native-runner-file-handoff.ts:301— native-runner-file-handoff.readVerifiedWorkspaceFile has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 8, 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.
plan-review-context.buildDocumentReviewContext (cognitive 32) server/src/services/plan-review-context.ts:347— plan-review-context.buildDocumentReviewContext has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3 (5 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 13). Of this number, 18 points are the body's own statements and 14 belong to one function literal 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.
service.recoveryService.terminalizeOrphanedRunningRun (cognitive 32) REDACTED:6072— service.recoveryService.terminalizeOrphanedRunningRun has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 10, ternaries 8 (9 pts), 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.
worker-rpc-host.startWorkerRpcHost.handleLine (cognitive 32) packages/plugins/sdk/src/worker-rpc-host.ts:2325— worker-rpc-host.startWorkerRpcHost.handleLine has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 5 (13 pts), boolean chains 3, error handling 2 (3 pts) (nesting depth added 13). Of this number, 17 points are the body's own statements and 15 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.
BrokerCore.compensateExpose (cognitive 32) packages/tailscale-https-broker/src/broker-core.ts:568— BrokerCore.compensateExpose has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 6 (7 pts), error handling 4 (5 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.
company-portability.companyPortabilityService.resolveSource (cognitive 32) server/src/services/company-portability.ts:3783— company-portability.companyPortabilityService.resolveSource has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 6 (9 pts), boolean chains 5, error handling 2 (3 pts), loops 2 (nesting depth added 8). Of this number, 28 points are the body's own statements and 4 belong to one function literal 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.
onboarding-seed.onboardingSeedService.applyWithin (cognitive 32) server/src/services/onboarding-seed.ts:217— onboarding-seed.onboardingSeedService.applyWithin has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 6 (17 pts), if/else 7 (9 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.
recovery-observability.recoveryObservabilityService.report (cognitive 32) server/src/services/recovery-observability.ts:170— recovery-observability.recoveryObservabilityService.report has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 3, 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.
notion-generic-live.completeNotionAuthorization (cognitive 32) scripts/smoke/notion-generic-live.mjs:265— notion-generic-live.completeNotionAuthorization has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (28 pts), error handling 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.
SidebarCompanyMenu.BuiltinCompanyMenu (cognitive 32) ui/src/components/SidebarCompanyMenu.tsx:159— SidebarCompanyMenu.BuiltinCompanyMenu has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 9 (12 pts), boolean chains 10, if/else 9 (10 pts) (nesting depth added 4). Of this number, 18 points are the body's own statements and 14 belong to 6 function items inside it that branch. 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.
SidebarRecentTasks.RecentTasksList (cognitive 32) ui/src/components/SidebarRecentTasks.tsx:94— SidebarRecentTasks.RecentTasksList has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 6, boolean chains 5, error handling 3 (nesting depth added 6). Most of this is not in the body itself: 3 of the 32 points are its own statements and the rest belongs to 5 function items inside it that branch (toggleTaskPause, a function literal at line 249, submitRename, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
index.normalizedEnvEntries (cognitive 32) ui/src/components/environment-variables-editor/index.tsx:41— index.normalizedEnvEntries has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 5 (15 pts), boolean chains 1, 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.
CliAuth.CliAuthPage (cognitive 32) ui/src/pages/CliAuth.tsx:24— CliAuth.CliAuthPage has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 13, ternaries 8 (11 pts), if/else 8 (nesting depth added 3). Of this number, 28 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
SidebarNavItem.production.SidebarNavItem (cognitive 32) ui/src/components/SidebarNavItem.production.tsx:72— SidebarNavItem.production.SidebarNavItem has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 9 (16 pts), boolean chains 14, if/else 2 (nesting depth added 7). Of this number, 30 points are the body's own statements and 2 belong to 2 function literals 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.
SidebarCompanyMenu.production.BuiltinCompanyMenu (cognitive 32) ui/src/components/SidebarCompanyMenu.production.tsx:155— SidebarCompanyMenu.production.BuiltinCompanyMenu has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 9 (12 pts), boolean chains 10, if/else 9 (10 pts) (nesting depth added 4). Of this number, 18 points are the body's own statements and 14 belong to 6 function items inside it that branch. 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-log-chunks.mergeRunLogChunks (cognitive 32) ui/src/lib/run-log-chunks.ts:202— run-log-chunks.mergeRunLogChunks has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 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.
ProjectWorkspaceSummaryCard.ProjectWorkspaceSummaryCard (cognitive 32) ui/src/components/ProjectWorkspaceSummaryCard.tsx:41— ProjectWorkspaceSummaryCard.ProjectWorkspaceSummaryCard has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 19 (29 pts), boolean chains 3 (nesting depth added 10). Of this number, 30 points are the body's own statements and 2 belong to one function literal 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.
GitHubConnectionRecovery.GitHubAppRecovery (cognitive 32) ui/src/pages/apps/chat/GitHubConnectionRecovery.tsx:43— GitHubConnectionRecovery.GitHubAppRecovery has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 19, ternaries 7 (12 pts), error handling 1 (nesting depth added 5). Of this number, 28 points are the body's own statements and 4 belong to 2 function items inside it that branch. 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.
ConnectClientDialog.ConnectClientDialog (cognitive 32) ui/src/pages/apps/gateways/ConnectClientDialog.tsx:63— ConnectClientDialog.ConnectClientDialog has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 18 (26 pts), boolean chains 3, if/else 2, error handling 1 (nesting depth added 8). Of this number, 19 points are the body's own statements and 13 belong to 10 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.
SkillStudio.RunDetailView (cognitive 32) ui/src/pages/SkillStudio.tsx:3025— SkillStudio.RunDetailView has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 16 (19 pts), boolean chains 9, if/else 4 (nesting depth added 3). Of this number, 19 points are the body's own statements and 13 belong to 10 function literals inside it that branch. 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.
CommentThread.CommentCard (cognitive 32) ui/src/components/CommentThread.tsx:297— CommentThread.CommentCard has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 18 (24 pts), boolean chains 8 (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.
AgentMailIntentSetup.AgentMailIntentSetup (cognitive 32) ui/src/features/connections/AgentMailIntentSetup.tsx:23— AgentMailIntentSetup.AgentMailIntentSetup has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 15, ternaries 5 (9 pts), if/else 5 (6 pts), error handling 2 (nesting depth added 5). Of this number, 20 points are the body's own statements and 12 belong to 5 function literals inside it that branch. 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.
AwsAgentCoreHarnessProvider::poll (cognitive 32) packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs:1711— AwsAgentCoreHarnessProvider::poll has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 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.
execution-target.runAdapterExecutionTargetProcess (cognitive 31) REDACTED:866— execution-target.runAdapterExecutionTargetProcess has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 7 (12 pts), if/else 6 (11 pts), boolean chains 6, error handling 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.
quota-probe.main (cognitive 31) packages/adapters/claude-local/src/cli/quota-probe.ts:33— quota-probe.main has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (16 pts), error handling 3 (7 pts), boolean chains 4, ternaries 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.
CodexHarnessSession.startTurn (cognitive 31) packages/paperclip-runner/src/drivers/codex/codex-harness-session.ts:161— CodexHarnessSession.startTurn has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 8, ternaries 5 (7 pts), error handling 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.
archive.packControlledAttempt (cognitive 31) packages/paperclip-runner/scripts/controlled-evals/archive.mjs:44— archive.packControlledAttempt has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (5 pts), error handling 1 (3 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.
runner-protocol-eval-history-view.renderProtocolEvalHistoryIndex (cognitive 31) packages/paperclip-runner/scripts/runner-protocol-eval-history-view.mjs:75— runner-protocol-eval-history-view.renderProtocolEvalHistoryIndex has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 9, if/else 4 (7 pts), loops 3 (nesting depth added 5). Of this number, 19 points are the body's own statements and 12 belong to 6 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.
RunnerdExternalSession.open (cognitive 31) packages/paperclip-runner/src/drivers/external/runnerd-external-driver.ts:166— RunnerdExternalSession.open has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 12, ternaries 1 (nesting depth added 5). Of this number, 22 points are the body's own statements and 9 belong to 5 function literals 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.
acpx-runtime-sidecar.waitForTool (cognitive 31) packages/paperclip-runner/src/cli/acpx-runtime-sidecar.ts:711— acpx-runtime-sidecar.waitForTool has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 9, error handling 1 (2 pts) (nesting depth added 8). Of this number, 23 points are the body's own statements and 8 belong to 4 function literals 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.
capability-eval-suite.runCapabilityLiveCodexMatrix (cognitive 31) packages/paperclip-runner/src/conformance/capability-eval-suite.ts:302— capability-eval-suite.runCapabilityLiveCodexMatrix has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 9 (19 pts), if/else 3 (6 pts), boolean chains 5, loops 1 (nesting depth added 13). Of this number, 29 points are the body's own statements and 2 belong to 2 function literals 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.
LiveConsoleScriptedSession.#runBeat (cognitive 31) packages/paperclip-runner/src/mock-core/live-console-scripted-driver.ts:504— LiveConsoleScriptedSession.#runBeat has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 4, loops 2 (4 pts), ternaries 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.
secrets.secretService.updateUnlocked (cognitive 31) server/src/services/secrets.ts:2624— secrets.secretService.updateUnlocked has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 8, ternaries 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.
decision-model-provider.runDecisionProvider (cognitive 31) server/src/services/decision-model-provider.ts:43— decision-model-provider.runDecisionProvider has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 10 (22 pts), boolean chains 4, if/else 2 (4 pts), error handling 1 (nesting depth added 14). Of this number, 28 points are the body's own statements and 3 belong to one function literal 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.
prompt-injection-prevention.promptInjectionPreventionService.resolve (cognitive 31) server/src/services/prompt-injection-prevention.ts:77— prompt-injection-prevention.promptInjectionPreventionService.resolve has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 9, ternaries 4 (8 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.
git-restore-point.scanChangedPaths (cognitive 31) REDACTED:181— git-restore-point.scanChangedPaths has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 14). Of this number, 29 points are the body's own statements and 2 belong to one function literal 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.
isolated-task-directory-snapshot.decodeTaskDirectorySnapshot (cognitive 31) server/src/services/isolated-task-directory-snapshot.ts:173— isolated-task-directory-snapshot.decodeTaskDirectorySnapshot has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 8, ternaries 1 (2 pts), error handling 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.
execution-workspaces.executionWorkspaceService.runTaskDirectoryFolderWork (cognitive 31) server/src/services/execution-workspaces.ts:1795— execution-workspaces.executionWorkspaceService.runTaskDirectoryFolderWork has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 5 (9 pts), ternaries 2 (3 pts), error handling 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.
connection-intents.connectionIntentService.resolveService (cognitive 31) server/src/services/connection-intents.ts:366— connection-intents.connectionIntentService.resolveService has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 6 (11 pts), boolean chains 9 (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.
root-threads.createDiscordRootThreads.admitDiscordRootMention (cognitive 31) server/src/services/chat-channels/discord/root-threads.ts:68— root-threads.createDiscordRootThreads.admitDiscordRootMention has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 10, ternaries 2, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 86, 83, 338). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
gateway-events.createDiscordGatewayEvents.processDiscordGatewayEvent (cognitive 31) server/src/services/chat-channels/discord/gateway-events.ts:77— gateway-events.createDiscordGatewayEvents.processDiscordGatewayEvent has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 7 (10 pts), boolean chains 9 (nesting depth added 5). Most of this is not in the body itself: 6 of the 31 points are its own statements and the rest belongs to one function literal inside it that branches (line 116). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
cloud-callback.createCloudOAuthCallback::completePaperclipCloudConnectorCallback (cognitive 31) server/src/services/tool-access/oauth/cloud-callback.ts:39— cloud-callback.createCloudOAuthCallback::completePaperclipCloudConnectorCallback has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 11 (13 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.
tool-access.toolAccessService.ensureNoDuplicateNameError (cognitive 31) server/src/services/tool-access.ts:4786— tool-access.toolAccessService.ensureNoDuplicateNameError has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 12 (19 pts), boolean chains 11, if/else 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.
issue-thread-interactions.issueThreadInteractionService.acceptRequestConfirmation (cognitive 31) server/src/services/issue-thread-interactions.ts:2150— issue-thread-interactions.issueThreadInteractionService.acceptRequestConfirmation has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (18 pts), ternaries 5 (8 pts), boolean chains 4, loops 1 (nesting depth added 6). Most of this is not in the body itself: 3 of the 31 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 2172, publish). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
issues.terminalExplicitBlockersByRoot (cognitive 31) server/src/services/issues.ts:3682— issues.terminalExplicitBlockersByRoot has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 6 (10 pts), boolean chains 2 (nesting depth added 14). Of this number, 27 points are the body's own statements and 4 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.
sentry.captureRunFailure (cognitive 31) server/src/sentry.ts:209— sentry.captureRunFailure has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 10 (11 pts), if/else 7 (10 pts), boolean chains 6, error handling 2 (3 pts), 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.
queue.createHeartbeatQueue.resumeQueuedRuns (cognitive 31) server/src/services/heartbeat/queue.ts:1793— queue.createHeartbeatQueue.resumeQueuedRuns has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 7, loops 4, ternaries 4 (nesting depth added 8). Of this number, 29 points are the body's own statements and 2 belong to one function literal 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.
native-session-handoff.buildNativeSessionHandoff (cognitive 31) server/src/services/native-runtime/native-session-handoff.ts:50— native-session-handoff.buildNativeSessionHandoff has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 16 (17 pts), if/else 7 (8 pts), boolean chains 4, loops 2 (nesting depth added 2). Of this number, 24 points are the body's own statements and 7 belong to 4 function items inside it that branch. 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.
extract-proposed-events.classifyTypeNode (cognitive 31) scripts/extract-proposed-events.mjs:231— extract-proposed-events.classifyTypeNode has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 4, loops 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.
migrate-inline-env-secrets.main (cognitive 31) scripts/migrate-inline-env-secrets.ts:30— migrate-inline-env-secrets.main has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 2 (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.
local-ai-credentials.readVerifiedLocalAiCredential (cognitive 31) server/src/services/local-ai-credentials.ts:11— local-ai-credentials.readVerifiedLocalAiCredential has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (18 pts), error handling 2 (4 pts), ternaries 2 (4 pts), boolean chains 3, loops 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.
workspace-readiness.resolveWorkspaceReadiness (cognitive 31) server/src/services/workspace-readiness.ts:183— workspace-readiness.resolveWorkspaceReadiness has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 3 (8 pts), ternaries 2 (6 pts), boolean chains 4 (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.
projects.projectRoutes::handleProjectWorkspaceRuntimeCommand (cognitive 31) server/src/routes/projects.ts:721— projects.projectRoutes::handleProjectWorkspaceRuntimeCommand has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14, boolean chains 12, ternaries 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.
idle-issue-schedule.readIdleIssueSchedule (cognitive 31) server/src/services/idle-issue-schedule.ts:16— idle-issue-schedule.readIdleIssueSchedule has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 15, if/else 8 (15 pts), loops 1 (nesting depth added 7). 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.
CreateSecretPopover.SecretPopoverForm (cognitive 31) ui/src/components/environment-variables-editor/CreateSecretPopover.tsx:30— CreateSecretPopover.SecretPopoverForm has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 18 (21 pts), if/else 5, boolean chains 4, error handling 1 (nesting depth added 3). Of this number, 21 points are the body's own statements and 10 belong to 3 function items inside it that branch. 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.
proposal-review.ApproveDialog (cognitive 31) ui/src/pages/secrets/proposal-review.tsx:367— proposal-review.ApproveDialog has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 13 (28 pts), boolean chains 3 (nesting depth added 15). Of this number, 30 points are the body's own statements and 1 belongs to one function literal 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.
TaskChatSystemNotice.TaskChatSystemNotice (cognitive 31) ui/src/components/task-chat/TaskChatSystemNotice.tsx:52— TaskChatSystemNotice.TaskChatSystemNotice has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 14 (20 pts), boolean chains 8, if/else 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.
tool-taxonomy.toolActivityPresentation (cognitive 31) ui/src/components/task-chat/tool-taxonomy.ts:363— tool-taxonomy.toolActivityPresentation has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 16 (28 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.
task-chat-activity-presentation.providerActivityPresentation (cognitive 31) ui/src/components/task-chat/task-chat-activity-presentation.ts:59— task-chat-activity-presentation.providerActivityPresentation has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 7 (15 pts), if/else 6 (12 pts), boolean chains 3, match/switch 1 (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.
issue-change-receipt.formatIssueChangeValue (cognitive 31) ui/src/lib/issue-change-receipt.ts:63— issue-change-receipt.formatIssueChangeValue has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 5 (11 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.
AgentDetail.LatestRunCard (cognitive 31) ui/src/pages/AgentDetail.tsx:1577— AgentDetail.LatestRunCard has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 10 (17 pts), boolean chains 9, if/else 3 (4 pts), loops 1 (nesting depth added 8). Of this number, 24 points are the body's own statements and 7 belong to 3 function literals 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.
SearchFilterMenu.SearchFilterMenu (cognitive 31) ui/src/components/search/SearchFilterMenu.tsx:59— SearchFilterMenu.SearchFilterMenu has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 12 (19 pts), boolean chains 5, if/else 3 (5 pts), loops 1 (2 pts) (nesting depth added 10). Most of this is not in the body itself: 8 of the 31 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 181, a function literal at line 147, handleOptionClick, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CompanySettings.CompanySettings (cognitive 31) ui/src/pages/CompanySettings.tsx:34— CompanySettings.CompanySettings has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 17, if/else 8, ternaries 4 (6 pts) (nesting depth added 2). Of this number, 23 points are the body's own statements and 8 belong to 5 function items inside it that branch. 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.
SmokeLabTab.SmokeLabTab (cognitive 31) ui/src/pages/tools/SmokeLabTab.tsx:69— SmokeLabTab.SmokeLabTab has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 19, ternaries 8 (9 pts), if/else 3 (nesting depth added 1). Of this number, 22 points are the body's own statements and 9 belong to 5 function items inside it that branch. 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.
ChatEndpointDetail.Settings (cognitive 31) ui/src/pages/apps/chat/ChatEndpointDetail.tsx:462— ChatEndpointDetail.Settings has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 9 (18 pts), boolean chains 12, if/else 1 (nesting depth added 9). Of this number, 22 points are the body's own statements and 9 belong to 3 function literals 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.
ProfileSettings.ProfileSettings (cognitive 31) ui/src/pages/ProfileSettings.tsx:23— ProfileSettings.ProfileSettings has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 14 (16 pts), boolean chains 9, if/else 6 (nesting depth added 2). Of this number, 22 points are the body's own statements and 9 belong to 9 function items inside it that branch. 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.
ArtifactFileRow.ArtifactFileRow (cognitive 31) ui/src/components/artifacts/v1/ArtifactFileRow.tsx:27— ArtifactFileRow.ArtifactFileRow has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 11 (15 pts), boolean chains 14, if/else 1 (2 pts) (nesting depth added 5). Of this number, 29 points are the body's own statements and 2 belong to one function literal 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.
useSummaryDraftStream.useSummaryDraftStream (cognitive 31) ui/src/components/useSummaryDraftStream.ts:62— useSummaryDraftStream.useSummaryDraftStream has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15, ternaries 6 (8 pts), boolean chains 7, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 5 of the 31 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 129, 149, 100, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
artifact-card-data.parseArtifactCsv (cognitive 31) ui/src/lib/artifact-card-data.ts:55— artifact-card-data.parseArtifactCsv has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 6, loops 1 (nesting depth added 9). Of this number, 30 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.
AgentDetail.production.LatestRunCard (cognitive 31) ui/src/pages/AgentDetail.production.tsx:1631— AgentDetail.production.LatestRunCard has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 10 (17 pts), boolean chains 9, if/else 3 (4 pts), loops 1 (nesting depth added 8). Of this number, 24 points are the body's own statements and 7 belong to 3 function literals 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.
AiConnectionsReview.AgentConnectionReview (cognitive 31) ui/storybook/prototypes/AiConnectionsReview.tsx:49— AiConnectionsReview.AgentConnectionReview has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 20, ternaries 7 (10 pts), if/else 1 (nesting depth added 3). Of this number, 26 points are the body's own statements and 5 belong to 5 function items inside it that branch. 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.
ServiceConsent.ServiceConsent (cognitive 31) ui/storybook/prototypes/google-workspace/ServiceConsent.tsx:21— ServiceConsent.ServiceConsent has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 11 (16 pts), boolean chains 12, if/else 2 (3 pts) (nesting depth added 6). Of this number, 23 points are the body's own statements and 8 belong to 4 function literals 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.
ExternalAgentInvitePreview.ExternalAgentInvitePreview (cognitive 31) ui/storybook/support/external-agent-invite/ExternalAgentInvitePreview.tsx:40— ExternalAgentInvitePreview.ExternalAgentInvitePreview has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 12 (18 pts), boolean chains 7, if/else 6 (nesting depth added 6). Most of this is not in the body itself: 13 of the 31 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 56, 95, 54, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CodexProviderState::validate (cognitive 31) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:1111— CodexProviderState::validate has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 29, if/else 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.
worktree.runWorktreeInit (cognitive 30) cli/src/commands/worktree.ts:2409— worktree.runWorktreeInit has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 5, boolean chains 3, error handling 2 (3 pts), loops 1 (2 pts) (nesting depth added 6). Of this number, 26 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
git-workspace-sync.readGitWorkspaceSnapshot (cognitive 30) packages/adapter-utils/src/git-workspace-sync.ts:199— git-workspace-sync.readGitWorkspaceSnapshot has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (12 pts), loops 4 (8 pts), boolean chains 4, error handling 3, ternaries 3 (nesting depth added 5). Of this number, 22 points are the body's own statements and 8 belong to 3 function items inside it that branch. 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.
execute.emitRuntimeEvent (cognitive 30) packages/adapter-utils/src/acpx-engine/execute.ts:3230— execute.emitRuntimeEvent has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 5 (10 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.
build-config.buildClaudeLocalConfig (cognitive 30) packages/adapters/claude-local/src/ui/build-config.ts:22— build-config.buildClaudeLocalConfig has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 6 (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.
check-migration-safety.splitSqlList (cognitive 30) packages/db/src/check-migration-safety.ts:345— check-migration-safety.splitSqlList has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 3, 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.
OpenCodeHarnessSession.resolveRuntimeRequest (cognitive 30) REDACTED:746— OpenCodeHarnessSession.resolveRuntimeRequest has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 5 (11 pts), boolean chains 6, error handling 1 (nesting depth added 8). Of this number, 27 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.
materialize-pi-distribution.verifyLockedPiPackageGraph (cognitive 30) packages/paperclip-runner/scripts/materialize-pi-distribution.mjs:39— materialize-pi-distribution.verifyLockedPiPackageGraph has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 9, error handling 1 (2 pts), 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.
live-projection.providerActivityItem (cognitive 30) packages/paperclip-runner/src/issue-thread/live-projection.ts:56— live-projection.providerActivityItem has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 6 (21 pts), boolean chains 7, if/else 2 (nesting depth added 15). 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.
PiAssistantMessages.normalize (cognitive 30) packages/paperclip-runner/src/drivers/acpx/pi-acp-runtime.ts:153— PiAssistantMessages.normalize has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 7 (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.
native-session-runtime.replayProvesEffectFreeInitialAcpxTurn (cognitive 30) packages/paperclip-runner/src/native-session-runtime.ts:1758— native-session-runtime.replayProvesEffectFreeInitialAcpxTurn has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 10, ternaries 4, loops 2 (3 pts), error handling 1 (nesting depth added 6). Of this number, 22 points are the body's own statements and 8 belong to 5 function literals 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.
conversation.Conversation (cognitive 30) packages/paperclip-runner/src/react/components/conversation.tsx:51— conversation.Conversation has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15, ternaries 9 (13 pts), boolean chains 2 (nesting depth added 4). Most of this is not in the body itself: 4 of the 30 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 143, 74, 64, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
redaction.authorizationCredentialRange (cognitive 30) server/src/redaction.ts:571— redaction.authorizationCredentialRange has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 6, loops 1 (3 pts), ternaries 2 (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, 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.
redaction.sanitizeRecord (cognitive 30) server/src/redaction.ts:899— redaction.sanitizeRecord has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 6, 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.
authorization.createAuthorizationService.decide (cognitive 30) server/src/services/authorization.ts:2792— authorization.createAuthorizationService.decide has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 8 (15 pts), boolean chains 8, if/else 5 (7 pts) (nesting depth added 9). Most of this is not in the body itself: 8 of the 30 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 2811, 2852). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
agent-conversations.prepareConversationTurn (cognitive 30) server/src/services/agent-conversations.ts:119— agent-conversations.prepareConversationTurn has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 6 (11 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 11). Most of this is not in the body itself: 3 of the 30 points are its own statements and the rest belongs to one function literal inside it that branches (line 127). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
budgets.budgetServiceInTransaction.upsertPolicy (cognitive 30) server/src/services/budgets.ts:736— budgets.budgetServiceInTransaction.upsertPolicy has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 9, ternaries 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.
documents.documentService.upsertIssueDocument (cognitive 30) server/src/services/documents.ts:198— documents.documentService.upsertIssueDocument has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (25 pts), error handling 1 (2 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 17). Most of this is not in the body itself: 13 of the 30 points are its own statements and the rest belongs to one function literal inside it that branches (line 223). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
cognee-connection.callCogneeCloud (cognitive 30) server/src/services/cognee-connection.ts:50— cognee-connection.callCogneeCloud has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 4, ternaries 3 (4 pts) (nesting depth added 10). Of this number, 28 points are the body's own statements and 2 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.
tool-gateway.createToolGatewayService.executeApprovedAgentInvocation (cognitive 30) server/src/services/tool-gateway.ts:8043— tool-gateway.createToolGatewayService.executeApprovedAgentInvocation has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 4 (8 pts), boolean chains 6, error handling 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.
tool-gateway.createToolGatewayService.buildTestCallStatus (cognitive 30) server/src/services/tool-gateway.ts:8607— tool-gateway.createToolGatewayService.buildTestCallStatus has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5, ternaries 5, error handling 1 (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.
chat-provider-lifecycle.parseSlackLifecycle (cognitive 30) server/src/services/chat-provider-lifecycle.ts:89— chat-provider-lifecycle.parseSlackLifecycle has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 6 (12 pts), boolean chains 6 (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.
git-workspace-restoration.assertReproducibleManagedCheckout (cognitive 30) server/src/services/git-workspace-restoration.ts:277— git-workspace-restoration.assertReproducibleManagedCheckout has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (23 pts), ternaries 6, 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.
execution-workspaces.preserveWorkspaceMetadataForPatch (cognitive 30) server/src/services/execution-workspaces.ts:261— execution-workspaces.preserveWorkspaceMetadataForPatch has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 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.
slack-board-authority.authorizeSlackBoardPublication (cognitive 30) server/src/services/slack-board-authority.ts:53— slack-board-authority.authorizeSlackBoardPublication has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 4, loops 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.
board-messages.createSlackBoardMessages.processPendingSlackBoardMessages (cognitive 30) server/src/services/chat-channels/slack/board-messages.ts:25— board-messages.createSlackBoardMessages.processPendingSlackBoardMessages has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (18 pts), ternaries 2 (5 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (nesting depth added 14). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 31, 66). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
oauth.createPublicMcpOAuth.exchangeAuthorizationCode (cognitive 30) server/src/services/public-mcp/oauth.ts:348— oauth.createPublicMcpOAuth.exchangeAuthorizationCode has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 7, error handling 2, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 8 of the 30 points are its own statements and the rest belongs to one function literal inside it that branches (line 356). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
legacy-shutdown-workspace-settlement.allowLegacyShutdownWorkspaceCleanup (cognitive 30) server/src/services/legacy-shutdown-workspace-settlement.ts:107— legacy-shutdown-workspace-settlement.allowLegacyShutdownWorkspaceCleanup has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 9 (nesting depth added 5). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to one function literal inside it that branches (line 110). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
agent-instruction-revisions.agentInstructionRevisionService.commitInternal (cognitive 30) server/src/services/agent-instruction-revisions.ts:212— agent-instruction-revisions.agentInstructionRevisionService.commitInternal has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 11 (13 pts), if/else 8 (11 pts), boolean chains 6 (nesting depth added 5). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 223, 250, 256). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
skill-version-cache.protectedVersions (cognitive 30) server/src/services/skill-version-cache.ts:94— skill-version-cache.protectedVersions has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 3 (6 pts), boolean chains 3, error handling 1 (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.
run-failure-diagnostics.readNativeCloseSettlement (cognitive 30) REDACTED:86— run-failure-diagnostics.readNativeCloseSettlement has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 5, 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.
app.CreateSpaceModal (cognitive 30) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:2043— app.CreateSpaceModal has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 13 (14 pts), if/else 8, boolean chains 7, error handling 1 (nesting depth added 1). Of this number, 17 points are the body's own statements and 13 belong to 5 function items inside it that branch. 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.
pod-exec.execInPodStreaming (cognitive 30) packages/plugins/sandbox-providers/kubernetes/src/pod-exec.ts:298— pod-exec.execInPodStreaming has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (19 pts), boolean chains 4, error handling 4, ternaries 2 (3 pts) (nesting depth added 2). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 380, 338, 319, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
issue.createLegacyAskUserQuestionsPayloadSchema (cognitive 30) packages/shared/src/validators/issue.ts:1985— issue.createLegacyAskUserQuestionsPayloadSchema has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 5, ternaries 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.
catalog-builder.discoverSkillCandidates (cognitive 30) packages/skills-catalog/src/catalog-builder.ts:189— catalog-builder.discoverSkillCandidates has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 3 (6 pts), ternaries 1 (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.
feedback.buildAgentContext (cognitive 30) server/src/services/feedback.ts:1086— feedback.buildAgentContext has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 13 (15 pts), if/else 8 (12 pts), boolean chains 3 (nesting depth added 6). Of this number, 26 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
events.createPublicMcpEvents.deliverOne (cognitive 30) server/src/services/public-mcp/events.ts:297— events.createPublicMcpEvents.deliverOne has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 6, ternaries 4 (6 pts), error handling 2 (nesting depth added 5). Of this number, 27 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
SidebarStarredProjects.SidebarStarredProjects (cognitive 30) ui/src/components/SidebarStarredProjects.tsx:42— SidebarStarredProjects.SidebarStarredProjects has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 10, if/else 7 (9 pts) (nesting depth added 4). Most of this is not in the body itself: 3 of the 30 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 108, 59, 91, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Sidebar.Sidebar (cognitive 30) ui/src/components/Sidebar.tsx:53— Sidebar.Sidebar has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 21 (24 pts), boolean chains 6 (nesting depth added 3). Of this number, 26 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
search-query-parser.tokenizeQuery (cognitive 30) ui/src/lib/search-query-parser.ts:88— search-query-parser.tokenizeQuery has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 5 (12 pts), boolean chains 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.
SidebarShell.SidebarShell (cognitive 30) ui/src/components/SidebarShell.tsx:92— SidebarShell.SidebarShell has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 12 (16 pts), if/else 10, boolean chains 4 (nesting depth added 4). Of this number, 18 points are the body's own statements and 12 belong to 5 function literals inside it that branch. 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.
index.parseDeltaEvent (cognitive 30) ui/src/adapters/paperclip-runner/index.ts:267— index.parseDeltaEvent has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 8 (18 pts), if/else 7 (8 pts), boolean chains 4 (nesting depth added 11). Of this number, 23 points are the body's own statements and 7 belong to one function literal 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.
SidebarStarredProjects.production.SidebarStarredProjects (cognitive 30) ui/src/components/SidebarStarredProjects.production.tsx:42— SidebarStarredProjects.production.SidebarStarredProjects has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 10, if/else 7 (9 pts) (nesting depth added 4). Most of this is not in the body itself: 3 of the 30 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 108, 59, 91, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
recovery-lineage.readRecoveryRetryLineage (cognitive 30) ui/src/lib/recovery-lineage.ts:140— recovery-lineage.readRecoveryRetryLineage has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 12, ternaries 9 (11 pts), if/else 7 (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.
tool-taxonomy.actionCopy (cognitive 30) ui/src/components/task-chat/tool-taxonomy.ts:310— tool-taxonomy.actionCopy has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 28, match/switch 1, ternaries 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.
WorkspaceRuntimeControls.CommandSection (cognitive 30) ui/src/components/WorkspaceRuntimeControls.tsx:411— WorkspaceRuntimeControls.CommandSection has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 13 (28 pts), boolean chains 2 (nesting depth added 15). Most of this is not in the body itself: 5 of the 30 points are its own statements and the rest belongs to one function literal inside it that branches (line 452). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
activity-format.formatIssueActivityAction (cognitive 30) ui/src/lib/activity-format.ts:509— activity-format.formatIssueActivityAction has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 6 (12 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.
Routines.buildRoutineGroups (cognitive 30) ui/src/pages/Routines.tsx:159— Routines.buildRoutineGroups has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 10 (18 pts), if/else 6 (10 pts), boolean chains 2 (nesting depth added 12). Most of this is not in the body itself: 3 of the 30 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 173, 203, 217, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
DecisionResolver.DecisionResolver (cognitive 30) ui/src/components/DecisionResolver.tsx:43— DecisionResolver.DecisionResolver has cognitive complexity 30 (threshold 15). Drivers by points: loops 7 (11 pts), if/else 8 (9 pts), boolean chains 7, ternaries 3 (nesting depth added 5). Most of this is not in the body itself: 9 of the 30 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 73, a function literal at line 113, a function literal at line 128, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
InstanceGeneralSettings.InstanceGeneralSettings (cognitive 30) ui/src/pages/InstanceGeneralSettings.tsx:23— InstanceGeneralSettings.InstanceGeneralSettings has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 11 (14 pts), boolean chains 13, if/else 3 (nesting depth added 3). Of this number, 28 points are the body's own statements and 2 belong to 6 function literals inside it that branch. 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.
SkillFolderTree.MoveToFolderDialog (cognitive 30) ui/src/components/folders/SkillFolderTree.tsx:812— SkillFolderTree.MoveToFolderDialog has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 16 (17 pts), boolean chains 9, if/else 4 (nesting depth added 1). Most of this is not in the body itself: 12 of the 30 points are its own statements and the rest belongs to 6 function items inside it that branch (renderNode, submitNewFolder, a function literal at line 841, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
Routines.production.buildRoutineGroups (cognitive 30) ui/src/pages/Routines.production.tsx:159— Routines.production.buildRoutineGroups has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 10 (18 pts), if/else 6 (10 pts), boolean chains 2 (nesting depth added 12). Most of this is not in the body itself: 3 of the 30 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 173, 203, 217, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ExcerptSheet.ExcerptSheet (cognitive 30) ui/src/artifact-directions/directions/d1-solid/ExcerptSheet.tsx:142— ExcerptSheet.ExcerptSheet has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 15 (29 pts), boolean chains 1 (nesting depth added 14). Of this number, 23 points are the body's own statements and 7 belong to 2 function literals 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.
InboxAgentPolicyControl.InboxAgentPolicyControl (cognitive 30) ui/src/components/InboxAgentPolicyControl.tsx:47— InboxAgentPolicyControl.InboxAgentPolicyControl has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 14 (20 pts), boolean chains 6, if/else 4 (nesting depth added 6). Of this number, 22 points are the body's own statements and 8 belong to 6 function literals 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.
TaskList.TaskList (cognitive 30) ui/src/components/TaskList.tsx:39— TaskList.TaskList has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 15 (22 pts), if/else 3 (4 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 8). Most of this is not in the body itself: 7 of the 30 points are its own statements and the rest belongs to 5 function items inside it that branch (renderBranch, sortValue, updateColumns, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentsUsingSkillDialog.AgentRow (cognitive 30) ui/src/components/skill-studio/AgentsUsingSkillDialog.tsx:292— AgentsUsingSkillDialog.AgentRow has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 13 (29 pts), boolean chains 1 (nesting depth added 16). Of this number, 24 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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.
voice-session-controller.createVoiceSessionController.start (cognitive 30) ui/src/lib/voice-session-controller.ts:102— voice-session-controller.createVoiceSessionController.start has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (9 pts), ternaries 3 (9 pts), error handling 1 (nesting depth added 8). Most of this is not in the body itself: 14 of the 30 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 108, 135). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
BulkAgentSettingsProposal.Proposal (cognitive 30) ui/storybook/support/design-proposals/BulkAgentSettingsProposal.tsx:143— BulkAgentSettingsProposal.Proposal has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 17, ternaries 10 (11 pts), if/else 2 (nesting depth added 1). Most of this is not in the body itself: 14 of the 30 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 194, a function literal at line 146, a function literal at line 153, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
setup-token-parse.hasValidQuery (cognitive 29) packages/adapters/claude-local/src/server/setup-token-parse.ts:260— setup-token-parse.hasValidQuery has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (24 pts), loops 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.
CodexRpcClient.onStdout (cognitive 29) packages/adapters/codex-local/src/server/quota.ts:518— CodexRpcClient.onStdout has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 3 (7 pts), boolean chains 2, error handling 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.
parse-stdout.parseAssistantMessage (cognitive 29) packages/adapters/gemini-local/src/ui/parse-stdout.ts:78— parse-stdout.parseAssistantMessage has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 6, ternaries 2 (3 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.
parse-stdout.parseGeminiStdoutLine (cognitive 29) packages/adapters/gemini-local/src/ui/parse-stdout.ts:212— parse-stdout.parseGeminiStdoutLine has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 7, ternaries 2 (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.
parse.parseGrokJsonl (cognitive 29) packages/adapters/grok-local/src/server/parse.ts:33— parse.parseGrokJsonl has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 4, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runtime-config.prepareOpenCodeRuntimeConfig (cognitive 29) packages/adapters/opencode-local/src/server/runtime-config.ts:107— runtime-config.prepareOpenCodeRuntimeConfig has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 8 (11 pts), error handling 3 (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.
check-migration-safety.analyzeMigrationSafety (cognitive 29) packages/db/src/check-migration-safety.ts:886— check-migration-safety.analyzeMigrationSafety has cognitive complexity 29 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 4 (9 pts), boolean chains 4 (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.
CodexHarnessSession.reconcile (cognitive 29) packages/paperclip-runner/src/drivers/codex/codex-harness-session.ts:687— CodexHarnessSession.reconcile has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 5, 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.
DurablePrpControlPlane.#handleJson (cognitive 29) REDACTED:2119— DurablePrpControlPlane.#handleJson has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 9, error handling 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.
durable-prp-control-plane.warmTransitionRecoveryProof (cognitive 29) REDACTED:780— durable-prp-control-plane.warmTransitionRecoveryProof has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 15, if/else 9 (12 pts), error handling 1, ternaries 1 (nesting depth added 3). Of this number, 27 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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-runtime-adapter.runtimePort (cognitive 29) packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts:1075— codex-runtime-adapter.runtimePort has cognitive complexity 29 (threshold 15). Drivers by points: if/else 44 (52 pts), boolean chains 23, ternaries 9, error handling 2, 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. This shape REPEATS in the file: one other method here (codex-runtime-adapter.runtimePort::closeRuntime) 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.
workflow-traceability.validateStressTraceabilityManifest (cognitive 29) packages/paperclip-runner/src/eval/workflow-traceability.ts:29— workflow-traceability.validateStressTraceabilityManifest has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 7, 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.
policy.transition (cognitive 29) server/src/modules/agent-lifecycle/domain/policy.ts:17— policy.transition has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (25 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.
chat-github-response-comments.githubResponseCommentService.finishRun (cognitive 29) server/src/services/chat-github-response-comments.ts:305— chat-github-response-comments.githubResponseCommentService.finishRun has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 7, ternaries 2 (5 pts), error handling 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.
prompt-injection-prevention.promptInjectionPreventionService.classify (cognitive 29) server/src/services/prompt-injection-prevention.ts:140— prompt-injection-prevention.promptInjectionPreventionService.classify has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 7, ternaries 4, error handling 3, loops 1 (nesting depth added 4). Most of this is not in the body itself: 12 of the 29 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 155, 180). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
distribution-plugin-catalog.distributionPluginActivationGuard (cognitive 29) server/src/services/distribution-plugin-catalog.ts:52— distribution-plugin-catalog.distributionPluginActivationGuard has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 11, ternaries 3 (4 pts), error handling 1 (nesting depth added 6). None of this is in the body itself: all 29 points belong to 2 function literals inside it that branch (lines 58, 65). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tool-gateway.createToolGatewayService.buildRemoteHeaders (cognitive 29) server/src/services/tool-gateway.ts:3652— tool-gateway.createToolGatewayService.buildRemoteHeaders has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 5 (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.
workspaces.assertGitSensitiveAdapterWorkspaceValid (cognitive 29) server/src/services/heartbeat/workspaces.ts:1097— workspaces.assertGitSensitiveAdapterWorkspaceValid has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 13 (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.
policy.decideScheduledRetryGate (cognitive 29) server/src/modules/run-dispatch/domain/policy.ts:263— policy.decideScheduledRetryGate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 9, ternaries 1 (2 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.
credential-access.createConnectionCredentialAccess.resolveCredentialHeaders (cognitive 29) server/src/services/tool-access/credential-access.ts:112— credential-access.createConnectionCredentialAccess.resolveCredentialHeaders has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 3 (7 pts), boolean chains 6, error handling 2 (3 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.
issue-thread-interactions.issueThreadInteractionService.submitItemVerdicts (cognitive 29) server/src/services/issue-thread-interactions.ts:4176— issue-thread-interactions.issueThreadInteractionService.submitItemVerdicts has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (20 pts), ternaries 5, loops 1 (3 pts), boolean chains 1 (nesting depth added 9). Most of this is not in the body itself: 2 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 4188). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
oauth.createPublicMcpOAuth.actorForGrant (cognitive 29) server/src/services/public-mcp/oauth.ts:121— oauth.createPublicMcpOAuth.actorForGrant has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 6 (nesting depth added 11). Of this number, 28 points are the body's own statements and 1 belongs to one function literal 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.
case-handoff-authority.assertCaseHandoffSourceAuthority (cognitive 29) server/src/services/case-handoff-authority.ts:124— case-handoff-authority.assertCaseHandoffSourceAuthority has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 9, ternaries 2 (4 pts), error handling 1 (2 pts) (nesting depth added 9). Most of this is not in the body itself: 14 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 136). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-github-access.createNativeGitHubAccess (cognitive 29) server/src/services/native-runtime/native-github-access.ts:20— native-github-access.createNativeGitHubAccess has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 9, if/else 9, ternaries 5 (8 pts), error handling 3 (nesting depth added 3). Most of this is not in the body itself: 14 of the 29 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 36, 143, 78). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
runtime-skill-cache.publishLocked (cognitive 29) server/src/services/runtime-skill-cache.ts:117— runtime-skill-cache.publishLocked has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (21 pts), error handling 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 18). Of this number, 26 points are the body's own statements and 3 belong to one function literal 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.
company-skills.companySkillService.importPackageFiles (cognitive 29) server/src/services/company-skills.ts:6236— company-skills.companySkillService.importPackageFiles has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (9 pts), boolean chains 4, loops 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.
routines.routineService.updateTrigger (cognitive 29) server/src/services/routines.ts:2580— routines.routineService.updateTrigger has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (23 pts), ternaries 5, boolean chains 1 (nesting depth added 11). Of this number, 22 points are the body's own statements and 7 belong to one function literal 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.
native-session-executor.nativeSessionFailureSourceCode (cognitive 29) server/src/services/native-runtime/native-session-executor.ts:6458— native-session-executor.nativeSessionFailureSourceCode has cognitive complexity 29 (threshold 15). Drivers by points: if/else 26 (28 pts), ternaries 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.
native-session-executor.createRunnerdBackendWithinSessionClaim.checkpointRemoteRunner (cognitive 29) server/src/services/native-runtime/native-session-executor.ts:12948— native-session-executor.createRunnerdBackendWithinSessionClaim.checkpointRemoteRunner has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 6, ternaries 2 (4 pts), error handling 2, loops 2 (nesting depth added 7). Most of this is not in the body itself: 13 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 13000). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
use-cases.createRecordWatchdogDecision (cognitive 29) server/src/modules/active-run-watchdog/application/use-cases.ts:136— use-cases.createRecordWatchdogDecision has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 9, if/else 7 (8 pts) (nesting depth added 5). None of this is in the body itself: all 29 points belong to one function literal inside it that branches (line 137). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
run-liveness.classifyRunLiveness (cognitive 29) server/src/services/run-liveness.ts:300— run-liveness.classifyRunLiveness has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 5 (8 pts), boolean chains 7 (nesting depth added 5). Of this number, 27 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
ai-connection-session.aiConnectionSessionCompatibilityInputs (cognitive 29) server/src/services/ai-connection-session.ts:43— ai-connection-session.aiConnectionSessionCompatibilityInputs has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 4 (6 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 12). Of this number, 26 points are the body's own statements and 3 belong to one function literal 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.
decision-models.decisionModelService.decide (cognitive 29) server/src/services/decision-models.ts:176— decision-models.decisionModelService.decide has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 8, error handling 4, ternaries 4, loops 1 (nesting depth added 3). Most of this is not in the body itself: 12 of the 29 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 190, 211). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
file-sync.assertTarballEntriesConfined (cognitive 29) packages/plugins/sandbox-providers/daytona/src/file-sync.ts:301— file-sync.assertTarballEntriesConfined has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 2 (5 pts), loops 2 (3 pts), error handling 2, boolean chains 1 (nesting depth added 11). Of this number, 24 points are the body's own statements and 5 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.
portability-zip.readZipArchive (cognitive 29) packages/shared/src/portability-zip.ts:208— portability-zip.readZipArchive has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 3, ternaries 2 (3 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.
export.sendEvents (cognitive 29) scripts/ci-profile/export.mjs:17— export.sendEvents has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 17). Of this number, 26 points are the body's own statements and 3 belong to one function literal 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.
publish-announcements.main (cognitive 29) scripts/publish-announcements.ts:74— publish-announcements.main has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3 (5 pts), boolean chains 4, error handling 1 (2 pts), ternaries 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.
voice-sessions.voiceWebhookRoutes (cognitive 29) server/src/routes/voice-sessions.ts:91— voice-sessions.voiceWebhookRoutes has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 4 (14 pts), if/else 8 (11 pts), boolean chains 2, error handling 2 (nesting depth added 13). None of this is in the body itself: all 29 points belong to 2 function literals inside it that branch (lines 94, 106). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
decisions.decisionService.decide (cognitive 29) server/src/services/decisions.ts:638— decisions.decisionService.decide has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (18 pts), ternaries 5 (6 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.
access.listAvailableSkills (cognitive 29) REDACTED:248— access.listAvailableSkills has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 5 (10 pts), loops 3 (5 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.
plugin-host-services.buildHostServices.readAuthorizationPolicy (cognitive 29) server/src/services/plugin-host-services.ts:1512— plugin-host-services.buildHostServices.readAuthorizationPolicy has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 7 (10 pts), boolean chains 7 (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.
native-workspace-sync-retention.nativeWorkspaceSyncRetentionService.nextDeadlineAt (cognitive 29) server/src/services/native-runtime/native-workspace-sync-retention.ts:387— native-workspace-sync-retention.nativeWorkspaceSyncRetentionService.nextDeadlineAt has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 4 (10 pts), loops 3 (5 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.
environment-custom-image-terminal-ws.setupEnvironmentCustomImageTerminalWebSocketServer (cognitive 29) server/src/realtime/environment-custom-image-terminal-ws.ts:484— environment-custom-image-terminal-ws.setupEnvironmentCustomImageTerminalWebSocketServer has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21 (25 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 5). Most of this is not in the body itself: 1 of the 29 points is its own statement and the rest belongs to 11 function literals inside it that branch (lines 634, 521, 722, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
registry.syncExternalAdapters (cognitive 29) ui/src/adapters/registry.ts:154— registry.syncExternalAdapters has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 6, loops 2 (nesting depth added 12). Of this number, 15 points are the body's own statements and 14 belong to 5 function literals 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.
DesignSandboxTasks.DesignSandboxTasks (cognitive 29) ui/src/pages/DesignSandboxTasks.tsx:28— DesignSandboxTasks.DesignSandboxTasks has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 13 (23 pts), loops 2 (3 pts), boolean chains 2, if/else 1 (nesting depth added 11). Of this number, 23 points are the body's own statements and 6 belong to 3 function literals 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.
TaskChatShimmer.taskChatShimmerOwner (cognitive 29) ui/src/components/task-chat/TaskChatShimmer.tsx:9— TaskChatShimmer.taskChatShimmerOwner has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 4 (12 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.
IssueThreadInteractionCard.ToolActionResolution (cognitive 29) ui/src/components/IssueThreadInteractionCard.tsx:1686— IssueThreadInteractionCard.ToolActionResolution has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 12 (20 pts), boolean chains 6, error handling 1 (2 pts), if/else 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.
use-side-panel-tabs.sidePanelTabsReducer (cognitive 29) ui/src/components/side-panel/use-side-panel-tabs.ts:28— use-side-panel-tabs.sidePanelTabsReducer has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 6 (14 pts), if/else 6 (12 pts), boolean chains 2, match/switch 1 (nesting depth added 14). Of this number, 27 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
CaseDetail.CaseDetail (cognitive 29) ui/src/pages/CaseDetail.tsx:35— CaseDetail.CaseDetail has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 24, if/else 3, ternaries 1 (2 pts) (nesting depth added 1). Of this number, 26 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
AgentToolsTab.GitHubIdentitySection (cognitive 29) ui/src/pages/AgentToolsTab.tsx:40— AgentToolsTab.GitHubIdentitySection has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 10 (29 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.
CompanyImport.ImportPreviewPane (cognitive 29) ui/src/pages/CompanyImport.tsx:205— CompanyImport.ImportPreviewPane has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 10 (18 pts), boolean chains 6, if/else 3 (5 pts) (nesting depth added 10). Of this number, 21 points are the body's own statements and 8 belong to one function literal 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.
FrontmatterPanel.FrontmatterPanel (cognitive 29) ui/src/components/FrontmatterPanel.tsx:219— FrontmatterPanel.FrontmatterPanel has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 14 (18 pts), boolean chains 7, if/else 2 (3 pts), error handling 1 (nesting depth added 5). Of this number, 23 points are the body's own statements and 6 belong to 4 function literals inside it that branch. 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.
TweakPanel.TweakPanel (cognitive 29) ui/src/components/task-chat/TweakPanel.tsx:46— TweakPanel.TweakPanel has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 9 (19 pts), loops 6, boolean chains 2, if/else 2 (nesting depth added 10). Most of this is not in the body itself: 12 of the 29 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 164, 61, 82, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RunnerTransportEndpoint::open (cognitive 29) packages/paperclip-runner/runner/crates/runner-core/src/durable/transport.rs:254— RunnerTransportEndpoint::open has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 4 (9 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 16). 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.
managed-install-check.managedInstallChecks (cognitive 28) cli/src/checks/managed-install-check.ts:47— managed-install-check.managedInstallChecks has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 7 (10 pts), if/else 4 (7 pts), boolean chains 5, error handling 3, 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.
context.upsertProfile (cognitive 28) cli/src/client/context.ts:145— context.upsertProfile has cognitive complexity 28 (threshold 15). Drivers by points: if/else 18, boolean chains 10. 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.
service.withHotRestartLock (cognitive 28) cli/src/commands/service.ts:58— service.withHotRestartLock has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (20 pts), error handling 3 (6 pts), boolean chains 1, 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.
workspace-restore-merge.directoryMergeConflicts (cognitive 28) packages/adapter-utils/src/workspace-restore-merge.ts:707— workspace-restore-merge.directoryMergeConflicts has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 6 (8 pts), boolean chains 6 (nesting depth added 10). Of this number, 22 points are the body's own statements and 6 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.
workspace-seed-cache.publishWorkspaceSeedGeneration::capacity (cognitive 28) packages/adapter-utils/src/workspace-seed-cache.ts:177— workspace-seed-cache.publishWorkspaceSeedGeneration::capacity has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 6, ternaries 2 (3 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. This shape REPEATS in the file: one other method here (workspace-seed-cache.publishWorkspaceSeedGeneration) 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.
http2-bridge-server.createHttp2BridgeServer.handleStream (cognitive 28) packages/adapter-utils/src/http2-bridge-server.ts:1161— http2-bridge-server.createHttp2BridgeServer.handleStream has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 2 (4 pts), error handling 3, boolean chains 2, loops 1 (nesting depth added 9). Of this number, 27 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.
tools.createToolDefinitions (cognitive 28) packages/mcp-server/src/tools.ts:270— tools.createToolDefinitions has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 11 (14 pts), if/else 7 (9 pts), boolean chains 3, loops 2 (nesting depth added 5). None of this is in the body itself: all 28 points belong to 10 function literals inside it that branch (lines 650, 327, 357, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
redaction.inspect (cognitive 28) packages/paperclip-runner/src/semantic-tools/redaction.ts:71— redaction.inspect has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 6, 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-question-adapter.runtimeRequestResponse (cognitive 28) packages/paperclip-runner/src/drivers/codex/codex-question-adapter.ts:563— codex-question-adapter.runtimeRequestResponse has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 8, ternaries 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.
CodexHarnessSession.goal (cognitive 28) packages/paperclip-runner/src/drivers/codex/codex-harness-session.ts:569— CodexHarnessSession.goal has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 8 (10 pts), boolean chains 6, error handling 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.
RawWebSocketWireConnection.#consume (cognitive 28) REDACTED:1380— RawWebSocketWireConnection.#consume has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (21 pts), error handling 1 (3 pts), loops 2 (3 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.
build-copilot-distribution.readCopilotArchiveEntries (cognitive 28) packages/paperclip-runner/scripts/build-copilot-distribution.mjs:62— build-copilot-distribution.readCopilotArchiveEntries has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 8, loops 1, ternaries 1 (nesting depth added 7). Of this number, 22 points are the body's own statements and 6 belong to 3 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.
generate-protocol-manifest.buildProtocolManifest (cognitive 28) packages/paperclip-runner/scripts/generate-protocol-manifest.mjs:32— generate-protocol-manifest.buildProtocolManifest has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (23 pts), error handling 1 (4 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.
cursor-usage-receipt.parseCursorPromptUsage (cognitive 28) packages/paperclip-runner/src/drivers/acpx/cursor-usage-receipt.ts:17— cursor-usage-receipt.parseCursorPromptUsage has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 14, if/else 9 (12 pts), error handling 1, loops 1 (nesting depth added 3). Of this number, 25 points are the body's own statements and 3 belong to 4 function items inside it that branch. 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.
cursor-launch-policy.assertCursorWorkspacePolicy (cognitive 28) packages/paperclip-runner/src/drivers/acpx/cursor-launch-policy.ts:28— cursor-launch-policy.assertCursorWorkspacePolicy has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 3 (7 pts), loops 3, ternaries 2 (3 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.
acp-permission-adapter.normalizeAcpxPermission (cognitive 28) packages/paperclip-runner/src/drivers/acpx/acp-permission-adapter.ts:19— acp-permission-adapter.normalizeAcpxPermission has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 9, ternaries 5 (7 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.
usage-accounting.parseCursorPromptUsage (cognitive 28) packages/paperclip-runner/src/drivers/acpx/usage-accounting.ts:109— usage-accounting.parseCursorPromptUsage has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 14, if/else 9 (12 pts), error handling 1, loops 1 (nesting depth added 3). Of this number, 25 points are the body's own statements and 3 belong to 4 function items inside it that branch. 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.
eval-session.parseEvalSessionCliArgs (cognitive 28) packages/paperclip-runner/src/cli/eval-session.ts:60— eval-session.parseEvalSessionCliArgs has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 6, boolean chains 5, error handling 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.
harness-driver.runHarnessDriverConformance (cognitive 28) packages/paperclip-runner/src/conformance/harness-driver.ts:115— harness-driver.runHarnessDriverConformance has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 10, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
native-session-runtime.reconcileRecoveryCheckpoint (cognitive 28) packages/paperclip-runner/src/native-session-runtime.ts:1569— native-session-runtime.reconcileRecoveryCheckpoint has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 5, loops 2 (3 pts), ternaries 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.
ScenarioChatDemoRuntime.handle (cognitive 28) REDACTED:570— ScenarioChatDemoRuntime.handle has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 6, ternaries 2 (4 pts), error handling 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.
tailnet-gateway.createCapabilityTailnetGateway (cognitive 28) packages/paperclip-runner/src/live/tailnet-gateway.ts:185— tailnet-gateway.createCapabilityTailnetGateway has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 4 (6 pts), boolean chains 4, loops 3 (nesting depth added 6). Most of this is not in the body itself: 2 of the 28 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 310, capabilityValid, a function literal at line 227, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
redaction.sanitizeValue (cognitive 28) server/src/redaction.ts:751— redaction.sanitizeValue has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 8 (17 pts), if/else 7, 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.
environments.environmentService.update (cognitive 28) REDACTED:1134— environments.environmentService.update has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (17 pts), ternaries 4 (8 pts), boolean chains 3 (nesting depth added 7). Of this number, 26 points are the body's own statements and 2 belong to one function literal 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.
authorization.scopeAllows (cognitive 28) server/src/services/authorization.ts:425— authorization.scopeAllows has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 5 (6 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.
conversation-continuation.getConversationOwnershipBlocker (cognitive 28) server/src/services/conversation-continuation.ts:107— conversation-continuation.getConversationOwnershipBlocker has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 9, 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.
workspace-operations.workspaceOperationService.createRecorder.recordOperation (cognitive 28) server/src/services/workspace-operations.ts:478— workspace-operations.workspaceOperationService.createRecorder.recordOperation has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10, boolean chains 8, ternaries 4 (8 pts), error handling 2 (nesting depth added 4). Of this number, 19 points are the body's own statements and 9 belong to 4 function items inside it that branch. 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.
case-access.canActorReceiveCase (cognitive 28) server/src/services/case-access.ts:194— case-access.canActorReceiveCase has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 3 (6 pts), loops 2 (4 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.
mcp-http.readMcpHttpResponse (cognitive 28) server/src/services/mcp-http.ts:180— mcp-http.readMcpHttpResponse has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, loops 2 (4 pts), error handling 1, ternaries 1 (nesting depth added 9). Of this number, 19 points are the body's own statements and 9 belong to 3 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.
workspace-runtime.waitForAllocatedPortBind (cognitive 28) server/src/services/workspace-runtime.ts:5418— workspace-runtime.waitForAllocatedPortBind has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 6, 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.
execution-workspaces.executionWorkspaceService.findGitWorktreeContention (cognitive 28) server/src/services/execution-workspaces.ts:2898— execution-workspaces.executionWorkspaceService.findGitWorktreeContention has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 3 (5 pts), boolean chains 4, 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.
email-channels.emailChannelService.control (cognitive 28) server/src/services/email-channels.ts:2373— email-channels.emailChannelService.control has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 4 (5 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 10). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 2379, 2442, 2401, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
connection-intents.connectionIntentService.usableConnectionForAgent (cognitive 28) server/src/services/connection-intents.ts:266— connection-intents.connectionIntentService.usableConnectionForAgent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 6 (9 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 7). Of this number, 22 points are the body's own statements and 6 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.
failed-run-retry.createChatFailedRunRetry.failedNativeRetryCoordinator (cognitive 28) server/src/services/chat-channels/failed-run-retry.ts:278— failed-run-retry.createChatFailedRunRetry.failedNativeRetryCoordinator has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 15, if/else 7 (13 pts) (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
publication-policy.createGitHubPublicationPolicy.settleGitHubAutomaticPublication (cognitive 28) server/src/services/chat-channels/github/publication-policy.ts:235— publication-policy.createGitHubPublicationPolicy.settleGitHubAutomaticPublication has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 7, ternaries 2 (4 pts), loops 1 (nesting depth added 6). Of this number, 21 points are the body's own statements and 7 belong to 2 function literals 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.
chat-provider-links.chatProviderConversationUrl (cognitive 28) server/src/services/chat-provider-links.ts:139— chat-provider-links.chatProviderConversationUrl has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (20 pts), error handling 1 (3 pts), ternaries 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.
lifecycle.createChatMessageLifecycle.recordLifecycleDelivery (cognitive 28) server/src/services/chat-channels/inbound/lifecycle.ts:134— lifecycle.createChatMessageLifecycle.recordLifecycleDelivery has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 8 (9 pts), boolean chains 6, loops 1 (3 pts) (nesting depth added 4). Most of this is not in the body itself: 13 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 173). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
webhook-callbacks.createSlackWebhookCallbacks.recordSlackWebhookCallback (cognitive 28) server/src/services/chat-channels/slack/webhook-callbacks.ts:55— webhook-callbacks.createSlackWebhookCallbacks.recordSlackWebhookCallback has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (18 pts), ternaries 3 (7 pts), boolean chains 3 (nesting depth added 14). Most of this is not in the body itself: 3 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 60). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
reactions.createInboundReactions.processPendingReactionDelivery (cognitive 28) server/src/services/chat-channels/reactions.ts:624— reactions.createInboundReactions.processPendingReactionDelivery has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 5, ternaries 1 (nesting depth added 7). Most of this is not in the body itself: 2 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 652). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
dot-runner.createDotRunnerMcpBridge.callTool (cognitive 28) server/src/services/public-mcp/dot-runner.ts:53— dot-runner.createDotRunnerMcpBridge.callTool has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 6 (8 pts), boolean chains 3, error handling 1 (3 pts), loops 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.
dot.createBroker.requestTurn (cognitive 28) server/src/modules/external-agents/dot.ts:331— dot.createBroker.requestTurn has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, ternaries 4 (5 pts), loops 1 (2 pts) (nesting depth added 5). Of this number, 17 points are the body's own statements and 11 belong to one function literal inside it that branches. 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.
issues.listIssueBlockerAttentionMap::classifyPath (cognitive 28) server/src/services/issues.ts:4170— issues.listIssueBlockerAttentionMap::classifyPath 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. This shape REPEATS in the file: one other method here (issues.listIssueBlockerAttentionMap) 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.
native-deliverable-text.createNativeDeliverableTextObservation (cognitive 28) server/src/services/native-runtime/native-deliverable-text.ts:15— native-deliverable-text.createNativeDeliverableTextObservation has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 8, loops 1 (2 pts), ternaries 1 (nesting depth added 7). None of this is in the body itself: all 28 points belong to 2 function items inside it that branch (a function literal at line 28, observeItem). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
native-failed-workspace-recovery.preserveCancelledNativeWorkspaces (cognitive 28) server/src/services/native-runtime/native-failed-workspace-recovery.ts:89— native-failed-workspace-recovery.preserveCancelledNativeWorkspaces has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (5 pts), boolean chains 3, error handling 1 (3 pts), ternaries 1 (nesting depth added 16). Of this number, 27 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.
case-handoffs.assertCaseContentsFitTask (cognitive 28) server/src/services/case-handoffs.ts:166— case-handoffs.assertCaseContentsFitTask has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 3, ternaries 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.
sentry-links.addSentryRunLinks (cognitive 28) REDACTED:32— sentry-links.addSentryRunLinks has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 13, if/else 7, ternaries 5 (6 pts), error handling 2 (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.
native-session-executor.retainedNativeCleanupJournalMatches (cognitive 28) server/src/services/native-runtime/native-session-executor.ts:2238— native-session-executor.retainedNativeCleanupJournalMatches has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 19, if/else 9. Of this number, 23 points are the body's own statements and 5 belong to 10 function items inside it that branch. 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.
native-session-executor.cleanupProviderHomeSnapshot::visit (cognitive 28) server/src/services/native-runtime/native-session-executor.ts:2542— native-session-executor.cleanupProviderHomeSnapshot::visit has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5, loops 2 (4 pts), ternaries 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.
catalog-builder.validateLocalReferences (cognitive 28) packages/teams-catalog/src/catalog-builder.ts:480— catalog-builder.validateLocalReferences has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 5, loops 4, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
app-brand-validation.validateManifest (cognitive 28) scripts/app-brand-validation.mjs:26— app-brand-validation.validateManifest has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 7, loops 3 (5 pts), ternaries 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.
cloud-migrator-artifacts.assertLockfile (cognitive 28) scripts/cloud-migrator-artifacts.mjs:39— cloud-migrator-artifacts.assertLockfile has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 5, 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.
prepare-runner-release-image.main (cognitive 28) scripts/prepare-runner-release-image.mjs:70— prepare-runner-release-image.main has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 6, loops 3 (nesting depth added 6). Of this number, 27 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.
authz.assertCompanyAccess (cognitive 28) server/src/routes/authz.ts:75— authz.assertCompanyAccess has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 7, ternaries 2 (4 pts) (nesting depth added 10). Of this number, 27 points are the body's own statements and 1 belongs to one function literal 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.
decisions.decisionService.runEffects (cognitive 28) server/src/services/decisions.ts:547— decisions.decisionService.runEffects has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 6 (13 pts), if/else 5 (9 pts), error handling 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.
skill-sources.skillSourceService.settings (cognitive 28) server/src/services/skill-sources.ts:320— skill-sources.skillSourceService.settings has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 6 (7 pts), boolean chains 5 (nesting depth added 7). Of this number, 17 points are the body's own statements and 11 belong to one function literal 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.
issues.buildIssueWakeDiagnosis (cognitive 28) server/src/routes/issues.ts:1551— issues.buildIssueWakeDiagnosis has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 4, ternaries 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.
useKeyboardShortcuts.useKeyboardShortcuts (cognitive 28) ui/src/hooks/useKeyboardShortcuts.ts:18— useKeyboardShortcuts.useKeyboardShortcuts has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 7 (nesting depth added 5). None of this is in the body itself: all 28 points belong to 3 function literals inside it that branch (lines 51, 135, 32). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
LiveUpdatesProvider.handleLiveEvent (cognitive 28) ui/src/context/LiveUpdatesProvider.tsx:1824— LiveUpdatesProvider.handleLiveEvent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 5, ternaries 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.
QuestionForm.answerError (cognitive 28) ui/src/components/task-chat/QuestionForm.tsx:69— QuestionForm.answerError has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 10, 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.
IssueChatThread.IssueChatFeedbackButtons (cognitive 28) ui/src/components/IssueChatThread.tsx:2746— IssueChatThread.IssueChatFeedbackButtons has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 12 (14 pts), if/else 8, boolean chains 5, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 9 of the 28 points are its own statements and the rest belongs to 7 function items inside it that branch (handleVote, handleSubmitReason, a function literal at line 2771, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TaskTreeControls.TaskTreeControlDialog (cognitive 28) ui/src/components/TaskTreeControls.tsx:74— TaskTreeControls.TaskTreeControlDialog has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 15 (24 pts), boolean chains 3, if/else 1 (nesting depth added 9). Of this number, 27 points are the body's own statements and 1 belongs to one function literal 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.
RunTranscriptView.TranscriptToolCard (cognitive 28) ui/src/components/transcript/RunTranscriptView.tsx:1028— RunTranscriptView.TranscriptToolCard has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 14 (21 pts), boolean chains 7 (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.
AgentBubbleActionRow.IssueChatFeedbackButtons (cognitive 28) ui/src/components/AgentBubbleActionRow.tsx:175— AgentBubbleActionRow.IssueChatFeedbackButtons has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 12 (14 pts), if/else 8, boolean chains 5, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 9 of the 28 points are its own statements and the rest belongs to 7 function items inside it that branch (handleVote, handleSubmitReason, a function literal at line 196, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SlackIdentityStep.SlackIdentityStep (cognitive 28) ui/src/pages/apps/chat/SlackIdentityStep.tsx:11— SlackIdentityStep.SlackIdentityStep has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 8 (16 pts), boolean chains 11, if/else 1 (nesting depth added 8). Of this number, 14 points are the body's own statements and 14 belong to 4 function literals 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.
PhotonConnectStep.PhotonConnectStep (cognitive 28) ui/src/pages/apps/chat/PhotonConnectStep.tsx:12— PhotonConnectStep.PhotonConnectStep has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 16, ternaries 8 (12 pts) (nesting depth added 4). Of this number, 22 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
IdentitiesSection.GitHubConnectionSummary (cognitive 28) ui/src/pages/apps/app-detail/IdentitiesSection.tsx:287— IdentitiesSection.GitHubConnectionSummary has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 16 (26 pts), boolean chains 1, if/else 1 (nesting depth added 10). Of this number, 25 points are the body's own statements and 3 belong to one function literal 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.
SkillFolderTree.TreeBranch (cognitive 28) ui/src/components/folders/SkillFolderTree.tsx:527— SkillFolderTree.TreeBranch has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 11 (17 pts), boolean chains 6, if/else 3 (5 pts) (nesting depth added 8). Of this number, 19 points are the body's own statements and 9 belong to 4 function literals 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.
SkillPackagePreview.SkillPackagePreview (cognitive 28) ui/src/pages/skills/SkillPackagePreview.tsx:13— SkillPackagePreview.SkillPackagePreview has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 14, ternaries 11 (13 pts), if/else 1 (nesting depth added 2). Of this number, 26 points are the body's own statements and 2 belong to 4 function literals inside it that branch. 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.
SkillStudio.StudioNewSkillPanel (cognitive 28) ui/src/pages/SkillStudio.tsx:431— SkillStudio.StudioNewSkillPanel has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 17 (19 pts), boolean chains 8, if/else 1 (nesting depth added 2). Of this number, 16 points are the body's own statements and 12 belong to 7 function literals inside it that branch. 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.
DesignPageAside.DesignPageAside (cognitive 28) ui/src/components/DesignPageAside.tsx:15— DesignPageAside.DesignPageAside has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 8, boolean chains 6, error handling 1 (nesting depth added 6). Most of this is not in the body itself: 5 of the 28 points are its own statements and the rest belongs to 7 function items inside it that branch (resizeWithKeyboard, a function literal at line 30, a function literal at line 48, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
useWorkspaceFileAvailability.useWorkspaceFileAvailability (cognitive 28) ui/src/hooks/useWorkspaceFileAvailability.ts:51— useWorkspaceFileAvailability.useWorkspaceFileAvailability has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 5, loops 4 (5 pts), error handling 1 (nesting depth added 4). Most of this is not in the body itself: 3 of the 28 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 88, 155, 190, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
layout.computeLayout (cognitive 28) ui/src/lib/timeline/layout.ts:255— layout.computeLayout has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 7 (11 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.
ComposioAppManager.ComposioAccountObservations (cognitive 28) ui/src/pages/apps/ComposioAppManager.tsx:29— ComposioAppManager.ComposioAccountObservations has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 10 (23 pts), boolean chains 3, error handling 1, if/else 1 (nesting depth added 13). Most of this is not in the body itself: 6 of the 28 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 51, refresh). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
UserSecretDefinitionsTab.UserSecretDefinitionsTab (cognitive 28) ui/src/pages/secrets/UserSecretDefinitionsTab.tsx:66— UserSecretDefinitionsTab.UserSecretDefinitionsTab has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 15 (19 pts), boolean chains 8, if/else 1 (nesting depth added 4). Of this number, 14 points are the body's own statements and 14 belong to 8 function literals inside it that branch. 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.
Client.migrate_input_receipts (cognitive 28) server/src/services/scripts/v9/client.py:482— Client.migrate_input_receipts has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (4 pts), boolean chains 3, ternaries 2 (3 pts), error handling 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.
worktree.renderMergePlan (cognitive 27) cli/src/commands/worktree.ts:3185— worktree.renderMergePlan has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 5 (16 pts), if/else 5, loops 2 (4 pts), boolean chains 2 (nesting depth added 13). Of this number, 25 points are the body's own statements and 2 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.
remote-managed-runtime.prepareRemoteManagedRuntime (cognitive 27) packages/adapter-utils/src/remote-managed-runtime.ts:109— remote-managed-runtime.prepareRemoteManagedRuntime has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 4 (8 pts), error handling 2 (3 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.
startup-reuse.summarizeStartupReuse (cognitive 27) packages/adapter-utils/src/startup-reuse.ts:68— startup-reuse.summarizeStartupReuse has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 9, ternaries 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.
terminal-session-failure.sanitizeTerminalSessionFailure (cognitive 27) REDACTED:55— terminal-session-failure.sanitizeTerminalSessionFailure has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 4 (7 pts), boolean chains 3, error handling 2 (3 pts), loops 3 (nesting depth added 9). Of this number, 25 points are the body's own statements and 2 belong to 2 function literals 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.
quota-probe.main (cognitive 27) packages/adapters/codex-local/src/cli/quota-probe.ts:35— quota-probe.main has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (16 pts), error handling 3 (7 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.
format-event.printToolCallEventTopLevel (cognitive 27) packages/adapters/cursor-local/src/cli/format-event.ts:109— format-event.printToolCallEventTopLevel has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 6 (8 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.
check-migration-safety.splitSqlStatements (cognitive 27) packages/db/src/check-migration-safety.ts:129— check-migration-safety.splitSqlStatements has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (25 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.
Inspector.Inspector (cognitive 27) packages/paperclip-runner/devtools/browser/src/live/Inspector.tsx:40— Inspector.Inspector has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 13 (23 pts), boolean chains 2, if/else 2 (nesting depth added 10). Of this number, 15 points are the body's own statements and 12 belong to 4 function literals 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.
CapabilityMockControlPlaneAdapter.#validateState (cognitive 27) packages/paperclip-runner/src/mock-core/capability-mock-control-plane-adapter.ts:1802— CapabilityMockControlPlaneAdapter.#validateState has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 7 (8 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.
runner-provider-launch.validatePreparedRunnerLaunch (cognitive 27) packages/paperclip-runner/src/live/runner-provider-launch.ts:98— runner-provider-launch.validatePreparedRunnerLaunch has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 10, error handling 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.
DurablePrpCodexTransport.constructor (cognitive 27) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:3592— DurablePrpCodexTransport.constructor has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 8, ternaries 4 (7 pts) (nesting depth added 5). Of this number, 24 points are the body's own statements and 3 belong to one function literal 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.
CapabilityLiveSession.#captureTurnUsage (cognitive 27) packages/paperclip-runner/src/live/live-session.ts:1759— CapabilityLiveSession.#captureTurnUsage has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts), ternaries 6, loops 2 (3 pts) (nesting depth added 3). Of this number, 23 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
materialize-pi-distribution.assertPiNodeSystemDependencies (cognitive 27) packages/paperclip-runner/scripts/materialize-pi-distribution.mjs:75— materialize-pi-distribution.assertPiNodeSystemDependencies has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (4 pts), boolean chains 3, ternaries 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.
installation-integrity.commandLease.spawn (cognitive 27) packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts:1541— installation-integrity.commandLease.spawn has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (16 pts), ternaries 5 (7 pts), boolean chains 3, error handling 1 (nesting depth added 4). Of this number, 25 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
runner-protocol-eval-campaign.buildProtocolEvalCatalog (cognitive 27) packages/paperclip-runner/scripts/runner-protocol-eval-campaign.mjs:126— runner-protocol-eval-campaign.buildProtocolEvalCatalog has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 6, ternaries 3 (5 pts), loops 1 (nesting depth added 7). Of this number, 26 points are the body's own statements and 1 belongs to one function literal 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.
opencode-app-server-proxy.pumpEvents (cognitive 27) packages/paperclip-runner/src/cli/opencode-app-server-proxy.ts:194— opencode-app-server-proxy.pumpEvents has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (24 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.
inspector.Inspector (cognitive 27) packages/paperclip-runner/src/react/inspector.tsx:40— inspector.Inspector has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 13 (23 pts), boolean chains 2, if/else 2 (nesting depth added 10). Of this number, 15 points are the body's own statements and 12 belong to 4 function literals 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.
hot-restart.isObservedHotRestartTargetAlive (cognitive 27) server/src/services/hot-restart.ts:234— hot-restart.isObservedHotRestartTargetAlive has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 6, ternaries 3 (5 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.
chat-question-forms.createChatQuestionFormDraft (cognitive 27) server/src/services/chat-question-forms.ts:265— chat-question-forms.createChatQuestionFormDraft has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 5 (7 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.
chat-sdk-runtime.validatedAttachmentRecoveryDescriptor (cognitive 27) server/src/services/chat-sdk-runtime.ts:1673— chat-sdk-runtime.validatedAttachmentRecoveryDescriptor has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 9, if/else 8 (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.
slack-client.slackClient (cognitive 27) server/src/services/connectors/slack-client.ts:27— slack-client.slackClient has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 4 (9 pts), boolean chains 5, error handling 2, loops 1 (nesting depth added 7). None of this is in the body itself: all 27 points belong to 2 function literals inside it that branch (lines 28, 48). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
bundled-plugins.ensureBundledPlugins (cognitive 27) server/src/services/bundled-plugins.ts:384— bundled-plugins.ensureBundledPlugins has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 4, error handling 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.
execution-workspace-policy.parseProjectExecutionWorkspacePolicy (cognitive 27) server/src/services/execution-workspace-policy.ts:107— execution-workspace-policy.parseProjectExecutionWorkspacePolicy has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 15, boolean chains 8, if/else 4. Of this number, 23 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
workspace-runtime.restartDesiredRuntimeServicesOnStartup (cognitive 27) server/src/services/workspace-runtime.ts:8872— workspace-runtime.restartDesiredRuntimeServicesOnStartup has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 4 (8 pts), error handling 2 (4 pts), boolean chains 3, 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.
chat-github-wizard.githubChatWizardService.cloudCallback (cognitive 27) server/src/services/chat-github-wizard.ts:1331— chat-github-wizard.githubChatWizardService.cloudCallback has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 10, ternaries 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.
budget-reservations.reserveRunBudget (cognitive 27) server/src/services/budget-reservations.ts:73— budget-reservations.reserveRunBudget has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 6, ternaries 2 (3 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 1 of the 27 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 74, 111). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
policy.decideQueuedRunStaleness (cognitive 27) server/src/modules/run-dispatch/domain/policy.ts:499— policy.decideQueuedRunStaleness has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 11 (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.
client.createOAuthClientProtocol.exchangeOAuthToken (cognitive 27) server/src/services/tool-access/oauth/client.ts:299— client.createOAuthClientProtocol.exchangeOAuthToken has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 6, 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.
github-grant-continuity.createGitHubGrantContinuity.refreshManagedGitHubGrantAccessOnce (cognitive 27) server/src/services/tool-access/github-grant-continuity.ts:62— github-grant-continuity.createGitHubGrantContinuity.refreshManagedGitHubGrantAccessOnce has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 5 (9 pts), boolean chains 5, error handling 2 (3 pts) (nesting depth added 8). Of this number, 20 points are the body's own statements and 7 belong to 2 function literals 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.
health.buildRuntimeAlerts (cognitive 27) server/src/services/tool-access/runtime/health.ts:19— health.buildRuntimeAlerts has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 17 (19 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.
remote-launch-assets.stageRemoteLaunchAssets (cognitive 27) server/src/services/native-runtime/remote-launch-assets.ts:33— remote-launch-assets.stageRemoteLaunchAssets has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 4 (6 pts), boolean chains 2, ternaries 1 (nesting depth added 10). Most of this is not in the body itself: 9 of the 27 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 36, measure, stageRuntimeContext, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
remote-pi-companion.importRemotePiCompanion (cognitive 27) server/src/services/native-runtime/remote-pi-companion.ts:105— remote-pi-companion.importRemotePiCompanion has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 6 (7 pts), boolean chains 6, error handling 3 (nesting depth added 5). Of this number, 23 points are the body's own statements and 4 belong to 3 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.
openapi.zodToOpenApiSchema (cognitive 27) server/src/routes/openapi.ts:469— openapi.zodToOpenApiSchema has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 6). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
openapi.applyDocumentFixups (cognitive 27) server/src/routes/openapi.ts:1806— openapi.applyDocumentFixups has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (24 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.
runner-api-client.runnerApiUrl (cognitive 27) server/src/services/native-runtime/runner-api-client.ts:74— runner-api-client.runnerApiUrl has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 6, loops 3 (5 pts), ternaries 1 (2 pts) (nesting depth added 7). Of this number, 24 points are the body's own statements and 3 belong to 2 function literals 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.
issue-title.setIssueTitle (cognitive 27) server/src/services/issue-title.ts:15— issue-title.setIssueTitle has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 12, ternaries 2 (nesting depth added 3). Of this number, 25 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
company-skills.parseSkillImportSourceInput (cognitive 27) server/src/services/company-skills.ts:874— company-skills.parseSkillImportSourceInput has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, loops 1 (3 pts), ternaries 2 (3 pts) (nesting depth added 10). Of this number, 26 points are the body's own statements and 1 belongs to one function literal 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.
company-skills.deriveImportedSkillSource (cognitive 27) server/src/services/company-skills.ts:1007— company-skills.deriveImportedSkillSource has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 7 (15 pts), if/else 5 (7 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.
routines.routineService.restoreRevision (cognitive 27) server/src/services/routines.ts:2743— routines.routineService.restoreRevision has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 8 (9 pts), boolean chains 2, loops 2 (nesting depth added 8). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 2773, 2795). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PaperclipRunnerToolAuthority.#callApi (cognitive 27) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:857— PaperclipRunnerToolAuthority.#callApi has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 6, ternaries 3 (nesting depth added 3). Of this number, 14 points are the body's own statements and 13 belong to 2 function items inside it that branch. 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.
PaperclipRunnerToolAuthority.#readApiFile (cognitive 27) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:1138— PaperclipRunnerToolAuthority.#readApiFile has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). Of this number, 25 points are the body's own statements and 2 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.
status-cards.statusCardService.update (cognitive 27) server/src/services/status-cards.ts:268— status-cards.statusCardService.update has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 8, if/else 4 (6 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.
activity.activityService.runsForIssue (cognitive 27) server/src/services/activity.ts:430— activity.activityService.runsForIssue has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 10 (15 pts), if/else 4 (6 pts), boolean chains 4, loops 2 (nesting depth added 7). Most of this is not in the body itself: 12 of the 27 points are its own statements and the rest belongs to one function literal inside it that branches (line 564). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
company-portability-agent-selection.resolvePortableExportAgentSelection (cognitive 27) server/src/services/company-portability-agent-selection.ts:11— company-portability-agent-selection.resolvePortableExportAgentSelection has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 2 (6 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 11). Of this number, 26 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.
company-portability.renderYamlBlock (cognitive 27) server/src/services/company-portability.ts:2474— company-portability.renderYamlBlock has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (20 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.
idle-admission.trackIdleRequestHandlers (cognitive 27) server/src/middleware/idle-admission.ts:71— idle-admission.trackIdleRequestHandlers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 12). None of this is in the body itself: all 27 points belong to 3 function items inside it that branch (visit, visit::invoke, a function literal at line 96). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
issues.buildExecutionStageWakeup (cognitive 27) server/src/routes/issues.ts:2754— issues.buildExecutionStageWakeup has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 5 (7 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.
CellMarquee.CellMarquee (cognitive 27) ui/src/components/CellMarquee.tsx:21— CellMarquee.CellMarquee has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 12, if/else 9, ternaries 6. Most of this is not in the body itself: 12 of the 27 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 61, 84, 89, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
NewGoalDialog.NewGoalDialog (cognitive 27) ui/src/components/NewGoalDialog.tsx:36— NewGoalDialog.NewGoalDialog has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 13, ternaries 8 (9 pts), if/else 5 (nesting depth added 1). Most of this is not in the body itself: 13 of the 27 points are its own statements and the rest belongs to 8 function items inside it that branch (handleSubmit, handleKeyDown, a function literal at line 160, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentBasicsDialog.AgentBasicsDialog (cognitive 27) ui/src/components/new-agent/AgentBasicsDialog.tsx:44— AgentBasicsDialog.AgentBasicsDialog has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 28, ternaries 16 (24 pts), if/else 13 (16 pts), error handling 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. This shape REPEATS in the file: one other method here (AgentBasicsDialog.AgentBasicsDialog::submit) 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.
index.parseQuestionSet.questions (cognitive 27) ui/src/adapters/paperclip-runner/index.ts:538— index.parseQuestionSet.questions has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 17 (25 pts), boolean chains 2 (nesting depth added 8). Of this number, 26 points are the body's own statements and 1 belongs to one function literal 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.
WorkspaceBaseRefRecoveryNotice.WorkspaceBaseRefRecoveryNotice (cognitive 27) ui/src/components/WorkspaceBaseRefRecoveryNotice.tsx:26— WorkspaceBaseRefRecoveryNotice.WorkspaceBaseRefRecoveryNotice has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 14, ternaries 7 (10 pts), if/else 2, error handling 1 (nesting depth added 3). Of this number, 21 points are the body's own statements and 6 belong to one function item inside it that branches. 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.
transcript-adapter.coalesceSettledTurns (cognitive 27) ui/src/components/task-chat/transcript-adapter.ts:1994— transcript-adapter.coalesceSettledTurns has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (9 pts), boolean chains 5, 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.
RunTranscriptView.TranscriptToolGroup (cognitive 27) ui/src/components/transcript/RunTranscriptView.tsx:1281— RunTranscriptView.TranscriptToolGroup has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 12, if/else 2 (nesting depth added 2). Of this number, 19 points are the body's own statements and 8 belong to 4 function literals inside it that branch. 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.
DecisionModelSettings.DecisionModelSettingsView (cognitive 27) ui/src/components/decision-models/DecisionModelSettings.tsx:24— DecisionModelSettings.DecisionModelSettingsView has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 16, ternaries 7 (8 pts), if/else 3 (nesting depth added 1). Of this number, 19 points are the body's own statements and 8 belong to 5 function literals inside it that branch. 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.
FastResponseSettings.FastResponseSettingsView (cognitive 27) ui/src/components/fast-responses/FastResponseSettings.tsx:35— FastResponseSettings.FastResponseSettingsView has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 17, ternaries 7, if/else 3. Of this number, 17 points are the body's own statements and 10 belong to 4 function literals inside it that branch. 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.
AdvancedPanel.DangerZone (cognitive 27) ui/src/pages/apps/app-detail/AdvancedPanel.tsx:433— AdvancedPanel.DangerZone has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 11 (15 pts), boolean chains 11, if/else 1 (nesting depth added 4). Of this number, 26 points are the body's own statements and 1 belongs to one function literal 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.
SkillStudio.VersionHistorySheet (cognitive 27) ui/src/pages/SkillStudio.tsx:3425— SkillStudio.VersionHistorySheet has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 7 (12 pts), boolean chains 9, if/else 3 (5 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 10 of the 27 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 3495, 3471, 3472, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
company-export-selection.buildExportCheckedFiles (cognitive 27) ui/src/lib/company-export-selection.ts:218— company-export-selection.buildExportCheckedFiles has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 6, 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.
CompanySkills.production.SkillCard (cognitive 27) ui/src/pages/CompanySkills.production.tsx:805— CompanySkills.production.SkillCard has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 15 (18 pts), boolean chains 7, if/else 2 (nesting depth added 3). Of this number, 24 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
useWindowAutoFollow.useWindowAutoFollow (cognitive 27) ui/src/components/task-chat/useWindowAutoFollow.ts:33— useWindowAutoFollow.useWindowAutoFollow has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 5). None of this is in the body itself: all 27 points belong to 8 function items inside it that branch (a function literal at line 99, reconcile, a function literal at line 75, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
DurableRunnerConfig::validate (cognitive 27) packages/paperclip-runner/runner/crates/runner-core/src/durable/mod.rs:202— DurableRunnerConfig::validate has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 11, 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.
(anonymous) (cognitive 27) docker/openclaw-smoke/server.mjs:43— (anonymous) has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 3 (8 pts), boolean chains 6, if/else 5 (6 pts), error handling 2 (4 pts), other 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity· main (cognitive 27) · ×1
main (cognitive 27) ui/src/artifact-directions/shot.cjs:215— main has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 5 (9 pts), ternaries 3 (6 pts), boolean chains 2, other 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.
access.registerAccessCommands (cognitive 26) cli/src/commands/client/access.ts:26— access.registerAccessCommands has cognitive complexity 26 (threshold 15). Drivers by points: error handling 18 (19 pts), ternaries 3 (4 pts), if/else 2, loops 1 (nesting depth added 2). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 18 function literals inside it that branch (lines 175, 109, 223, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
teams.registerTeamCommands (cognitive 26) cli/src/commands/client/teams.ts:63— teams.registerTeamCommands has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), error handling 7 (9 pts), boolean chains 1 (nesting depth added 7). None of this is in the body itself: all 26 points belong to 6 function literals inside it that branch (lines 222, 139, 73, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
worktree.quarantineSeededWorktreeExecutionState (cognitive 26) cli/src/commands/worktree.ts:1282— worktree.quarantineSeededWorktreeExecutionState has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 4, ternaries 2 (4 pts), boolean chains 1 (nesting depth added 10). None of this is in the body itself: all 26 points belong to one function literal inside it that branches (line 1288). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
server-utils.normalizePaperclipWakePayload (cognitive 26) REDACTED:1704— server-utils.normalizePaperclipWakePayload has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 13, ternaries 11 (12 pts), if/else 1 (nesting depth added 1). Of this number, 22 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
http2-bridge-server.wrapDuplexChannelAsNodeDuplex (cognitive 26) packages/adapter-utils/src/http2-bridge-server.ts:357— http2-bridge-server.wrapDuplexChannelAsNodeDuplex has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 5 (7 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 3). Of this number, 13 points are the body's own statements and 13 belong to 5 function items inside it that branch. 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.
execution-target.prepareGitHubExecutionEnvironment (cognitive 26) REDACTED:1639— execution-target.prepareGitHubExecutionEnvironment has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 6 (7 pts), error handling 1 (2 pts), loops 1 (2 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.
execution-target.startAdapterExecutionTargetPaperclipBridge.forwardBridgeRequest (cognitive 26) REDACTED:4460— execution-target.startAdapterExecutionTargetPaperclipBridge.forwardBridgeRequest has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 5 (10 pts), boolean chains 4, error handling 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.
quota.mapCodexRpcQuota (cognitive 26) packages/adapters/codex-local/src/server/quota.ts:417— quota.mapCodexRpcQuota has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 4 (6 pts), boolean chains 5, loops 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.
parse-stdout.parseSdkMessage (cognitive 26) packages/adapters/cursor-cloud/src/ui/parse-stdout.ts:55— parse-stdout.parseSdkMessage has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 6 (12 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.
parse-stdout.parseKimiStdoutLine (cognitive 26) packages/adapters/kimi-local/src/ui/parse-stdout.ts:48— parse-stdout.parseKimiStdoutLine has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, ternaries 2 (5 pts), 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.
build-config.buildOpenClawGatewayConfig (cognitive 26) packages/adapters/openclaw-gateway/src/ui/build-config.ts:15— build-config.buildOpenClawGatewayConfig has cognitive complexity 26 (threshold 15). Drivers by points: if/else 24 (25 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.
copilot-events.normalizeCopilotSessionEvent (cognitive 26) packages/paperclip-runner/src/drivers/acpx/copilot-events.ts:43— copilot-events.normalizeCopilotSessionEvent has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 6, error handling 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-driver-values.differingJsonPaths (cognitive 26) packages/paperclip-runner/src/drivers/codex/codex-driver-values.ts:191— codex-driver-values.differingJsonPaths has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (7 pts), boolean chains 5, 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-runner.replayPersistedCodexEvents (cognitive 26) packages/paperclip-runner/src/mock-core/codex-runner.ts:259— codex-runner.replayPersistedCodexEvents has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, error handling 1 (2 pts), loops 1, ternaries 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.
CapabilityMockControlPlaneAdapter.completeRun (cognitive 26) packages/paperclip-runner/src/mock-core/capability-mock-control-plane-adapter.ts:543— CapabilityMockControlPlaneAdapter.completeRun has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 5 (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.
environment.createAcpxSidecarHostEnvironment (cognitive 26) packages/paperclip-runner/src/drivers/acpx/environment.ts:45— environment.createAcpxSidecarHostEnvironment has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4, error handling 1 (2 pts), loops 1, ternaries 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.
runner-binary.runnerBinaryTarget (cognitive 26) packages/paperclip-runner/src/live/runner-binary.ts:5— runner-binary.runnerBinaryTarget has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 6 (17 pts), if/else 5 (6 pts), boolean chains 3 (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.
runnerd-codex-transport.awaitRunnerSuspensionBarrier (cognitive 26) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:756— runnerd-codex-transport.awaitRunnerSuspensionBarrier has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, error handling 2 (4 pts), loops 1 (nesting depth added 8). Of this number, 23 points are the body's own statements and 3 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.
protocol-contract.projectAcpxFixture (cognitive 26) REDACTED:430— protocol-contract.projectAcpxFixture has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 10). Of this number, 25 points are the body's own statements and 1 belongs to one function literal 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.
installation-integrity.verifyQualifiedRuntimeExecutable (cognitive 26) packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts:1023— installation-integrity.verifyQualifiedRuntimeExecutable has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 11, ternaries 4 (8 pts), if/else 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.
cursor-instructions.createCursorInstructionAdmission.createGuard (cognitive 26) packages/paperclip-runner/src/drivers/acpx/cursor-instructions.ts:29— cursor-instructions.createCursorInstructionAdmission.createGuard has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 7, error handling 1, ternaries 1 (nesting depth added 5). None of this is in the body itself: all 26 points belong to one function literal inside it that branches (line 33). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
codex-native-backend.createTransportBackedNativeSessionBackend (cognitive 26) packages/paperclip-runner/src/backends/codex-native-backend.ts:106— codex-native-backend.createTransportBackedNativeSessionBackend has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 13 (14 pts), boolean chains 10, if/else 2 (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.
PiToolIdentities.normalize (cognitive 26) packages/paperclip-runner/src/drivers/acpx/pi-acp-runtime.ts:263— PiToolIdentities.normalize has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 6 (13 pts), boolean chains 7, if/else 5 (6 pts) (nesting depth added 8). Of this number, 15 points are the body's own statements and 11 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.
remote-http-endpoint-guard.isPrivateOrReservedIpv4 (cognitive 26) server/src/services/remote-http-endpoint-guard.ts:161— remote-http-endpoint-guard.isPrivateOrReservedIpv4 has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15, boolean chains 11. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
secrets.secretService.createSecretUnlocked (cognitive 26) server/src/services/secrets.ts:2180— secrets.secretService.createSecretUnlocked has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 3, error handling 3, ternaries 3 (nesting depth added 6). Of this number, 25 points are the body's own statements and 1 belongs to one function literal 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.
secrets.secretService.completeClaudeOAuthUserSecret (cognitive 26) server/src/services/secrets.ts:3271— secrets.secretService.completeClaudeOAuthUserSecret has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 5, error handling 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.
secrets.secretService.importRemoteSecrets (cognitive 26) server/src/services/secrets.ts:4411— secrets.secretService.importRemoteSecrets has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 2 (5 pts), boolean chains 3, ternaries 1 (3 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.
secrets.secretService.collectMissingRuntimeBindings (cognitive 26) server/src/services/secrets.ts:5290— secrets.secretService.collectMissingRuntimeBindings has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 3, ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 7). Of this number, 18 points are the body's own statements and 8 belong to 2 function literals 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.
chat-attachment-reuse.principalAuthorized (cognitive 26) server/src/services/native-runtime/chat-attachment-reuse.ts:338— chat-attachment-reuse.principalAuthorized has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 7 (10 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 7). Of this number, 22 points are the body's own statements and 4 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.
voice-inbound-service.voiceInboundService.decide (cognitive 26) server/src/services/voice/voice-inbound-service.ts:215— voice-inbound-service.voiceInboundService.decide has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (15 pts), ternaries 4 (6 pts), boolean chains 5 (nesting depth added 3). Most of this is not in the body itself: 4 of the 26 points are its own statements and the rest belongs to one function literal inside it that branches (line 217). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
tool-gateway.createToolGatewayService.updateNamedGateway (cognitive 26) server/src/services/tool-gateway.ts:8878— tool-gateway.createToolGatewayService.updateNamedGateway has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 21, boolean chains 3, if/else 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.
chat-provider-lifecycle.parseGitHubLifecycle (cognitive 26) server/src/services/chat-provider-lifecycle.ts:203— chat-provider-lifecycle.parseGitHubLifecycle has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 7 (17 pts), if/else 5 (7 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.
chat-discord-command-registration-store.reconcileStoredDiscordCommandRegistration (cognitive 26) server/src/services/chat-discord-command-registration-store.ts:139— chat-discord-command-registration-store.reconcileStoredDiscordCommandRegistration has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, ternaries 5 (6 pts), error handling 1 (nesting depth added 4). Most of this is not in the body itself: 8 of the 26 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 164, a function literal at line 253, check, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
maintenance.createTelegramMaintenance.repairTelegramStopSubscription (cognitive 26) server/src/services/chat-channels/telegram/maintenance.ts:782— maintenance.createTelegramMaintenance.repairTelegramStopSubscription has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10, boolean chains 8, ternaries 3 (6 pts), error handling 2 (nesting depth added 3). Most of this is not in the body itself: 10 of the 26 points are its own statements and the rest belongs to 3 function items inside it that branch (request, a function literal at line 812, plainObject). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
resources.githubRepositoryInventoryItemFromPayload (cognitive 26) server/src/services/chat-channels/github/resources.ts:9— resources.githubRepositoryInventoryItemFromPayload has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 10, if/else 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.
git-workspace-restoration.assertReproducibleFetchHead (cognitive 26) server/src/services/git-workspace-restoration.ts:441— git-workspace-restoration.assertReproducibleFetchHead has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 5, loops 3, ternaries 1 (2 pts) (nesting depth added 6). Of this number, 25 points are the body's own statements and 1 belongs to one function literal 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.
nested-clone-migration.planRefs (cognitive 26) server/src/services/nested-clone-migration.ts:235— nested-clone-migration.planRefs has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 5 (9 pts), boolean chains 3, 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.
fast-response-provider.fastResponseModel (cognitive 26) server/src/services/fast-response-provider.ts:96— fast-response-provider.fastResponseModel has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 7, boolean chains 6, loops 1 (2 pts) (nesting depth added 6). Of this number, 22 points are the body's own statements and 4 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.
disposition-repair.collectDispositionRepairSourceState (cognitive 26) server/src/services/recovery/disposition-repair.ts:89— disposition-repair.collectDispositionRepairSourceState has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 8 (23 pts), boolean chains 3 (nesting depth added 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal 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.
preparation.createChatPublicationPreparation.ensureDurablePublicationTransport (cognitive 26) server/src/services/chat-channels/publications/preparation.ts:37— preparation.createChatPublicationPreparation.ensureDurablePublicationTransport has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 3 (6 pts), boolean chains 4 (nesting depth added 9). Most of this is not in the body itself: 11 of the 26 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 75, 100). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
issue-thread-interactions.issueThreadInteractionService.sweepMergedPullRequestConfirmations (cognitive 26) server/src/services/issue-thread-interactions.ts:2862— issue-thread-interactions.issueThreadInteractionService.sweepMergedPullRequestConfirmations has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 5 (6 pts), boolean chains 4, error handling 1 (2 pts), ternaries 1 (nesting depth added 9). Of this number, 25 points are the body's own statements and 1 belongs to one function literal 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.
case-handoff-lifecycle.completeTerminalCaseHandoffsForIssue (cognitive 26) server/src/services/heartbeat/case-handoff-lifecycle.ts:170— case-handoff-lifecycle.completeTerminalCaseHandoffsForIssue has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 7 (9 pts), boolean chains 4, error handling 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.
usage-receipts.createRunUsageRecorder.capture (cognitive 26) server/src/services/usage-receipts.ts:286— usage-receipts.createRunUsageRecorder.capture has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 9, ternaries 2 (4 pts), loops 1 (2 pts), error handling 1 (nesting depth added 8). Of this number, 25 points are the body's own statements and 1 belongs to one function literal 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.
native-deliverable-feedback.explicitlyRequestsFileOutput (cognitive 26) server/src/services/native-runtime/native-deliverable-feedback.ts:81— native-deliverable-feedback.explicitlyRequestsFileOutput has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 17, if/else 8 (9 pts) (nesting depth added 1). None of this is in the body itself: all 26 points belong to 4 function literals inside it that branch (lines 88, 134, 99, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-file-resources.workspaceFileResourceService.listCandidates (cognitive 26) server/src/services/workspace-file-resources.ts:1121— workspace-file-resources.workspaceFileResourceService.listCandidates has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 5, loops 1 (2 pts), ternaries 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.
workspace-file-resources.workspaceFileResourceService.resolve (cognitive 26) server/src/services/workspace-file-resources.ts:1401— workspace-file-resources.workspaceFileResourceService.resolve has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 10). Of this number, 24 points are the body's own statements and 2 belong to one function literal 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.
company-skills.companySkillService.updateStatus (cognitive 26) server/src/services/company-skills.ts:4285— company-skills.companySkillService.updateStatus has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 6 (10 pts), boolean chains 8, if/else 6 (8 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.
PaperclipRunnerToolAuthority.#projectMuseDocumentContent (cognitive 26) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:2131— PaperclipRunnerToolAuthority.#projectMuseDocumentContent has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 12, if/else 10, ternaries 4. Most of this is not in the body itself: 4 of the 26 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 2158, a function literal at line 2141, a function literal at line 2154, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
native-workspace-export-recovery.recoverLegacyUnsafeWorkspaceExports (cognitive 26) server/src/services/native-runtime/native-workspace-export-recovery.ts:14— native-workspace-export-recovery.recoverLegacyUnsafeWorkspaceExports has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 9, ternaries 3, loops 1 (nesting depth added 6). Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 30, selectCandidates, a function literal at line 50). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
run-preparation.gatewayConnectionIds (cognitive 26) server/src/services/heartbeat/run-preparation.ts:1338— run-preparation.gatewayConnectionIds has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (6 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.
use-cases.createAdmitWakeBehindIssueExecution (cognitive 26) server/src/modules/wake-queue/application/use-cases.ts:790— use-cases.createAdmitWakeBehindIssueExecution has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 9 (13 pts), boolean chains 9, if/else 4 (nesting depth added 4). None of this is in the body itself: all 26 points belong to one function literal inside it that branches (line 795). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
run-control.createHeartbeatRunControl.releaseEnvironmentLeasesForRun (cognitive 26) server/src/services/heartbeat/run-control.ts:351— run-control.createHeartbeatRunControl.releaseEnvironmentLeasesForRun has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (9 pts), ternaries 2 (3 pts), error handling 1 (2 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.
run-lifecycle.createHeartbeatLifecycle.handleSuccessfulRunHandoff (cognitive 26) server/src/services/heartbeat/run-lifecycle.ts:1631— run-lifecycle.createHeartbeatLifecycle.handleSuccessfulRunHandoff has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 11, if/else 9 (10 pts), boolean chains 5 (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-lifecycle.createHeartbeatLifecycle.finalizeIssueCommentPolicy (cognitive 26) server/src/services/heartbeat/run-lifecycle.ts:2505— run-lifecycle.createHeartbeatLifecycle.finalizeIssueCommentPolicy has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 5 (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.
session-preparation.prepareHeartbeatSession (cognitive 26) server/src/services/heartbeat/session-preparation.ts:75— session-preparation.prepareHeartbeatSession has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 10 (13 pts), if/else 5 (7 pts), boolean chains 6 (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.
core.paperclipProfileIncludesIssue (cognitive 26) packages/plugins/plugin-llm-wiki/src/wiki/core.ts:3672— core.paperclipProfileIncludesIssue has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (4 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.
check-agent-lifecycle-boundaries.agentLifecycleWriteViolations (cognitive 26) REDACTED:6— check-agent-lifecycle-boundaries.agentLifecycleWriteViolations has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 3 (6 pts), ternaries 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.
publish-announcements.prepareAnnouncementPublish (cognitive 26) scripts/publish-announcements.ts:41— publish-announcements.prepareAnnouncementPublish has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 4 (11 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.
ai-connections.aiConnectionRoutes (cognitive 26) server/src/routes/ai-connections.ts:141— ai-connections.aiConnectionRoutes has cognitive complexity 26 (threshold 15). Drivers by points: if/else 18 (19 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 2). None of this is in the body itself: all 26 points belong to 13 function items inside it that branch (a function literal at line 294, a function literal at line 252, a function literal at line 326, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
decision-queues.decisionQueueService.materializeSeededQueues (cognitive 26) server/src/services/decision-queues.ts:685— decision-queues.decisionQueueService.materializeSeededQueues has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (4 pts), boolean chains 3, ternaries 1 (nesting depth added 10). Of this number, 14 points are the body's own statements and 12 belong to one function literal 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.
secret-proposals.createSecretProposalsService.createBinding (cognitive 26) server/src/services/secret-proposals.ts:360— secret-proposals.createSecretProposalsService.createBinding has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 5 (nesting depth added 5). Of this number, 19 points are the body's own statements and 7 belong to one function literal inside it that branches. 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.
capabilities.createPublicMcpExecutor (cognitive 26) server/src/services/public-mcp/capabilities.ts:163— capabilities.createPublicMcpExecutor has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 6, error handling 1, ternaries 1 (nesting depth added 5). None of this is in the body itself: all 26 points belong to one function literal inside it that branches (line 164). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
access.extractHeaderEntries (cognitive 26) REDACTED:425— access.extractHeaderEntries has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 3 (12 pts), loops 1 (nesting depth added 15). 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.
access.isPrivateOrReservedIpv4 (cognitive 26) REDACTED:2358— access.isPrivateOrReservedIpv4 has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15, boolean chains 11. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
angle-bracket-markdown.transformAngleBrackets (cognitive 26) ui/src/lib/angle-bracket-markdown.ts:201— angle-bracket-markdown.transformAngleBrackets has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 3, ternaries 1 (3 pts), loops 1 (nesting depth added 13). 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.
StatusIcon.blockedAttentionLabel (cognitive 26) ui/src/components/StatusIcon.tsx:27— StatusIcon.blockedAttentionLabel has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 5, ternaries 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.
ChatIdentityConfirm.ChatIdentityConfirm (cognitive 26) ui/src/pages/apps/chat/ChatIdentityConfirm.tsx:22— ChatIdentityConfirm.ChatIdentityConfirm has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 15, ternaries 5 (6 pts), if/else 5 (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.
TaskListColumns.SortableColumnHeader (cognitive 26) ui/src/components/TaskListColumns.tsx:65— TaskListColumns.SortableColumnHeader has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 11 (17 pts), boolean chains 5, if/else 2 (4 pts) (nesting depth added 8). Of this number, 21 points are the body's own statements and 5 belong to one function literal 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.
TaskChatRunnerActivityGroup.presentation (cognitive 26) ui/src/components/task-chat/TaskChatRunnerActivityGroup.tsx:30— TaskChatRunnerActivityGroup.presentation has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 7 (14 pts), boolean chains 6, if/else 5 (6 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.
runRetryState.describeRunRetryState (cognitive 26) ui/src/lib/runRetryState.ts:47— runRetryState.describeRunRetryState has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 11 (21 pts), if/else 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.
FileTree.parseFrontmatter (cognitive 26) ui/src/components/FileTree.tsx:166— FileTree.parseFrontmatter has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 4, loops 1, ternaries 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.
AgentDetail.AgentOverview (cognitive 26) ui/src/pages/AgentDetail.tsx:1722— AgentDetail.AgentOverview has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 14 (20 pts), boolean chains 5, loops 1 (nesting depth added 6). Of this number, 25 points are the body's own statements and 1 belongs to one function literal 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.
ProfilesIndex.ProfilesIndex (cognitive 26) ui/src/pages/tools/profiles/ProfilesIndex.tsx:46— ProfilesIndex.ProfilesIndex has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 11 (19 pts), if/else 6, boolean chains 1 (nesting depth added 8). Most of this is not in the body itself: 6 of the 26 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 227, 182, 66, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CompanySkills.CatalogDetailPane (cognitive 26) ui/src/pages/CompanySkills.tsx:1772— CompanySkills.CatalogDetailPane has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 10 (18 pts), if/else 5, 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.
CompanySkills.production.CatalogDetailPane (cognitive 26) ui/src/pages/CompanySkills.production.tsx:1862— CompanySkills.production.CatalogDetailPane has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 10 (18 pts), if/else 5, 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.
IssuePrivacyActions.IssuePrivacyActions (cognitive 26) ui/src/components/IssuePrivacyActions.tsx:40— IssuePrivacyActions.IssuePrivacyActions has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 10 (17 pts), boolean chains 7, if/else 2 (nesting depth added 7). Of this number, 21 points are the body's own statements and 5 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.
IssueArtifactCard.IssueArtifactFile (cognitive 26) ui/src/components/artifacts/IssueArtifactCard.tsx:53— IssueArtifactCard.IssueArtifactFile has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 15, ternaries 5 (8 pts), if/else 3 (nesting depth added 3). 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, 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.
SpekoIncomingCalls.SpekoIncomingCallCard (cognitive 26) ui/src/components/voice/SpekoIncomingCalls.tsx:10— SpekoIncomingCalls.SpekoIncomingCallCard has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 8 (17 pts), boolean chains 5, if/else 3 (4 pts) (nesting depth added 10). Of this number, 21 points are the body's own statements and 5 belong to 2 function literals 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.
useBrowserViewport.useBrowserViewport (cognitive 26) ui/src/hooks/useBrowserViewport.ts:34— useBrowserViewport.useBrowserViewport has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 15, if/else 9, ternaries 2. None of this is in the body itself: all 26 points belong to 12 function literals inside it that branch (lines 108, 162, 172, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ConnectionSetup.ConnectionSetup::connect (cognitive 26) ui/storybook/prototypes/provider-routing/ConnectionSetup.tsx:80— ConnectionSetup.ConnectionSetup::connect has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 11 (20 pts), if/else 2 (3 pts), error handling 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. This shape REPEATS in the file: one other method here (ConnectionSetup.ConnectionSetup) 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.
agent-observability.buildProviderObservabilityLaunch (cognitive 25) packages/adapter-utils/src/agent-observability.ts:45— agent-observability.buildProviderObservabilityLaunch has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 11 (14 pts), boolean chains 7, if/else 3 (4 pts) (nesting depth added 4). Of this number, 23 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
workspace-restore-merge.mergeDirectoryWithBaseline (cognitive 25) packages/adapter-utils/src/workspace-restore-merge.ts:741— workspace-restore-merge.mergeDirectoryWithBaseline has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 6, loops 3, ternaries 1 (nesting depth added 7). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 757, 779). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
runtime-config.parseCodexProvidersConfig (cognitive 25) packages/adapters/codex-local/src/server/runtime-config.ts:77— runtime-config.parseCodexProvidersConfig has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 3 (6 pts), boolean chains 4, error handling 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.
execute.ensureCodexSkillsInjected (cognitive 25) packages/adapters/codex-local/src/server/execute.ts:510— execute.ensureCodexSkillsInjected has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 3 (8 pts), error handling 1 (2 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.
acp.testGeminiAcpEnvironment (cognitive 25) packages/adapters/gemini-local/src/server/acp.ts:389— acp.testGeminiAcpEnvironment has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 13 (17 pts), boolean chains 4, if/else 3, error handling 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.
runtime-config.preparePiRuntimeConfig (cognitive 25) packages/adapters/pi-local/src/server/runtime-config.ts:108— runtime-config.preparePiRuntimeConfig has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 4 (9 pts), loops 2 (4 pts), boolean chains 2, error handling 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.
RequestCard.RequestCard (cognitive 25) packages/paperclip-runner/devtools/browser/src/live/RequestCard.tsx:47— RequestCard.RequestCard has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 11 (19 pts), boolean chains 4, if/else 2 (nesting depth added 8). Of this number, 14 points are the body's own statements and 11 belong to 3 function literals 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.
workspace-diff.diffPaperclipWorkspace (cognitive 25) packages/paperclip-runner/src/live/workspace-diff.ts:173— workspace-diff.diffPaperclipWorkspace has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 5 (9 pts), loops 3, boolean chains 2 (nesting depth added 9). Of this number, 24 points are the body's own statements and 1 belongs to one function literal 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.
native-execution.buildNativeModelEnvelope (cognitive 25) packages/paperclip-runner/src/contracts/native-execution.ts:953— native-execution.buildNativeModelEnvelope has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 7 (12 pts), boolean chains 10, if/else 3 (nesting depth added 5). Of this number, 21 points are the body's own statements and 4 belong to one function literal 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.
durable-prp-control-plane.isStoredCoreState (cognitive 25) REDACTED:636— durable-prp-control-plane.isStoredCoreState has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 10, error handling 1 (2 pts) (nesting depth added 4). Of this number, 24 points are the body's own statements and 1 belongs to 3 function literals inside it that branch. 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.
Composer.Composer (cognitive 25) packages/paperclip-runner/devtools/issue-thread/src/Composer.tsx:35— Composer.Composer has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 9 (14 pts), boolean chains 6, if/else 3 (4 pts), error handling 1 (nesting depth added 6). Of this number, 18 points are the body's own statements and 7 belong to 3 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.
materialize-cursor-distribution.cursorDistributionClosure::walk (cognitive 25) packages/paperclip-runner/scripts/materialize-cursor-distribution.mjs:27— materialize-cursor-distribution.cursorDistributionClosure::walk has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 5, ternaries 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.
forbidden-imports.findSpecifiersInFiles (cognitive 25) packages/paperclip-runner/scripts/lib/forbidden-imports.mjs:50— forbidden-imports.findSpecifiersInFiles has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 8, loops 4 (7 pts) (nesting depth added 6). Most of this is not in the body itself: 10 of the 25 points are its own statements and the rest belongs to 3 function items inside it that branch (visit, add, a function literal at line 63). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
acp-question-adapter.acpContent (cognitive 25) packages/paperclip-runner/src/drivers/acpx/acp-question-adapter.ts:225— acp-question-adapter.acpContent has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 2, loops 1 (nesting depth added 12). Of this number, 23 points are the body's own statements and 2 belong to one function literal 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.
acpx-sidecar-input.directAcpxSidecarErrorCode (cognitive 25) packages/paperclip-runner/src/cli/acpx-sidecar-input.ts:59— acpx-sidecar-input.directAcpxSidecarErrorCode has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12, ternaries 6 (8 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DotSession.command (cognitive 25) packages/paperclip-runner/src/drivers/dot/dot-harness-driver.ts:138— DotSession.command has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 5). Most of this is not in the body itself: 9 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 153). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
menu.Menu (cognitive 25) packages/paperclip-runner/src/react/components/menu.tsx:15— menu.Menu has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (14 pts), ternaries 5 (7 pts), boolean chains 4 (nesting depth added 3). Most of this is not in the body itself: 6 of the 25 points are its own statements and the rest belongs to 9 function items inside it that branch (onMenuKeyDown, focusItem, a function literal at line 116, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
redaction.escapedQuotedValueEnd (cognitive 25) server/src/redaction.ts:503— redaction.escapedQuotedValueEnd has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 3, loops 2 (3 pts), ternaries 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.
worktree-config.atomicWriteFile (cognitive 25) server/src/worktree-config.ts:167— worktree-config.atomicWriteFile has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (11 pts), ternaries 2 (6 pts), error handling 2 (4 pts), boolean chains 3, 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.
secrets.secretResolutionErrorCode (cognitive 25) server/src/services/secrets.ts:839— secrets.secretResolutionErrorCode has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 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.
connection-credentials.writeConnectionCredential (cognitive 25) server/src/services/connection-credentials.ts:38— connection-credentials.writeConnectionCredential has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 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.
budget-exposure.readObservedSpends (cognitive 25) server/src/services/budget-exposure.ts:73— budget-exposure.readObservedSpends has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 14 (24 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.
index.supabaseClient.invoke (cognitive 25) server/src/services/connectors/supabase/index.ts:170— index.supabaseClient.invoke has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 3 (6 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.
chat-teams-file-consent.installTeamsFileConsentHook (cognitive 25) server/src/services/chat-teams-file-consent.ts:795— chat-teams-file-consent.installTeamsFileConsentHook has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (5 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (nesting depth added 9). Most of this is not in the body itself: 4 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 820). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
ChatSdkEndpointRuntime.attachmentRecoveryDescriptor (cognitive 25) server/src/services/chat-sdk-runtime.ts:2741— ChatSdkEndpointRuntime.attachmentRecoveryDescriptor has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 9, if/else 5 (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.
voice-session-store.voiceSessionStore.reserve (cognitive 25) server/src/services/voice/voice-session-store.ts:158— voice-session-store.voiceSessionStore.reserve has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 5, ternaries 2 (nesting depth added 7). None of this is in the body itself: all 25 points belong to one function literal inside it that branches (line 163). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
chat-run-publications.safeMilestoneText (cognitive 25) server/src/services/chat-run-publications.ts:245— chat-run-publications.safeMilestoneText has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 7 (22 pts), if/else 3 (nesting depth added 15). 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.
recovery-effect-receipts.priorRecoveryApiReceipt (cognitive 25) server/src/services/recovery-effect-receipts.ts:38— recovery-effect-receipts.priorRecoveryApiReceipt has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 3, loops 2 (3 pts), ternaries 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.
tool-gateway.createToolGatewayService.connectedMcpToolsForCompany (cognitive 25) server/src/services/tool-gateway.ts:1386— tool-gateway.createToolGatewayService.connectedMcpToolsForCompany has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 13, ternaries 8 (9 pts), if/else 3 (nesting depth added 1). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 1458, 1487, 1397, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
provider-client.createSlackSetupClient (cognitive 25) server/src/services/connectors/slack/setup/provider-client.ts:17— provider-client.createSlackSetupClient has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 4 (6 pts), boolean chains 3, loops 1 (2 pts), error handling 1 (nesting depth added 9). None of this is in the body itself: all 25 points belong to one function literal inside it that branches (line 18). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
service.slackChatRegistrationService.complete (cognitive 25) server/src/services/connectors/slack/setup/service.ts:90— service.slackChatRegistrationService.complete has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 10, if/else 9 (10 pts), ternaries 2 (4 pts), error handling 1 (nesting depth added 3). None of this is in the body itself: all 25 points belong to one function literal inside it that branches (line 92). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
git-restore-point.writeIgnoredFiles (cognitive 25) REDACTED:257— git-restore-point.writeIgnoredFiles has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (5 pts), ternaries 2 (5 pts), boolean chains 3, error handling 1 (nesting depth added 8). Of this number, 22 points are the body's own statements and 3 belong to one function literal 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.
projects.projectService.update (cognitive 25) server/src/services/projects.ts:967— projects.projectService.update has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 7, ternaries 1 (nesting depth added 3). None of this is in the body itself: all 25 points belong to 3 function literals inside it that branch (lines 970, 1014, 1044). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
file-delivery.createTeamsFileDelivery.tryProcessTeamsFilePublication (cognitive 25) server/src/services/chat-channels/microsoft-teams/file-delivery.ts:264— file-delivery.createTeamsFileDelivery.tryProcessTeamsFilePublication has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 8, error handling 1, loops 1 (nesting depth added 5). Most of this is not in the body itself: 11 of the 25 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 294, 299). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
publication-replacement.createChatPublicationReplacement.inboundWakePublicationToReplace (cognitive 25) server/src/services/chat-channels/publication-replacement.ts:448— publication-replacement.createChatPublicationReplacement.inboundWakePublicationToReplace has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, ternaries 3 (4 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.
slack-board-messages.mirrorSlackBoardComment (cognitive 25) server/src/services/slack-board-messages.ts:26— slack-board-messages.mirrorSlackBoardComment has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 6 (10 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 9). Of this number, 22 points are the body's own statements and 3 belong to one function literal 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.
wakeup-authorization.createInboundWakeAuthority.authorizeInboundWakeup (cognitive 25) server/src/services/chat-channels/inbound/wakeup-authorization.ts:41— wakeup-authorization.createInboundWakeAuthority.authorizeInboundWakeup has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 9, ternaries 4 (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.
reactions.createInboundReactions.handleReaction (cognitive 25) server/src/services/chat-channels/reactions.ts:316— reactions.createInboundReactions.handleReaction has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 7 (8 pts), boolean chains 3, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 10 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 413). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
chat-channels.chatChannelService.applyProviderLifecycleEffect (cognitive 25) server/src/services/chat-channels.ts:2648— chat-channels.chatChannelService.applyProviderLifecycleEffect has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 4 (8 pts), boolean chains 5, error handling 1 (nesting depth added 6). Most of this is not in the body itself: 11 of the 25 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2733, 2810, 2659). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
refresh-leases.createOAuthRefreshLeases.acquireOAuthGrantRefreshLease (cognitive 25) server/src/services/tool-access/oauth/refresh-leases.ts:196— refresh-leases.createOAuthRefreshLeases.acquireOAuthGrantRefreshLease has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 7, ternaries 2 (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.
composio-app-setup.composioAppAccounts::visit (cognitive 25) server/src/services/composio-app-setup.ts:32— composio-app-setup.composioAppAccounts::visit has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (8 pts), ternaries 2 (6 pts), 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.
tool-access.toolAccessService.configureRailwaySsh (cognitive 25) server/src/services/tool-access.ts:4649— tool-access.toolAccessService.configureRailwaySsh has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 9, ternaries 2 (3 pts) (nesting depth added 4). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to one function literal inside it that branches (line 4651). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-broker.createNativeExternalBroker.assertCurrentAuthority (cognitive 25) server/src/modules/external-agents/native-broker.ts:58— native-broker.createNativeExternalBroker.assertCurrentAuthority has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 8, ternaries 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.
native-broker.createNativeExternalBroker.operation (cognitive 25) server/src/modules/external-agents/native-broker.ts:159— native-broker.createNativeExternalBroker.operation has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 4, loops 1, ternaries 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.
agent-directory-working-copies.agentDirectoryWorkingCopyService.checkpoint (cognitive 25) server/src/services/agent-directory-working-copies.ts:319— agent-directory-working-copies.agentDirectoryWorkingCopyService.checkpoint has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (13 pts), if/else 3 (5 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (nesting depth added 8). Of this number, 22 points are the body's own statements and 3 belong to one function literal 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.
agent-directory-working-copies.agentDirectoryWorkingCopyService.collectStopped (cognitive 25) server/src/services/agent-directory-working-copies.ts:358— agent-directory-working-copies.agentDirectoryWorkingCopyService.collectStopped has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 9, error handling 1 (2 pts), loops 1, ternaries 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.
company-skills.companySkillService.list (cognitive 25) server/src/services/company-skills.ts:3269— company-skills.companySkillService.list has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 10, ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 3358, 3332, 3313). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
company-skills.companySkillService.resetSkill (cognitive 25) server/src/services/company-skills.ts:4997— company-skills.companySkillService.resetSkill has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 6 (9 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.
company-skills.companySkillService.browseProjectWorkspace (cognitive 25) server/src/services/company-skills.ts:5096— company-skills.companySkillService.browseProjectWorkspace has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 9, boolean chains 5, loops 1 (nesting depth added 4). Of this number, 20 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
company-skills.companySkillService.upsertImportedSkills (cognitive 25) server/src/services/company-skills.ts:6375— company-skills.companySkillService.upsertImportedSkills has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 3 (6 pts), boolean chains 4, 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.
built-in-agents.builtInAgentService.provision (cognitive 25) server/src/services/built-in-agents.ts:1865— built-in-agents.builtInAgentService.provision has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 2 (5 pts), boolean chains 3, error handling 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.
obsolete-policy-reviews.dismissObsoleteNativePolicyReviews (cognitive 25) server/src/services/native-runtime/obsolete-policy-reviews.ts:16— obsolete-policy-reviews.dismissObsoleteNativePolicyReviews has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 4 (8 pts), error handling 2 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). Most of this is not in the body itself: 9 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 61). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
use-cases.createScanSilentActiveRuns (cognitive 25) server/src/modules/active-run-watchdog/application/use-cases.ts:239— use-cases.createScanSilentActiveRuns has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 7). None of this is in the body itself: all 25 points belong to 3 function items inside it that branch (inspectSilentActiveRun, a function literal at line 303, resolveSourceIssue). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
use-cases.runReleaseRecoveryTail (cognitive 25) server/src/modules/wake-queue/application/use-cases.ts:494— use-cases.runReleaseRecoveryTail has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 11, if/else 7, ternaries 6 (7 pts) (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.
queue.createHeartbeatQueue.claimQueuedRun::lockIssueExecutionClaim (cognitive 25) server/src/services/heartbeat/queue.ts:1176— queue.createHeartbeatQueue.claimQueuedRun::lockIssueExecutionClaim has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 9, ternaries 4 (5 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. This shape REPEATS in the file: one other method here (queue.createHeartbeatQueue.claimQueuedRun) 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.
app.OnThisPagePane (cognitive 25) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:3474— app.OnThisPagePane has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 17 (22 pts), if/else 2, boolean chains 1 (nesting depth added 5). Of this number, 15 points are the body's own statements and 10 belong to 4 function literals inside it that branch. 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.
connection-search.scoreConnectionSearch (cognitive 25) packages/shared/src/connection-search.ts:42— connection-search.scoreConnectionSearch has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 7, loops 1, ternaries 1 (nesting depth added 8). Of this number, 20 points are the body's own statements and 5 belong to 2 function literals 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.
frontmatter.parseYamlBlock (cognitive 25) packages/teams-catalog/src/frontmatter.ts:71— frontmatter.parseYamlBlock has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 3, loops 2 (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.
github-connection-events.githubSnapshotUpdate (cognitive 25) server/src/services/github-connection-events.ts:173— github-connection-events.githubSnapshotUpdate has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 16 (21 pts), boolean chains 2, if/else 2 (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.
github-connection-events.githubConnectionEventService.runPoll (cognitive 25) server/src/services/github-connection-events.ts:463— github-connection-events.githubConnectionEventService.runPoll has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 4 (6 pts), error handling 2 (5 pts), boolean chains 3, ternaries 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.
decision-training.loadSourceDecision (cognitive 25) server/src/services/decision-training.ts:89— decision-training.loadSourceDecision has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 5 (7 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.
company-portability.readPortableIssueComments (cognitive 25) server/src/services/company-portability.ts:887— company-portability.readPortableIssueComments has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 5 (10 pts), boolean chains 4, 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.
company-portability.resolvePortableRoutineDefinition (cognitive 25) server/src/services/company-portability.ts:1795— company-portability.resolvePortableRoutineDefinition has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 5, loops 1, ternaries 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.
teams-catalog.collectCatalogTeamSkillPreparations (cognitive 25) server/src/services/teams-catalog.ts:591— teams-catalog.collectCatalogTeamSkillPreparations has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (19 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.
decisions.decisionRoutes (cognitive 25) server/src/routes/decisions.ts:52— decisions.decisionRoutes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 3, loops 2, ternaries 2 (nesting depth added 3). None of this is in the body itself: all 25 points belong to 9 function literals inside it that branch (lines 58, 164, 174, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
plugin-local-folders.listPluginLocalFolderEntries::visit (cognitive 25) server/src/services/plugin-local-folders.ts:435— plugin-local-folders.listPluginLocalFolderEntries::visit has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 4 (9 pts), error handling 1 (2 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.
StarToggle.StarToggle (cognitive 25) ui/src/components/StarToggle.tsx:43— StarToggle.StarToggle has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 9 (14 pts), boolean chains 9, if/else 2 (nesting depth added 5). Of this number, 24 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.
DotRunnerConnection.DotRunnerConnection (cognitive 25) ui/src/components/DotRunnerConnection.tsx:16— DotRunnerConnection.DotRunnerConnection has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 19, if/else 3, ternaries 3. Of this number, 18 points are the body's own statements and 7 belong to 4 function literals inside it that branch. 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.
index.runtimeRequestEntry (cognitive 25) ui/src/adapters/paperclip-runner/index.ts:408— index.runtimeRequestEntry has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 12 (16 pts), boolean chains 8, if/else 1 (nesting depth added 4). Of this number, 22 points are the body's own statements and 3 belong to 3 function literals inside it that branch. 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.
TaskChatRunnerActivityGroup.TaskChatRunnerActivityGroup (cognitive 25) ui/src/components/task-chat/TaskChatRunnerActivityGroup.tsx:311— TaskChatRunnerActivityGroup.TaskChatRunnerActivityGroup has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 12 (23 pts), boolean chains 2 (nesting depth added 11). Of this number, 24 points are the body's own statements and 1 belongs to one function literal 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.
IssueThreadInteractionCard.RequestToolActionCard (cognitive 25) ui/src/components/IssueThreadInteractionCard.tsx:1740— IssueThreadInteractionCard.RequestToolActionCard has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (14 pts), boolean chains 7, if/else 3, error handling 1 (nesting depth added 6). Of this number, 21 points are the body's own statements and 4 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.
IssuePlanDecompositionsSection.IssuePlanDecompositionsSection (cognitive 25) ui/src/components/IssuePlanDecompositionsSection.tsx:33— IssuePlanDecompositionsSection.IssuePlanDecompositionsSection has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 17 (21 pts), boolean chains 3, if/else 1 (nesting depth added 4). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 56). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
OutputPrimaryCard.OutputPrimaryCard (cognitive 25) ui/src/components/issue-output/OutputPrimaryCard.tsx:27— OutputPrimaryCard.OutputPrimaryCard has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 13, ternaries 7 (12 pts) (nesting depth added 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.
TaskChatToolCard.TaskChatToolCard (cognitive 25) ui/src/components/task-chat/TaskChatToolCard.tsx:33— TaskChatToolCard.TaskChatToolCard has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 15 (19 pts), boolean chains 6 (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.
Timeline.Timeline (cognitive 25) ui/src/pages/Timeline.tsx:307— Timeline.Timeline has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 11, if/else 7, ternaries 6 (7 pts) (nesting depth added 1). Most of this is not in the body itself: 11 of the 25 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 323, a function literal at line 313, a function literal at line 330, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
Companies.Companies (cognitive 25) ui/src/pages/Companies.tsx:35— Companies.Companies has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 9 (12 pts), boolean chains 7, if/else 4 (6 pts) (nesting depth added 5). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 127, saveEdit, a function literal at line 147, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
RunTranscriptView.TranscriptCommandGroup (cognitive 25) ui/src/components/transcript/RunTranscriptView.tsx:1141— RunTranscriptView.TranscriptCommandGroup has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 14, ternaries 8 (9 pts), if/else 2 (nesting depth added 1). Of this number, 19 points are the body's own statements and 6 belong to 4 function literals inside it that branch. 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.
project-workspaces-tab.buildProjectWorkspaceSummaries (cognitive 25) ui/src/lib/project-workspaces-tab.ts:86— project-workspaces-tab.buildProjectWorkspaceSummaries has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 2, loops 2, ternaries 1 (nesting depth added 11). Of this number, 23 points are the body's own statements and 2 belong to one function literal 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.
RoutineHistoryTab.RoutineHistoryTab (cognitive 25) ui/src/components/RoutineHistoryTab.tsx:62— RoutineHistoryTab.RoutineHistoryTab has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 11, if/else 8, ternaries 5 (6 pts) (nesting depth added 1). Most of this is not in the body itself: 12 of the 25 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 102, a function literal at line 113, openRestoreConfirm, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
RoutineSaveBar.RoutineSaveBar (cognitive 25) ui/src/components/RoutineSaveBar.tsx:31— RoutineSaveBar.RoutineSaveBar has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 9, if/else 5 (6 pts) (nesting depth added 4). Of this number, 15 points are the body's own statements and 10 belong to 2 function literals 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.
PermissionsPanel.AgentAccessSection (cognitive 25) ui/src/pages/apps/app-detail/PermissionsPanel.tsx:102— PermissionsPanel.AgentAccessSection has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 10 (22 pts), if/else 2 (3 pts) (nesting depth added 13). Of this number, 19 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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.
AdvancedPanel.ReconnectForm (cognitive 25) ui/src/pages/apps/app-detail/AdvancedPanel.tsx:274— AdvancedPanel.ReconnectForm has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 9, if/else 3 (nesting depth added 3). Most of this is not in the body itself: 11 of the 25 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 316, 299, 298, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
cron-readable.describeCron (cognitive 25) ui/src/lib/cron-readable.ts:37— cron-readable.describeCron has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 8 (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.
Sheets.DocumentSheet (cognitive 25) ui/src/artifact-directions/directions/d3-tactile/objects/Sheets.tsx:27— Sheets.DocumentSheet has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 11 (24 pts), boolean chains 1 (nesting depth added 13). Of this number, 18 points are the body's own statements and 7 belong to one function literal 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.
ArtifactsPanel.ArtifactsPanel (cognitive 25) ui/src/components/ArtifactsPanel.tsx:87— ArtifactsPanel.ArtifactsPanel has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (15 pts), boolean chains 5, if/else 3 (5 pts) (nesting depth added 9). Most of this is not in the body itself: 9 of the 25 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 173, 185, 139). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentBulkRoster.AgentBulkRoster (cognitive 25) ui/src/components/agents/AgentBulkRoster.tsx:16— AgentBulkRoster.AgentBulkRoster has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 14, ternaries 10 (11 pts) (nesting depth added 1). Of this number, 16 points are the body's own statements and 9 belong to 9 function items inside it that branch. 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.
IssueArtifactCard.IssueWorkProductArtifactCard (cognitive 25) ui/src/components/artifacts/IssueArtifactCard.tsx:201— IssueArtifactCard.IssueWorkProductArtifactCard has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 12, ternaries 5 (9 pts), if/else 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.
TaskChatCompactInteractionCard.SuggestedTasksCard (cognitive 25) ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx:1351— TaskChatCompactInteractionCard.SuggestedTasksCard has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 7, boolean chains 6, loops 1 (2 pts), error handling 1 (nesting depth added 3). Most of this is not in the body itself: 11 of the 25 points are its own statements and the rest belongs to 5 function items inside it that branch (resolve, a function literal at line 1413, a function literal at line 1398, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentWorkloadTrial.AgentWorkloadContent (cognitive 25) ui/storybook/support/design-proposals/AgentWorkloadTrial.tsx:55— AgentWorkloadTrial.AgentWorkloadContent has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 6 (11 pts), boolean chains 7, if/else 5 (7 pts) (nesting depth added 7). Most of this is not in the body itself: 7 of the 25 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 67, 88, 128, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
update.compareVersions (cognitive 24) cli/src/commands/update.ts:93— update.compareVersions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 2 (5 pts), boolean chains 2, loops 2 (nesting depth added 9). Of this number, 23 points are the body's own statements and 1 belongs to one function literal 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.
server-utils.readPaperclipSkillSyncPreference (cognitive 24) REDACTED:4153— server-utils.readPaperclipSkillSyncPreference has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 4 (10 pts), boolean chains 3, loops 1 (nesting depth added 11). Most of this is not in the body itself: 6 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 4167). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
execution-target.startAdapterExecutionTargetProcessSessionBridge.server (cognitive 24) REDACTED:2302— execution-target.startAdapterExecutionTargetProcessSessionBridge.server has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (5 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 10). None of this is in the body itself: all 24 points belong to 4 function literals inside it that branch (lines 2319, 2314, 2310, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
codex-boundaries.validateCodexWorkingDirectory (cognitive 24) packages/paperclip-runner/src/drivers/codex/codex-boundaries.ts:50— codex-boundaries.validateCodexWorkingDirectory has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 7, 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.
environment.createSanitizedAcpxSpawnInput (cognitive 24) packages/paperclip-runner/src/drivers/acpx/environment.ts:101— environment.createSanitizedAcpxSpawnInput has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, ternaries 5, 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.
IssueHeader.IssueHeader (cognitive 24) packages/paperclip-runner/devtools/issue-thread/src/IssueHeader.tsx:33— IssueHeader.IssueHeader has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 15 (19 pts), boolean chains 3, if/else 2 (nesting depth added 4). Of this number, 22 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
opencode-app-server-proxy.handle (cognitive 24) packages/paperclip-runner/src/cli/opencode-app-server-proxy.ts:321— opencode-app-server-proxy.handle has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 3 (7 pts), boolean chains 3, 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.
plugin-runner-probe.probePluginRunnerEnvironment (cognitive 24) server/src/services/native-runtime/plugin-runner-probe.ts:15— plugin-runner-probe.probePluginRunnerEnvironment has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 7, if/else 5, 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.
task-workspace-access.taskWorkspaceProjectRequirements (cognitive 24) server/src/services/task-workspace-access.ts:20— task-workspace-access.taskWorkspaceProjectRequirements has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 12 (15 pts), boolean chains 7, if/else 1, loops 1 (nesting depth added 3). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 28, 44, 38, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
s3-multipart.putS3Multipart (cognitive 24) server/src/storage/s3-multipart.ts:8— s3-multipart.putS3Multipart has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (3 pts), boolean chains 2, error handling 1, ternaries 1 (nesting depth added 11). Most of this is not in the body itself: 11 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 22). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
secrets.secretService.buildBindingTargetMap (cognitive 24) server/src/services/secrets.ts:2752— secrets.secretService.buildBindingTargetMap has cognitive complexity 24 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 6, ternaries 2 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
secrets.secretService.removeSecretUnlocked (cognitive 24) server/src/services/secrets.ts:3395— secrets.secretService.removeSecretUnlocked has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 2 (4 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 9). Of this number, 22 points are the body's own statements and 2 belong to one function literal 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.
secrets.secretService.resolveUserSecretValue (cognitive 24) server/src/services/secrets.ts:4220— secrets.secretService.resolveUserSecretValue has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, error handling 1, ternaries 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.
run-cancellation.cancellationResultJson (cognitive 24) server/src/services/run-cancellation.ts:89— run-cancellation.cancellationResultJson has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (15 pts), if/else 5 (6 pts), boolean chains 3 (nesting depth added 11). 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.
native-workspace-reconstruction.validateNativeWorkspaceReconstruction (cognitive 24) server/src/services/native-runtime/native-workspace-reconstruction.ts:38— native-workspace-reconstruction.validateNativeWorkspaceReconstruction has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 13, if/else 7 (9 pts), ternaries 2 (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.
resource-memberships.resourceMembershipService.updateAgent (cognitive 24) server/src/services/resource-memberships.ts:348— resource-memberships.resourceMembershipService.updateAgent has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 10 (17 pts), if/else 4, 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.
chat-question-forms.chatQuestionFormValidationResponse (cognitive 24) server/src/services/chat-question-forms.ts:785— chat-question-forms.chatQuestionFormValidationResponse has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 2 (6 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.
paperclip-cloud-connector.paperclipCloudConnectorConfigFromEnv (cognitive 24) server/src/services/paperclip-cloud-connector.ts:198— paperclip-cloud-connector.paperclipCloudConnectorConfigFromEnv has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, if/else 7, ternaries 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.
heartbeat-run-summary.findHeartbeatRunCompletionComment (cognitive 24) server/src/services/heartbeat-run-summary.ts:623— heartbeat-run-summary.findHeartbeatRunCompletionComment has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 5, 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.
chat-github-reviews.githubChatReviewService.scope (cognitive 24) server/src/services/chat-github-reviews.ts:134— chat-github-reviews.githubChatReviewService.scope has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 11, if/else 10, ternaries 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.
execution-workspace-repositories.executionWorkspaceRepositoryService.request (cognitive 24) server/src/services/execution-workspace-repositories.ts:125— execution-workspace-repositories.executionWorkspaceRepositoryService.request has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 146, 176). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-base-ref-diagnostics.readWorkspaceBaseRefDiagnostic (cognitive 24) server/src/services/workspace-base-ref-diagnostics.ts:24— workspace-base-ref-diagnostics.readWorkspaceBaseRefDiagnostic has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 8, 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.
workspace-runtime.resolveManagedPaperclipRuntimePublicOrigin (cognitive 24) server/src/services/workspace-runtime.ts:5543— workspace-runtime.resolveManagedPaperclipRuntimePublicOrigin has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 8, ternaries 1 (2 pts), 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.
workspace-runtime.startLocalRuntimeService (cognitive 24) server/src/services/workspace-runtime.ts:7027— workspace-runtime.startLocalRuntimeService has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 7, error handling 2 (3 pts), loops 1, ternaries 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.
app-setup.createGitHubAppSetup.storeGitHubApp (cognitive 24) server/src/services/chat-channels/github/app-setup.ts:91— app-setup.createGitHubAppSetup.storeGitHubApp has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, error handling 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 5). Most of this is not in the body itself: 4 of the 24 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 94, 105, 125). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
setup-services.createSlackSetupServices (cognitive 24) server/src/services/chat-channels/slack/setup-services.ts:30— setup-services.createSlackSetupServices has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13, boolean chains 8, ternaries 3. None of this is in the body itself: all 24 points belong to 10 function items inside it that branch (a function literal at line 41, linkSlackAccount, a function literal at line 75, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
aggregator-accounts.createAggregatorAccounts.discoverAggregatorInventory (cognitive 24) server/src/services/tool-access/catalog/aggregator-accounts.ts:277— aggregator-accounts.createAggregatorAccounts.discoverAggregatorInventory has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4, ternaries 2 (nesting depth added 8). Of this number, 19 points are the body's own statements and 5 belong to 2 function literals 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.
catalog-completion.createOAuthCatalogCompletion::finishOAuthCatalogWithRecommendedDefaults (cognitive 24) server/src/services/tool-access/oauth/catalog-completion.ts:16— catalog-completion.createOAuthCatalogCompletion::finishOAuthCatalogWithRecommendedDefaults has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (18 pts), boolean chains 3, if/else 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.
tool-profile-entry-validation.assertProfileEntryInputs (cognitive 24) server/src/services/tool-profile-entry-validation.ts:33— tool-profile-entry-validation.assertProfileEntryInputs has cognitive complexity 24 (threshold 15). Drivers by points: loops 7 (10 pts), if/else 3 (6 pts), ternaries 3 (5 pts), boolean chains 3 (nesting depth added 8). Of this number, 23 points are the body's own statements and 1 belongs to one function literal 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.
git-credentials.createGitRemoteAuthProvider (cognitive 24) server/src/services/git-credentials.ts:224— git-credentials.createGitRemoteAuthProvider has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 9). None of this is in the body itself: all 24 points belong to 2 function items inside it that branch (a function literal at line 280, resolveCredential). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
git-credentials.resolveManagedGitHubCredential::acquire (cognitive 24) server/src/services/git-credentials.ts:497— git-credentials.resolveManagedGitHubCredential::acquire has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 7, ternaries 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
github-external-object-provider.pullRequestSnapshot (cognitive 24) server/src/services/github-external-object-provider.ts:240— github-external-object-provider.pullRequestSnapshot has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 16 (20 pts), if/else 3, 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.
environment-config.normalizeEnvironmentConfigForPersistence (cognitive 24) server/src/services/environment-config.ts:542— environment-config.normalizeEnvironmentConfigForPersistence has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 2, ternaries 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.
environment-config.resolveEnvironmentDriverConfigForRuntime (cognitive 24) server/src/services/environment-config.ts:649— environment-config.resolveEnvironmentDriverConfigForRuntime has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 7, loops 1 (3 pts), ternaries 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.
native-broker.createNativeExternalBroker.port.attach (cognitive 24) server/src/modules/external-agents/native-broker.ts:197— native-broker.createNativeExternalBroker.port.attach has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5, ternaries 2 (3 pts), error handling 1, loops 1 (nesting depth added 4). Most of this is not in the body itself: 9 of the 24 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 204, drain, a function literal at line 225). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
dot.createBroker.requestWork (cognitive 24) server/src/modules/external-agents/dot.ts:375— dot.createBroker.requestWork has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, ternaries 4, loops 1 (2 pts), error handling 1 (nesting depth added 6). Of this number, 20 points are the body's own statements and 4 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.
agent-directory-working-copies.agentDirectoryWorkingCopyService.adopt (cognitive 24) server/src/services/agent-directory-working-copies.ts:253— agent-directory-working-copies.agentDirectoryWorkingCopyService.adopt has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, if/else 7 (8 pts), ternaries 3, error handling 1 (nesting depth added 1). Of this number, 20 points are the body's own statements and 4 belong to 2 function items inside it that branch. 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.
workspace-file-resources.workspaceFileResourceService.loadAvailabilityTargets (cognitive 24) server/src/services/workspace-file-resources.ts:1186— workspace-file-resources.workspaceFileResourceService.loadAvailabilityTargets has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 3 (5 pts), boolean chains 4, error handling 1 (3 pts), loops 1 (nesting depth added 9). Of this number, 23 points are the body's own statements and 1 belongs to one function literal 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.
company-skills.resolveRequestedSkillEntriesOrThrow (cognitive 24) server/src/services/company-skills.ts:2276— company-skills.resolveRequestedSkillEntriesOrThrow has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (22 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.
company-skills.companySkillService.installUpdate (cognitive 24) server/src/services/company-skills.ts:4877— company-skills.companySkillService.installUpdate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 2, ternaries 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.
routines.routineService.reconcileExecutionRunStatuses (cognitive 24) server/src/services/routines.ts:3337— routines.routineService.reconcileExecutionRunStatuses has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (4 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (nesting depth added 12). Of this number, 17 points are the body's own statements and 7 belong to one function literal 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.
native-session-executor.runnerdAuthorityLifecycle (cognitive 24) server/src/services/native-runtime/native-session-executor.ts:2065— native-session-executor.runnerdAuthorityLifecycle has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (7 pts), error handling 3 (5 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.
native-session-executor.createRunnerdBackendWithinSessionClaim.prepareRemoteRunner (cognitive 24) server/src/services/native-runtime/native-session-executor.ts:12301— native-session-executor.createRunnerdBackendWithinSessionClaim.prepareRemoteRunner has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 7 (nesting depth added 7). Most of this is not in the body itself: 11 of the 24 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 12375, 12336, 12403). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-workspace-sync.parseGitSnapshot (cognitive 24) server/src/services/native-runtime/native-workspace-sync.ts:416— native-workspace-sync.parseGitSnapshot has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 9, loops 1 (2 pts), ternaries 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.
fresh-workspace-continuation.readFreshWorkspaceReadiness (cognitive 24) server/src/services/fresh-workspace-continuation.ts:51— fresh-workspace-continuation.readFreshWorkspaceReadiness has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 3 (nesting depth added 9). Of this number, 22 points are the body's own statements and 2 belong to one function literal 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.
runtime-mode.resolveNativeRuntimeMode (cognitive 24) server/src/services/native-runtime/runtime-mode.ts:100— runtime-mode.resolveNativeRuntimeMode has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 7, 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.
app.LintPanelContent (cognitive 24) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4589— app.LintPanelContent has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 15 (22 pts), error handling 1, if/else 1 (nesting depth added 7). Most of this is not in the body itself: 11 of the 24 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 4655, runLint). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
catalog-builder.buildReferencedCatalogSkill (cognitive 24) packages/skills-catalog/src/catalog-builder.ts:331— catalog-builder.buildReferencedCatalogSkill has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 7, ternaries 1 (nesting depth added 3). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
release-package-map.findUnpublishableWorkspaceEdges (cognitive 24) scripts/release-package-map.mjs:93— release-package-map.findUnpublishableWorkspaceEdges has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (17 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.
ingest-app-definitions.specialMethodsFor (cognitive 24) scripts/ingest-app-definitions.mjs:1204— ingest-app-definitions.specialMethodsFor has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, ternaries 2 (4 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.
native-agent-runtime-inheritance.inheritedScalar (cognitive 24) server/src/services/native-runtime/native-agent-runtime-inheritance.ts:41— native-agent-runtime-inheritance.inheritedScalar has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (14 pts), boolean chains 6, if/else 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.
native-workspace-export-retry.retryNativeWorkspaceExport::inspect (cognitive 24) server/src/services/native-runtime/native-workspace-export-retry.ts:24— native-workspace-export-retry.retryNativeWorkspaceExport::inspect has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 15, if/else 9. 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.
plugin-host-services.clampProviderSpanAttributes (cognitive 24) server/src/services/plugin-host-services.ts:582— plugin-host-services.clampProviderSpanAttributes 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.
native-workspace-sync-retention.nativeWorkspaceSyncRetentionService.tick (cognitive 24) server/src/services/native-runtime/native-workspace-sync-retention.ts:336— native-workspace-sync-retention.nativeWorkspaceSyncRetentionService.tick has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 2 (5 pts), ternaries 2 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SetMyUserSecretDialog.SetMyUserSecretDialog (cognitive 24) ui/src/pages/secrets/SetMyUserSecretDialog.tsx:27— SetMyUserSecretDialog.SetMyUserSecretDialog has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 14 (20 pts), if/else 3, boolean chains 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 8 belong to 4 function literals 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.
WorkspaceFileLink.WorkspaceFileLink (cognitive 24) ui/src/components/WorkspaceFileLink.tsx:24— WorkspaceFileLink.WorkspaceFileLink has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (15 pts), if/else 6, boolean chains 3 (nesting depth added 4). Of this number, 17 points are the body's own statements and 7 belong to one function item inside it that branches. 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.
AiConnectionPicker.AiConnectionPicker (cognitive 24) ui/src/components/ai-connections/AiConnectionPicker.tsx:33— AiConnectionPicker.AiConnectionPicker has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 7 (14 pts), boolean chains 6, if/else 2 (4 pts) (nesting depth added 9). Of this number, 13 points are the body's own statements and 11 belong to 2 function literals 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.
schema-config-fields.SchemaConfigFields::writeValue (cognitive 24) ui/src/adapters/schema-config-fields.tsx:369— schema-config-fields.SchemaConfigFields::writeValue has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 4 (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.
TaskChatProtocolActivityRow.TaskChatProtocolActivityRow (cognitive 24) ui/src/components/task-chat/TaskChatProtocolActivityRow.tsx:279— TaskChatProtocolActivityRow.TaskChatProtocolActivityRow has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 12 (17 pts), boolean chains 4, if/else 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.
transcriptPresentation.describeToolInput (cognitive 24) ui/src/lib/transcriptPresentation.ts:186— transcriptPresentation.describeToolInput has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (13 pts), if/else 7 (8 pts), boolean chains 3 (nesting depth added 8). Of this number, 21 points are the body's own statements and 3 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.
IssueChatThread.VirtualizedIssueChatThreadListInner (cognitive 24) ui/src/components/IssueChatThread.tsx:4331— IssueChatThread.VirtualizedIssueChatThreadListInner has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 5, ternaries 3 (nesting depth added 1). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 10 function literals inside it that branch (lines 4420, 4450, 4441, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
DocumentAnnotationPopover.DocumentAnnotationPopover (cognitive 24) ui/src/components/DocumentAnnotationPopover.tsx:29— DocumentAnnotationPopover.DocumentAnnotationPopover has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 7 (11 pts), if/else 5 (8 pts), boolean chains 5 (nesting depth added 7). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 99, submitComposer, a function literal at line 48, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ActivityRow.ActivityRow (cognitive 24) ui/src/components/ActivityRow.tsx:36— ActivityRow.ActivityRow has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (14 pts), boolean chains 8, if/else 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.
AgentDetail.LogViewer (cognitive 24) ui/src/pages/AgentDetail.tsx:4022— AgentDetail.LogViewer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 42 (48 pts), boolean chains 36, ternaries 15 (21 pts), error handling 5 (6 pts), loops 1 (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (AgentDetail.LogViewer::appendLogContent) 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.
ProviderQuotaCard.ProviderQuotaCard (cognitive 24) ui/src/components/ProviderQuotaCard.tsx:45— ProviderQuotaCard.ProviderQuotaCard has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 19, ternaries 4, loops 1. Of this number, 22 points are the body's own statements and 2 belong to 4 function literals inside it that branch. 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.
AggregatorAppManager.AccountObservations (cognitive 24) ui/src/pages/apps/AggregatorAppManager.tsx:33— AggregatorAppManager.AccountObservations has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 10 (20 pts), boolean chains 4 (nesting depth added 10). Most of this is not in the body itself: 9 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 47, 37). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ComposioAppSetup.ComposioAppSetup (cognitive 24) ui/src/pages/apps/ComposioAppSetup.tsx:13— ComposioAppSetup.ComposioAppSetup has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 10 (15 pts), boolean chains 4, if/else 4, error handling 1 (nesting depth added 5). Of this number, 14 points are the body's own statements and 10 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.
Browse.connectorAction (cognitive 24) ui/src/pages/apps/Browse.tsx:276— Browse.connectorAction has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 6 (10 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.
AgentChatPicker.AgentChatPickerResults (cognitive 24) ui/src/components/AgentChatPicker.tsx:35— AgentChatPicker.AgentChatPickerResults has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (14 pts), boolean chains 7, if/else 2, error handling 1 (nesting depth added 8). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SpekoProviderSetup.SpekoProviderSetup (cognitive 24) ui/src/components/voice/SpekoProviderSetup.tsx:17— SpekoProviderSetup.SpekoProviderSetup has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 7 (13 pts), boolean chains 9, if/else 2 (nesting depth added 6). Of this number, 20 points are the body's own statements and 4 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.
csv-preview.parseCsv (cognitive 24) ui/src/lib/csv-preview.ts:6— csv-preview.parseCsv has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 7, 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.
webhook-url-warning.webhookUrlWarningReason (cognitive 24) ui/src/lib/webhook-url-warning.ts:12— webhook-url-warning.webhookUrlWarningReason has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 3, error handling 1, ternaries 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.
AgentDetail.production.LogViewer (cognitive 24) ui/src/pages/AgentDetail.production.tsx:3733— AgentDetail.production.LogViewer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 42 (48 pts), boolean chains 36, ternaries 15 (21 pts), error handling 5 (6 pts), loops 1 (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (AgentDetail.production.LogViewer::appendLogContent) 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.
UploadPreview.UploadPreview (cognitive 24) ui/storybook/support/artifact-upload/UploadPreview.tsx:15— UploadPreview.UploadPreview has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 6 (8 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 4). Most of this is not in the body itself: 3 of the 24 points are its own statements and the rest belongs to 8 function items inside it that branch (handlePreviewLink, a function literal at line 17, a function literal at line 40, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
projectRepositorySkills.installProjectSkillFixtures (cognitive 24) ui/storybook/support/projectRepositorySkills.ts:28— projectRepositorySkills.installProjectSkillFixtures has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (8 pts), ternaries 4 (5 pts) (nesting depth added 2). Of this number, 15 points are the body's own statements and 9 belong to 36 function items inside it that branch. 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.
workspace-restore-merge.walkDirectory (cognitive 23) packages/adapter-utils/src/workspace-restore-merge.ts:147— workspace-restore-merge.walkDirectory has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3, ternaries 2 (3 pts), boolean chains 1 (nesting depth added 7). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 2 function items inside it that branch (visitBatch, readEntry). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
sandbox-managed-runtime.confineFullWorkspaceExport::walk (cognitive 23) packages/adapter-utils/src/sandbox-managed-runtime.ts:923— sandbox-managed-runtime.confineFullWorkspaceExport::walk has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (19 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.
ssh.createSshCommandManagedRuntimeRunner.execute (cognitive 23) REDACTED:56— ssh.createSshCommandManagedRuntimeRunner.execute has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 5 (8 pts), boolean chains 1, error handling 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.
execute.reconcileManagedCodexSkills (cognitive 23) packages/adapter-utils/src/acpx-engine/execute.ts:1277— execute.reconcileManagedCodexSkills has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3, 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.
usage-checkpoint.createUsageCheckpointLog (cognitive 23) packages/adapter-utils/src/usage-checkpoint.ts:68— usage-checkpoint.createUsageCheckpointLog has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 5, error handling 2 (3 pts), loops 1 (2 pts) (nesting depth added 3). Most of this is not in the body itself: 3 of the 23 points are its own statements and the rest belongs to 3 function items inside it that branch (publish, log, retain). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
parse-stdout.parseCodexItem (cognitive 23) packages/adapters/codex-local/src/ui/parse-stdout.ts:168— parse-stdout.parseCodexItem has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 7, ternaries 4 (5 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.
execute.buildPrompt (cognitive 23) packages/adapters/hermes/src/server/execute.ts:149— execute.buildPrompt has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 21, if/else 1, ternaries 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.
execute.extractRuntimeServicesFromMeta (cognitive 23) packages/adapters/openclaw-gateway/src/server/execute.ts:947— execute.extractRuntimeServicesFromMeta has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 8 (14 pts), boolean chains 4, if/else 3 (4 pts), loops 1 (nesting depth added 7). Of this number, 21 points are the body's own statements and 2 belong to 2 function literals 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.
client.applyPendingMigrationsManually (cognitive 23) REDACTED:506— client.applyPendingMigrationsManually has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (4 pts), error handling 1 (nesting depth added 12). Most of this is not in the body itself: 9 of the 23 points are its own statements and the rest belongs to one function item inside it that branches (applyMigration). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
backup-lib.pruneOldBackups (cognitive 23) packages/db/src/backup-lib.ts:127— backup-lib.pruneOldBackups has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3, 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.
check-migration-safety.stripSqlComments (cognitive 23) packages/db/src/check-migration-safety.ts:259— check-migration-safety.stripSqlComments has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (4 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.
codex-notification-identity.classifyCodexNotification (cognitive 23) packages/paperclip-runner/src/drivers/codex/codex-notification-identity.ts:27— codex-notification-identity.classifyCodexNotification has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, if/else 5 (6 pts), ternaries 4 (5 pts) (nesting depth added 2). Of this number, 21 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
DurablePrpControlPlane.#commandResult (cognitive 23) REDACTED:2926— DurablePrpControlPlane.#commandResult has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 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.
runnerd-codex-transport.awaitProviderDrainBarrier (cognitive 23) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:600— runnerd-codex-transport.awaitProviderDrainBarrier has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 4, loops 2 (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.
private-snapshot.createAcpxPrivateSnapshot (cognitive 23) packages/paperclip-runner/src/drivers/acpx/private-snapshot.ts:53— private-snapshot.createAcpxPrivateSnapshot has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19 (29 pts), loops 7 (9 pts), boolean chains 6, ternaries 2, error handling 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. This shape REPEATS in the file: one other method here (private-snapshot.createAcpxPrivateSnapshot::copy) 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.
protocol-contract.loadSchemaCatalog (cognitive 23) REDACTED:71— protocol-contract.loadSchemaCatalog has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (4 pts), ternaries 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.
protocol-contract.assertAcpxQuestionFixture (cognitive 23) REDACTED:361— protocol-contract.assertAcpxQuestionFixture has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, loops 3, ternaries 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.
acp-question-adapter.normalizeField (cognitive 23) packages/paperclip-runner/src/drivers/acpx/acp-question-adapter.ts:110— acp-question-adapter.normalizeField has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 6 (8 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.
access.accessService.setUserCompanyAccess (cognitive 23) server/src/services/access.ts:806— access.accessService.setUserCompanyAccess has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, loops 3 (5 pts) (nesting depth added 7). None of this is in the body itself: all 23 points belong to 4 function literals inside it that branch (lines 813, 823, 830, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
secrets.secretService.resolveSecretValueForEphemeralAccess (cognitive 23) server/src/services/secrets.ts:1481— secrets.secretService.resolveSecretValueForEphemeralAccess has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 6 (17 pts), boolean chains 3, if/else 3 (nesting depth added 11). 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.
secrets.secretService.collectMissingAdapterConfigRuntimeBindings (cognitive 23) server/src/services/secrets.ts:5449— secrets.secretService.collectMissingAdapterConfigRuntimeBindings has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 7). Of this number, 17 points are the body's own statements and 6 belong to 2 function literals 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.
chat-attachment-reuse.authorizeChatConversationForBoundRun (cognitive 23) server/src/services/native-runtime/chat-attachment-reuse.ts:433— chat-attachment-reuse.authorizeChatConversationForBoundRun has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 7 (9 pts), boolean chains 3, loops 1 (nesting depth added 6). Of this number, 18 points are the body's own statements and 5 belong to one function literal 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.
chat-attachment-reuse.resolveExternalChatResponseWaitAuthorizationInTransaction (cognitive 23) server/src/services/native-runtime/chat-attachment-reuse.ts:628— chat-attachment-reuse.resolveExternalChatResponseWaitAuthorizationInTransaction has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 8 (11 pts), if/else 5 (6 pts), boolean chains 5, error handling 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.
client.unikraftClient.execute (cognitive 23) server/src/services/connectors/unikraft/client.ts:54— client.unikraftClient.execute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 2, loops 1, ternaries 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.
tool-gateway.createToolGatewayService.sweepActionReviews (cognitive 23) server/src/services/tool-gateway.ts:9716— tool-gateway.createToolGatewayService.sweepActionReviews has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 3 (8 pts), loops 3 (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.
voice-session-service.voiceSessionService.reconcile (cognitive 23) server/src/services/voice/voice-session-service.ts:202— voice-session-service.voiceSessionService.reconcile has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (7 pts), error handling 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.
chat-discord-command-registration.request (cognitive 23) server/src/services/chat-discord-command-registration.ts:315— chat-discord-command-registration.request has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 5 (7 pts), boolean chains 4, error handling 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.
agent-avatar-pool.createAgentAvatarPool.drain (cognitive 23) server/src/services/agent-avatar-pool.ts:30— agent-avatar-pool.createAgentAvatarPool.drain has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 3 (8 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 11). Of this number, 12 points are the body's own statements and 11 belong to 3 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.
provider-effects.createProviderEffects.processProviderEffect::processClaimedEffect (cognitive 23) server/src/services/chat-channels/provider-effects.ts:606— provider-effects.createProviderEffects.processProviderEffect::processClaimedEffect has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (17 pts), error handling 2 (3 pts), ternaries 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.
execution-workspace-policy.buildExecutionWorkspaceAdapterConfig (cognitive 23) server/src/services/execution-workspace-policy.ts:435— execution-workspace-policy.buildExecutionWorkspaceAdapterConfig has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 6, ternaries 2 (6 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.
project-workspace-provider.resolveProjectWorkspaceProvider (cognitive 23) server/src/services/project-workspace-provider.ts:26— project-workspace-provider.resolveProjectWorkspaceProvider has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 10 (14 pts), boolean chains 7, if/else 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.
email-channels.emailChannelService.runTick (cognitive 23) server/src/services/email-channels.ts:2142— email-channels.emailChannelService.runTick has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, error handling 3 (4 pts), loops 4 (nesting depth added 4). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 2163, 2258, 2194, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
postgres.createPostgresRunDispatchAdapter.loadGateFacts (cognitive 23) server/src/modules/run-dispatch/adapters/postgres.ts:275— postgres.createPostgresRunDispatchAdapter.loadGateFacts has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 5 (7 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.
chat-teams-file-transfers.teamsFileTransferService.expireAndRecover (cognitive 23) server/src/services/chat-teams-file-transfers.ts:862— chat-teams-file-transfers.teamsFileTransferService.expireAndRecover has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (7 pts), boolean chains 4, error handling 2 (3 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 11 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 934). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
policy.definiteAttachmentProviderRejection (cognitive 23) server/src/services/chat-channels/publications/policy.ts:31— policy.definiteAttachmentProviderRejection has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (7 pts), boolean chains 4 (nesting depth added 9). Of this number, 22 points are the body's own statements and 1 belongs to one function literal 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.
requests.createChatPublicationRequests.publishBoardMessage (cognitive 23) server/src/services/chat-channels/publications/requests.ts:175— requests.createChatPublicationRequests.publishBoardMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, ternaries 3 (4 pts), error handling 1, loops 1 (nesting depth added 3). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 207, validRejectedIds). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
reader.createToolCatalogReader.listCatalog (cognitive 23) server/src/services/tool-access/catalog/reader.ts:19— reader.createToolCatalogReader.listCatalog has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 15, if/else 2 (4 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 4). Of this number, 18 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
aggregator-accounts.createAggregatorAccounts.syncAggregatorApps (cognitive 23) server/src/services/tool-access/catalog/aggregator-accounts.ts:324— aggregator-accounts.createAggregatorAccounts.syncAggregatorApps has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 5 (8 pts), error handling 1 (2 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 11). Most of this is not in the body itself: 4 of the 23 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 350, 368, 347). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
vercel-callback.createVercelOAuthCallback::completeVercelConnectCallback (cognitive 23) server/src/services/tool-access/oauth/vercel-callback.ts:33— vercel-callback.createVercelOAuthCallback::completeVercelConnectCallback has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 7 (9 pts), boolean chains 2, 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, 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.
issue-thread-interactions.normalizeQuestionAnswers (cognitive 23) server/src/services/issue-thread-interactions.ts:1671— issue-thread-interactions.normalizeQuestionAnswers has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, loops 3 (4 pts), ternaries 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.
native-cancellation-request.claimCancellationRequest (cognitive 23) server/src/services/native-runtime/native-cancellation-request.ts:77— native-cancellation-request.claimCancellationRequest has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 8, ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 4 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 80). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
agent-instruction-authorization.resolveInstructionActor (cognitive 23) server/src/services/agent-instruction-authorization.ts:24— agent-instruction-authorization.resolveInstructionActor has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PaperclipControlPlanePort.appendEvent (cognitive 23) server/src/services/native-runtime/paperclip-control-plane-port.ts:217— PaperclipControlPlanePort.appendEvent has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, loops 1 (3 pts), ternaries 2 (nesting depth added 5). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
PaperclipRunnerToolAuthority.definitions (cognitive 23) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:246— PaperclipRunnerToolAuthority.definitions has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, ternaries 6 (7 pts), if/else 5 (nesting depth added 1). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 271, 284). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PaperclipRunnerToolAuthority.#registerDeliverable (cognitive 23) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:1939— PaperclipRunnerToolAuthority.#registerDeliverable has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 8 (15 pts), if/else 6 (7 pts), boolean chains 1 (nesting depth added 8). Of this number, 15 points are the body's own statements and 8 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.
remote-runner-recovery-diagnostics.remoteRecoveryProbeReason (cognitive 23) server/src/services/native-runtime/remote-runner-recovery-diagnostics.ts:76— remote-runner-recovery-diagnostics.remoteRecoveryProbeReason has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (23 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.
native-session-executor.rebaseRetainedNativeCleanupProviderHome (cognitive 23) server/src/services/native-runtime/native-session-executor.ts:2660— native-session-executor.rebaseRetainedNativeCleanupProviderHome has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 6, error handling 1, ternaries 1 (nesting depth added 2). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
native-session-executor.syncRemoteRunnerDirectoryOut (cognitive 23) server/src/services/native-runtime/native-session-executor.ts:10872— native-session-executor.syncRemoteRunnerDirectoryOut has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, error handling 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.
run-preparation.createHeartbeatRunPreparation.resolveResponsibleUserIdForRunSeed (cognitive 23) server/src/services/heartbeat/run-preparation.ts:3162— run-preparation.createHeartbeatRunPreparation.resolveResponsibleUserIdForRunSeed has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 3 (4 pts), boolean chains 3, 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.
run-state.buildExplicitResumeSessionOverride (cognitive 23) server/src/services/heartbeat/run-state.ts:591— run-state.buildExplicitResumeSessionOverride has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 10 (17 pts), boolean chains 5, if/else 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.
policy.decideReleaseRecovery (cognitive 23) server/src/modules/wake-queue/domain/policy.ts:379— policy.decideReleaseRecovery has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 2 (5 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.
run-lifecycle.createHeartbeatLifecycle.setRunStatusFromLive (cognitive 23) server/src/services/heartbeat/run-lifecycle.ts:1114— run-lifecycle.createHeartbeatLifecycle.setRunStatusFromLive has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 5 (9 pts), boolean chains 7, if/else 6 (7 pts) (nesting depth added 5). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1162, 1206). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
app.FreshnessChip (cognitive 23) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:3624— app.FreshnessChip has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 11 (15 pts), boolean chains 4, if/else 4 (nesting depth added 4). Of this number, 18 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
plugin.runSessionLogStream (cognitive 23) packages/plugins/sandbox-providers/daytona/src/plugin.ts:2098— plugin.runSessionLogStream has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 11). Of this number, 17 points are the body's own statements and 6 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.
environment-tasks.parseEnvironmentTaskResult (cognitive 23) packages/plugins/sdk/src/environment-tasks.ts:178— environment-tasks.parseEnvironmentTaskResult has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 6 (21 pts), boolean chains 1, if/else 1 (nesting depth added 15). 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.
environment-creation-cleanup.readEnvironmentCreationCleanupError (cognitive 23) packages/plugins/sdk/src/environment-creation-cleanup.ts:82— environment-creation-cleanup.readEnvironmentCreationCleanupError has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 10, if/else 8, ternaries 4 (5 pts) (nesting depth added 1). Of this number, 22 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
ai-provider-routing.aiProviderRoutingSchema (cognitive 23) packages/shared/src/ai-provider-routing.ts:29— ai-provider-routing.aiProviderRoutingSchema has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 10, error handling 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.
check-token-gates.main (cognitive 23) scripts/check-token-gates.mjs:263— check-token-gates.main has cognitive complexity 23 (threshold 15). Drivers by points: loops 7 (13 pts), if/else 3 (6 pts), ternaries 4 (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.
codemod-extract-colors.main (cognitive 23) scripts/codemod-extract-colors.mjs:401— codemod-extract-colors.main has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (4 pts), ternaries 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.
dev-runner.maybeAutoRestartChild (cognitive 23) scripts/dev-runner.ts:757— dev-runner.maybeAutoRestartChild has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 7, boolean chains 6, error handling 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.
company-search.issueFilterConditions (cognitive 23) server/src/services/company-search.ts:272— company-search.issueFilterConditions has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 7, ternaries 3 (6 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.
feedback.buildOpenCodeTraceFiles (cognitive 23) server/src/services/feedback.ts:569— feedback.buildOpenCodeTraceFiles has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 3 (4 pts), ternaries 3, boolean chains 1, error handling 1 (nesting depth added 4). Of this number, 21 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
github-connection-events.githubConnectionEventService.processForCompany (cognitive 23) server/src/services/github-connection-events.ts:343— github-connection-events.githubConnectionEventService.processForCompany has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 3 (5 pts), error handling 2 (3 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 7). Of this number, 12 points are the body's own statements and 11 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.
company-import-transfers.sweepAbandonedImportTransferSpools (cognitive 23) server/src/services/company-import-transfers.ts:137— company-import-transfers.sweepAbandonedImportTransferSpools has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 2 (4 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.
skill-source-git-snapshot.openGitSkillSnapshot (cognitive 23) server/src/services/skill-source-git-snapshot.ts:238— skill-source-git-snapshot.openGitSkillSnapshot has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 9, ternaries 2, 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.
skill-sources.skillSourceService.importFromUrl (cognitive 23) server/src/services/skill-sources.ts:423— skill-sources.skillSourceService.importFromUrl has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 6, error handling 1 (3 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 8). Of this number, 19 points are the body's own statements and 4 belong to 2 function literals 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.
decision-training.decisionTrainingRoutes (cognitive 23) server/src/routes/decision-training.ts:53— decision-training.decisionTrainingRoutes has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19, boolean chains 3, ternaries 1. None of this is in the body itself: all 23 points belong to 8 function items inside it that branch (a function literal at line 199, a function literal at line 233, a function literal at line 175, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
muse-qualification.main (cognitive 23) scripts/smoke/muse-qualification.ts:164— muse-qualification.main has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, ternaries 3, error handling 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.
posthog-live-lib.extractProjectSummary::visit (cognitive 23) scripts/smoke/posthog-live-lib.mjs:149— posthog-live-lib.extractProjectSummary::visit has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 3, loops 1, ternaries 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.
blockquote-markdown.unescapeBlockquoteMarkers (cognitive 23) ui/src/lib/blockquote-markdown.ts:53— blockquote-markdown.unescapeBlockquoteMarkers has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
attention.attentionDetailLine (cognitive 23) ui/src/lib/attention.ts:201— attention.attentionDetailLine has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 7 (15 pts), if/else 3 (5 pts), boolean chains 2, 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.
CompanySettingsSidebar.production.CompanySettingsSidebar (cognitive 23) ui/src/components/CompanySettingsSidebar.production.tsx:46— CompanySettingsSidebar.production.CompanySettingsSidebar has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 15, ternaries 3 (4 pts), if/else 2 (3 pts), error handling 1 (nesting depth added 2). Of this number, 15 points are the body's own statements and 8 belong to 3 function literals inside it that branch. 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.
composer-draft.draftAttachments (cognitive 23) ui/src/lib/composer-draft.ts:182— composer-draft.draftAttachments has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 7, ternaries 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.
IssueThreadInteractionCard.TaskTreeNode (cognitive 23) ui/src/components/IssueThreadInteractionCard.tsx:557— IssueThreadInteractionCard.TaskTreeNode has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 14 (19 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.
IssuePropertiesArtifactsTab.MarkdownWorkProductRow (cognitive 23) ui/src/components/issue-properties/IssuePropertiesArtifactsTab.tsx:116— IssuePropertiesArtifactsTab.MarkdownWorkProductRow has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10, ternaries 8 (9 pts), boolean chains 4 (nesting depth added 1). Of this number, 14 points are the body's own statements and 9 belong to 5 function items inside it that branch. 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.
WorkspaceRuntimeControls.buildWorkspaceServiceControlEntries (cognitive 23) ui/src/components/WorkspaceRuntimeControls.tsx:230— WorkspaceRuntimeControls.buildWorkspaceServiceControlEntries has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 10 (20 pts), boolean chains 2, if/else 1 (nesting depth added 10). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 243, 255). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SidePanelTabs.SidePanelTabs::handleKeyDown (cognitive 23) ui/src/components/side-panel/SidePanelTabs.tsx:267— SidePanelTabs.SidePanelTabs::handleKeyDown has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 5 (7 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. This shape REPEATS in the file: one other method here (SidePanelTabs.SidePanelTabs) 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.
RunWorkspaceRecoverySurface.RunWorkspaceRecoverySurface (cognitive 23) ui/src/components/RunWorkspaceRecoverySurface.tsx:54— RunWorkspaceRecoverySurface.RunWorkspaceRecoverySurface has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9, ternaries 7, boolean chains 6, match/switch 1. Most of this is not in the body itself: 8 of the 23 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 127, 158, 181, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WorkspaceServiceControlBar.ServicePopoverRow (cognitive 23) ui/src/components/WorkspaceServiceControlBar.tsx:352— WorkspaceServiceControlBar.ServicePopoverRow has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 7 (18 pts), boolean chains 5 (nesting depth added 11). 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.
FastResponseSettings.FastResponseSettingsSection (cognitive 23) ui/src/components/fast-responses/FastResponseSettings.tsx:266— FastResponseSettings.FastResponseSettingsSection has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 6 (16 pts), if/else 4 (5 pts), boolean chains 2 (nesting depth added 11). Most of this is not in the body itself: 6 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 391, 370). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
EmailEndpointSetup.EmailEndpointSettings (cognitive 23) ui/src/pages/apps/chat/EmailEndpointSetup.tsx:577— EmailEndpointSetup.EmailEndpointSettings has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 14, ternaries 5 (6 pts), if/else 3 (nesting depth added 1). Of this number, 21 points are the body's own statements and 2 belong to 3 function literals inside it that branch. 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.
ImportSkillsFromProjectDialog.SelectStep (cognitive 23) ui/src/pages/skills/ImportSkillsFromProjectDialog.tsx:923— ImportSkillsFromProjectDialog.SelectStep has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 6 (11 pts), boolean chains 9, if/else 3 (nesting depth added 5). Of this number, 13 points are the body's own statements and 10 belong to 2 function literals 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.
CaseFieldsPanel.CaseFieldValue (cognitive 23) ui/src/components/CaseFieldsPanel.tsx:158— CaseFieldsPanel.CaseFieldValue has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 7). Of this number, 20 points are the body's own statements and 3 belong to one function literal 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.
CaseListRow.CaseListRow (cognitive 23) ui/src/components/cases/CaseListRow.tsx:9— CaseListRow.CaseListRow has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 12 (16 pts), boolean chains 7 (nesting depth added 4). Of this number, 19 points are the body's own statements and 4 belong to one function literal 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.
ForkSkillDialog.ForkSkillDialog (cognitive 23) ui/src/components/skill-studio/ForkSkillDialog.tsx:39— ForkSkillDialog.ForkSkillDialog has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 14 (17 pts), boolean chains 3, if/else 2, loops 1 (nesting depth added 3). Of this number, 14 points are the body's own statements and 9 belong to 6 function items inside it that branch. 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.
AccessEditor.AccessEditor (cognitive 23) ui/storybook/prototypes/github-chat/AccessEditor.tsx:54— AccessEditor.AccessEditor has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 14 (16 pts), boolean chains 6, if/else 1 (nesting depth added 2). Of this number, 12 points are the body's own statements and 11 belong to 6 function items inside it that branch. 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.
api.installFixtureApi.fixtureFetch (cognitive 23) ui/storybook/support/capability-gaps/api.ts:42— api.installFixtureApi.fixtureFetch has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, ternaries 5 (7 pts), if/else 4 (5 pts) (nesting depth added 3). Of this number, 21 points are the body's own statements and 2 belong to one function literal 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.
CodexProviderConfig::validate (cognitive 23) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:427— CodexProviderConfig::validate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13, boolean chains 10. 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.
IdentityOutputBuffer::settle (cognitive 23) packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:1762— IdentityOutputBuffer::settle has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (18 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.
mcp-auth.loginMcpDevice (cognitive 22) cli/src/client/mcp-auth.ts:148— mcp-auth.loginMcpDevice has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (5 pts), boolean chains 4, 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.
secrets.migrateInlineEnv (cognitive 22) cli/src/commands/client/secrets.ts:283— secrets.migrateInlineEnv has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (4 pts), ternaries 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.
server.server (cognitive 22) docker/openclaw-smoke/server.mjs:43— server.server has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), ternaries 2 (6 pts), error handling 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.
workspace-git-stream.runWorkspaceGitProcess::collect (cognitive 22) packages/adapter-utils/src/workspace-git-stream.ts:57— workspace-git-stream.runWorkspaceGitProcess::collect has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (4 pts), ternaries 2 (4 pts), error handling 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.
workspace-seed-cache.readWorkspaceSeedGeneration (cognitive 22) packages/adapter-utils/src/workspace-seed-cache.ts:23— workspace-seed-cache.readWorkspaceSeedGeneration has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7, loops 2, error handling 1, ternaries 1 (nesting depth added 3). Of this number, 20 points are the body's own statements and 2 belong to one function literal 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.
workspace-seed-cache.evictSeedGenerations (cognitive 22) packages/adapter-utils/src/workspace-seed-cache.ts:103— workspace-seed-cache.evictSeedGenerations has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 8, loops 3 (4 pts) (nesting depth added 5). Of this number, 17 points are the body's own statements and 5 belong to 3 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.
execute.referencedSourceContentSignature (cognitive 22) packages/adapter-utils/src/acpx-engine/execute.ts:769— execute.referencedSourceContentSignature has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 4 (6 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 8). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 3 function items inside it that branch (walk, a function literal at line 785, isIgnoredByGitResolution). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
execute.prepareCodexSkillRuntime (cognitive 22) packages/adapter-utils/src/acpx-engine/execute.ts:1316— execute.prepareCodexSkillRuntime has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 4 (6 pts), error handling 2 (5 pts), boolean chains 4, 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.
acp.probeClaudeAcpSandboxLogin (cognitive 22) packages/adapters/claude-local/src/server/acp.ts:629— acp.probeClaudeAcpSandboxLogin has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 2 (3 pts), boolean chains 2, loops 1 (2 pts), error handling 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.
acp.testKimiAcpEnvironment (cognitive 22) packages/adapters/kimi-local/src/server/acp.ts:279— acp.testKimiAcpEnvironment has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 12 (14 pts), boolean chains 4, if/else 3, error handling 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.
menu.Menu (cognitive 22) packages/paperclip-runner/devtools/browser/src/components/ui/menu.tsx:15— menu.Menu has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 5 (7 pts), boolean chains 4 (nesting depth added 3). Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to 9 function items inside it that branch (onMenuKeyDown, focusItem, a function literal at line 108, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ProcessCodexAppServerTransport.#onLine (cognitive 22) packages/paperclip-runner/src/drivers/codex/app-server-transport.ts:615— ProcessCodexAppServerTransport.#onLine has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5, 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.
cursor-extensions.createCursorProfileExtensionAdapter.notification (cognitive 22) packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts:76— cursor-extensions.createCursorProfileExtensionAdapter.notification has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, ternaries 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
codex-session-terminal.mapTerminalTurn (cognitive 22) packages/paperclip-runner/src/drivers/codex/codex-session-terminal.ts:102— codex-session-terminal.mapTerminalTurn has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 3 (6 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.
policy.decideCapabilitySemanticAuthorization (cognitive 22) packages/paperclip-runner/src/semantic-tools/policy.ts:53— policy.decideCapabilitySemanticAuthorization has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (13 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.
DurablePrpCodexTransport.#stopProviderBeforeSuspend (cognitive 22) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:4367— DurablePrpCodexTransport.#stopProviderBeforeSuspend has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (7 pts), ternaries 3 (5 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.
CapabilitySemanticToolRuntime.reconcileExpiredExtensionReceipt (cognitive 22) packages/paperclip-runner/src/tools/capability-semantic-tool-runtime.ts:153— CapabilitySemanticToolRuntime.reconcileExpiredExtensionReceipt has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 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.
capability-semantic-tool-runtime.validateJsonSchema (cognitive 22) packages/paperclip-runner/src/tools/capability-semantic-tool-runtime.ts:1617— capability-semantic-tool-runtime.validateJsonSchema has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6, loops 1 (2 pts), ternaries 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.
capability-eval-suite.runCase (cognitive 22) packages/paperclip-runner/src/conformance/capability-eval-suite.ts:159— capability-eval-suite.runCase has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, ternaries 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.
live-workflow-matrix.executeRunnerLiveSchedule (cognitive 22) packages/paperclip-runner/src/eval/live-workflow-matrix.ts:470— live-workflow-matrix.executeRunnerLiveSchedule has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (15 pts), error handling 1 (3 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.
scenario-parity.capabilityScenarioParity (cognitive 22) packages/paperclip-runner/src/scenarios/scenario-parity.ts:64— scenario-parity.capabilityScenarioParity has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, ternaries 5 (7 pts) (nesting depth added 3). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
request-card.RequestCard (cognitive 22) packages/paperclip-runner/src/react/request-card.tsx:47— request-card.RequestCard has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 9 (16 pts), boolean chains 4, if/else 2 (nesting depth added 7). Of this number, 11 points are the body's own statements and 11 belong to 3 function literals 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.
redaction.redactStandaloneBearerCredentials (cognitive 22) server/src/redaction.ts:688— redaction.redactStandaloneBearerCredentials has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (5 pts), boolean chains 3 (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.
managed-config.findSecretLikeConfigKey (cognitive 22) server/src/services/managed-config.ts:85— managed-config.findSecretLikeConfigKey has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (4 pts), ternaries 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.
secrets.secretService.resolveSecretValueForAgentAccess (cognitive 22) server/src/services/secrets.ts:1594— secrets.secretService.resolveSecretValueForAgentAccess has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 2 (5 pts), boolean chains 4, error handling 1 (nesting depth added 6). Of this number, 19 points are the body's own statements and 3 belong to one function literal 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.
native-reconstruction-intervening-executions.reconciledInterveningExecutions (cognitive 22) server/src/services/native-runtime/native-reconstruction-intervening-executions.ts:17— native-reconstruction-intervening-executions.reconciledInterveningExecutions has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 8). Of this number, 21 points are the body's own statements and 1 belongs to 2 function literals 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.
agent-records.configPatchFromSnapshot (cognitive 22) server/src/lib/agent-records.ts:235— agent-records.configPatchFromSnapshot has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, ternaries 7, if/else 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.
resource-memberships.resourceMembershipService.updateProject (cognitive 22) server/src/services/resource-memberships.ts:255— resource-memberships.resourceMembershipService.updateProject has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 10 (17 pts), boolean chains 3, if/else 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.
recovery-transport.photonEnvelopeSequence (cognitive 22) server/src/services/photon/recovery-transport.ts:22— recovery-transport.photonEnvelopeSequence has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 2 (nesting depth added 9). Of this number, 14 points are the body's own statements and 8 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.
chat-github-receipt-reactions.applyGitHubReceiptReaction::request (cognitive 22) server/src/services/chat-github-receipt-reactions.ts:116— chat-github-receipt-reactions.applyGitHubReceiptReaction::request has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (4 pts), error handling 2 (3 pts), ternaries 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. This shape REPEATS in the file: one other method here (chat-github-receipt-reactions.applyGitHubReceiptReaction) 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.
chat-github-review-policy.githubReviewLineIsInPatch (cognitive 22) server/src/services/chat-github-review-policy.ts:60— chat-github-review-policy.githubReviewLineIsInPatch has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 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.
native-chat-review-presentation.authorizeNativeChatReviewPresentation (cognitive 22) server/src/services/native-runtime/native-chat-review-presentation.ts:317— native-chat-review-presentation.authorizeNativeChatReviewPresentation has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (8 pts), ternaries 4, 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.
issue-tree-control.issueTreeControlService.restoreIssueStatusesForHold (cognitive 22) server/src/services/issue-tree-control.ts:945— issue-tree-control.issueTreeControlService.restoreIssueStatusesForHold has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 6 (8 pts), boolean chains 1 (nesting depth added 7). Of this number, 16 points are the body's own statements and 6 belong to one function literal 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.
tool-access-policy.timeWindowMatches (cognitive 22) server/src/services/tool-access-policy.ts:473— tool-access-policy.timeWindowMatches has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 7, ternaries 3 (nesting depth added 4). Of this number, 21 points are the body's own statements and 1 belongs to one function literal 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.
plugin-loader.ensureLocalPluginBuilt (cognitive 22) REDACTED:877— plugin-loader.ensureLocalPluginBuilt has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 5 (8 pts), boolean chains 3, error handling 1, 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.
tool-gateway.createToolGatewayService.reflectToolActionInteractionLifecycle (cognitive 22) server/src/services/tool-gateway.ts:2260— tool-gateway.createToolGatewayService.reflectToolActionInteractionLifecycle has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 6, boolean chains 3 (nesting depth added 6). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 2285). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
manager-grants.createSlackManagerGrants.complete (cognitive 22) server/src/services/connectors/slack/setup/manager-grants.ts:99— manager-grants.createSlackManagerGrants.complete has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, ternaries 2 (4 pts), error handling 2 (nesting depth added 4). None of this is in the body itself: all 22 points belong to 3 function literals inside it that branch (lines 103, 128, 108). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
callback-verification.createSlackCallbackVerification.verifySlackRequestUrl (cognitive 22) server/src/services/chat-channels/slack/callback-verification.ts:250— callback-verification.createSlackCallbackVerification.verifySlackRequestUrl has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 8, ternaries 3 (nesting depth added 1). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 258). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
provider-effects.createProviderEffects.lockCurrentProviderEffectAuthorization (cognitive 22) server/src/services/chat-channels/provider-effects.ts:441— provider-effects.createProviderEffects.lockCurrentProviderEffectAuthorization has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7, ternaries 5 (6 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.
git-workspace-expiration-locks.lockPaths (cognitive 22) server/src/services/git-workspace-expiration-locks.ts:13— git-workspace-expiration-locks.lockPaths has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, loops 1 (nesting depth added 7). Of this number, 16 points are the body's own statements and 6 belong to 4 function literals 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.
git-workspace-restoration.finishGitCacheTrash (cognitive 22) server/src/services/git-workspace-restoration.ts:672— git-workspace-restoration.finishGitCacheTrash has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 4, loops 2 (nesting depth added 6). Of this number, 21 points are the body's own statements and 1 belongs to one function literal 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.
nested-clone-migration.inspectStandaloneClone (cognitive 22) server/src/services/nested-clone-migration.ts:191— nested-clone-migration.inspectStandaloneClone has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 5, 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.
execution-workspace-repositories.executionWorkspaceRepositoryService.sharedPublicationPin (cognitive 22) server/src/services/execution-workspace-repositories.ts:288— execution-workspace-repositories.executionWorkspaceRepositoryService.sharedPublicationPin has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, ternaries 1 (nesting depth added 3). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
ai-provider-routing.managedProviderRouting (cognitive 22) server/src/services/ai-provider-routing.ts:9— ai-provider-routing.managedProviderRouting has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 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.
chat-github-wizard.githubChatWizardService.start (cognitive 22) server/src/services/chat-github-wizard.ts:214— chat-github-wizard.githubChatWizardService.start has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 5 (nesting depth added 5). Of this number, 16 points are the body's own statements and 6 belong to one function literal 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.
failed-run-retry.createChatFailedRunRetry.failedChatRetryReceipt (cognitive 22) server/src/services/chat-channels/failed-run-retry.ts:1473— failed-run-retry.createChatFailedRunRetry.failedChatRetryReceipt has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7 (22 pts) (nesting depth added 15). 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.
native-question-bridge.projectNativeRuntimeRequest (cognitive 22) server/src/services/native-runtime/native-question-bridge.ts:116— native-question-bridge.projectNativeRuntimeRequest has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 8, ternaries 3 (4 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.
default-access.createCatalogDefaultAccess.enableCatalogEntriesByDefault (cognitive 22) server/src/services/tool-access/catalog/default-access.ts:42— default-access.createCatalogDefaultAccess.enableCatalogEntriesByDefault has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7 (12 pts), if/else 7, boolean chains 3 (nesting depth added 5). Of this number, 21 points are the body's own statements and 1 belongs to one function literal 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.
projection.summarizeProfile (cognitive 22) server/src/services/tool-access/profiles/projection.ts:106— projection.summarizeProfile has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (5 pts), boolean chains 2, ternaries 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.
aggregator-accounts.createAggregatorAccounts.syncComposioApps (cognitive 22) server/src/services/tool-access/catalog/aggregator-accounts.ts:165— aggregator-accounts.createAggregatorAccounts.syncComposioApps has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 3 (6 pts), error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 12). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 189, updateLease). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
direct-callback.createDirectOAuthCallback::completeOAuthCallback (cognitive 22) server/src/services/tool-access/oauth/direct-callback.ts:55— direct-callback.createDirectOAuthCallback::completeOAuthCallback has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 8 (10 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.
tool-access.gitHubReadGrantAccess (cognitive 22) server/src/services/tool-access.ts:695— tool-access.gitHubReadGrantAccess has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (8 pts), error handling 1 (2 pts), loops 1, ternaries 1 (nesting depth added 4). Of this number, 18 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
tool-access.toolAccessService.createConnection (cognitive 22) server/src/services/tool-access.ts:4464— tool-access.toolAccessService.createConnection has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7 (11 pts), if/else 6 (7 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.
agent-credentials.agentCredentialService.enforceClaudeOAuthBindingClaim (cognitive 22) server/src/services/agent-credentials.ts:114— agent-credentials.agentCredentialService.enforceClaudeOAuthBindingClaim has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 3 (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.
oauth.createPublicMcpOAuth.authorize (cognitive 22) server/src/services/public-mcp/oauth.ts:479— oauth.createPublicMcpOAuth.authorize has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 7 (nesting depth added 4). Of this number, 14 points are the body's own statements and 8 belong to 2 function literals 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.
muse-identity.museIdentity.authenticate (cognitive 22) server/src/services/muse-identity.ts:230— muse-identity.museIdentity.authenticate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, 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.
native-broker.createNativeExternalBroker.forward (cognitive 22) server/src/modules/external-agents/native-broker.ts:94— native-broker.createNativeExternalBroker.forward has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, ternaries 2 (4 pts), error handling 1 (nesting depth added 5). Of this number, 16 points are the body's own statements and 6 belong to 2 function literals 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.
issue-graph-liveness.classifyIssueGraphLiveness (cognitive 22) server/src/services/recovery/issue-graph-liveness.ts:487— issue-graph-liveness.classifyIssueGraphLiveness has cognitive complexity 22 (threshold 15). Drivers by points: if/else 28 (47 pts), boolean chains 13, ternaries 7 (13 pts), loops 4 (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. This shape REPEATS in the file: 2 other methods here (issue-graph-liveness.classifyIssueGraphLiveness::blockedFindingForLeaf, issue-graph-liveness.classifyIssueGraphLiveness::firstBlockedChainFinding) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
agent-commentary.submitAgentCommentary (cognitive 22) server/src/services/agent-commentary.ts:22— agent-commentary.submitAgentCommentary has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 4, error handling 1, ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 36). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
workspace-file-resources.workspaceFileResourceService.prepareDownload (cognitive 22) server/src/services/workspace-file-resources.ts:1750— workspace-file-resources.workspaceFileResourceService.prepareDownload has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, 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.
case-context.getCaseExecutionContext (cognitive 22) server/src/services/case-context.ts:30— case-context.getCaseExecutionContext has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 4 (5 pts), boolean chains 4 (nesting depth added 4). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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-preparation.mergeCoalescedContextSnapshot (cognitive 22) server/src/services/heartbeat/run-preparation.ts:1868— run-preparation.mergeCoalescedContextSnapshot has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 9 (10 pts), ternaries 1 (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.
app.SettingsBody::fixAllConfigurationErrors (cognitive 22) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:6029— app.SettingsBody::fixAllConfigurationErrors has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6, ternaries 2 (4 pts), 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. This shape REPEATS in the file: one other method here (app.SettingsBody) 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.
worker-rpc-host.startWorkerRpcHost.dispatchMethod (cognitive 22) packages/plugins/sdk/src/worker-rpc-host.ts:1629— worker-rpc-host.startWorkerRpcHost.dispatchMethod has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 1 (2 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.
codemod-extract-sizes.main (cognitive 22) scripts/codemod-extract-sizes.mjs:425— codemod-extract-sizes.main has cognitive complexity 22 (threshold 15). Drivers by points: loops 7 (12 pts), if/else 4 (5 pts), boolean chains 3, ternaries 2 (nesting depth added 6). 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.
company-search.compareSearchResults (cognitive 22) server/src/services/company-search.ts:356— company-search.compareSearchResults has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (22 pts) (nesting depth added 9). None of this is in the body itself: all 22 points belong to one function literal inside it that branches (line 357). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
feedback.resolveFeedbackTarget (cognitive 22) server/src/services/feedback.ts:790— feedback.resolveFeedbackTarget has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 4 (8 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.
decisions.decisionService.createInStore (cognitive 22) server/src/services/decisions.ts:191— decisions.decisionService.createInStore has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 7, ternaries 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.
teams-catalog.renderYamlBlock (cognitive 22) server/src/services/teams-catalog.ts:365— teams-catalog.renderYamlBlock has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 6, 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.
skill-source-sync.projectSkillRepositories (cognitive 22) server/src/services/skill-source-sync.ts:28— skill-source-sync.projectSkillRepositories has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (9 pts), boolean chains 6, if/else 3 (6 pts), loops 1 (nesting depth added 8). Of this number, 19 points are the body's own statements and 3 belong to one function literal 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.
assets.sanitizeSvgBuffer (cognitive 22) server/src/routes/assets.ts:27— assets.sanitizeSvgBuffer has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 6, loops 3 (4 pts), error handling 1 (nesting depth added 5). Of this number, 18 points are the body's own statements and 4 belong to one function literal 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.
plugin-api-ws.proxyPluginApiWebSocket (cognitive 22) server/src/realtime/plugin-api-ws.ts:35— plugin-api-ws.proxyPluginApiWebSocket has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, loops 3, error handling 2 (nesting depth added 2). Of this number, 11 points are the body's own statements and 11 belong to 3 function items inside it that branch. 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.
plugin-dev-watcher.resolvePluginWatchTargets (cognitive 22) server/src/services/plugin-dev-watcher.ts:75— plugin-dev-watcher.resolvePluginWatchTargets has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3, loops 2, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 3 function items inside it that branch (addRuntimeFilesFromDir, addWatchTarget, a function literal at line 133). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
chat-webhook-ingress.probeTarget (cognitive 22) scripts/smoke/chat-webhook-ingress.mjs:189— chat-webhook-ingress.probeTarget has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 4 (5 pts), boolean chains 3 (nesting depth added 4). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 234, 273, 216, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
verify-release-registry-state.collectInternalDependencyProblemEntries (cognitive 22) scripts/verify-release-registry-state.mjs:175— verify-release-registry-state.collectInternalDependencyProblemEntries has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (16 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.
verify-release-registry-state.main (cognitive 22) scripts/verify-release-registry-state.mjs:364— verify-release-registry-state.main has cognitive complexity 22 (threshold 15). Drivers by points: loops 6 (10 pts), if/else 5 (9 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 9). Of this number, 21 points are the body's own statements and 1 belongs to one function literal 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.
live-events-ws.authorizeUpgrade (cognitive 22) server/src/realtime/live-events-ws.ts:134— live-events-ws.authorizeUpgrade has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 3 (nesting depth added 10). 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.
SidebarAccountMenu.SidebarAccountMenu (cognitive 22) ui/src/components/SidebarAccountMenu.tsx:120— SidebarAccountMenu.SidebarAccountMenu has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 9, if/else 1 (nesting depth added 2). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
useLocalAiLogin.useLocalAiLogin (cognitive 22) ui/src/components/ai-connections/useLocalAiLogin.ts:6— useLocalAiLogin.useLocalAiLogin has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 4 (7 pts), boolean chains 5, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 48, 28, 71). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SidebarAccountMenu.production.SidebarAccountMenu (cognitive 22) ui/src/components/SidebarAccountMenu.production.tsx:118— SidebarAccountMenu.production.SidebarAccountMenu has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 9, if/else 1 (nesting depth added 2). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
TaskChatProtocolCard.WorkspaceChangeCard (cognitive 22) ui/src/components/task-chat/TaskChatProtocolCard.tsx:390— TaskChatProtocolCard.WorkspaceChangeCard has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 16 (20 pts), boolean chains 1, if/else 1 (nesting depth added 4). Of this number, 17 points are the body's own statements and 5 belong to 3 function literals inside it that branch. 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-log-chunks.applyRetentionBudget (cognitive 22) ui/src/lib/run-log-chunks.ts:85— run-log-chunks.applyRetentionBudget has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, loops 3 (5 pts), 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.
property-picker.PropertyPicker (cognitive 22) ui/src/components/issue-properties/property-picker.tsx:9— property-picker.PropertyPicker has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7 (12 pts), boolean chains 8, if/else 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.
TaskAttachmentPanel.TextAttachmentPreview (cognitive 22) ui/src/components/task-side-panel/TaskAttachmentPanel.tsx:42— TaskAttachmentPanel.TextAttachmentPreview has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 8 (17 pts), boolean chains 5 (nesting depth added 9). 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.
BuiltInBundlePanel.BuiltInBundlePanel (cognitive 22) ui/src/components/BuiltInBundlePanel.tsx:242— BuiltInBundlePanel.BuiltInBundlePanel has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 12, ternaries 6 (7 pts), if/else 3 (nesting depth added 1). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
RoutineHistoryTab.RevisionPreview (cognitive 22) ui/src/components/RoutineHistoryTab.tsx:490— RoutineHistoryTab.RevisionPreview has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 12, ternaries 8 (10 pts) (nesting depth added 2). Of this number, 16 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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.
RoutineHistoryTab.compareTriggers (cognitive 22) ui/src/components/RoutineHistoryTab.tsx:1255— RoutineHistoryTab.compareTriggers has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 2 (8 pts), if/else 4 (7 pts), boolean chains 4, loops 3 (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.
PromptInjectionPreventionSettings.PromptInjectionPreventionSettingsView (cognitive 22) ui/src/components/prompt-injection-prevention/PromptInjectionPreventionSettings.tsx:19— PromptInjectionPreventionSettings.PromptInjectionPreventionSettingsView has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 16, if/else 3, ternaries 3. Of this number, 16 points are the body's own statements and 6 belong to 5 function literals inside it that branch. 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.
GatewayActivityPanel.ActivityRow (cognitive 22) ui/src/pages/apps/gateways/panels/GatewayActivityPanel.tsx:65— GatewayActivityPanel.ActivityRow has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 12 (22 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.
zip.readZipArchive (cognitive 22) ui/src/lib/zip.ts:181— zip.readZipArchive has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, ternaries 2 (3 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.
ExecutionParticipantPicker.ExecutionParticipantPicker (cognitive 22) ui/src/components/ExecutionParticipantPicker.tsx:29— ExecutionParticipantPicker.ExecutionParticipantPicker has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 8, boolean chains 7, if/else 7. Of this number, 11 points are the body's own statements and 11 belong to 8 function items inside it that branch. 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.
JsonSchemaForm.JsonSchemaForm (cognitive 22) REDACTED:1279— JsonSchemaForm.JsonSchemaForm has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (5 pts), boolean chains 3, loops 2 (nesting depth added 7). Most of this is not in the body itself: 4 of the 22 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1326, 1364, 1380). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AiConnectionUsagePanel.overageSummary (cognitive 22) ui/src/components/ai-connections/AiConnectionUsagePanel.tsx:47— AiConnectionUsagePanel.overageSummary has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 5 (14 pts), boolean chains 5, if/else 3 (nesting depth added 9). 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.
CaseHandoffHistory.HandoffRow (cognitive 22) ui/src/components/cases/CaseHandoffHistory.tsx:40— CaseHandoffHistory.HandoffRow has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 10 (17 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.
VoiceControls.VoiceControls (cognitive 22) ui/src/components/voice/VoiceControls.tsx:29— VoiceControls.VoiceControls has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 10, ternaries 6 (10 pts), if/else 2 (nesting depth added 4). Of this number, 19 points are the body's own statements and 3 belong to one function literal 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.
GitHubChatPreview.ReviewCard (cognitive 22) ui/storybook/prototypes/github-chat/GitHubChatPreview.tsx:1706— GitHubChatPreview.ReviewCard has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 9 (19 pts), boolean chains 3 (nesting depth added 10). 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.
ProjectHealthTrial.ProjectHealthContent (cognitive 22) ui/storybook/support/design-proposals/ProjectHealthTrial.tsx:40— ProjectHealthTrial.ProjectHealthContent has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7 (11 pts), boolean chains 6, if/else 3 (5 pts) (nesting depth added 6). Most of this is not in the body itself: 10 of the 22 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 63, a function literal at line 126, a function literal at line 129, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
State::validate (cognitive 22) packages/paperclip-runner/runner/crates/runner-core/src/external_provider_backend.rs:212— State::validate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, loops 3, 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.
feedback.renderFeedbackReport (cognitive 21) cli/src/commands/client/feedback.ts:292— feedback.renderFeedbackReport has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 4 (7 pts), ternaries 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.
company.promptForImportSelection (cognitive 21) cli/src/commands/client/company.ts:419— company.promptForImportSelection has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 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.
secrets.registerSecretCommands (cognitive 21) cli/src/commands/client/secrets.ts:367— secrets.registerSecretCommands has cognitive complexity 21 (threshold 15). Drivers by points: error handling 13, ternaries 4, if/else 3, boolean chains 1. None of this is in the body itself: all 21 points belong to 14 function literals inside it that branch (lines 393, 541, 375, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
service.registerServiceCommands (cognitive 21) cli/src/commands/service.ts:166— service.registerServiceCommands has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 4). Most of this is not in the body itself: 3 of the 21 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 174, 198, 228, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
update.isDatabaseUnreachableError (cognitive 21) cli/src/commands/update.ts:30— update.isDatabaseUnreachableError has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (17 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.
2026-05-23-cli-api-parity-openapi-reference.applyDocumentFixups (cognitive 21) doc/plans/2026-05-23-cli-api-parity-openapi-reference.ts:323— 2026-05-23-cli-api-parity-openapi-reference.applyDocumentFixups has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (18 pts), 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.
execute.prepareGeminiSkillRuntime (cognitive 21) packages/adapter-utils/src/acpx-engine/execute.ts:1440— execute.prepareGeminiSkillRuntime has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 2 (5 pts), error handling 1 (2 pts), loops 2, 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.
execute.classifyError (cognitive 21) packages/adapter-utils/src/acpx-engine/execute.ts:3513— execute.classifyError has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12, ternaries 7 (8 pts), boolean chains 1 (nesting depth added 1). Of this number, 14 points are the body's own statements and 7 belong to one function literal inside it that branches. 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.
usage-checkpoint.createStringCompactor (cognitive 21) packages/adapter-utils/src/usage-checkpoint.ts:32— usage-checkpoint.createStringCompactor has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 1, loops 1 (nesting depth added 9). None of this is in the body itself: all 21 points belong to one function literal inside it that branches (line 35). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
codex-home.stageContainedSubtree (cognitive 21) packages/adapters/codex-local/src/server/codex-home.ts:448— codex-home.stageContainedSubtree has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 10). Of this number, 16 points are the body's own statements and 5 belong to 2 function literals 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.
workspace-diff.capturePaperclipWorkspace::visit (cognitive 21) packages/paperclip-runner/src/live/workspace-diff.ts:84— workspace-diff.capturePaperclipWorkspace::visit has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, error handling 2 (3 pts), ternaries 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.
redaction.redact (cognitive 21) packages/paperclip-runner/src/semantic-tools/redaction.ts:140— redaction.redact has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4, ternaries 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.
codex-security-config.createIsolatedCodexAppServerArgs (cognitive 21) packages/paperclip-runner/src/drivers/codex/codex-security-config.ts:251— codex-security-config.createIsolatedCodexAppServerArgs has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 12, boolean chains 6, if/else 2, loops 1. Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
pi-extension-adapter.createPiProfileExtensionAdapter.notification (cognitive 21) packages/paperclip-runner/src/drivers/acpx/pi-extension-adapter.ts:15— pi-extension-adapter.createPiProfileExtensionAdapter.notification has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (6 pts), boolean chains 3 (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.
CodexHarnessSession.steer (cognitive 21) packages/paperclip-runner/src/drivers/codex/codex-harness-session.ts:332— CodexHarnessSession.steer has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 4, error handling 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.
evidence-redaction.redactCapabilityEvidenceData (cognitive 21) packages/paperclip-runner/src/live/evidence-redaction.ts:285— evidence-redaction.redactCapabilityEvidenceData has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 2 (5 pts), boolean chains 3, match/switch 1 (nesting depth added 9). Of this number, 19 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
evidence-redaction.capabilityEvidenceDetail (cognitive 21) packages/paperclip-runner/src/live/evidence-redaction.ts:382— evidence-redaction.capabilityEvidenceDetail has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8 (15 pts), boolean chains 5, match/switch 1 (nesting depth added 7). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DurablePrpControlPlane.rotateRunIdentity (cognitive 21) REDACTED:1728— DurablePrpControlPlane.rotateRunIdentity has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 4, 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.
runtime-context-materializer.materializeNativeRuntimeSkills (cognitive 21) packages/paperclip-runner/src/drivers/runtime-context-materializer.ts:208— runtime-context-materializer.materializeNativeRuntimeSkills has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 5 (10 pts), error handling 1 (nesting depth added 10). Of this number, 20 points are the body's own statements and 1 belongs to one function literal 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.
forbidden-imports.violationReason (cognitive 21) packages/paperclip-runner/scripts/lib/forbidden-imports.mjs:166— forbidden-imports.violationReason has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 8 (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.
runner-tool-bridge.taggedValue (cognitive 21) packages/paperclip-runner/src/drivers/runner-tool-bridge.ts:761— runner-tool-bridge.taggedValue has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (15 pts), ternaries 2 (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.
CodexAcpxDriver.#retryQuarantinedHostCleanups (cognitive 21) REDACTED:667— CodexAcpxDriver.#retryQuarantinedHostCleanups has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 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.
workflow-scoring.scoreRunnerWorkflow (cognitive 21) packages/paperclip-runner/src/eval/workflow-scoring.ts:90— workflow-scoring.scoreRunnerWorkflow has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 7 (12 pts), boolean chains 7, if/else 1, 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.
ai-connection-usage.readUsage (cognitive 21) server/src/services/ai-connection-usage.ts:66— ai-connection-usage.readUsage has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 5 (7 pts), boolean chains 1, error handling 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.
legacy-workspace-restore-recovery.preserveLegacyWorkspaceRestoreSources (cognitive 21) server/src/services/legacy-workspace-restore-recovery.ts:67— legacy-workspace-restore-recovery.preserveLegacyWorkspaceRestoreSources has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 5, loops 1, ternaries 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.
issue-recovery-actions.issueRecoveryActionService.projectNativeRunActivity (cognitive 21) server/src/services/issue-recovery-actions.ts:160— issue-recovery-actions.issueRecoveryActionService.projectNativeRunActivity has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (7 pts), loops 3, ternaries 2 (3 pts) (nesting depth added 4). Of this number, 19 points are the body's own statements and 2 belong to one function literal 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.
issue-execution-policy.applyMonitorTransition (cognitive 21) server/src/services/issue-execution-policy.ts:1062— issue-execution-policy.applyMonitorTransition has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 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.
agent-conversations.settleConversationTurn (cognitive 21) server/src/services/agent-conversations.ts:283— agent-conversations.settleConversationTurn has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8 (9 pts), if/else 7, boolean chains 5 (nesting depth added 1). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 292). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
case-access.assertCaseTrustedForExecution (cognitive 21) server/src/services/case-access.ts:56— case-access.assertCaseTrustedForExecution has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8, boolean chains 5, loops 4, ternaries 4. Of this number, 19 points are the body's own statements and 2 belong to 3 function items inside it that branch. 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.
chat-question-forms.formKind (cognitive 21) server/src/services/chat-question-forms.ts:216— chat-question-forms.formKind has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 3 (8 pts), if/else 5 (7 pts), boolean chains 6 (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.
interactions.parsePhotonQuestionAnswer (cognitive 21) server/src/services/photon/interactions.ts:76— interactions.parsePhotonQuestionAnswer has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, ternaries 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.
paperclip-cloud-connector-enrollment.startPaperclipCloudConnectorEnrollmentUnlocked (cognitive 21) server/src/services/paperclip-cloud-connector-enrollment.ts:145— paperclip-cloud-connector-enrollment.startPaperclipCloudConnectorEnrollmentUnlocked has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 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.
chat-sdk-runtime.createProviderAdapter (cognitive 21) server/src/services/chat-sdk-runtime.ts:1351— chat-sdk-runtime.createProviderAdapter has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, ternaries 1 (2 pts), match/switch 1 (nesting depth added 6). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 1439, 1410, 1403, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
speko-call-report.parseSpekoCallReport (cognitive 21) server/src/services/voice/speko-call-report.ts:33— speko-call-report.parseSpekoCallReport has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 6, if/else 3 (6 pts), ternaries 4 (6 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
voice-inbound-service.voiceInboundService.pendingTool (cognitive 21) server/src/services/voice/voice-inbound-service.ts:167— voice-inbound-service.voiceInboundService.pendingTool has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (6 pts), boolean chains 2 (nesting depth added 9). None of this is in the body itself: all 21 points belong to one function literal inside it that branches (line 168). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
credentials.verifyGitHubCredentials (cognitive 21) server/src/services/chat-channels/github/credentials.ts:26— credentials.verifyGitHubCredentials has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8 (13 pts), boolean chains 6, if/else 2 (nesting depth added 5). Of this number, 17 points are the body's own statements and 4 belong to one function literal 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.
isolated-task-directory-snapshot.walk::visit (cognitive 21) server/src/services/isolated-task-directory-snapshot.ts:60— isolated-task-directory-snapshot.walk::visit has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 2 (3 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.
isolated-repository-rehome.cloneDisposable (cognitive 21) server/src/services/isolated-repository-rehome.ts:540— isolated-repository-rehome.cloneDisposable has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (14 pts), ternaries 5, boolean chains 1, error handling 1 (nesting depth added 1). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
workspace-login-handoff.verifyWorkspaceHandoffTicket (cognitive 21) server/src/auth/workspace-login-handoff.ts:322— workspace-login-handoff.verifyWorkspaceHandoffTicket has cognitive complexity 21 (threshold 15). Drivers by points: if/else 20, error handling 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.
local-service-supervisor.terminateLocalService (cognitive 21) server/src/services/local-service-supervisor.ts:548— local-service-supervisor.terminateLocalService has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 4, error handling 2, boolean chains 1, loops 1 (nesting depth added 2). Of this number, 13 points are the body's own statements and 8 belong to 2 function items inside it that branch. 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.
projects.projectService.replaceRepositories (cognitive 21) server/src/services/projects.ts:929— projects.projectService.replaceRepositories has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, loops 2 (nesting depth added 7). None of this is in the body itself: all 21 points belong to 2 function literals inside it that branch (lines 930, 954). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspaces.applyPersistedExecutionWorkspaceConfig (cognitive 21) server/src/services/heartbeat/workspaces.ts:159— workspaces.applyPersistedExecutionWorkspaceConfig has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (20 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.
execution-workspaces.executionWorkspaceService.resolveSourceWorkspaceConfiguration (cognitive 21) server/src/services/execution-workspaces.ts:1434— execution-workspaces.executionWorkspaceService.resolveSourceWorkspaceConfiguration has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 13 (15 pts), boolean chains 5, if/else 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.
execution-workspaces.executionWorkspaceService.validateSelection (cognitive 21) server/src/services/execution-workspaces.ts:1482— execution-workspaces.executionWorkspaceService.validateSelection has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 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.
chat-discord-native-commands.parseDiscordNativeCommand (cognitive 21) server/src/services/chat-discord-native-commands.ts:86— chat-discord-native-commands.parseDiscordNativeCommand has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, ternaries 6 (7 pts), if/else 6 (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.
outbound-attachments.hydrateOutboundAttachment (cognitive 21) server/src/services/chat-channels/outbound-attachments.ts:75— outbound-attachments.hydrateOutboundAttachment has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 4 (6 pts), boolean chains 5, error handling 1, loops 1 (nesting depth added 4). Of this number, 19 points are the body's own statements and 2 belong to 2 function literals 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.
fast-responses.fastResponseService.resolve (cognitive 21) server/src/services/fast-responses.ts:423— fast-responses.fastResponseService.resolve has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, ternaries 3 (4 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.
email-channels.emailChannelService.catchUp (cognitive 21) server/src/services/email-channels.ts:1923— email-channels.emailChannelService.catchUp has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, ternaries 1 (4 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.
file-transfer-authority.createTeamsFileAuthority.teamsFileSourceBinding (cognitive 21) server/src/services/chat-channels/microsoft-teams/file-transfer-authority.ts:379— file-transfer-authority.createTeamsFileAuthority.teamsFileSourceBinding has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, ternaries 3, 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.
file-delivery.createTeamsFileDelivery.teamsTransferProtocol (cognitive 21) server/src/services/chat-channels/microsoft-teams/file-delivery.ts:69— file-delivery.createTeamsFileDelivery.teamsTransferProtocol has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 8, ternaries 2 (3 pts) (nesting depth added 1). None of this is in the body itself: all 21 points belong to 3 function items inside it that branch (a function literal at line 112, currentRuntime, a function literal at line 191). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
chat-publication-text-parts.boundedMarkdownBlocks (cognitive 21) server/src/services/chat-publication-text-parts.ts:123— chat-publication-text-parts.boundedMarkdownBlocks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 4, loops 1 (nesting depth added 5). Of this number, 15 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.
file-receipts.createSlackFileReceipts.lockSlackFileReceiptAuthorization (cognitive 21) server/src/services/chat-channels/slack/file-receipts.ts:330— file-receipts.createSlackFileReceipts.lockSlackFileReceiptAuthorization has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 5, if/else 5 (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.
webhook-events.createGitHubWebhookEvents.handleGitHubWebhookEvent (cognitive 21) server/src/services/chat-channels/github/webhook-events.ts:54— webhook-events.createGitHubWebhookEvents.handleGitHubWebhookEvent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (21 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.
endpoints.createChatEndpoints.create (cognitive 21) server/src/services/chat-channels/endpoints.ts:239— endpoints.createChatEndpoints.create has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, ternaries 3 (4 pts) (nesting depth added 3). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 276). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
grant-refresh.createOAuthGrantRefresh::refreshOAuthGrantCredentials (cognitive 21) server/src/services/tool-access/oauth/grant-refresh.ts:38— grant-refresh.createOAuthGrantRefresh::refreshOAuthGrantCredentials has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (7 pts), ternaries 4 (6 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.
github-access-discovery.loadGitHubTokenRepositories (cognitive 21) server/src/services/tool-access/github-access-discovery.ts:10— github-access-discovery.loadGitHubTokenRepositories has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
health.createToolRuntimeHealth (cognitive 21) server/src/services/tool-access/runtime/health.ts:197— health.createToolRuntimeHealth has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 16, ternaries 4 (5 pts) (nesting depth added 1). None of this is in the body itself: all 21 points belong to 15 function items inside it that branch (runtimeHealth, a function literal at line 303, a function literal at line 256, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
issue-thread-interactions.resolveRequestItemVerdictSubmissions (cognitive 21) server/src/services/issue-thread-interactions.ts:1597— issue-thread-interactions.resolveRequestItemVerdictSubmissions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 4 (8 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.
client-metadata.createClientMetadataResolver (cognitive 21) server/src/services/public-mcp/client-metadata.ts:49— client-metadata.createClientMetadataResolver has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 4, loops 2, ternaries 1 (nesting depth added 3). None of this is in the body itself: all 21 points belong to one function literal inside it that branches (line 51). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
issues.listBlockedInboxIssues (cognitive 21) server/src/services/issues.ts:6431— issues.listBlockedInboxIssues has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 9, loops 2 (5 pts), if/else 4, boolean chains 3 (nesting depth added 3). Of this number, 15 points are the body's own statements and 6 belong to one function literal inside it that branches. 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.
native-runner-execution-driver.createNativeRunnerExecutionDriver.controlPlaneRegistration (cognitive 21) server/src/services/native-runtime/native-runner-execution-driver.ts:68— native-runner-execution-driver.createNativeRunnerExecutionDriver.controlPlaneRegistration has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 4 (7 pts), boolean chains 2 (nesting depth added 4). None of this is in the body itself: all 21 points belong to 4 function literals inside it that branch (lines 73, 292, 273, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
provider-pack-layers.stageProviderPackLayers (cognitive 21) server/src/services/native-runtime/provider-pack-layers.ts:102— provider-pack-layers.stageProviderPackLayers has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, loops 2 (3 pts), error handling 1, ternaries 1 (nesting depth added 3). Of this number, 12 points are the body's own statements and 9 belong to 3 function items inside it that branch. 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.
skill-version-retention.skillVersionRetentionService.tick (cognitive 21) server/src/services/skill-version-retention.ts:427— skill-version-retention.skillVersionRetentionService.tick has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 3 (5 pts), ternaries 3 (5 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
github-commit-details.createGitHubCommitDiffDetailsResolver (cognitive 21) server/src/services/github-commit-details.ts:82— github-commit-details.createGitHubCommitDiffDetailsResolver has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 5, error handling 1, loops 1, ternaries 1 (nesting depth added 6). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 92). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-session-executor.closeIdleWarmNativeSessions (cognitive 21) server/src/services/native-runtime/native-session-executor.ts:720— native-session-executor.closeIdleWarmNativeSessions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 2, error handling 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.
native-restart-recovery.classifyNativeRunnerRecoveryEvidence (cognitive 21) server/src/services/native-runtime/native-restart-recovery.ts:294— native-restart-recovery.classifyNativeRunnerRecoveryEvidence has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6, ternaries 2 (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.
service.recoveryService.scheduleDispositionRepairAttempt (cognitive 21) REDACTED:3220— service.recoveryService.scheduleDispositionRepairAttempt has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 4 (6 pts), error handling 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.
heartbeat.heartbeatService.applyWakeQueuePostCommitEffects (cognitive 21) server/src/services/heartbeat.ts:1468— heartbeat.heartbeatService.applyWakeQueuePostCommitEffects has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (7 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.
app.buildBrowseTree (cognitive 21) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:3122— app.buildBrowseTree has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 5 (6 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 6). Of this number, 13 points are the body's own statements and 8 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.
core.startWikiQuerySession (cognitive 21) packages/plugins/plugin-llm-wiki/src/wiki/core.ts:3836— core.startWikiQuerySession has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 4, boolean chains 3 (nesting depth added 7). Most of this is not in the body itself: 5 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 3906). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
CreateosClient.transition (cognitive 21) packages/plugins/sandbox-providers/createos/src/client.ts:108— CreateosClient.transition has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (5 pts), boolean chains 3, error handling 1 (3 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.
file-sync.assertTarballEntriesConfined (cognitive 21) packages/plugins/sandbox-providers/kubernetes/src/file-sync.ts:372— file-sync.assertTarballEntriesConfined has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (18 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.
catalog-builder.collectSkillFiles::visit (cognitive 21) packages/skills-catalog/src/catalog-builder.ts:676— catalog-builder.collectSkillFiles::visit has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 1 (3 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.
catalog-builder.collectTeamFiles::visit (cognitive 21) packages/teams-catalog/src/catalog-builder.ts:373— catalog-builder.collectTeamFiles::visit has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 1 (3 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.
company-export-readme.generateReadme (cognitive 21) server/src/services/company-export-readme.ts:74— company-export-readme.generateReadme has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10, loops 4 (8 pts), ternaries 1 (3 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.
agent-harness-verification.agentHarnessVerificationService.verify (cognitive 21) server/src/services/agent-harness-verification.ts:41— agent-harness-verification.agentHarnessVerificationService.verify has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8, ternaries 5 (8 pts), boolean chains 5 (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.
issues.readToolActionContinuationContext (cognitive 21) server/src/routes/issues.ts:2290— issues.readToolActionContinuationContext has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 7, 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.
idle-scheduled-work.readIdleRoutineSchedule (cognitive 21) server/src/services/idle-scheduled-work.ts:16— idle-scheduled-work.readIdleRoutineSchedule has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, error handling 1 (3 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.
case-handoff-delivery.caseHandoffDeliveryService.deliver (cognitive 21) server/src/services/case-handoff-delivery.ts:81— case-handoff-delivery.caseHandoffDeliveryService.deliver has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 6 (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.
SidebarSection.SidebarSectionHeader (cognitive 21) ui/src/components/SidebarSection.tsx:66— SidebarSection.SidebarSectionHeader has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 7, if/else 2 (4 pts) (nesting depth added 5). Of this number, 15 points are the body's own statements and 6 belong to one function literal 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.
angle-bracket-markdown.transformInlineChunk (cognitive 21) ui/src/lib/angle-bracket-markdown.ts:138— angle-bracket-markdown.transformInlineChunk has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (4 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.
composer-run-settings.composerEfforts (cognitive 21) ui/src/components/task-chat/composer-run-settings.ts:63— composer-run-settings.composerEfforts has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9, ternaries 3 (7 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.
DevRestartBanner.DevRestartBanner (cognitive 21) ui/src/components/DevRestartBanner.tsx:33— DevRestartBanner.DevRestartBanner has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 12 (16 pts), if/else 3, boolean chains 1, error handling 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 6 belong to 2 function items inside it that branch. 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.
shell-navigation.classifyShellRoute (cognitive 21) ui/src/lib/shell-navigation.ts:25— shell-navigation.classifyShellRoute has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (15 pts), boolean chains 6 (nesting depth added 10). 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.
slots.loadPluginModule (cognitive 21) ui/src/plugins/slots.tsx:472— slots.loadPluginModule has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3, boolean chains 1, error handling 1 (nesting depth added 6). Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 499). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
AdapterLoginChrome.LocalProviderLoginInstructions (cognitive 21) ui/src/components/AdapterLoginChrome.tsx:470— AdapterLoginChrome.LocalProviderLoginInstructions has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 14, ternaries 3 (4 pts), if/else 2, error handling 1 (nesting depth added 1). Of this number, 18 points are the body's own statements and 3 belong to 2 function items inside it that branch. 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.
schema-config-fields.ComboboxField (cognitive 21) ui/src/adapters/schema-config-fields.tsx:65— schema-config-fields.ComboboxField has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 8, loops 1, ternaries 1 (nesting depth added 2). Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to 6 function items inside it that branch (handleKeyDown, a function literal at line 85, a function literal at line 168, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
BreadcrumbBar.production.BreadcrumbBar (cognitive 21) ui/src/components/BreadcrumbBar.production.tsx:42— BreadcrumbBar.production.BreadcrumbBar has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, ternaries 5 (8 pts), if/else 3 (nesting depth added 3). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 117). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
SidebarShell.production.SidebarShell (cognitive 21) ui/src/components/SidebarShell.production.tsx:91— SidebarShell.production.SidebarShell has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8 (10 pts), if/else 8, boolean chains 3 (nesting depth added 2). Of this number, 13 points are the body's own statements and 8 belong to 4 function literals inside it that branch. 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.
issue-detail-subissues.buildIssueSiblingNavigation (cognitive 21) ui/src/lib/issue-detail-subissues.ts:66— issue-detail-subissues.buildIssueSiblingNavigation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 4 (7 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 7). Of this number, 20 points are the body's own statements and 1 belongs to one function literal 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.
useIssueHistoryWindow.useIssueHistoryWindow (cognitive 21) ui/src/hooks/useIssueHistoryWindow.ts:13— useIssueHistoryWindow.useIssueHistoryWindow has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 41, 33). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
LiveUpdatesProvider.LiveUpdatesProvider (cognitive 21) ui/src/context/LiveUpdatesProvider.tsx:2021— LiveUpdatesProvider.LiveUpdatesProvider has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 9, ternaries 2. Most of this is not in the body itself: 3 of the 21 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 2145, 2089, 2123, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
adjacent-errors.compactAdjacentErrors (cognitive 21) ui/src/components/task-chat/adjacent-errors.ts:34— adjacent-errors.compactAdjacentErrors has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 10). Of this number, 19 points are the body's own statements and 2 belong to one function literal 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.
question-validation-pattern.matchSafeQuestionValidationPattern (cognitive 21) ui/src/components/task-chat/question-validation-pattern.ts:102— question-validation-pattern.matchSafeQuestionValidationPattern has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 1, loops 1, ternaries 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.
RichWorkProductCard.stateChipFor (cognitive 21) ui/src/components/task-chat/RichWorkProductCard.tsx:36— RichWorkProductCard.stateChipFor has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10, boolean chains 9, ternaries 1 (2 pts) (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.
TaskChatProtocolCard.ResourceCard (cognitive 21) ui/src/components/task-chat/TaskChatProtocolCard.tsx:1040— TaskChatProtocolCard.ResourceCard has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 5 (9 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.
transcriptPresentation.summarizeToolInput (cognitive 21) ui/src/lib/transcriptPresentation.ts:125— transcriptPresentation.summarizeToolInput has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 5 (8 pts), boolean chains 3 (nesting depth added 4). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
issue-chat-messages.runDurationLabel (cognitive 21) ui/src/lib/issue-chat-messages.ts:798— issue-chat-messages.runDurationLabel has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 2 (4 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.
IssueChatThread.IssueChatToolPart (cognitive 21) ui/src/components/IssueChatThread.tsx:1597— IssueChatThread.IssueChatToolPart has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 11 (17 pts), boolean chains 3, if/else 1 (nesting depth added 6). Of this number, 20 points are the body's own statements and 1 belongs to one function literal 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.
DocumentAnnotationPanel.ThreadCard (cognitive 21) ui/src/components/DocumentAnnotationPanel.tsx:318— DocumentAnnotationPanel.ThreadCard has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (9 pts), boolean chains 7, if/else 2 (5 pts) (nesting depth added 7). Of this number, 15 points are the body's own statements and 6 belong to one function literal 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.
SidePanelTabs.SidePanelTabs (cognitive 21) ui/src/components/side-panel/SidePanelTabs.tsx:159— SidePanelTabs.SidePanelTabs has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 23 (35 pts), if/else 15 (17 pts), boolean chains 14 (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. This shape REPEATS in the file: one other method here (SidePanelTabs.SidePanelTabs::handleKeyDown) 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.
BudgetIncidentCard.BudgetIncidentCard (cognitive 21) ui/src/components/BudgetIncidentCard.tsx:28— BudgetIncidentCard.BudgetIncidentCard has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 15 (17 pts), boolean chains 3, if/else 1 (nesting depth added 2). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
ProfileDetail.ProfileDetail (cognitive 21) ui/src/pages/tools/profiles/ProfileDetail.tsx:49— ProfileDetail.ProfileDetail has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8 (9 pts), if/else 6 (7 pts), boolean chains 4, loops 1 (nesting depth added 2). Of this number, 13 points are the body's own statements and 8 belong to 5 function literals inside it that branch. 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.
Browse.ConnectionAccountRow (cognitive 21) ui/src/pages/apps/Browse.tsx:1347— Browse.ConnectionAccountRow has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10 (16 pts), boolean chains 5 (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.
ArtifactRow.ArtifactRow (cognitive 21) ui/src/components/artifacts/v1/ArtifactRow.tsx:123— ArtifactRow.ArtifactRow has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 9 (16 pts), if/else 1 (4 pts), boolean chains 1 (nesting depth added 10). Of this number, 15 points are the body's own statements and 6 belong to 2 function literals 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.
AgentsUsingSkillDialog.AgentsUsingSkillDialog (cognitive 21) ui/src/components/skill-studio/AgentsUsingSkillDialog.tsx:95— AgentsUsingSkillDialog.AgentsUsingSkillDialog has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10 (15 pts), if/else 3, boolean chains 2, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 168, a function literal at line 203, a function literal at line 129, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TaskVoiceLauncher.TaskVoiceLauncher (cognitive 21) ui/src/components/voice/TaskVoiceLauncher.tsx:10— TaskVoiceLauncher.TaskVoiceLauncher has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 7, if/else 6 (7 pts), ternaries 4 (7 pts) (nesting depth added 4). Of this number, 14 points are the body's own statements and 7 belong to 4 function literals 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.
ConnectionSetupFlow.connectionDefaultSummarySentence (cognitive 21) ui/src/features/connections/ConnectionSetupFlow.tsx:4534— ConnectionSetupFlow.connectionDefaultSummarySentence has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8 (21 pts) (nesting depth added 13). 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.
ConnectorCatalogNavigation.nativeRows (cognitive 21) ui/storybook/prototypes/ConnectorCatalogNavigation.tsx:36— ConnectorCatalogNavigation.nativeRows has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 11 (19 pts), boolean chains 1, if/else 1 (nesting depth added 8). None of this is in the body itself: all 21 points belong to 3 function literals inside it that branch (lines 37, 50, 50). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AcpxProviderSessionConfig::validate (cognitive 21) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs:109— AcpxProviderSessionConfig::validate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 5, 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.
ProviderStartupAttempt::validate (cognitive 21) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:143— ProviderStartupAttempt::validate has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 13, if/else 5, match/switch 2 (3 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.
parseStdoutLine (cognitive 21) packages/adapters/hermes/gateway-ui-parser.cjs:51— parseStdoutLine has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (9 pts), ternaries 1 (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.
storage.promptStorage (cognitive 20) cli/src/prompts/storage.ts:25— storage.promptStorage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 7 (nesting depth added 2). Of this number, 13 points are the body's own statements and 7 belong to 3 function literals inside it that branch. 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.
env.envCommand (cognitive 20) cli/src/commands/env.ts:39— env.envCommand has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 6, boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 5). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 4 function items inside it that branch (formatSection, a function literal at line 59, a function literal at line 60, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
worktree.acquireWorktreeSeedLock (cognitive 20) cli/src/commands/worktree.ts:2053— worktree.acquireWorktreeSeedLock has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, error handling 2 (4 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 8). Of this number, 17 points are the body's own statements and 3 belong to one function literal 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.
server-utils.resolveCommandPath (cognitive 20) REDACTED:3570— server-utils.resolveCommandPath has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 2 (4 pts), loops 2 (3 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.
server-utils.buildRuntimeMountedSkillSnapshot (cognitive 20) REDACTED:3831— server-utils.buildRuntimeMountedSkillSnapshot has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 3 (7 pts), loops 3 (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.
workspace-restore-merge.acquireDirectoryMergeLock (cognitive 20) packages/adapter-utils/src/workspace-restore-merge.ts:369— workspace-restore-merge.acquireDirectoryMergeLock has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, error handling 2 (3 pts), loops 2 (nesting depth added 5). Of this number, 12 points are the body's own statements and 8 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.
execution-target.ensureAdapterExecutionTargetRuntimeCommandInstalled (cognitive 20) REDACTED:1166— execution-target.ensureAdapterExecutionTargetRuntimeCommandInstalled has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, ternaries 1 (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.
parse-stdout.parseCursorToolCallEvent (cognitive 20) packages/adapters/cursor-local/src/ui/parse-stdout.ts:182— parse-stdout.parseCursorToolCallEvent has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (11 pts), boolean chains 5, if/else 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.
runtime-config.attributeOpenCodeProviders (cognitive 20) packages/adapters/opencode-local/src/server/runtime-config.ts:277— runtime-config.attributeOpenCodeProviders has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (13 pts), if/else 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 10). Of this number, 13 points are the body's own statements and 7 belong to one function literal 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.
build-config.buildPiLocalConfig (cognitive 20) packages/adapters/pi-local/src/ui/build-config.ts:3— build-config.buildPiLocalConfig has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
replay-contract.versionIssues (cognitive 20) packages/paperclip-runner/src/protocol/replay-contract.ts:169— replay-contract.versionIssues has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 7, loops 1 (nesting depth added 4). Of this number, 11 points are the body's own statements and 9 belong to one function literal 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-turn-diff.parseCodexTurnDiff::finish (cognitive 20) packages/paperclip-runner/src/drivers/codex/codex-turn-diff.ts:93— codex-turn-diff.parseCodexTurnDiff::finish has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 7 (13 pts), boolean chains 5, if/else 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. This shape REPEATS in the file: one other method here (codex-turn-diff.parseCodexTurnDiff) 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-security-config.codexNetworkReadOnlyRoots (cognitive 20) packages/paperclip-runner/src/drivers/codex/codex-security-config.ts:13— codex-security-config.codexNetworkReadOnlyRoots has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (5 pts), loops 2 (5 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-security-config.codexExecutableReadOnlyRoots (cognitive 20) packages/paperclip-runner/src/drivers/codex/codex-security-config.ts:32— codex-security-config.codexExecutableReadOnlyRoots has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, error handling 3, ternaries 3 (nesting depth added 2). Of this number, 14 points are the body's own statements and 6 belong to 2 function items inside it that branch. 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.
JsonStringReader.consume (cognitive 20) packages/paperclip-runner/src/drivers/opencode/sse-frames.ts:399— JsonStringReader.consume has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 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.
opencode-server-driver.resolvePinnedOpenCodeCommand (cognitive 20) REDACTED:100— opencode-server-driver.resolvePinnedOpenCodeCommand has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, error handling 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.
codex-command.resolveCodexCommand (cognitive 20) packages/paperclip-runner/src/drivers/codex/codex-command.ts:6— codex-command.resolveCodexCommand has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 4 (5 pts), boolean chains 2, ternaries 1 (nesting depth added 5). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
codex-credentials.acquireCredentialHomeLock (cognitive 20) packages/paperclip-runner/src/drivers/acpx/codex-credentials.ts:362— codex-credentials.acquireCredentialHomeLock has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 3 (4 pts), boolean chains 2, loops 1 (nesting depth added 5). Of this number, 18 points are the body's own statements and 2 belong to one function literal 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-runtime-adapter.goalSnapshotFromAcpMessage (cognitive 20) packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts:2157— codex-runtime-adapter.goalSnapshotFromAcpMessage has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 5, if/else 4 (nesting depth added 3). Of this number, 16 points are the body's own statements and 4 belong to 2 function items inside it that branch. 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.
compatibility.assertPaperclipRunnerCompatibility (cognitive 20) packages/paperclip-runner/src/compatibility.ts:78— compatibility.assertPaperclipRunnerCompatibility has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (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.
CapabilityToolAuthorizationEngine.#evaluate (cognitive 20) packages/paperclip-runner/src/tools/capability-tool-authorization.ts:85— CapabilityToolAuthorizationEngine.#evaluate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5, ternaries 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.
CapabilitySemanticToolRuntime.#completeExtensionExecution (cognitive 20) packages/paperclip-runner/src/tools/capability-semantic-tool-runtime.ts:1047— CapabilitySemanticToolRuntime.#completeExtensionExecution has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, ternaries 1 (3 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.
capability-semantic-tool-runtime.commandForOperation (cognitive 20) packages/paperclip-runner/src/tools/capability-semantic-tool-runtime.ts:1524— capability-semantic-tool-runtime.commandForOperation has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 9 (18 pts), boolean chains 1, 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.
PiTurnUsage.accept (cognitive 20) packages/paperclip-runner/src/drivers/acpx/pi-acp-runtime.ts:519— PiTurnUsage.accept has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, ternaries 3 (4 pts), loops 1 (nesting depth added 2). 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, 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.
eval-execution.assertEvalBehaviorFaultMatrix (cognitive 20) packages/paperclip-runner/src/eval/eval-execution.ts:761— eval-execution.assertEvalBehaviorFaultMatrix has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (4 pts), boolean chains 3, ternaries 1 (nesting depth added 8). Of this number, 18 points are the body's own statements and 2 belong to 2 function literals 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.
workflow-report.runnerWorkflowAlerts (cognitive 20) packages/paperclip-runner/src/eval/workflow-report.ts:211— workflow-report.runnerWorkflowAlerts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, ternaries 2, loops 1 (nesting depth added 3). Of this number, 16 points are the body's own statements and 4 belong to 3 function literals inside it that branch. 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.
native-session-runtime.replayCheckpointedTurnTerminal (cognitive 20) packages/paperclip-runner/src/native-session-runtime.ts:1645— native-session-runtime.replayCheckpointedTurnTerminal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, loops 2 (3 pts), ternaries 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.
redaction.rawQuotedValueEnd (cognitive 20) server/src/redaction.ts:463— redaction.rawQuotedValueEnd has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 2, loops 1, ternaries 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.
plugin-event-bus.passesFilter (cognitive 20) server/src/services/plugin-event-bus.ts:89— plugin-event-bus.passesFilter has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (10 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.
secrets.secretService.createCurrentUserSecretValue (cognitive 20) server/src/services/secrets.ts:2990— secrets.secretService.createCurrentUserSecretValue has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, error handling 3, ternaries 1 (nesting depth added 4). Of this number, 19 points are the body's own statements and 1 belongs to one function literal 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.
budgets.budgetServiceInTransaction.evaluateAffectedScopes (cognitive 20) server/src/services/budgets.ts:623— budgets.budgetServiceInTransaction.evaluateAffectedScopes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, loops 3 (nesting depth added 8). Of this number, 19 points are the body's own statements and 1 belongs to one function literal 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.
PhotonCloudClient.allocation (cognitive 20) server/src/services/photon/cloud.ts:193— PhotonCloudClient.allocation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, ternaries 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.
UploadCapability.exchange (cognitive 20) server/src/services/chat-teams-file-consent.ts:422— UploadCapability.exchange has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 5, error handling 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.
chat-github-attachments.githubAttachmentCommentFetch (cognitive 20) REDACTED:451— chat-github-attachments.githubAttachmentCommentFetch has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 5 (7 pts), boolean chains 3, loops 1 (nesting depth added 8). None of this is in the body itself: all 20 points belong to one function literal inside it that branches (line 455). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
chat-sdk-runtime.installDiscordNativeCommands (cognitive 20) server/src/services/chat-sdk-runtime.ts:710— chat-sdk-runtime.installDiscordNativeCommands has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 19, if/else 1. Of this number, 19 points are the body's own statements and 1 belongs to 2 function items inside it that branch. 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.
chat-provider-inventory.listSlackBotChannels (cognitive 20) server/src/services/chat-provider-inventory.ts:62— chat-provider-inventory.listSlackBotChannels has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 3 (7 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
heartbeat-run-summary.summarizeHeartbeatRunResultJson (cognitive 20) server/src/services/heartbeat-run-summary.ts:65— heartbeat-run-summary.summarizeHeartbeatRunResultJson has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5, boolean chains 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.
speko-provider.createSpekoProvider.request (cognitive 20) server/src/services/voice/speko-provider.ts:21— speko-provider.createSpekoProvider.request has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 4 (6 pts), boolean chains 2, error handling 2, loops 1 (nesting depth added 8). 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.
distribution-plugin-catalog.readDistributionPluginCatalog (cognitive 20) server/src/services/distribution-plugin-catalog.ts:126— distribution-plugin-catalog.readDistributionPluginCatalog has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6, loops 1, ternaries 1 (nesting depth added 2). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 142). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
voice-session-service.voiceSessionService.closeProviderOnce (cognitive 20) server/src/services/voice/voice-session-service.ts:141— voice-session-service.voiceSessionService.closeProviderOnce has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (5 pts), ternaries 1 (2 pts) (nesting depth added 10). Of this number, 19 points are the body's own statements and 1 belongs to one function literal 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.
plugin-workspaces.callWorkspaceProvider (cognitive 20) server/src/services/plugin-workspaces.ts:73— plugin-workspaces.callWorkspaceProvider has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, ternaries 3 (4 pts), error handling 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.
git-restore-point.rawIgnoredTree (cognitive 20) REDACTED:227— git-restore-point.rawIgnoredTree has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (3 pts), ternaries 1 (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.
git-workspace-restoration.inspectRecipe (cognitive 20) server/src/services/git-workspace-restoration.ts:572— git-workspace-restoration.inspectRecipe has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, loops 1 (2 pts), error handling 1, ternaries 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.
git-workspace-restoration.restoreGitCacheBase (cognitive 20) server/src/services/git-workspace-restoration.ts:714— git-workspace-restoration.restoreGitCacheBase has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (3 pts), boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 4 belong to 2 function literals 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.
workspace-instance-cleanup.readVerifiedPostgresCommand (cognitive 20) server/src/services/workspace-instance-cleanup.ts:107— workspace-instance-cleanup.readVerifiedPostgresCommand has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 2 (3 pts), boolean chains 2, 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.
workspace-runtime.waitForRuntimeServiceReadiness (cognitive 20) server/src/services/workspace-runtime.ts:5351— workspace-runtime.waitForRuntimeServiceReadiness has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, 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.
fast-responses.fastResponseSourceCurrent (cognitive 20) server/src/services/fast-responses.ts:210— fast-responses.fastResponseSourceCurrent has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 6, ternaries 4. 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.
email-channels.emailChannelService.importAttachments (cognitive 20) server/src/services/email-channels.ts:982— email-channels.emailChannelService.importAttachments has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 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.
satisfied-connection-intents.satisfiedConnectionIntentService.sweepPending (cognitive 20) server/src/services/satisfied-connection-intents.ts:80— satisfied-connection-intents.satisfiedConnectionIntentService.sweepPending has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (nesting depth added 8). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 95). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
postgres.createPostgresRunDispatchAdapter.loadStalenessFacts (cognitive 20) server/src/modules/run-dispatch/adapters/postgres.ts:527— postgres.createPostgresRunDispatchAdapter.loadStalenessFacts has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, ternaries 7 (8 pts), if/else 1 (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.
chat-discord-question-forms.retainDiscordQuestionFormCorrection (cognitive 20) server/src/services/chat-discord-question-forms.ts:135— chat-discord-question-forms.retainDiscordQuestionFormCorrection has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 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.
chat-credential-mutation-lease.chatCredentialMutationLease (cognitive 20) server/src/services/chat-credential-mutation-lease.ts:27— chat-credential-mutation-lease.chatCredentialMutationLease has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 3 (4 pts), error handling 2, loops 1 (nesting depth added 6). None of this is in the body itself: all 20 points belong to 5 function items inside it that branch (acquireCredentialMutationLease, withCredentialMutationLease::assertOwned, withCredentialMutationLease, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
refresh-leases.createOAuthRefreshLeases.acquireOAuthRefreshLease (cognitive 20) server/src/services/tool-access/oauth/refresh-leases.ts:68— refresh-leases.createOAuthRefreshLeases.acquireOAuthRefreshLease has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, ternaries 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.
aggregator-accounts.createAggregatorAccounts.aggregatorDiscoveryState (cognitive 20) server/src/services/tool-access/catalog/aggregator-accounts.ts:232— aggregator-accounts.createAggregatorAccounts.aggregatorDiscoveryState has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 6 (8 pts), ternaries 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.
issue-thread-interactions.issueThreadInteractionService.rejectRequestConfirmation (cognitive 20) server/src/services/issue-thread-interactions.ts:2425— issue-thread-interactions.issueThreadInteractionService.rejectRequestConfirmation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10, boolean chains 9, ternaries 1. Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 2454). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
issue-thread-interactions.issueThreadInteractionService.answerQuestions (cognitive 20) server/src/services/issue-thread-interactions.ts:5017— issue-thread-interactions.issueThreadInteractionService.answerQuestions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 1 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 5). Of this number, 11 points are the body's own statements and 9 belong to one function literal 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.
agent-configuration.prepareAgentConfiguration (cognitive 20) server/src/services/agent-configuration.ts:15— agent-configuration.prepareAgentConfiguration has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 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.
agent-runner-selection.resolveAgentRunnerEnvironmentForCompany (cognitive 20) server/src/services/agent-runner-selection.ts:314— agent-runner-selection.resolveAgentRunnerEnvironmentForCompany has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, 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.
muse-receiver.createReceiver.signal (cognitive 20) server/src/services/muse-receiver.ts:57— muse-receiver.createReceiver.signal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 8, error handling 1, ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 69). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
environment-runtime.buildEnvironmentSecretMetadataForLeaseFingerprint (cognitive 20) server/src/services/environment-runtime.ts:897— environment-runtime.buildEnvironmentSecretMetadataForLeaseFingerprint has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 7 (12 pts), if/else 3 (4 pts), boolean chains 3, loops 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 4 belong to one function literal 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.
environment-runtime.createPluginEnvironmentDriver.acquireRunLease (cognitive 20) server/src/services/environment-runtime.ts:3657— environment-runtime.createPluginEnvironmentDriver.acquireRunLease has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 9, if/else 5 (6 pts), boolean chains 5 (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.
runner-goals.settleLiveRunnerGoalBeforeInterrupt (cognitive 20) server/src/services/runner-goals.ts:954— runner-goals.settleLiveRunnerGoalBeforeInterrupt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 5 (8 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.
setup-readiness.prepareProbeCodexSource (cognitive 20) server/src/services/native-runtime/setup-readiness.ts:31— setup-readiness.prepareProbeCodexSource has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (3 pts), boolean chains 1, error handling 1 (nesting depth added 9). Of this number, 18 points are the body's own statements and 2 belong to one function literal 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.
remote-provider-pack-authority.resolveRemoteProviderPackAuthority (cognitive 20) server/src/services/native-runtime/remote-provider-pack-authority.ts:30— remote-provider-pack-authority.resolveRemoteProviderPackAuthority has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, error handling 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.
case-handoffs.caseHandoffService.acceptTerminal (cognitive 20) server/src/services/case-handoffs.ts:285— case-handoffs.caseHandoffService.acceptTerminal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, boolean chains 6, ternaries 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.
case-agent-read.projectAgentCaseRead (cognitive 20) server/src/services/case-agent-read.ts:87— case-agent-read.projectAgentCaseRead has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, ternaries 5 (6 pts), if/else 5, 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.
openapi.applyStringChecks (cognitive 20) server/src/routes/openapi.ts:418— openapi.applyStringChecks has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (18 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.
openapi.resolveOperationAuthLevel (cognitive 20) server/src/routes/openapi.ts:1763— openapi.resolveOperationAuthLevel has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13, boolean chains 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.
skill-version-retention.skillVersionRetentionService.protectedVersionIds (cognitive 20) server/src/services/skill-version-retention.ts:215— skill-version-retention.skillVersionRetentionService.protectedVersionIds has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 6 (10 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.
company-skills.companySkillService.getTestRunDetail (cognitive 20) server/src/services/company-skills.ts:6956— company-skills.companySkillService.getTestRunDetail has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 12 (15 pts), if/else 3, 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.
company-skills.companySkillService.deleteSkills (cognitive 20) server/src/services/company-skills.ts:7319— company-skills.companySkillService.deleteSkills has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 4, error handling 2 (nesting depth added 7). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 7348, withCacheLocks, assertUnused, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
current-wake-comments.readCurrentWakeComments (cognitive 20) server/src/services/native-runtime/current-wake-comments.ts:607— current-wake-comments.readCurrentWakeComments has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 8 (9 pts), ternaries 1 (2 pts) (nesting depth added 2). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 625). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
run-failure-diagnostics.collectRunFailureSecretValues (cognitive 20) REDACTED:176— run-failure-diagnostics.collectRunFailureSecretValues has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (7 pts), error handling 1 (2 pts), loops 1 (nesting depth added 4). 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.
native-session-executor.reserveWarmNativeInstructionDirectory (cognitive 20) server/src/services/native-runtime/native-session-executor.ts:653— native-session-executor.reserveWarmNativeInstructionDirectory has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, loops 1 (nesting depth added 7). Of this number, 15 points are the body's own statements and 5 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.
process.createProcessAdapter.cleanupRunProcess (cognitive 20) server/src/modules/active-run-watchdog/adapters/process.ts:23— process.createProcessAdapter.cleanupRunProcess has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 6, if/else 3, 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.
service.recoveryService.repairNativeBlockedWait (cognitive 20) REDACTED:1603— service.recoveryService.repairNativeBlockedWait has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, loops 1 (2 pts), ternaries 2 (nesting depth added 2). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1612, 1740). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-recovery.reconcileRetainedWorkspaces (cognitive 20) server/src/services/workspace-recovery.ts:341— workspace-recovery.reconcileRetainedWorkspaces has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 354). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
app.IngestTab (cognitive 20) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:3978— app.IngestTab has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (9 pts), boolean chains 7, if/else 3, error handling 1 (nesting depth added 1). Of this number, 10 points are the body's own statements and 10 belong to one function item inside it that branches. 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.
agent-eligibility.getAgentOrgChainHealth (cognitive 20) packages/shared/src/agent-eligibility.ts:126— agent-eligibility.getAgentOrgChainHealth has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 4 (8 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.
agent-eligibility.getAgentWorkEligibility (cognitive 20) packages/shared/src/agent-eligibility.ts:223— agent-eligibility.getAgentWorkEligibility has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 9 (20 pts) (nesting depth added 11). 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.
BrokerCore.doRemove (cognitive 20) packages/tailscale-https-broker/src/broker-core.ts:650— BrokerCore.doRemove has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3, error handling 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.
catalog-builder.discoverTeamCandidates (cognitive 20) packages/teams-catalog/src/catalog-builder.ts:197— catalog-builder.discoverTeamCandidates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (6 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.
preview-artifacts.tarManifest (cognitive 20) scripts/preview-artifacts.mjs:44— preview-artifacts.tarManifest has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, ternaries 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.
cloud-source-verification.readSourceVerification (cognitive 20) scripts/cloud-source-verification.mjs:22— cloud-source-verification.readSourceVerification has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 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.
cloud-source-verification.createActionsReader (cognitive 20) scripts/cloud-source-verification.mjs:93— cloud-source-verification.createActionsReader has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 10). None of this is in the body itself: all 20 points belong to one function literal inside it that branches (line 98). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
codemod-extract-type.main (cognitive 20) scripts/codemod-extract-type.mjs:166— codemod-extract-type.main has cognitive complexity 20 (threshold 15). Drivers by points: loops 6 (10 pts), if/else 4 (5 pts), boolean chains 3, ternaries 2 (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.
feedback.feedbackService.saveIssueVote (cognitive 20) server/src/services/feedback.ts:1926— feedback.feedbackService.saveIssueVote has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 12 (13 pts), if/else 5, boolean chains 2 (nesting depth added 1). None of this is in the body itself: all 20 points belong to one function literal inside it that branches (line 1935). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
decisions.decisionService.list (cognitive 20) server/src/services/decisions.ts:265— decisions.decisionService.list has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4, boolean chains 3, loops 2 (3 pts) (nesting depth added 4). Of this number, 11 points are the body's own statements and 9 belong to one function literal inside it that branches. 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.
costs.parseCostDateRange (cognitive 20) server/src/routes/costs.ts:41— costs.parseCostDateRange has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, ternaries 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.
companies.resolveImportPayload (cognitive 20) server/src/routes/companies.ts:185— companies.resolveImportPayload has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 2 (4 pts), ternaries 1 (3 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.
built-in-agents.builtInAgentRoutes (cognitive 20) server/src/routes/built-in-agents.ts:72— built-in-agents.builtInAgentRoutes has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 13, if/else 6, boolean chains 1. None of this is in the body itself: all 20 points belong to 8 function items inside it that branch (assertCanControlBuiltInRoutine, logBuiltInAgentMutation, a function literal at line 183, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
device-login-service.createDeviceLoginService.runLogin (cognitive 20) server/src/services/device-login-service.ts:1019— device-login-service.createDeviceLoginService.runLogin has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (7 pts), if/else 4 (6 pts), error handling 3 (5 pts), boolean chains 2 (nesting depth added 6). Of this number, 17 points are the body's own statements and 3 belong to 2 function literals 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.
agent-action-audit.agentActionAuditService.list (cognitive 20) server/src/services/agent-action-audit.ts:55— agent-action-audit.agentActionAuditService.list has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12, ternaries 5, boolean chains 2, 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.
plugin-managed-agents.pluginManagedAgentService.reset (cognitive 20) server/src/services/plugin-managed-agents.ts:641— plugin-managed-agents.pluginManagedAgentService.reset has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 pts), boolean chains 3, ternaries 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.
runner-release-crate-cache.expandGlob (cognitive 20) REDACTED:116— runner-release-crate-cache.expandGlob has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 3 (6 pts), error handling 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.
notion-generic-live-lib.extractNotionIdentity::visit (cognitive 20) REDACTED:377— notion-generic-live-lib.extractNotionIdentity::visit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, 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.
standard-image-contract.resolveStandardImageDigest::request (cognitive 20) scripts/standard-image-contract.mjs:26— standard-image-contract.resolveStandardImageDigest::request has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 4, error handling 2 (4 pts), ternaries 1 (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.
ComposerWorktreePicker.ComposerWorktreePicker (cognitive 20) ui/src/components/task-chat/ComposerWorktreePicker.tsx:36— ComposerWorktreePicker.ComposerWorktreePicker has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (17 pts), boolean chains 3 (nesting depth added 9). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 84, 53). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SidebarProjects.SidebarProjects (cognitive 20) ui/src/components/SidebarProjects.tsx:256— SidebarProjects.SidebarProjects has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, boolean chains 7, ternaries 2. Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 363, 351, 336, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
issue-filters.applyIssueFilters (cognitive 20) ui/src/lib/issue-filters.ts:209— issue-filters.applyIssueFilters has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 8 (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.
CompanySettingsSidebar.CompanySettingsSidebar (cognitive 20) ui/src/components/CompanySettingsSidebar.tsx:45— CompanySettingsSidebar.CompanySettingsSidebar has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 13, ternaries 3 (4 pts), if/else 1 (2 pts), error handling 1 (nesting depth added 2). Of this number, 13 points are the body's own statements and 7 belong to 2 function literals inside it that branch. 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.
AiConnectionCredentialStep.ApiKeyConnectionStep (cognitive 20) ui/src/components/ai-connections/AiConnectionCredentialStep.tsx:103— AiConnectionCredentialStep.ApiKeyConnectionStep has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, ternaries 7 (8 pts), if/else 1 (nesting depth added 1). Of this number, 16 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
LegacyInbox.FailedRunInboxRow (cognitive 20) ui/src/pages/LegacyInbox.tsx:284— LegacyInbox.FailedRunInboxRow has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 11 (15 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.
issue-queued-comment-queue.normalizeIssueQueuedCommentQueue (cognitive 20) ui/src/lib/issue-queued-comment-queue.ts:26— issue-queued-comment-queue.normalizeIssueQueuedCommentQueue has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 13, boolean chains 6, if/else 1. Of this number, 12 points are the body's own statements and 8 belong to one function literal inside it that branches. 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.
TaskChatProtocolCard.ProviderActivityCard (cognitive 20) ui/src/components/task-chat/TaskChatProtocolCard.tsx:257— TaskChatProtocolCard.ProviderActivityCard has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10 (16 pts), boolean chains 4 (nesting depth added 6). Of this number, 13 points are the body's own statements and 7 belong to 3 function literals 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.
issue-chat-messages.buildIssueChatMessages (cognitive 20) ui/src/lib/issue-chat-messages.ts:1162— issue-chat-messages.buildIssueChatMessages has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 5, boolean chains 3, ternaries 1 (2 pts) (nesting depth added 5). Of this number, 18 points are the body's own statements and 2 belong to one function literal 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.
IssueThreadInteractionCard.RequestCheckboxConfirmationResolution (cognitive 20) ui/src/components/IssueThreadInteractionCard.tsx:2778— IssueThreadInteractionCard.RequestCheckboxConfirmationResolution has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (16 pts), if/else 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.
TaskChatThread.acceptedSemanticResultVerificationCaveats (cognitive 20) ui/src/components/TaskChatThread.tsx:361— TaskChatThread.acceptedSemanticResultVerificationCaveats has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 5 (7 pts), boolean chains 4 (nesting depth added 4). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 393, 370). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RunnerInspector.buildOperations (cognitive 20) ui/src/components/RunnerInspector.tsx:270— RunnerInspector.buildOperations has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 5 (6 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 6). Of this number, 18 points are the body's own statements and 2 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.
native-run-events.runtimeRequestEntry (cognitive 20) ui/src/components/transcript/native-run-events.ts:142— native-run-events.runtimeRequestEntry has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 11, boolean chains 8, if/else 1. Of this number, 16 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
native-run-events.runResultEntry (cognitive 20) ui/src/components/transcript/native-run-events.ts:235— native-run-events.runResultEntry has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 13 (17 pts), boolean chains 3 (nesting depth added 4). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 257, 278, 266). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AllowedProjectsEditor.AllowedProjectsEditor (cognitive 20) ui/src/components/AllowedProjectsEditor.tsx:16— AllowedProjectsEditor.AllowedProjectsEditor has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 13, ternaries 3 (5 pts), error handling 1, if/else 1 (nesting depth added 2). Of this number, 13 points are the body's own statements and 7 belong to 3 function items inside it that branch. 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.
RunTranscriptView.summarizeToolInput (cognitive 20) ui/src/components/transcript/RunTranscriptView.tsx:259— RunTranscriptView.summarizeToolInput has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 5 (8 pts), boolean chains 3 (nesting depth added 4). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
ProjectAccessMembers.ProjectAccessMembers (cognitive 20) ui/src/components/ProjectAccessMembers.tsx:18— ProjectAccessMembers.ProjectAccessMembers has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 12 (13 pts), boolean chains 7 (nesting depth added 1). Of this number, 10 points are the body's own statements and 10 belong to 4 function literals inside it that branch. 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.
Search.SearchTabContent (cognitive 20) ui/src/pages/Search.tsx:738— Search.SearchTabContent has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (13 pts), if/else 6 (7 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.
ExecutionWorkspaceDetail.ExecutionWorkspaceRoutinesList (cognitive 20) ui/src/pages/ExecutionWorkspaceDetail.tsx:645— ExecutionWorkspaceDetail.ExecutionWorkspaceRoutinesList has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 12 (17 pts), if/else 2, boolean chains 1 (nesting depth added 5). Of this number, 10 points are the body's own statements and 10 belong to 4 function literals 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.
DecisionQueuePage.DecisionQueuePage (cognitive 20) ui/src/pages/DecisionQueuePage.tsx:61— DecisionQueuePage.DecisionQueuePage has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, ternaries 5 (6 pts), if/else 5, loops 1 (nesting depth added 1). Of this number, 10 points are the body's own statements and 10 belong to 7 function literals inside it that branch. 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.
ProfilesTab.EffectiveAgentPanel (cognitive 20) ui/src/pages/tools/ProfilesTab.tsx:474— ProfilesTab.EffectiveAgentPanel has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 7 (20 pts) (nesting depth added 13). Of this number, 15 points are the body's own statements and 5 belong to one function literal 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.
EmailEndpointSetup.readEmailSetupDraft (cognitive 20) ui/src/pages/apps/chat/EmailEndpointSetup.tsx:64— EmailEndpointSetup.readEmailSetupDraft 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.
GitHubBotManagement.GitHubBotManagement (cognitive 20) ui/src/pages/apps/chat/GitHubBotManagement.tsx:185— GitHubBotManagement.GitHubBotManagement has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (6 pts), ternaries 2 (3 pts), error handling 1 (nesting depth added 2). Of this number, 13 points are the body's own statements and 7 belong to 2 function items inside it that branch. 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.
Secrets.Secrets::renderRowActions (cognitive 20) ui/src/pages/Secrets.tsx:1517— Secrets.Secrets::renderRowActions has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 11 (20 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. This shape REPEATS in the file: one other method here (Secrets.Secrets) 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.
CompanyExport.generateReadmeFromSelection (cognitive 20) ui/src/pages/CompanyExport.tsx:415— CompanyExport.generateReadmeFromSelection has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9, loops 3 (6 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 5). Of this number, 18 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
SpekoPhoneLine.SpekoPhoneLineForm (cognitive 20) ui/src/components/voice/SpekoPhoneLine.tsx:8— SpekoPhoneLine.SpekoPhoneLineForm has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 15, ternaries 4, if/else 1. Of this number, 15 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
RemoteMcpProductionSetup.RemoteMcpProductionSetup (cognitive 20) ui/src/features/connections/remote-mcp/RemoteMcpProductionSetup.tsx:30— RemoteMcpProductionSetup.RemoteMcpProductionSetup has cognitive complexity 20 (threshold 15). Drivers by points: if/else 43 (52 pts), ternaries 32 (47 pts), boolean chains 28, error handling 11 (18 pts), loops 1 (2 pts) (nesting depth added 32). 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. This shape REPEATS in the file: one other method here (RemoteMcpProductionSetup.RemoteMcpProductionSetup::submit) 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.
ConnectionPoolConnectorHost.ConnectionPoolConnectorHost (cognitive 20) ui/storybook/prototypes/ConnectionPoolConnectorHost.tsx:22— ConnectionPoolConnectorHost.ConnectionPoolConnectorHost has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 11 (15 pts), boolean chains 4, if/else 1 (nesting depth added 4). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 26, 31, 29, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ComposerRunSettingsLiveStory.ComposerRunSettingsLiveStory (cognitive 20) ui/storybook/prototypes/composer-model-picker/ComposerRunSettingsLiveStory.tsx:41— ComposerRunSettingsLiveStory.ComposerRunSettingsLiveStory has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 5, if/else 3 (nesting depth added 2). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 94, a function literal at line 114, send, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
run.registerRunCommands (cognitive 19) cli/src/commands/client/run.ts:46— run.registerRunCommands has cognitive complexity 19 (threshold 15). Drivers by points: error handling 10, if/else 8, loops 1. None of this is in the body itself: all 19 points belong to 10 function literals inside it that branch (lines 136, 54, 79, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
sandbox-managed-runtime.copySelectedWorkspaceEntries (cognitive 19) packages/adapter-utils/src/sandbox-managed-runtime.ts:1058— sandbox-managed-runtime.copySelectedWorkspaceEntries has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 9). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (assertParentDirectory, assertSourceRoot). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
http2-bridge-server.parseCanonicalBridgeRequestPath (cognitive 19) packages/adapter-utils/src/http2-bridge-server.ts:547— http2-bridge-server.parseCanonicalBridgeRequestPath has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, error handling 2 (3 pts), loops 2, ternaries 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.
execution-target.ensureSandboxCommandResolvable (cognitive 19) REDACTED:759— execution-target.ensureSandboxCommandResolvable has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (4 pts), boolean chains 3, error handling 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.
execute.buildPrompt (cognitive 19) packages/adapter-utils/src/acpx-engine/execute.ts:3105— execute.buildPrompt has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9 (12 pts), boolean chains 4, error handling 1 (2 pts), if/else 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.
env-bindings.parseEnvBindings (cognitive 19) packages/adapter-utils/src/env-bindings.ts:26— env-bindings.parseEnvBindings has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 5, 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.
format-event.printLegacyToolEvent (cognitive 19) packages/adapters/cursor-local/src/cli/format-event.ts:159— format-event.printLegacyToolEvent has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 3 (4 pts), boolean chains 3, error handling 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.
format-event.printGrokStreamEvent (cognitive 19) packages/adapters/grok-local/src/cli/format-event.ts:12— format-event.printGrokStreamEvent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (7 pts), boolean chains 2, error handling 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.
agent-observability.redactObservabilityDiagnostic (cognitive 19) packages/paperclip-runner/src/drivers/agent-observability.ts:69— agent-observability.redactObservabilityDiagnostic has cognitive complexity 19 (threshold 15). Drivers by points: loops 7 (9 pts), error handling 2 (6 pts), if/else 2 (4 pts) (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.
codex-startup-trust.editTrust (cognitive 19) packages/paperclip-runner/src/drivers/codex/codex-startup-trust.ts:19— codex-startup-trust.editTrust has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 5 (8 pts), error handling 1 (nesting depth added 8). Of this number, 18 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.
opencode-server-driver.startOpenCodeProviderProxy.server (cognitive 19) REDACTED:2181— opencode-server-driver.startOpenCodeProviderProxy.server has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, ternaries 3, loops 2, error handling 1 (nesting depth added 2). None of this is in the body itself: all 19 points belong to 3 function literals inside it that branch (lines 2185, 2212, 2235). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
runnerd-codex-transport.createCapabilityRunnerdProviderEnvironmentBase (cognitive 19) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:3281— runnerd-codex-transport.createCapabilityRunnerdProviderEnvironmentBase has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 6 (7 pts), boolean chains 1, 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.
DevtoolsInspector.EvalReportInspector (cognitive 19) packages/paperclip-runner/devtools/issue-thread/src/DevtoolsInspector.tsx:201— DevtoolsInspector.EvalReportInspector has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 15 (18 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.
native-distribution-integrity.readNativeAcpxDistributionEntries (cognitive 19) packages/paperclip-runner/src/drivers/acpx/native-distribution-integrity.ts:64— native-distribution-integrity.readNativeAcpxDistributionEntries has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 14, 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.
cursor-native-usage.createCursorNativeUsage.begin (cognitive 19) packages/paperclip-runner/scripts/cursor-native-usage.mjs:21— cursor-native-usage.createCursorNativeUsage.begin has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, ternaries 1 (2 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.
discover-copilot-acp.createDiscoveryRpc (cognitive 19) packages/paperclip-runner/scripts/discover-copilot-acp.mjs:27— discover-copilot-acp.createDiscoveryRpc has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 1 (3 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). None of this is in the body itself: all 19 points belong to one function literal inside it that branches (line 41). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
protocol-contract.assertAcpxPropertyValue (cognitive 19) REDACTED:676— protocol-contract.assertAcpxPropertyValue has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (14 pts), boolean chains 3, if/else 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.
provision-pi.provisionPi (cognitive 19) packages/paperclip-runner/scripts/provision-pi.mjs:52— provision-pi.provisionPi has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, loops 1 (nesting depth added 3). Of this number, 11 points are the body's own statements and 8 belong to 3 function literals inside it that branch. 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.
qualify-copilot-acp.evaluateProbe (cognitive 19) packages/paperclip-runner/scripts/qualify-copilot-acp.mjs:26— qualify-copilot-acp.evaluateProbe has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 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.
release-provider-pack.verifyReleaseProviderPack (cognitive 19) packages/paperclip-runner/scripts/release-provider-pack.mjs:10— release-provider-pack.verifyReleaseProviderPack has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 2 (4 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.
pi-message-projection.createPiMessageProjection.normalize (cognitive 19) packages/paperclip-runner/src/drivers/acpx/pi-message-projection.ts:13— pi-message-projection.createPiMessageProjection.normalize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5 (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.
RuntimeAdmissionCleanup.#retryRetained (cognitive 19) packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts:829— RuntimeAdmissionCleanup.#retryRetained has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, ternaries 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.
harness-driver-backend.jsonStringBytes (cognitive 19) packages/paperclip-runner/src/backends/harness-driver-backend.ts:345— harness-driver-backend.jsonStringBytes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, 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.
acpx-runtime-sidecar.shutdown (cognitive 19) packages/paperclip-runner/src/cli/acpx-runtime-sidecar.ts:1556— acpx-runtime-sidecar.shutdown has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 3 (9 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.
copilot-metadata-probe.createMetadataRpc (cognitive 19) packages/paperclip-runner/src/drivers/copilot-metadata-probe.ts:129— copilot-metadata-probe.createMetadataRpc has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 9). None of this is in the body itself: all 19 points belong to one function literal inside it that branches (line 138). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
live-projection.interactionPayload (cognitive 19) packages/paperclip-runner/src/issue-thread/live-projection.ts:211— live-projection.interactionPayload has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8 (17 pts), boolean chains 1, match/switch 1 (nesting depth added 9). Of this number, 11 points are the body's own statements and 8 belong to one function literal inside it that branches. 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.
eval-session.boundedEvalSessionUsage (cognitive 19) packages/paperclip-runner/src/cli/eval-session.ts:308— eval-session.boundedEvalSessionUsage has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 7, ternaries 2. Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
pi-acp-runtime.createPiLaunchSpec (cognitive 19) packages/paperclip-runner/src/drivers/acpx/pi-acp-runtime.ts:366— pi-acp-runtime.createPiLaunchSpec has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, ternaries 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.
pi-runtime-extension.piMcpToolError (cognitive 19) packages/paperclip-runner/src/drivers/acpx/pi-runtime-extension.ts:247— pi-runtime-extension.piMcpToolError has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 2, ternaries 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.
authorization.decidePaperclipSemanticAuthorization (cognitive 19) packages/paperclip-runner/src/semantic-tools/authorization.ts:11— authorization.decidePaperclipSemanticAuthorization has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 5 (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.
heartbeat-run-events.appendHeartbeatRunEvent (cognitive 19) server/src/services/heartbeat-run-events.ts:67— heartbeat-run-events.appendHeartbeatRunEvent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, ternaries 2 (nesting depth added 5). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 95). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
remote-connection-failure.classifyRemoteConnectionError (cognitive 19) server/src/services/remote-connection-failure.ts:61— remote-connection-failure.classifyRemoteConnectionError has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 4 (5 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.
json-schema-secret-refs.collectSecretRefPaths::walk (cognitive 19) server/src/services/json-schema-secret-refs.ts:39— json-schema-secret-refs.collectSecretRefPaths::walk has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), boolean chains 3, 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.
workspace-recovery-snapshot.preserveWorkspaceSnapshot (cognitive 19) server/src/services/workspace-recovery-snapshot.ts:58— workspace-recovery-snapshot.preserveWorkspaceSnapshot has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (5 pts), loops 2 (nesting depth added 7). Of this number, 16 points are the body's own statements and 3 belong to 3 function literals 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.
secrets.secretService.resolveEnvBindings (cognitive 19) server/src/services/secrets.ts:5222— secrets.secretService.resolveEnvBindings has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 2 (6 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.
ai-connections.aiConnectionService.credential (cognitive 19) server/src/services/ai-connections.ts:500— ai-connections.aiConnectionService.credential has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (15 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.
cards.slackSelectionMessage (cognitive 19) server/src/services/chat-channels/slack/cards.ts:36— cards.slackSelectionMessage has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 6 (7 pts), boolean chains 2, loops 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 4 belong to 2 function literals 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.
grants.createConnectionGrants.revokeConnectionGrant (cognitive 19) server/src/services/tool-access/connections/grants.ts:478— grants.createConnectionGrants.revokeConnectionGrant has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 1 (3 pts), ternaries 2, boolean chains 1 (nesting depth added 5). Of this number, 14 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
chat-github-attachments.validateGitHubAttachmentLocator (cognitive 19) REDACTED:199— chat-github-attachments.validateGitHubAttachmentLocator has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, ternaries 3 (6 pts), if/else 2 (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.
chat-sdk-runtime.paperclipAuthoritativeIngressState (cognitive 19) server/src/services/chat-sdk-runtime.ts:1775— chat-sdk-runtime.paperclipAuthoritativeIngressState has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 4 (7 pts), boolean chains 1 (nesting depth added 6). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1788, 1801, 1812, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
voice-session-store.voiceSessionStore.authorizeGuestTask (cognitive 19) server/src/services/voice/voice-session-store.ts:103— voice-session-store.voiceSessionStore.authorizeGuestTask has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (7 pts), ternaries 1 (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.
tool-access-policy.toolAccessPolicyService.createTrustRuleFromActionRequest (cognitive 19) server/src/services/tool-access-policy.ts:1938— tool-access-policy.toolAccessPolicyService.createTrustRuleFromActionRequest has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (8 pts), if/else 7, boolean chains 4 (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.
plugin-database.pluginDatabaseService.applyMigrations (cognitive 19) server/src/services/plugin-database.ts:463— plugin-database.pluginDatabaseService.applyMigrations has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 8). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to one function item inside it that branches (applyWithClient). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
tool-gateway.createToolGatewayService.resolveRunContext (cognitive 19) server/src/services/tool-gateway.ts:1715— tool-gateway.createToolGatewayService.resolveRunContext has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 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.
tool-gateway.createToolGatewayService.readHeaderPolicy (cognitive 19) server/src/services/tool-gateway.ts:3526— tool-gateway.createToolGatewayService.readHeaderPolicy has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 9). Of this number, 18 points are the body's own statements and 1 belongs to one function literal 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.
chat-provider-lifecycle.parseTeamsLifecycle (cognitive 19) server/src/services/chat-provider-lifecycle.ts:334— chat-provider-lifecycle.parseTeamsLifecycle has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 6 (8 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.
authorization.createChatInboundAuthority.lockCurrentPrincipalAuthorization (cognitive 19) server/src/services/chat-channels/inbound/authorization.ts:175— authorization.createChatInboundAuthority.lockCurrentPrincipalAuthorization has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, error handling 1 (2 pts), ternaries 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.
provider-effects.providerEffectPayload (cognitive 19) server/src/services/chat-channels/provider-effects.ts:87— provider-effects.providerEffectPayload has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts), loops 1 (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.
task-start.createSlackTaskStart.finalizeSlackTaskStartFailure (cognitive 19) server/src/services/chat-channels/slack/task-start.ts:188— task-start.createSlackTaskStart.finalizeSlackTaskStartFailure has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (9 pts), boolean chains 6, if/else 4 (nesting depth added 2). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 240). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
execution-workspace-policy.parseIssueExecutionWorkspaceSettings (cognitive 19) server/src/services/execution-workspace-policy.ts:211— execution-workspace-policy.parseIssueExecutionWorkspaceSettings has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8, boolean chains 7, if/else 4. Of this number, 13 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
repository-object-cache.publishRepositoryObjectCache (cognitive 19) server/src/services/repository-object-cache.ts:88— repository-object-cache.publishRepositoryObjectCache has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 2 (5 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 5). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 94). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
git-workspace-restoration.gitCacheExpirationLockLocations (cognitive 19) server/src/services/git-workspace-restoration.ts:622— git-workspace-restoration.gitCacheExpirationLockLocations has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 3 (6 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 8). Of this number, 16 points are the body's own statements and 3 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.
isolated-repository-rehome.inspectWorktree (cognitive 19) server/src/services/isolated-repository-rehome.ts:174— isolated-repository-rehome.inspectWorktree has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 3, loops 1 (nesting depth added 1). Of this number, 16 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
workspace-instance-cleanup.cleanupWorktreeInstanceArtifacts (cognitive 19) server/src/services/workspace-instance-cleanup.ts:266— workspace-instance-cleanup.cleanupWorktreeInstanceArtifacts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, boolean chains 4, ternaries 2, error handling 1. Of this number, 16 points are the body's own statements and 3 belong to 2 function items inside it that branch. 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.
port-reservation.findExposurePairConflict (cognitive 19) server/src/services/runtime-exposure/port-reservation.ts:317— port-reservation.findExposurePairConflict has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3, 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.
workspace-runtime.refreshRemoteTrackingBaseRefWithDiagnostic (cognitive 19) server/src/services/workspace-runtime.ts:977— workspace-runtime.refreshRemoteTrackingBaseRefWithDiagnostic has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 6, boolean chains 3, error handling 1 (nesting depth added 4). Of this number, 12 points are the body's own statements and 7 belong to 3 function literals 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.
workspace-runtime.startRuntimeServicesForWorkspaceControlUnlocked (cognitive 19) server/src/services/workspace-runtime.ts:7807— workspace-runtime.startRuntimeServicesForWorkspaceControlUnlocked has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 4, ternaries 2 (3 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.
execution-workspaces.executionWorkspaceService.sweepTerminalWorkspaces::expireTaskDirectory (cognitive 19) server/src/services/execution-workspaces.ts:3445— execution-workspaces.executionWorkspaceService.sweepTerminalWorkspaces::expireTaskDirectory has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 4 (5 pts), boolean chains 4 (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. This shape REPEATS in the file: one other method here (execution-workspaces.executionWorkspaceService.sweepTerminalWorkspaces) 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.
commands.createDiscordCommands.reconcileDiscordCommands (cognitive 19) server/src/services/chat-channels/discord/commands.ts:91— commands.createDiscordCommands.reconcileDiscordCommands has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, boolean chains 6, ternaries 2, error handling 1. Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to 4 function items inside it that branch (reconcile, reconcile::authorize, reconcile::setCapability, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
email-channels.emailChannelService.queueSend (cognitive 19) server/src/services/email-channels.ts:1508— email-channels.emailChannelService.queueSend has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 4). Of this number, 11 points are the body's own statements and 8 belong to one function literal 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.
postgres.createPostgresRunDispatchAdapter.withRunOwnershipLocks (cognitive 19) server/src/modules/run-dispatch/adapters/postgres.ts:201— postgres.createPostgresRunDispatchAdapter.withRunOwnershipLocks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (6 pts), loops 1 (nesting depth added 9). Of this number, 11 points are the body's own statements and 8 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.
failed-run-retry.createChatFailedRunRetry.assertFailedNativeRetryState (cognitive 19) server/src/services/chat-channels/failed-run-retry.ts:548— failed-run-retry.createChatFailedRunRetry.assertFailedNativeRetryState has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 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.
chat-teams-file-transfers.teamsFileTransferService.process (cognitive 19) server/src/services/chat-teams-file-transfers.ts:737— chat-teams-file-transfers.teamsFileTransferService.process has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2, error handling 1 (nesting depth added 3). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 799). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
file-transfer-authority.createTeamsFileAuthority.teamsFileCurrentScope (cognitive 19) server/src/services/chat-channels/microsoft-teams/file-transfer-authority.ts:122— file-transfer-authority.createTeamsFileAuthority.teamsFileCurrentScope has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 9, ternaries 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.
chat-provider-links.teamsConversationLink (cognitive 19) server/src/services/chat-provider-links.ts:35— chat-provider-links.teamsConversationLink has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 9, ternaries 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.
messages.microsoftTeamsLifecycleEventFromPayload (cognitive 19) server/src/services/chat-channels/microsoft-teams/messages.ts:18— messages.microsoftTeamsLifecycleEventFromPayload has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (9 pts), boolean chains 7, if/else 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.
chat-channels.chatChannelService.processPendingDeliveries (cognitive 19) server/src/services/chat-channels.ts:3026— chat-channels.chatChannelService.processPendingDeliveries has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 2 (4 pts), boolean chains 2, loops 1, ternaries 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.
aggregator-accounts.createAggregatorAccounts.openComposioGateway.checkBatch (cognitive 19) server/src/services/tool-access/catalog/aggregator-accounts.ts:106— aggregator-accounts.createAggregatorAccounts.openComposioGateway.checkBatch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 6). Of this number, 18 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.
service.createToolProfileService.updateProfile (cognitive 19) server/src/services/tool-access/profiles/service.ts:488— service.createToolProfileService.updateProfile has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 1 (2 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). Of this number, 10 points are the body's own statements and 9 belong to one function literal 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.
issue-thread-interactions.issueThreadInteractionService.expireStaleRequestConfirmationsForIssueDocument (cognitive 19) server/src/services/issue-thread-interactions.ts:4687— issue-thread-interactions.issueThreadInteractionService.expireStaleRequestConfirmationsForIssueDocument has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 3). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 4711, 4739). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
muse-oauth-diagnostics.recordMuseCodeRejection (cognitive 19) server/src/services/public-mcp/muse-oauth-diagnostics.ts:67— muse-oauth-diagnostics.recordMuseCodeRejection has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, ternaries 2, error handling 1, loops 1 (nesting depth added 1). Of this number, 12 points are the body's own statements and 7 belong to one function literal inside it that branches. 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.
routine.grokRoutineService.send (cognitive 19) server/src/services/grok-bot/routine.ts:167— routine.grokRoutineService.send has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 2 (3 pts), boolean chains 2, error handling 1 (nesting depth added 3). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 168, handoff, a function literal at line 220). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
dot.createDotRunnerMcpTools.callTool (cognitive 19) server/src/modules/external-agents/dot.ts:607— dot.createDotRunnerMcpTools.callTool has cognitive complexity 19 (threshold 15). Drivers by points: if/else 17, boolean chains 1, ternaries 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.
issue-graph-liveness.classifyIssueReviewPaths (cognitive 19) server/src/services/recovery/issue-graph-liveness.ts:223— issue-graph-liveness.classifyIssueReviewPaths has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, loops 2, ternaries 1 (nesting depth added 3). Of this number, 11 points are the body's own statements and 8 belong to 2 function items inside it that branch. 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.
issues.liveDescendantCountMapForIssues (cognitive 19) server/src/services/issues.ts:3450— issues.liveDescendantCountMapForIssues has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 2 (5 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.
agent-instructions.deriveBundleState (cognitive 19) server/src/services/agent-instructions.ts:245— agent-instructions.deriveBundleState has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (9 pts), error handling 2 (4 pts), if/else 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.
assigned-mcp-tools.createAssignedMcpTools.search (cognitive 19) server/src/services/native-runtime/assigned-mcp-tools.ts:107— assigned-mcp-tools.createAssignedMcpTools.search has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 4 (6 pts), boolean chains 4, loops 1 (nesting depth added 5). Of this number, 15 points are the body's own statements and 4 belong to 2 function literals 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.
case-handoffs.caseHandoffService.apply (cognitive 19) server/src/services/case-handoffs.ts:242— case-handoffs.caseHandoffService.apply has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 4, 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.
company-skills.companySkillService.updateFile (cognitive 19) server/src/services/company-skills.ts:4728— company-skills.companySkillService.updateFile has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, boolean chains 5, ternaries 2, error handling 1. None of this is in the body itself: all 19 points belong to 2 function literals inside it that branch (lines 4738, 4760). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PaperclipRunnerToolAuthority.#assertDotApiFileAccess (cognitive 19) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:1114— PaperclipRunnerToolAuthority.#assertDotApiFileAccess has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7, 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.
PaperclipRunnerToolAuthority.#boundContext (cognitive 19) server/src/services/native-runtime/paperclip-runner-tool-authority.ts:1228— PaperclipRunnerToolAuthority.#boundContext has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 8, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
native-session-executor.resolveNativeHarnessPersistenceProfile (cognitive 19) server/src/services/native-runtime/native-session-executor.ts:5643— native-session-executor.resolveNativeHarnessPersistenceProfile has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (18 pts), boolean chains 1 (nesting depth added 11). 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.
native-session-executor.assertSafeExtractedCheckpoint (cognitive 19) server/src/services/native-runtime/native-session-executor.ts:10831— native-session-executor.assertSafeExtractedCheckpoint has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (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.
native-local-process-stop.releaseSettledNativeRunProcess (cognitive 19) server/src/services/native-local-process-stop.ts:145— native-local-process-stop.releaseSettledNativeRunProcess has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6 (nesting depth added 4). None of this is in the body itself: all 19 points belong to 2 function literals inside it that branch (lines 146, 166). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
case-context.caseWakeWithInstructionReference (cognitive 19) server/src/services/case-context.ts:234— case-context.caseWakeWithInstructionReference has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 7, if/else 1 (nesting depth added 3). Of this number, 13 points are the body's own statements and 6 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.
run-state.resolveNextSessionState (cognitive 19) server/src/services/heartbeat/run-state.ts:912— run-state.resolveNextSessionState has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8 (14 pts), if/else 4, 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.
run-state.createHeartbeatRunState.evaluateSessionCompaction (cognitive 19) server/src/services/heartbeat/run-state.ts:1345— run-state.createHeartbeatRunState.evaluateSessionCompaction has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7, boolean chains 6, ternaries 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.
retries.createHeartbeatRetries.retryScheduledRetryNow (cognitive 19) server/src/services/heartbeat/retries.ts:1701— retries.createHeartbeatRetries.retryScheduledRetryNow has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 3 (4 pts), boolean chains 1 (nesting depth added 3). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
execution-policy-bootstrap.parseExecutionPolicyBootstrapEnv (cognitive 19) server/src/services/execution-policy-bootstrap.ts:70— execution-policy-bootstrap.parseExecutionPolicyBootstrapEnv has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (16 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.
fresh-workspace-seed.materializeFreshWorkspaceSeed (cognitive 19) server/src/services/fresh-workspace-seed.ts:13— fresh-workspace-seed.materializeFreshWorkspaceSeed has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5 (nesting depth added 5). Of this number, 16 points are the body's own statements and 3 belong to 2 function literals 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.
scheduling.createHeartbeatScheduling.tickTimers (cognitive 19) server/src/services/heartbeat/scheduling.ts:1204— scheduling.createHeartbeatScheduling.tickTimers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 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.
env-file.trailingEnvCommentStart (cognitive 19) packages/shared/src/env-file.ts:26— env-file.trailingEnvCommentStart has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, 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.
plugin.pluginUiSlotDeclarationSchema (cognitive 19) packages/shared/src/validators/plugin.ts:395— plugin.pluginUiSlotDeclarationSchema has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 9. 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.
catalog-builder.collectReferencedSkillFiles (cognitive 19) packages/skills-catalog/src/catalog-builder.ts:564— catalog-builder.collectReferencedSkillFiles has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2, ternaries 1 (nesting depth added 7). Of this number, 17 points are the body's own statements and 2 belong to one function literal 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.
protocol.decodeRequest (cognitive 19) packages/tailscale-https-broker/src/protocol.ts:79— protocol.decodeRequest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, boolean chains 6, error handling 1, ternaries 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.
node-reporter.reporter (cognitive 19) scripts/ci-profile/node-reporter.mjs:4— node-reporter.reporter has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 3 (6 pts), boolean chains 4, 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.
create-provider-pack-archive.createProviderPackLayers (cognitive 19) scripts/create-provider-pack-archive.mjs:44— create-provider-pack-archive.createProviderPackLayers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (6 pts), loops 4 (6 pts), boolean chains 3, ternaries 2 (3 pts), error handling 1 (nesting depth added 4). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 3 function items inside it that branch (visit, archive, a function literal at line 73). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
run-vitest-stable.runGeneralGroup (cognitive 19) scripts/run-vitest-stable.mjs:479— run-vitest-stable.runGeneralGroup has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 1 (3 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.
company-search.matchedFacetConditions (cognitive 19) server/src/services/company-search.ts:310— company-search.matchedFacetConditions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 7, ternaries 1 (2 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.
feedback.buildClaudeTraceFiles (cognitive 19) server/src/services/feedback.ts:441— feedback.buildClaudeTraceFiles has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 6, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
decisions.decisionService.snapshots (cognitive 19) server/src/services/decisions.ts:161— decisions.decisionService.snapshots has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), ternaries 2 (3 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.
secret-proposals.createSecretProposalsService.approve (cognitive 19) server/src/services/secret-proposals.ts:718— secret-proposals.createSecretProposalsService.approve has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3 (nesting depth added 6). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 731, 770). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
company-portability.deriveSkillExportDirCandidates (cognitive 19) server/src/services/company-portability.ts:489— company-portability.deriveSkillExportDirCandidates has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 3 (5 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 5). Of this number, 17 points are the body's own statements and 2 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.
slack-search-oauth.slackSearchOAuthService.accessToken (cognitive 19) server/src/services/connectors/slack-search-oauth.ts:223— slack-search-oauth.slackSearchOAuthService.accessToken has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, ternaries 2, loops 1 (nesting depth added 3). None of this is in the body itself: all 19 points belong to 2 function literals inside it that branch (lines 225, 261). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
slack-search-oauth.slackSearchOAuthService.complete (cognitive 19) server/src/services/connectors/slack-search-oauth.ts:502— slack-search-oauth.slackSearchOAuthService.complete has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6, loops 1, ternaries 1 (nesting depth added 1). Of this number, 10 points are the body's own statements and 9 belong to one function literal inside it that branches. 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.
company-skill-policy.companySkillPolicyRoutes (cognitive 19) server/src/routes/company-skill-policy.ts:10— company-skill-policy.companySkillPolicyRoutes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 4, error handling 1 (nesting depth added 3). None of this is in the body itself: all 19 points belong to 5 function items inside it that branch (assertCanAdministerPolicy, a function literal at line 16, assertSkillPolicyCompanyAccess, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
agents.agentRoutes (cognitive 19) server/src/routes/agents.ts:500— agents.agentRoutes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 598 (789 pts), ternaries 224 (329 pts), boolean chains 281, error handling 27 (42 pts), loops 11 (17 pts), match/switch 2 (nesting depth added 317). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 7 other methods here (agents.agentRoutes::assertSelectableAdapterType, agents.agentRoutes::assertAgentDefaultEnvironmentSelection, agents.agentRoutes::applyHiringAgentAuthInheritance, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 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.
announcement-feed.announcementFeedService.asset (cognitive 19) server/src/services/announcement-feed.ts:146— announcement-feed.announcementFeedService.asset has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 7, boolean chains 3, error handling 1 (nesting depth added 3). Of this number, 13 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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.
access.isInviteTokenHashCollisionError (cognitive 19) REDACTED:2282— access.isInviteTokenHashCollisionError has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 3 (6 pts), boolean chains 4, 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.
access.isPrivateOrReservedIpv6 (cognitive 19) REDACTED:2388— access.isPrivateOrReservedIpv6 has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
plugins.pluginRoutes::resolveScopedApiCompanyId (cognitive 19) REDACTED:613— plugins.pluginRoutes::resolveScopedApiCompanyId has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 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.
plugin-host-services.buildHostServices.isInviteTokenHashCollisionError (cognitive 19) server/src/services/plugin-host-services.ts:1382— plugin-host-services.buildHostServices.isInviteTokenHashCollisionError has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 3 (6 pts), boolean chains 4, 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.
storybook-catalog.renderIndex (cognitive 19) scripts/storybook-catalog.mjs:119— storybook-catalog.renderIndex has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 3 (6 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sw.self.addEventListener("fetch") (cognitive 19) ui/public/sw.js:101— sw.self.addEventListener("fetch") has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, ternaries 1 (2 pts), error handling 1 (nesting depth added 2). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 154, 137, 146). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
select.SelectPopover (cognitive 19) ui/src/components/ui/select.tsx:25— select.SelectPopover has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (10 pts), boolean chains 5, if/else 4 (nesting depth added 6). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 89, 69, 83, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
remark-workspace-file-refs.parseWorkspaceFileHref (cognitive 19) ui/src/lib/remark-workspace-file-refs.ts:36— remark-workspace-file-refs.parseWorkspaceFileHref has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9, boolean chains 7, if/else 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.
remark-workspace-file-refs.rewriteMarkdownTree (cognitive 19) ui/src/lib/remark-workspace-file-refs.ts:111— remark-workspace-file-refs.rewriteMarkdownTree has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (5 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.
slots.usePluginSlots.slots (cognitive 19) ui/src/plugins/slots.tsx:659— slots.usePluginSlots.slots has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts) (nesting depth added 11). Of this number, 17 points are the body's own statements and 2 belong to one function literal 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.
config-fields.HermesGatewayConfigFields (cognitive 19) ui/src/adapters/hermes-gateway/config-fields.tsx:100— config-fields.HermesGatewayConfigFields has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, ternaries 6, if/else 5. Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 229, writeValue, a function literal at line 117, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ReportsToPicker.ReportsToPicker (cognitive 19) ui/src/components/ReportsToPicker.tsx:13— ReportsToPicker.ReportsToPicker has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 9 (nesting depth added 5). Of this number, 17 points are the body's own statements and 2 belong to 2 function literals 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.
issue-hierarchy-context.loadIssueHierarchyChildren (cognitive 19) ui/src/lib/issue-hierarchy-context.ts:35— issue-hierarchy-context.loadIssueHierarchyChildren has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, loops 2 (3 pts), ternaries 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.
LiveUpdatesProvider.useTaskRunLiveUpdates (cognitive 19) ui/src/context/LiveUpdatesProvider.tsx:137— LiveUpdatesProvider.useTaskRunLiveUpdates has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, loops 1, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 168, 147, 162, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TaskChatPlanPreviewCard.TaskChatPlanPreviewCard (cognitive 19) ui/src/components/task-chat/TaskChatPlanPreviewCard.tsx:79— TaskChatPlanPreviewCard.TaskChatPlanPreviewCard has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 5, if/else 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.
IssueLinkQuicklook.IssueLinkQuicklook (cognitive 19) ui/src/components/IssueLinkQuicklook.tsx:231— IssueLinkQuicklook.IssueLinkQuicklook has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9, boolean chains 5, ternaries 4 (5 pts) (nesting depth added 1). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 335, 262, 324, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
FileViewerContext.writeFileViewerStateToSearch (cognitive 19) ui/src/context/FileViewerContext.tsx:100— FileViewerContext.writeFileViewerStateToSearch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 1, 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.
AgentChat.AgentChat (cognitive 19) ui/src/pages/AgentChat.tsx:15— AgentChat.AgentChat has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 8, error handling 1. Of this number, 12 points are the body's own statements and 7 belong to 3 function literals inside it that branch. 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.
AgentSkillRow.AgentSkillRow (cognitive 19) ui/src/pages/agent-skills/AgentSkillRow.tsx:58— AgentSkillRow.AgentSkillRow has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 4, if/else 1 (2 pts) (nesting depth added 3). Of this number, 14 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
AgentDetail.LogViewer::appendLogContent (cognitive 19) ui/src/pages/AgentDetail.tsx:4068— AgentDetail.LogViewer::appendLogContent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (6 pts), boolean chains 3, error handling 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. This shape REPEATS in the file: one other method here (AgentDetail.LogViewer) 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.
AttentionQueueRow.CompactDecisionActions (cognitive 19) ui/src/components/AttentionQueueRow.tsx:475— AttentionQueueRow.CompactDecisionActions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 5). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 492, 511, 546, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ProfilesTab.resolveAllowList (cognitive 19) ui/src/pages/tools/ProfilesTab.tsx:251— ProfilesTab.resolveAllowList has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 1 (3 pts), boolean chains 2, loops 2 (nesting depth added 7). Of this number, 16 points are the body's own statements and 3 belong to one function literal 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.
ChatEndpointDetail.Access (cognitive 19) ui/src/pages/apps/chat/ChatEndpointDetail.tsx:674— ChatEndpointDetail.Access has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (13 pts), boolean chains 6 (nesting depth added 6). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 798, 703, 714, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
gateway-helpers.deriveGatewayApps (cognitive 19) ui/src/pages/apps/gateways/gateway-helpers.ts:131— gateway-helpers.deriveGatewayApps has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, loops 3, ternaries 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.
GatewayDetail.GatewayDetail (cognitive 19) ui/src/pages/apps/gateways/GatewayDetail.tsx:29— GatewayDetail.GatewayDetail has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7, boolean chains 6, if/else 6. Of this number, 11 points are the body's own statements and 8 belong to 5 function literals inside it that branch. 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.
ScheduleEditor.ScheduleEditor (cognitive 19) ui/src/components/ScheduleEditor.tsx:194— ScheduleEditor.ScheduleEditor has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 6, ternaries 4 (6 pts) (nesting depth added 3). Of this number, 11 points are the body's own statements and 8 belong to 6 function items inside it that branch. 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.
RoutineTriggerCard.RoutineTriggerCard (cognitive 19) ui/src/components/RoutineTriggerCard.tsx:34— RoutineTriggerCard.RoutineTriggerCard has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9 (12 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.
GalleryPreview.Named (cognitive 19) ui/src/artifact-directions/directions/d2-tint/GalleryPreview.tsx:68— GalleryPreview.Named has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10 (19 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.
BuiltInAgentGate.BuiltInAgentGate (cognitive 19) ui/src/components/BuiltInAgentGate.tsx:36— BuiltInAgentGate.BuiltInAgentGate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7, boolean chains 6, ternaries 3 (6 pts) (nesting depth added 3). Of this number, 17 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
ManagedRoutinesList.ManagedRoutinesList (cognitive 19) ui/src/components/ManagedRoutinesList.tsx:77— ManagedRoutinesList.ManagedRoutinesList has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9 (16 pts), boolean chains 2, if/else 1 (nesting depth added 7). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to one function literal inside it that branches (line 109). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
WorkspaceFileBrowser.WorkspaceFileTree::renderNode (cognitive 19) ui/src/components/WorkspaceFileBrowser.tsx:384— WorkspaceFileBrowser.WorkspaceFileTree::renderNode has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (14 pts), boolean chains 4, if/else 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.
radio-card.RadioCardGroup (cognitive 19) ui/src/components/ui/radio-card.tsx:82— radio-card.RadioCardGroup has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), ternaries 3 (6 pts), loops 1 (nesting depth added 4). None of this is in the body itself: all 19 points belong to 2 function items inside it that branch (handleKeyDown, a function literal at line 130). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ConnectionSetupFlow.LinkConnectStep (cognitive 19) ui/src/features/connections/ConnectionSetupFlow.tsx:3280— ConnectionSetupFlow.LinkConnectStep has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 6 (nesting depth added 2). Of this number, 16 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
voice-call-attempt.createVoiceCallAttempt.start (cognitive 19) ui/src/lib/voice-call-attempt.ts:39— voice-call-attempt.createVoiceCallAttempt.start has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 3 (5 pts), ternaries 2 (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.
launchers.usePluginLaunchers.launchers (cognitive 19) ui/src/plugins/launchers.tsx:312— launchers.usePluginLaunchers.launchers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts) (nesting depth added 11). Of this number, 17 points are the body's own statements and 2 belong to one function literal 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.
AgentDetail.production.LogViewer::appendLogContent (cognitive 19) ui/src/pages/AgentDetail.production.tsx:3779— AgentDetail.production.LogViewer::appendLogContent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (6 pts), boolean chains 3, error handling 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. This shape REPEATS in the file: one other method here (AgentDetail.production.LogViewer) 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.
TeamCatalog.TeamDetailPane (cognitive 19) ui/src/pages/TeamCatalog.tsx:671— TeamCatalog.TeamDetailPane has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 6, if/else 2 (nesting depth added 3). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
AuditTab.AuditTab (cognitive 19) ui/src/pages/tools/AuditTab.tsx:326— AuditTab.AuditTab has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10 (17 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.
SegmentedControllersPreview.LayoutSwitch (cognitive 19) ui/storybook/support/design-proposals/SegmentedControllersPreview.tsx:27— SegmentedControllersPreview.LayoutSwitch has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10 (18 pts), boolean chains 1 (nesting depth added 8). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 31). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
PrimaryAgentStory.makeState (cognitive 19) ui/storybook/support/primary-agent/PrimaryAgentStory.tsx:60— PrimaryAgentStory.makeState has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 11 (17 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.
CredentialObserver::configure (cognitive 19) packages/paperclip-runner/runner/crates/runner-core/src/credential_observer.rs:118— CredentialObserver::configure has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
secrets-check.secretsCheck (cognitive 18) cli/src/checks/secrets-check.ts:51— secrets-check.secretsCheck has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 5 (6 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 3). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
mcp.registerMcpCommands (cognitive 18) cli/src/commands/mcp.ts:5— mcp.registerMcpCommands has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 6). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 15). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
worktree.worktreeMergeHistoryCommand (cognitive 18) cli/src/commands/worktree.ts:4126— worktree.worktreeMergeHistoryCommand has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 4 (5 pts), boolean chains 4 (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.
worktree.runWorktreeReseed (cognitive 18) cli/src/commands/worktree.ts:4262— worktree.runWorktreeReseed has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, boolean chains 3, ternaries 2, error handling 1, 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-observability-home.prepareAcpxCodexObservabilityHome (cognitive 18) packages/adapter-utils/src/codex-observability-home.ts:11— codex-observability-home.prepareAcpxCodexObservabilityHome has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 2 (4 pts), boolean chains 3, loops 2, ternaries 1 (nesting depth added 6). Of this number, 17 points are the body's own statements and 1 belongs to one function literal 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.
server-utils.materializePaperclipSkillCopy (cognitive 18) REDACTED:4532— server-utils.materializePaperclipSkillCopy has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 4, ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 3). Of this number, 9 points are the body's own statements and 9 belong to one function item inside it that branches. 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.
workspace-seed-cache.cacheUsage (cognitive 18) packages/adapter-utils/src/workspace-seed-cache.ts:142— workspace-seed-cache.cacheUsage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 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.
execution-target.maybeRunSandboxInstallCommand (cognitive 18) REDACTED:1060— execution-target.maybeRunSandboxInstallCommand has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 4, ternaries 2 (4 pts), error handling 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.
run-site-sandbox.createSandboxRunSite.placeWorkspace (cognitive 18) packages/adapter-utils/src/acpx-engine/run-site-sandbox.ts:235— run-site-sandbox.createSandboxRunSite.placeWorkspace has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 1 (2 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 5). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 237, 269). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
codex-home.stageDirectorySecure (cognitive 18) packages/adapters/codex-local/src/server/codex-home.ts:513— codex-home.stageDirectorySecure has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 8). Of this number, 13 points are the body's own statements and 5 belong to 2 function literals 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-args.buildCodexExecArgs (cognitive 18) packages/adapters/codex-local/src/server/codex-args.ts:29— codex-args.buildCodexExecArgs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, boolean chains 6, ternaries 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.
runtime-config.prepareCodexRuntimeConfig (cognitive 18) packages/adapters/codex-local/src/server/runtime-config.ts:345— runtime-config.prepareCodexRuntimeConfig has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 2 (4 pts) (nesting depth added 10). 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.
parse-stdout.parseCodexStdoutLine (cognitive 18) packages/adapters/codex-local/src/ui/parse-stdout.ts:225— parse-stdout.parseCodexStdoutLine has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 3 (6 pts), boolean chains 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.
execute.stageGrokProjectAssets (cognitive 18) packages/adapters/grok-local/src/server/execute.ts:110— execute.stageGrokProjectAssets 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.
parse-stdout.parseLineInternal (cognitive 18) packages/adapters/grok-local/src/ui/parse-stdout.ts:28— parse-stdout.parseLineInternal has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (6 pts), 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.
parse-stdout.parseHermesStdoutLine (cognitive 18) packages/adapters/hermes/src/ui/parse-stdout.ts:193— parse-stdout.parseHermesStdoutLine has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 1 (3 pts), boolean chains 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.
ui-parser.parseStdoutLine (cognitive 18) packages/adapters/hermes/ui-parser.cjs:122— ui-parser.parseStdoutLine has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 1 (3 pts), boolean chains 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.
client.loadAppliedMigrations (cognitive 18) REDACTED:875— client.loadAppliedMigrations has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 1 (nesting depth added 9). 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.
clean-poisoned-claude-sessions.classifyJsonlText (cognitive 18) packages/db/scripts/clean-poisoned-claude-sessions.ts:56— clean-poisoned-claude-sessions.classifyJsonlText has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, error handling 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.
session-reducer.timelineSummary (cognitive 18) packages/paperclip-runner/src/reducer/session-reducer.ts:105— session-reducer.timelineSummary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2, ternaries 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.
App.LiveRunner::startRun (cognitive 18) packages/paperclip-runner/devtools/browser/src/App.tsx:261— App.LiveRunner::startRun has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (2 pts), error handling 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. This shape REPEATS in the file: one other method here (App.LiveRunner) 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-security-config.gitFilesystemRoots (cognitive 18) packages/paperclip-runner/src/drivers/codex/codex-security-config.ts:161— codex-security-config.gitFilesystemRoots has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (6 pts), boolean chains 3, error handling 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-session-workspace.recordCanonicalWorkspaceChange (cognitive 18) packages/paperclip-runner/src/drivers/codex/codex-session-workspace.ts:95— codex-session-workspace.recordCanonicalWorkspaceChange has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (7 pts), if/else 6, boolean chains 5 (nesting depth added 1). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 100). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
CapabilityMockControlPlaneAdapter.appendEvent (cognitive 18) packages/paperclip-runner/src/mock-core/capability-mock-control-plane-adapter.ts:298— CapabilityMockControlPlaneAdapter.appendEvent has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals 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.
evidence-redaction.providerActivityDetails (cognitive 18) packages/paperclip-runner/src/live/evidence-redaction.ts:179— evidence-redaction.providerActivityDetails has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 1, 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.
BoundedJsonCompactor.write (cognitive 18) packages/paperclip-runner/src/drivers/opencode/sse-frames.ts:236— BoundedJsonCompactor.write has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 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.
runnerd-codex-transport.rotateLocalAuthorityEpoch (cognitive 18) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:282— runnerd-codex-transport.rotateLocalAuthorityEpoch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, ternaries 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.
runnerd-codex-transport.appServerThreadGoal (cognitive 18) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:1615— runnerd-codex-transport.appServerThreadGoal has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 10 (13 pts), if/else 3, boolean chains 2 (nesting depth added 3). Of this number, 12 points are the body's own statements and 6 belong to one function item inside it that branches. 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.
ThreadItems.WorkspaceFileReference (cognitive 18) packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx:277— ThreadItems.WorkspaceFileReference has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (16 pts), if/else 1 (2 pts) (nesting depth added 8). Of this number, 16 points are the body's own statements and 2 belong to one function literal 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.
private-snapshot.createAcpxPrivateSnapshot::copy (cognitive 18) packages/paperclip-runner/src/drivers/acpx/private-snapshot.ts:94— private-snapshot.createAcpxPrivateSnapshot::copy has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3, loops 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. This shape REPEATS in the file: one other method here (private-snapshot.createAcpxPrivateSnapshot) 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.
archive.readAttemptControlledEvidence (cognitive 18) packages/paperclip-runner/scripts/controlled-evals/archive.mjs:112— archive.readAttemptControlledEvidence has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, error handling 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.
copilot-permission-context.safeCopilotEditTarget (cognitive 18) packages/paperclip-runner/src/drivers/acpx/copilot-permission-context.ts:34— copilot-permission-context.safeCopilotEditTarget has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 6, ternaries 3. Of this number, 15 points are the body's own statements and 3 belong to 3 function literals inside it that branch. 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.
runner-tool-bridge.startRunnerToolBridge (cognitive 18) packages/paperclip-runner/src/drivers/runner-tool-bridge.ts:110— runner-tool-bridge.startRunnerToolBridge has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 3 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 4). Of this number, 16 points are the body's own statements and 2 belong to one function literal 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.
compatibility.assertPaperclipRunnerEvalCompatibility (cognitive 18) packages/paperclip-runner/src/evals/compatibility.ts:83— compatibility.assertPaperclipRunnerEvalCompatibility has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3, loops 1, 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.
acpx-qualification.resolveAcpxQualification (cognitive 18) server/src/services/native-runtime/acpx-qualification.ts:8— acpx-qualification.resolveAcpxQualification has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7, error handling 1, 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.
remote-http-fetch.sendRequest (cognitive 18) server/src/services/remote-http-fetch.ts:275— remote-http-fetch.sendRequest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), loops 2 (4 pts), boolean chains 3, ternaries 3 (nesting depth added 3). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
trust-preset-resolver.resolveCoreTrustPreset (cognitive 18) server/src/services/trust-preset-resolver.ts:273— trust-preset-resolver.resolveCoreTrustPreset has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, loops 2, ternaries 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.
authorization.createAuthorizationService.decideTaskBridgeAccess (cognitive 18) server/src/services/authorization.ts:1468— authorization.createAuthorizationService.decideTaskBridgeAccess has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, ternaries 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.
aws-secrets-manager-provider.createAwsSecretsManagerProvider.healthCheck (cognitive 18) server/src/secrets/aws-secrets-manager-provider.ts:1032— aws-secrets-manager-provider.createAwsSecretsManagerProvider.healthCheck has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (14 pts), boolean chains 2, error handling 1, if/else 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.
durable-directory.directoryAncestry (cognitive 18) server/src/lib/durable-directory.ts:14— durable-directory.directoryAncestry has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (16 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.
issue-execution-policy.normalizeIssueExecutionPolicy (cognitive 18) server/src/services/issue-execution-policy.ts:346— issue-execution-policy.normalizeIssueExecutionPolicy has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (10 pts), if/else 5 (6 pts), boolean chains 1, loops 1 (nesting depth added 2). Of this number, 9 points are the body's own statements and 9 belong to 3 function literals inside it that branch. 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.
cancelled-native-startup.isCancelledNativeStartup (cognitive 18) server/src/services/cancelled-native-startup.ts:33— cancelled-native-startup.isCancelledNativeStartup has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 14, if/else 4. 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.
PhotonCloudClient.request (cognitive 18) server/src/services/photon/cloud.ts:112— PhotonCloudClient.request has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, error handling 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.
paperclip-cloud-connector.createPaperclipCloudConnector.call (cognitive 18) server/src/services/paperclip-cloud-connector.ts:276— paperclip-cloud-connector.createPaperclipCloudConnector.call has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 3, ternaries 2 (3 pts), error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
voice-delivery-diagnostics.captureVoiceDeliveryDiagnostics (cognitive 18) server/src/services/voice/voice-delivery-diagnostics.ts:14— voice-delivery-diagnostics.captureVoiceDeliveryDiagnostics has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (6 pts), boolean chains 5, ternaries 2 (3 pts), error handling 2, loops 2 (nesting depth added 2). Of this number, 14 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
environment-selection.assertEnvironmentSelectionForCompany (cognitive 18) server/src/services/environment-selection.ts:3— environment-selection.assertEnvironmentSelectionForCompany has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 2 (4 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.
browser-use.browserUseService.discoverBrowsers (cognitive 18) server/src/services/browser-use.ts:989— browser-use.browserUseService.discoverBrowsers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), ternaries 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.
cron.nextCronTick (cognitive 18) server/src/services/cron.ts:253— cron.nextCronTick has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 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.
railway.createRailwayClient.query (cognitive 18) server/src/services/railway.ts:206— railway.createRailwayClient.query has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, ternaries 2 (4 pts), error handling 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.
tool-gateway.createToolGatewayService.requestApprovalForRecordedToolCall (cognitive 18) server/src/services/tool-gateway.ts:2414— tool-gateway.createToolGatewayService.requestApprovalForRecordedToolCall has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 4 (6 pts), boolean chains 5, error handling 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.
workspace-compaction.findRegenerableWorkspaceDirs (cognitive 18) server/src/services/workspace-compaction.ts:129— workspace-compaction.findRegenerableWorkspaceDirs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (5 pts), loops 3 (4 pts) (nesting depth added 8). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to one function item inside it that branches (collect). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
nested-repository-worktrees.restoreNestedRepositoryWorktree (cognitive 18) server/src/services/nested-repository-worktrees.ts:232— nested-repository-worktrees.restoreNestedRepositoryWorktree has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, ternaries 2 (3 pts), error handling 1, loops 1 (nesting depth added 3). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 241). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
managed-workspace-identity.probeManagedWorkspaceReadiness (cognitive 18) server/src/services/managed-workspace-identity.ts:132— managed-workspace-identity.probeManagedWorkspaceReadiness has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 5, ternaries 2 (4 pts), error handling 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.
UnixBrokerClient.roundTrip (cognitive 18) server/src/services/runtime-exposure/broker-client.ts:205— UnixBrokerClient.roundTrip has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 244, 221). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
port-reservation.buildExposureReservationLedger (cognitive 18) server/src/services/runtime-exposure/port-reservation.ts:201— port-reservation.buildExposureReservationLedger has cognitive complexity 18 (threshold 15). Drivers by points: loops 7 (9 pts), if/else 3 (4 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 4). Of this number, 15 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
port-reservation.findExposureReservationDrift (cognitive 18) server/src/services/runtime-exposure/port-reservation.ts:446— port-reservation.findExposureReservationDrift has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 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.
projects.projectService.resolveManagedProject (cognitive 18) server/src/services/projects.ts:758— projects.projectService.resolveManagedProject has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 1 (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.
workspaces.resolveExecutionWorkspaceConfigFreshness (cognitive 18) server/src/services/heartbeat/workspaces.ts:2992— workspaces.resolveExecutionWorkspaceConfigFreshness has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (13 pts), if/else 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.
chat-github-registration.githubChatRegistrationService.start (cognitive 18) server/src/services/chat-github-registration.ts:58— chat-github-registration.githubChatRegistrationService.start has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 8, ternaries 1. Of this number, 13 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
budget-reservations.recheckRunBudgetReservationInTransaction (cognitive 18) server/src/services/budget-reservations.ts:27— budget-reservations.recheckRunBudgetReservationInTransaction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, ternaries 1 (2 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-pricing.priceCodexReceipt (cognitive 18) server/src/services/codex-pricing.ts:18— codex-pricing.priceCodexReceipt has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (9 pts), boolean chains 5, if/else 4 (nesting depth added 1). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
email-channels.emailChannelService.reconnect (cognitive 18) server/src/services/email-channels.ts:2474— email-channels.emailChannelService.reconnect has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, error handling 1 (2 pts), ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2491, 2512, 2518). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-inbound-wakeup-publications.resolveInboundWakeReceipt (cognitive 18) server/src/services/chat-inbound-wakeup-publications.ts:67— chat-inbound-wakeup-publications.resolveInboundWakeReceipt has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 7, ternaries 1 (2 pts), 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.
failed-run-retry.createChatFailedRunRetry.authorizeFailedChatRunRetry (cognitive 18) server/src/services/chat-channels/failed-run-retry.ts:1321— failed-run-retry.createChatFailedRunRetry.authorizeFailedChatRunRetry has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 7, ternaries 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.
publication-drafts.createTelegramPublicationDrafts.reserveTelegramPublicationDraft (cognitive 18) server/src/services/chat-channels/telegram/publication-drafts.ts:244— publication-drafts.createTelegramPublicationDrafts.reserveTelegramPublicationDraft has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 7, ternaries 1. Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 344, 284). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
default-access.createCatalogDefaultAccess.upsertAskFirstPolicies (cognitive 18) server/src/services/tool-access/catalog/default-access.ts:226— default-access.createCatalogDefaultAccess.upsertAskFirstPolicies has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 2 (6 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 7). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals 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.
service.createToolProfileService.assertTargetExists (cognitive 18) server/src/services/tool-access/profiles/service.ts:282— service.createToolProfileService.assertTargetExists has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (18 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.
resolution.resolveCatalogAccess (cognitive 18) server/src/services/tool-access/profiles/resolution.ts:19— resolution.resolveCatalogAccess has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 8). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals 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.
issue-thread-interactions.issueThreadInteractionService.recordSecretProposalExecutionResult (cognitive 18) server/src/services/issue-thread-interactions.ts:3095— issue-thread-interactions.issueThreadInteractionService.recordSecretProposalExecutionResult has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, ternaries 6 (7 pts), if/else 4 (nesting depth added 1). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 3101). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
oauth.createPublicMcpOAuth.approveGrant (cognitive 18) server/src/services/public-mcp/oauth.ts:254— oauth.createPublicMcpOAuth.approveGrant has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 6, ternaries 1. Of this number, 14 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
agent-profile-avatar.setAgentProfileAvatar (cognitive 18) server/src/services/agent-profile-avatar.ts:32— agent-profile-avatar.setAgentProfileAvatar has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 5 (6 pts), boolean chains 4, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 43). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
dot.createBroker.authorizeAssignment (cognitive 18) server/src/modules/external-agents/dot.ts:55— dot.createBroker.authorizeAssignment has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (5 pts), ternaries 2 (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.
dot.createBroker.challenge (cognitive 18) server/src/modules/external-agents/dot.ts:447— dot.createBroker.challenge has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6 (nesting depth added 3). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 454). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
case-handoff-lifecycle.recoverLegacyCaseHandoffCleanup (cognitive 18) server/src/services/heartbeat/case-handoff-lifecycle.ts:78— case-handoff-lifecycle.recoverLegacyCaseHandoffCleanup has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, error handling 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.
legacy-execution-recovery.legacyExecutionNeedsReconciliation (cognitive 18) server/src/services/legacy-execution-recovery.ts:42— legacy-execution-recovery.legacyExecutionNeedsReconciliation has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 9. 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.
environment-runtime.stripSecretRefValuesFromPluginLeaseMetadata (cognitive 18) server/src/services/environment-runtime.ts:397— environment-runtime.stripSecretRefValuesFromPluginLeaseMetadata has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 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.
environment-runtime.createPluginEnvironmentDriver.resolvePluginDriverForRelease (cognitive 18) server/src/services/environment-runtime.ts:3596— environment-runtime.createPluginEnvironmentDriver.resolvePluginDriverForRelease has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 6 (7 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.
change-consent-gate.legacyTargetKeysFor (cognitive 18) server/src/services/change-consent-gate.ts:72— change-consent-gate.legacyTargetKeysFor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 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.
case-handoffs.caseHandoffService.list (cognitive 18) server/src/services/case-handoffs.ts:534— case-handoffs.caseHandoffService.list has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (6 pts), error handling 2 (5 pts), ternaries 4 (5 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.
workspace-file-resources.enumerateWorkspaceDirectoryChildren (cognitive 18) server/src/services/workspace-file-resources.ts:818— workspace-file-resources.enumerateWorkspaceDirectoryChildren has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 7). Of this number, 15 points are the body's own statements and 3 belong to one function literal 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.
company-skills.deriveCanonicalSkillKey (cognitive 18) server/src/services/company-skills.ts:664— company-skills.deriveCanonicalSkillKey has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, error handling 1 (3 pts), 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.
current-wake-comments.assertCurrentWakeCommentsRead (cognitive 18) server/src/services/native-runtime/current-wake-comments.ts:744— current-wake-comments.assertCurrentWakeCommentsRead has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 3). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 754). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-session-executor.claimWarmNativeInstructionCopy (cognitive 18) server/src/services/native-runtime/native-session-executor.ts:586— native-session-executor.claimWarmNativeInstructionCopy has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 5, error handling 1 (nesting depth added 1). Of this number, 15 points are the body's own statements and 3 belong to 2 function items inside it that branch. 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.
native-session-executor.runtimeQuestionFallbackFromEvent (cognitive 18) server/src/services/native-runtime/native-session-executor.ts:929— native-session-executor.runtimeQuestionFallbackFromEvent has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (12 pts), if/else 3, boolean chains 2, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 960, 983). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
run-preparation.mergeWakeCommentIds (cognitive 18) server/src/services/heartbeat/run-preparation.ts:1601— run-preparation.mergeWakeCommentIds has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 9). Of this number, 16 points are the body's own statements and 2 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.
service.recoveryService.hasCurrentNativePassiveWait (cognitive 18) REDACTED:1257— service.recoveryService.hasCurrentNativePassiveWait has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 7, 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.
context.mergeWakeCommentIds (cognitive 18) server/src/modules/wake-queue/domain/context.ts:40— context.mergeWakeCommentIds has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 9). Of this number, 16 points are the body's own statements and 2 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.
app.parseWikiFrontmatterBlock (cognitive 18) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:999— app.parseWikiFrontmatterBlock has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 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.
app.IngestFilesModal (cognitive 18) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:1809— app.IngestFilesModal has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (8 pts), boolean chains 4, if/else 4, error handling 1, loops 1 (nesting depth added 2). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 5 function items inside it that branch (confirm, a function literal at line 1846, a function literal at line 1841, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
app.SpaceRowMenu (cognitive 18) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:2795— app.SpaceRowMenu has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6, boolean chains 5, ternaries 3 (5 pts), error handling 2 (nesting depth added 2). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 4 function items inside it that branch (handleArchive, handleRefresh, a function literal at line 2819, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
app.buildRoutineHealthItems (cognitive 18) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:4896— app.buildRoutineHealthItems has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (6 pts), ternaries 2, loops 1 (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.
core.distillPaperclipProjectPage (cognitive 18) packages/plugins/plugin-llm-wiki/src/wiki/core.ts:3334— core.distillPaperclipProjectPage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 5 (7 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.
config.validateCloudflareDriverConfig (cognitive 18) packages/plugins/sandbox-providers/cloudflare/src/config.ts:43— config.validateCloudflareDriverConfig has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, error handling 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.
file-sync.syncOutDirectoryMapping (cognitive 18) packages/plugins/sandbox-providers/daytona/src/file-sync.ts:1269— file-sync.syncOutDirectoryMapping has cognitive complexity 18 (threshold 15). Drivers by points: error handling 2 (5 pts), if/else 2 (5 pts), ternaries 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 9). None of this is in the body itself: all 18 points belong to 2 function literals inside it that branch (lines 1289, 1335). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
env-file.updateEnvFileContents (cognitive 18) packages/shared/src/env-file.ts:109— env-file.updateEnvFileContents has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 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.
settings-visibility.parseHiddenSettingsList (cognitive 18) packages/shared/src/settings-visibility.ts:143— settings-visibility.parseHiddenSettingsList has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, loops 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.
worktree-seed-source.resolveRegisteredWorktreeSeedSource (cognitive 18) REDACTED:115— worktree-seed-source.resolveRegisteredWorktreeSeedSource has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, error handling 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.
StrictParser.parseString (cognitive 18) packages/tailscale-https-broker/src/strict-json.ts:112— StrictParser.parseString has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 1 (3 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.
preview-artifacts.imageExists (cognitive 18) scripts/preview-artifacts.mjs:85— preview-artifacts.imageExists has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3 (nesting depth added 3). Of this number, 15 points are the body's own statements and 3 belong to 2 function items inside it that branch. 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.
org-chart-svg.guessRoleTag (cognitive 18) server/src/routes/org-chart-svg.ts:138— org-chart-svg.guessRoleTag has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 8. 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-vitest-stable.runVitest (cognitive 18) scripts/run-vitest-stable.mjs:381— run-vitest-stable.runVitest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (7 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). Of this number, 13 points are the body's own statements and 5 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.
feedback.buildFeedbackTraceBundleFromRow (cognitive 18) server/src/services/feedback.ts:1468— feedback.buildFeedbackTraceBundleFromRow has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 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.
artifact-review-documents.artifactReviewDocumentService.ensureForWorkProduct (cognitive 18) server/src/services/artifact-review-documents.ts:157— artifact-review-documents.artifactReviewDocumentService.ensureForWorkProduct has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (4 pts), boolean chains 3, error handling 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.
decision-retention.resolveOrigin (cognitive 18) server/src/services/decision-retention.ts:77— decision-retention.resolveOrigin has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 4 (8 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.
secret-proposals.createSecretProposalsService.reflectProposalLifecycleOnInteraction (cognitive 18) server/src/services/secret-proposals.ts:256— secret-proposals.createSecretProposalsService.reflectProposalLifecycleOnInteraction has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 3, if/else 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.
secret-proposals.createSecretProposalsService.applyBindingApproval (cognitive 18) server/src/services/secret-proposals.ts:658— secret-proposals.createSecretProposalsService.applyBindingApproval has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
smoke-lab.smokeLabService.issueToken (cognitive 18) REDACTED:581— smoke-lab.smokeLabService.issueToken has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, ternaries 2 (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.
company-portability.parseGitHubSourceUrl (cognitive 18) server/src/services/company-portability.ts:3519— company-portability.parseGitHubSourceUrl has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 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.
public-mcp.publicMcpManagementRoutes (cognitive 18) REDACTED:198— public-mcp.publicMcpManagementRoutes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 4, ternaries 1 (nesting depth added 1). None of this is in the body itself: all 18 points belong to 11 function items inside it that branch (requestOAuth, a function literal at line 228, deviceOAuth, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
skill-source-git-snapshot.acquire.readBlobs (cognitive 18) server/src/services/skill-source-git-snapshot.ts:194— skill-source-git-snapshot.acquire.readBlobs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, 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.
skill-sources.skillSourceService.disconnect (cognitive 18) server/src/services/skill-sources.ts:368— skill-sources.skillSourceService.disconnect has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 2 (3 pts), boolean chains 2, loops 2, error handling 1 (nesting depth added 3). Of this number, 12 points are the body's own statements and 6 belong to 4 function items inside it that branch. 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.
native-workspace-owner-recovery.resumeNativeWorkspaceAfterOwnerStop (cognitive 18) server/src/services/native-runtime/native-workspace-owner-recovery.ts:16— native-workspace-owner-recovery.resumeNativeWorkspaceAfterOwnerStop has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 3). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to one function literal inside it that branches (line 24). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
issues.buildIssueSubtreeDiagnosticsResponse (cognitive 18) server/src/routes/issues.ts:1847— issues.buildIssueSubtreeDiagnosticsResponse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (6 pts), loops 3 (5 pts), boolean chains 4, ternaries 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
case-work-summary.enrichCaseWork (cognitive 18) server/src/services/case-work-summary.ts:10— case-work-summary.enrichCaseWork has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 13 (16 pts), boolean chains 1, if/else 1 (nesting depth added 3). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 53, 17, 18, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
plugin-local-folders.resolvePluginLocalFolderPath (cognitive 18) server/src/services/plugin-local-folders.ts:370— plugin-local-folders.resolvePluginLocalFolderPath has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 6, ternaries 1 (2 pts), error handling 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.
connection-intents.runtimeConnectionIntentRoutes (cognitive 18) server/src/routes/connection-intents.ts:43— connection-intents.runtimeConnectionIntentRoutes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 3 (5 pts), boolean chains 3 (nesting depth added 4). None of this is in the body itself: all 18 points belong to 2 function literals inside it that branch (lines 65, 47). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
verify-release-registry-state.verifyPackageRegistryProblems (cognitive 18) scripts/verify-release-registry-state.mjs:261— verify-release-registry-state.verifyPackageRegistryProblems has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (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.
prepare-native-run.prepareNativeHeartbeatRun (cognitive 18) server/src/services/native-runtime/prepare-native-run.ts:39— prepare-native-run.prepareNativeHeartbeatRun has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (9 pts), boolean chains 5, if/else 4 (nesting depth added 1). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 100). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
composer-run-settings.composerDefaultModel (cognitive 18) ui/src/components/task-chat/composer-run-settings.ts:31— composer-run-settings.composerDefaultModel has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 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.
ComposerAddMenu.ComposerAddMenu (cognitive 18) ui/src/components/task-chat/ComposerAddMenu.tsx:32— ComposerAddMenu.ComposerAddMenu has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (11 pts), if/else 4 (5 pts), boolean chains 2 (nesting depth added 3). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 6 function items inside it that branch (content, a function literal at line 38, a function literal at line 39, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
attention.groupAttentionItems (cognitive 18) ui/src/lib/attention.ts:857— attention.groupAttentionItems has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), loops 3 (5 pts), ternaries 2 (5 pts) (nesting depth added 6). Of this number, 17 points are the body's own statements and 1 belongs to one function literal 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.
inbox.buildInboxKeyboardNavEntries (cognitive 18) ui/src/lib/inbox.ts:1188— inbox.buildInboxKeyboardNavEntries has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 9). Of this number, 10 points are the body's own statements and 8 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.
AgentConversationsSidebar.AgentConversationsSidebar (cognitive 18) ui/src/components/AgentConversationsSidebar.tsx:12— AgentConversationsSidebar.AgentConversationsSidebar has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, ternaries 5 (6 pts), if/else 3 (4 pts), loops 1 (nesting depth added 2). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 23, 29, 30, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AiConnectionCredentialStep.SubscriptionConnectionStep (cognitive 18) ui/src/components/ai-connections/AiConnectionCredentialStep.tsx:41— AiConnectionCredentialStep.SubscriptionConnectionStep has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, ternaries 4 (7 pts), error handling 1, if/else 1 (nesting depth added 3). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
agent-config-patch.buildAgentUpdatePatch (cognitive 18) ui/src/lib/agent-config-patch.ts:19— agent-config-patch.buildAgentUpdatePatch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, ternaries 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.
recovery-display.deriveRecoveryDisplayState (cognitive 18) ui/src/lib/recovery-display.ts:69— recovery-display.deriveRecoveryDisplayState has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 1 (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.
BlockedInboxView.BlockedInboxRow (cognitive 18) ui/src/components/BlockedInboxView.tsx:307— BlockedInboxView.BlockedInboxRow has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 11 (14 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.
LegacyInbox.ApprovalInboxRow (cognitive 18) ui/src/pages/LegacyInbox.tsx:435— LegacyInbox.ApprovalInboxRow has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (14 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.
Inbox.ApprovalInboxRow (cognitive 18) ui/src/pages/Inbox.tsx:519— Inbox.ApprovalInboxRow has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (14 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.
LiveUpdatesProvider.buildRunStatusToast (cognitive 18) ui/src/context/LiveUpdatesProvider.tsx:1152— LiveUpdatesProvider.buildRunStatusToast has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 6, boolean chains 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.
TaskChatProtocolActivityRow.ResearchDetails (cognitive 18) ui/src/components/task-chat/TaskChatProtocolActivityRow.tsx:69— TaskChatProtocolActivityRow.ResearchDetails has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (16 pts), boolean chains 2 (nesting depth added 7). Of this number, 16 points are the body's own statements and 2 belong to one function literal 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.
transcript-adapter.paperclipRunnerFinalResponse (cognitive 18) ui/src/components/task-chat/transcript-adapter.ts:1335— transcript-adapter.paperclipRunnerFinalResponse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, ternaries 2 (3 pts), loops 2 (nesting depth added 4). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals 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.
transcriptPresentation.summarizeToolResult (cognitive 18) ui/src/lib/transcriptPresentation.ts:240— transcriptPresentation.summarizeToolResult has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 5 (8 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.
IssueChatThread.fallbackTextParts (cognitive 18) ui/src/components/IssueChatThread.tsx:868— IssueChatThread.fallbackTextParts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, 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.
IssueAttachmentsSection.IssueAttachmentsSection (cognitive 18) ui/src/components/IssueAttachmentsSection.tsx:227— IssueAttachmentsSection.IssueAttachmentsSection has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (6 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 2). Of this number, 11 points are the body's own statements and 7 belong to 6 function items inside it that branch. 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.
issue-output.getOutputFileGlyph (cognitive 18) ui/src/lib/issue-output.ts:185— issue-output.getOutputFileGlyph has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 5 (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.
IssueRelatedWorkPanel.ExternalObjectsSection (cognitive 18) ui/src/components/IssueRelatedWorkPanel.tsx:90— IssueRelatedWorkPanel.ExternalObjectsSection has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (17 pts), if/else 1 (nesting depth added 8). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 102, 141). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
searchable-select.scoreTokenAgainstText (cognitive 18) ui/src/lib/searchable-select.ts:41— searchable-select.scoreTokenAgainstText has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 1 (nesting depth added 4). Of this number, 11 points are the body's own statements and 7 belong to one function literal inside it that branches. 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.
FileViewerContext.EnabledFileViewerProvider (cognitive 18) ui/src/context/FileViewerContext.tsx:212— FileViewerContext.EnabledFileViewerProvider has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 5 (7 pts), boolean chains 1 (nesting depth added 4). None of this is in the body itself: all 18 points belong to 5 function literals inside it that branch (lines 231, 264, 220, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ArtifactFileChip.ArtifactFileChip (cognitive 18) ui/src/components/ArtifactFileChip.tsx:24— ArtifactFileChip.ArtifactFileChip has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (11 pts), if/else 5, boolean chains 2 (nesting depth added 3). Of this number, 9 points are the body's own statements and 9 belong to one function item inside it that branches. 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.
TaskChatLiveRunPill.toolCountSummaryFromEntries (cognitive 18) ui/src/components/task-chat/TaskChatLiveRunPill.tsx:19— TaskChatLiveRunPill.toolCountSummaryFromEntries has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (5 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.
EntityRow.EntityRow (cognitive 18) ui/src/components/EntityRow.tsx:46— EntityRow.EntityRow has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 14, ternaries 3, if/else 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.
activity-format.formatIssueUpdatedAction (cognitive 18) ui/src/lib/activity-format.ts:383— activity-format.formatIssueUpdatedAction has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 7, boolean chains 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.
RunTranscriptView.summarizeToolResult (cognitive 18) ui/src/components/transcript/RunTranscriptView.tsx:342— RunTranscriptView.summarizeToolResult has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 5 (8 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.
RunTranscriptView.TranscriptEventRow (cognitive 18) ui/src/components/transcript/RunTranscriptView.tsx:1460— RunTranscriptView.TranscriptEventRow has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (16 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.
RunTranscriptView.RunTranscriptView (cognitive 18) ui/src/components/transcript/RunTranscriptView.tsx:1847— RunTranscriptView.RunTranscriptView has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 13, ternaries 3, if/else 2. Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1887, 1862). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RoutineOverview.RoutineOverview (cognitive 18) ui/src/components/RoutineOverview.tsx:140— RoutineOverview.RoutineOverview has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 13 (17 pts), boolean chains 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
AssistantConnection.AssistantConnection (cognitive 18) ui/src/pages/apps/AssistantConnection.tsx:88— AssistantConnection.AssistantConnection has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, ternaries 5 (6 pts), if/else 1 (nesting depth added 1). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
OwnSlackAppSetup.OwnSlackAppSetup::create (cognitive 18) ui/src/pages/apps/chat/slack/OwnSlackAppSetup.tsx:64— OwnSlackAppSetup.OwnSlackAppSetup::create has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, error handling 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. This shape REPEATS in the file: one other method here (OwnSlackAppSetup.OwnSlackAppSetup) 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.
CompanySkills.CatalogList (cognitive 18) ui/src/pages/CompanySkills.tsx:1629— CompanySkills.CatalogList has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, ternaries 7, if/else 4. Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (renderRow, a function literal at line 1659). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SkillStudio.SkillPathDialog (cognitive 18) ui/src/pages/SkillStudio.tsx:1720— SkillStudio.SkillPathDialog has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (10 pts), if/else 6 (7 pts), boolean chains 1 (nesting depth added 3). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 1740, submit). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ImportFromVaultDialog.validateDraftRow (cognitive 18) ui/src/pages/secrets/ImportFromVaultDialog.tsx:268— ImportFromVaultDialog.validateDraftRow has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 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.
CompanyImport.buildActionMap (cognitive 18) ui/src/pages/CompanyImport.tsx:78— CompanyImport.buildActionMap has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 5 (6 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.
CompanyImport.buildConflictList (cognitive 18) ui/src/pages/CompanyImport.tsx:301— CompanyImport.buildConflictList has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 2 (4 pts), 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.
CompanyImport.watchImportJob (cognitive 18) ui/src/pages/CompanyImport.tsx:856— CompanyImport.watchImportJob has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 2, error handling 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.
DesignGuide.DesignGuide (cognitive 18) REDACTED:508— DesignGuide.DesignGuide has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8, boolean chains 7, if/else 3. Of this number, 11 points are the body's own statements and 7 belong to 4 function literals inside it that branch. 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.
CompanyExport.ExportPreviewPane (cognitive 18) ui/src/pages/CompanyExport.tsx:527— CompanyExport.ExportPreviewPane has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (13 pts), boolean chains 4, if/else 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.
CompanySkills.production.CatalogList (cognitive 18) ui/src/pages/CompanySkills.production.tsx:1719— CompanySkills.production.CatalogList has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, ternaries 7, if/else 4. Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (renderRow, a function literal at line 1749). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
App.OnboardingRoutePage (cognitive 18) ui/src/App.tsx:567— App.OnboardingRoutePage has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (15 pts), boolean chains 2, if/else 1 (nesting depth added 6). Of this number, 12 points are the body's own statements and 6 belong to one function literal 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.
PanelCard.PanelCard (cognitive 18) ui/src/artifact-directions/directions/d4-hybrid/PanelCard.tsx:57— PanelCard.PanelCard has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 12 (17 pts), boolean chains 1 (nesting depth added 5). Of this number, 16 points are the body's own statements and 2 belong to one function literal 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.
main.Lab (cognitive 18) ui/src/artifact-directions/main.tsx:132— main.Lab has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (13 pts), if/else 4, boolean chains 1 (nesting depth added 7). Of this number, 11 points are the body's own statements and 7 belong to one function literal 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.
ArtifactUploadControls.ArtifactUploadContent (cognitive 18) ui/src/components/artifacts/ArtifactUploadControls.tsx:33— ArtifactUploadControls.ArtifactUploadContent has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (18 pts) (nesting depth added 9). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 42). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
TeamCatalog.StepPreview (cognitive 18) ui/src/pages/TeamCatalog.tsx:1767— TeamCatalog.StepPreview has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 15, if/else 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.
generic-mcp-connect.genericConnectPayload (cognitive 18) ui/src/pages/apps/generic-mcp-connect.ts:222— generic-mcp-connect.genericConnectPayload has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (6 pts), boolean chains 5, if/else 3 (5 pts), 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.
CompletedActivityPreview.CompletedActivityPreview (cognitive 18) ui/storybook/prototypes/completed-activity/CompletedActivityPreview.tsx:195— CompletedActivityPreview.CompletedActivityPreview has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (10 pts), boolean chains 7, if/else 1 (nesting depth added 4). Of this number, 16 points are the body's own statements and 2 belong to one function literal 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.
task-list-data.columnData (cognitive 18) ui/storybook/support/design-proposals/task-list-data.ts:40— task-list-data.columnData has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 14 (16 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DurableState::enqueue_event_with_source_event_id (cognitive 18) packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:507— DurableState::enqueue_event_with_source_event_id has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, boolean chains 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.
store.writeConfig (cognitive 17) cli/src/config/store.ts:186— store.writeConfig has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 1 (4 pts), error handling 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.
install.installCommand (cognitive 17) cli/src/commands/install.ts:360— install.installCommand has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 4 (6 pts), error handling 2 (3 pts) (nesting depth added 6). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 371, 392). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
company.uploadCompanyImportTransfer (cognitive 17) cli/src/commands/client/company.ts:1148— company.uploadCompanyImportTransfer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 2 (4 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). Of this number, 16 points are the body's own statements and 1 belongs to one function literal 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.
onboard-service.waitUntilDashboardReady (cognitive 17) cli/src/onboard-service.ts:50— onboard-service.waitUntilDashboardReady has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 1 (4 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.
workspace-restore-diagnostics.sanitizeWorkspaceRestoreDiagnostic (cognitive 17) packages/adapter-utils/src/workspace-restore-diagnostics.ts:175— workspace-restore-diagnostics.sanitizeWorkspaceRestoreDiagnostic has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 7, if/else 2 (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.
git-workspace-sync.readManagedWorkspaceRepositories (cognitive 17) packages/adapter-utils/src/git-workspace-sync.ts:172— git-workspace-sync.readManagedWorkspaceRepositories has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 7). Of this number, 16 points are the body's own statements and 1 belongs to one function literal 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.
execution-target.readBridgeForwardResponseBody (cognitive 17) REDACTED:1847— execution-target.readBridgeForwardResponseBody has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 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.
build-config.buildCodexLocalConfig (cognitive 17) packages/adapters/codex-local/src/ui/build-config.ts:34— build-config.buildCodexLocalConfig has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
build-config.parseEnvBindings (cognitive 17) packages/adapters/kimi-local/src/ui/build-config.ts:26— build-config.parseEnvBindings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, 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.
execute.redactForLog (cognitive 17) packages/adapters/openclaw-gateway/src/server/execute.ts:275— execute.redactForLog has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 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.
models.ensureOpenCodeModelConfiguredAndAvailable (cognitive 17) packages/adapters/opencode-local/src/server/models.ts:267— models.ensureOpenCodeModelConfiguredAndAvailable has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (7 pts), error handling 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.
build-config.buildOpenCodeLocalConfig (cognitive 17) packages/adapters/opencode-local/src/ui/build-config.ts:10— build-config.buildOpenCodeLocalConfig has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 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.
clean-poisoned-claude-sessions.main (cognitive 17) packages/db/scripts/clean-poisoned-claude-sessions.ts:283— clean-poisoned-claude-sessions.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), loops 2 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 4). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
check-migration-safety.splitConjunctivePredicate (cognitive 17) packages/db/src/check-migration-safety.ts:539— check-migration-safety.splitConjunctivePredicate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 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.
runtime-config.readConfig (cognitive 17) packages/db/src/runtime-config.ts:142— runtime-config.readConfig has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (12 pts), boolean chains 2, if/else 2, error handling 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.
result-normalization.normalizePrpResultSignals (cognitive 17) packages/paperclip-runner/src/protocol/result-normalization.ts:216— result-normalization.normalizePrpResultSignals has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, ternaries 3 (4 pts) (nesting depth added 3). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to one function literal inside it that branches (line 223). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
provider-events.createAcpxToolEventNormalizer (cognitive 17) packages/paperclip-runner/src/provider-events.ts:290— provider-events.createAcpxToolEventNormalizer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 5, boolean chains 4 (nesting depth added 3). None of this is in the body itself: all 17 points belong to one function literal inside it that branches (line 294). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
runtime-context.parseNativeRuntimeContext (cognitive 17) packages/paperclip-runner/src/contracts/runtime-context.ts:113— runtime-context.parseNativeRuntimeContext has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 6 (7 pts), boolean chains 1 (nesting depth added 2). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
cursor-extensions.createCursorProfileExtensionAdapter.request (cognitive 17) packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts:45— cursor-extensions.createCursorProfileExtensionAdapter.request has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 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-startup-trust.trustCodexStartupRoot (cognitive 17) packages/paperclip-runner/src/drivers/codex/codex-startup-trust.ts:56— codex-startup-trust.trustCodexStartupRoot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, loops 1 (2 pts), error handling 1, 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.
CodexSessionState.constructor (cognitive 17) packages/paperclip-runner/src/drivers/codex/codex-session-state.ts:153— CodexSessionState.constructor has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 7, loops 2 (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-runner.dispositionIssues (cognitive 17) packages/paperclip-runner/src/mock-core/codex-runner.ts:76— codex-runner.dispositionIssues has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 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.
durable-prp-control-plane.canonicalJson (cognitive 17) REDACTED:361— durable-prp-control-plane.canonicalJson has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), 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.
OpenCodeSseParser.push (cognitive 17) packages/paperclip-runner/src/drivers/opencode/sse-frames.ts:94— OpenCodeSseParser.push 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.
provider-trace-file-sink.createProviderTraceFileSink (cognitive 17) packages/paperclip-runner/src/contracts/provider-trace-file-sink.ts:200— provider-trace-file-sink.createProviderTraceFileSink has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 4, error handling 2 (3 pts), ternaries 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.
OpenCodeServerDriver.#open (cognitive 17) REDACTED:365— OpenCodeServerDriver.#open has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 2, 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.
opencode-server-driver.api (cognitive 17) REDACTED:2697— opencode-server-driver.api has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (4 pts), error handling 2, 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.
opencode-server-driver.waitForHealth (cognitive 17) REDACTED:2827— opencode-server-driver.waitForHealth has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (4 pts), error handling 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.
DurablePrpCodexTransport.#handleSemanticToolInput (cognitive 17) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:5908— DurablePrpCodexTransport.#handleSemanticToolInput has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 5, if/else 4 (5 pts), ternaries 3 (5 pts), error handling 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.
runnerd-codex-transport.acpxProviderPackageAuthority (cognitive 17) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:3012— runnerd-codex-transport.acpxProviderPackageAuthority has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, ternaries 3 (4 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.
ThreadItems.WorkspaceChanges (cognitive 17) packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx:204— ThreadItems.WorkspaceChanges has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 13 (15 pts), if/else 1 (2 pts) (nesting depth added 3). Of this number, 12 points are the body's own statements and 5 belong to 3 function items inside it that branch. 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.
build-inputs.walk (cognitive 17) packages/paperclip-runner/scripts/build-inputs.mjs:165— build-inputs.walk has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 8). Of this number, 14 points are the body's own statements and 3 belong to one function literal 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.
archive.secretValues (cognitive 17) packages/paperclip-runner/scripts/controlled-evals/archive.mjs:13— archive.secretValues has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 6). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (visit, a function literal at line 16). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
public-eval-viewer.validatePublicChatPayload::visit (cognitive 17) packages/paperclip-runner/scripts/public-eval-viewer.mjs:140— public-eval-viewer.validatePublicChatPayload::visit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (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. This shape REPEATS in the file: one other method here (public-eval-viewer.validatePublicChatPayload) 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.
runner-protocol-eval-campaign.credentialForConfig (cognitive 17) packages/paperclip-runner/scripts/runner-protocol-eval-campaign.mjs:65— runner-protocol-eval-campaign.credentialForConfig has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 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.
runtime-sandbox.readAcpxRecoveryWorkspace (cognitive 17) packages/paperclip-runner/src/drivers/acpx/runtime-sandbox.ts:78— runtime-sandbox.readAcpxRecoveryWorkspace has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 5, error handling 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.
CodexAcpxSession.#finishClose (cognitive 17) REDACTED:1348— CodexAcpxSession.#finishClose has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (8 pts), if/else 6 (7 pts), boolean chains 1, error handling 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.
acpx-sidecar-input.acpxSidecarErrorCode (cognitive 17) packages/paperclip-runner/src/cli/acpx-sidecar-input.ts:38— acpx-sidecar-input.acpxSidecarErrorCode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 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.
eval-gateway-runtime.prepareEvalGatewayRuntime (cognitive 17) packages/paperclip-runner/src/cli/eval-gateway-runtime.ts:21— eval-gateway-runtime.prepareEvalGatewayRuntime has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, boolean chains 6, error handling 2, loops 1, ternaries 1. Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
semantic-conformance.canonicalJson (cognitive 17) packages/paperclip-runner/src/conformance/semantic-conformance.ts:278— semantic-conformance.canonicalJson has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, 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.
cursor-models.parseCursorModelsOutput (cognitive 17) server/src/adapters/cursor-models.ts:70— cursor-models.parseCursorModelsOutput has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3 (4 pts), boolean chains 3, error handling 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.
activity-log.resolveResponsibleUserIdForActivity (cognitive 17) server/src/services/activity-log.ts:92— activity-log.resolveResponsibleUserIdForActivity has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, ternaries 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.
aws-secrets-manager-provider.createAwsSecretsManagerProvider.deleteOrArchive (cognitive 17) server/src/secrets/aws-secrets-manager-provider.ts:1313— aws-secrets-manager-provider.createAwsSecretsManagerProvider.deleteOrArchive has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 2 (4 pts), boolean chains 3, ternaries 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.
secrets.secretService.resolveSecretValueInternal (cognitive 17) server/src/services/secrets.ts:1356— secrets.secretService.resolveSecretValueInternal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, ternaries 4 (5 pts), boolean chains 4, 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.
secrets.secretService.listAgentSecretAccess (cognitive 17) server/src/services/secrets.ts:1760— secrets.secretService.listAgentSecretAccess has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 5, boolean chains 2, loops 1 (nesting depth added 2). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1839, 1797). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
secrets.secretService.normalizeEnvConfig (cognitive 17) server/src/services/secrets.ts:1891— secrets.secretService.normalizeEnvConfig 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.
native-workspace-reconstruction.validateReconstructedWorkspaceDispatch (cognitive 17) server/src/services/native-runtime/native-workspace-reconstruction.ts:119— native-workspace-reconstruction.validateReconstructedWorkspaceDispatch 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.
board-auth.boardAuthService.approveCliAuthChallenge (cognitive 17) server/src/services/board-auth.ts:371— board-auth.boardAuthService.approveCliAuthChallenge has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 3, error handling 1 (2 pts), loops 2 (nesting depth added 2). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 373). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
budgets.budgetServiceInTransaction.resolveIncident (cognitive 17) server/src/services/budgets.ts:899— budgets.budgetServiceInTransaction.resolveIncident has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 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.
PaperclipChatSdkStateAdapter.dequeue (cognitive 17) server/src/services/chat-sdk-state.ts:380— PaperclipChatSdkStateAdapter.dequeue has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 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.
run-identity.initializeRunIdentity (cognitive 17) server/src/services/run-identity.ts:169— run-identity.initializeRunIdentity has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (8 pts), if/else 4 (5 pts), boolean chains 3, loops 1 (nesting depth added 2). None of this is in the body itself: all 17 points belong to one function literal inside it that branches (line 183). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
tool-access-policy.profileEntryMatches (cognitive 17) server/src/services/tool-access-policy.ts:616— tool-access-policy.profileEntryMatches has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (16 pts), if/else 1 (nesting depth added 10). 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.
tool-gateway.createToolGatewayService.resolveConnectedRemoteTool (cognitive 17) server/src/services/tool-gateway.ts:4890— tool-gateway.createToolGatewayService.resolveConnectedRemoteTool has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 8. 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.
tool-gateway.createToolGatewayService.elicitationQuestions (cognitive 17) server/src/services/tool-gateway.ts:5884— tool-gateway.createToolGatewayService.elicitationQuestions has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 3 (5 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tool-gateway.createToolGatewayService.resolveConnectionInstructionsForRun (cognitive 17) server/src/services/tool-gateway.ts:9279— tool-gateway.createToolGatewayService.resolveConnectionInstructionsForRun has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, error handling 1 (2 pts), loops 1, ternaries 1 (nesting depth added 6). Of this number, 13 points are the body's own statements and 4 belong to 2 function literals 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.
chat-provider-lifecycle.parseTelegramLifecycle (cognitive 17) server/src/services/chat-provider-lifecycle.ts:403— chat-provider-lifecycle.parseTelegramLifecycle has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, ternaries 5 (6 pts), if/else 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.
authorization.createChatInboundAuthority.ensurePrincipal (cognitive 17) server/src/services/chat-channels/inbound/authorization.ts:59— authorization.createChatInboundAuthority.ensurePrincipal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, ternaries 2 (3 pts), error handling 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.
provider-effects.createProviderEffects.finalizeProviderEffectFailure (cognitive 17) server/src/services/chat-channels/provider-effects.ts:236— provider-effects.createProviderEffects.finalizeProviderEffectFailure has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (7 pts), boolean chains 5, if/else 5 (nesting depth added 2). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 253). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
nested-repository-worktrees.releaseNestedRepositoryWorktrees (cognitive 17) server/src/services/nested-repository-worktrees.ts:308— nested-repository-worktrees.releaseNestedRepositoryWorktrees has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 2 (3 pts), ternaries 1 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 9). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 312, 316). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
isolated-repository-rehome.rehomeExpiredIsolatedRestoration (cognitive 17) server/src/services/isolated-repository-rehome.ts:677— isolated-repository-rehome.rehomeExpiredIsolatedRestoration has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, error handling 1, ternaries 1 (nesting depth added 1). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
subscription-identity.probeSubscriptionIdentity (cognitive 17) server/src/services/subscription-identity.ts:42— subscription-identity.probeSubscriptionIdentity has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, ternaries 2 (5 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
execution-workspaces.mergeExecutionWorkspaceConfig (cognitive 17) server/src/services/execution-workspaces.ts:1058— execution-workspaces.mergeExecutionWorkspaceConfig has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 11 (12 pts), if/else 5 (nesting depth added 1). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
chat-github-webhook-config.nextCursor (cognitive 17) server/src/services/chat-github-webhook-config.ts:190— chat-github-webhook-config.nextCursor has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, error handling 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.
chat-teams-inline-images.prepareTeamsInlineImage (cognitive 17) server/src/services/chat-teams-inline-images.ts:286— chat-teams-inline-images.prepareTeamsInlineImage has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 3, if/else 3, 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.
chat-teams-file-transfers.teamsFileTransferService.resolveInTransaction (cognitive 17) server/src/services/chat-teams-file-transfers.ts:1095— chat-teams-file-transfers.teamsFileTransferService.resolveInTransaction has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 4 (6 pts), boolean chains 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.
publication-replacement.createChatPublicationReplacement.runOwnershipMilestoneSupersessionReason (cognitive 17) server/src/services/chat-channels/publication-replacement.ts:74— publication-replacement.createChatPublicationReplacement.runOwnershipMilestoneSupersessionReason has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 2 (3 pts) (nesting depth added 2). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
publication-drafts.createTelegramPublicationDrafts.handleTelegramGenerationStopped (cognitive 17) server/src/services/chat-channels/telegram/publication-drafts.ts:65— publication-drafts.createTelegramPublicationDrafts.handleTelegramGenerationStopped has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 8. Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 104). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
chat-publication-stream.splitTelegramPublicationText (cognitive 17) server/src/services/chat-publication-stream.ts:139— chat-publication-stream.splitTelegramPublicationText has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wakeup-notices.createInboundWakeNotices.enqueueInboundWakeupPublications (cognitive 17) server/src/services/chat-channels/inbound/wakeup-notices.ts:133— wakeup-notices.createInboundWakeNotices.enqueueInboundWakeupPublications has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 2 (4 pts), error handling 1 (2 pts), loops 1, ternaries 1 (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.
discovery.createOAuthDiscovery.preflightConnectionMetadata (cognitive 17) server/src/services/tool-access/oauth/discovery.ts:482— discovery.createOAuthDiscovery.preflightConnectionMetadata has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (3 pts), boolean chains 2, error handling 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.
external-objects.externalObjectService.resolveObjectRefresh (cognitive 17) server/src/services/external-objects.ts:804— external-objects.externalObjectService.resolveObjectRefresh has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 4 (7 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.
github-external-object-provider.issueSnapshot (cognitive 17) server/src/services/github-external-object-provider.ts:318— github-external-object-provider.issueSnapshot has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 12 (16 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.
issue-thread-interactions.issueThreadInteractionService.acceptSuggestedTasks (cognitive 17) server/src/services/issue-thread-interactions.ts:3931— issue-thread-interactions.issueThreadInteractionService.acceptSuggestedTasks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 4 (5 pts), boolean chains 2, loops 1 (nesting depth added 2). Of this number, 10 points are the body's own statements and 7 belong to one function literal inside it that branches. 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.
routine.grokRoutineService.reserve (cognitive 17) server/src/services/grok-bot/routine.ts:127— routine.grokRoutineService.reserve has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, ternaries 6 (7 pts), boolean chains 3 (nesting depth added 1). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to one function literal inside it that branches (line 131). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
file-transfers.createPublicMcpTransfers.authorize (cognitive 17) server/src/services/public-mcp/file-transfers.ts:104— file-transfers.createPublicMcpTransfers.authorize has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, ternaries 1 (2 pts) (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.
dot.createBroker.stopGrokWork (cognitive 17) server/src/modules/external-agents/dot.ts:491— dot.createBroker.stopGrokWork has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 6, ternaries 4. None of this is in the body itself: all 17 points belong to one function literal inside it that branches (line 492). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
agentmail.executeAgentmailTool (cognitive 17) server/src/services/connectors/agentmail.ts:109— agentmail.executeAgentmailTool has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6 (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.
case-agent-read.loadAgentCaseDocument (cognitive 17) server/src/services/case-agent-read.ts:42— case-agent-read.loadAgentCaseDocument has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, ternaries 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.
openapi.applyNumberChecks (cognitive 17) server/src/routes/openapi.ts:447— openapi.applyNumberChecks 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.
agent-directory-probe.probeAgentDirectory (cognitive 17) server/src/services/agent-directory-probe.ts:16— agent-directory-probe.probeAgentDirectory has cognitive complexity 17 (threshold 15). Drivers by points: if/else 27 (60 pts), boolean chains 10, loops 4 (7 pts), ternaries 3 (5 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (agent-directory-probe.probeAgentDirectory::walk) 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.
agent-directory-probe.retireAgentDirectoryTransferScratch (cognitive 17) server/src/services/agent-directory-probe.ts:118— agent-directory-probe.retireAgentDirectoryTransferScratch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, loops 2 (nesting depth added 2). Of this number, 10 points are the body's own statements and 7 belong to 2 function items inside it that branch. 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.
project-tools.callProjectTool (cognitive 17) server/src/services/project-tools.ts:19— project-tools.callProjectTool has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 5 (7 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.
company-skills.validateProjectSkillImportPath (cognitive 17) server/src/services/company-skills.ts:1179— company-skills.validateProjectSkillImportPath has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2, ternaries 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.
routines.routineService.recordSuppressedAutomaticRun (cognitive 17) server/src/services/routines.ts:1416— routines.routineService.recordSuppressedAutomaticRun has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (4 pts), boolean chains 3, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 1427). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
remote-warm-session-recovery.inspectRemoteWarmSessionRecovery (cognitive 17) server/src/services/native-runtime/remote-warm-session-recovery.ts:16— remote-warm-session-recovery.inspectRemoteWarmSessionRecovery has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, loops 1, 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.
native-session-executor.createGovernedWaitEventObservation.observe (cognitive 17) server/src/services/native-runtime/native-session-executor.ts:1362— native-session-executor.createGovernedWaitEventObservation.observe has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (8 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.
native-run-finalizer.claimCoordinator (cognitive 17) server/src/services/native-runtime/native-run-finalizer.ts:166— native-run-finalizer.claimCoordinator has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (4 pts), boolean chains 3 (nesting depth added 4). None of this is in the body itself: all 17 points belong to one function literal inside it that branches (line 173). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
run-preparation.enrichWakeContextSnapshot (cognitive 17) server/src/services/heartbeat/run-preparation.ts:1697— run-preparation.enrichWakeContextSnapshot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 8. 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.
service.parseProviderQuotaClockReset (cognitive 17) REDACTED:573— service.parseProviderQuotaClockReset has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, ternaries 2, error handling 1, loops 1 (nesting depth added 2). Of this number, 14 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
environment-run-orchestrator.environmentRunOrchestrator.acquireForRun (cognitive 17) server/src/services/environment-run-orchestrator.ts:269— environment-run-orchestrator.environmentRunOrchestrator.acquireForRun has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, ternaries 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.
app.UnconfiguredFolder (cognitive 17) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:2988— app.UnconfiguredFolder has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 12 (14 pts), boolean chains 1, error handling 1, if/else 1 (nesting depth added 2). Of this number, 9 points are the body's own statements and 8 belong to 2 function items inside it that branch. 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.
execute.events (cognitive 17) packages/plugins/sandbox-providers/createos/src/execute.ts:32— execute.events has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 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.
plugin.executeOneShot (cognitive 17) packages/plugins/sandbox-providers/daytona/src/plugin.ts:1789— plugin.executeOneShot has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 3 (4 pts), error handling 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.
idle-drain.createPluginIdleDrain.prepare (cognitive 17) packages/plugins/sdk/src/idle-drain.ts:32— idle-drain.createPluginIdleDrain.prepare has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 4, ternaries 2 (4 pts), error handling 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.
worker-rpc-host.startWorkerRpcHost.handleOnEvent (cognitive 17) packages/plugins/sdk/src/worker-rpc-host.ts:1951— worker-rpc-host.startWorkerRpcHost.handleOnEvent has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 2 (6 pts), boolean chains 4, if/else 2 (4 pts), error handling 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.
issue.resolveIssueRecoveryActionSchema (cognitive 17) packages/shared/src/validators/issue.ts:629— issue.resolveIssueRecoveryActionSchema has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 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.
issue.paperclipQuestionSchema (cognitive 17) packages/shared/src/validators/issue.ts:1364— issue.paperclipQuestionSchema has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 7, error handling 1 (2 pts) (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.
issue.requestCheckboxConfirmationPayloadSchema (cognitive 17) packages/shared/src/validators/issue.ts:1670— issue.requestCheckboxConfirmationPayloadSchema has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 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.
workspace-commands.scoreWorkspaceRuntimeServiceMatch (cognitive 17) packages/shared/src/workspace-commands.ts:182— workspace-commands.scoreWorkspaceRuntimeServiceMatch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8 (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.
check-no-git-push.collectScannableFiles (cognitive 17) scripts/check-no-git-push.mjs:117— check-no-git-push.collectScannableFiles has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 2 (3 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.
local-ai-browser-login.startLocalBrowserLogin (cognitive 17) server/src/services/local-ai-browser-login.ts:50— local-ai-browser-login.startLocalBrowserLogin has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 3, ternaries 3, error handling 1 (2 pts) (nesting depth added 3). Of this number, 15 points are the body's own statements and 2 belong to 3 function literals inside it that branch. 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.
local-ai-login.localAiLoginService.start (cognitive 17) server/src/services/local-ai-login.ts:86— local-ai-login.localAiLoginService.start has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, ternaries 2 (3 pts), error handling 1 (nesting depth added 4). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 90). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
provider-billing-import.applyProviderDailyCosts (cognitive 17) server/src/services/provider-billing-import.ts:289— provider-billing-import.applyProviderDailyCosts has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 7). None of this is in the body itself: all 17 points belong to one function literal inside it that branches (line 297). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
accounting-integrity.inspect (cognitive 17) server/src/services/accounting-integrity.ts:12— accounting-integrity.inspect has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4, error handling 1 (2 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 1 belongs to one function literal 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.
company-skill-policy.resourceMatches (cognitive 17) server/src/services/company-skill-policy.ts:54— company-skill-policy.resourceMatches has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, ternaries 1 (2 pts) (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.
status-card-update-engine.diffStatusCardFingerprint (cognitive 17) server/src/services/status-card-update-engine.ts:56— status-card-update-engine.diffStatusCardFingerprint has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, 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.
company-portability.companyPortabilityService.assertImportAdapterConfigConstraints (cognitive 17) server/src/services/company-portability.ts:3618— company-portability.companyPortabilityService.assertImportAdapterConfigConstraints has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 2 (3 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.
agent-avatars.agentAvatarRoutes (cognitive 17) server/src/routes/agent-avatars.ts:27— agent-avatars.agentAvatarRoutes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 4 (6 pts), boolean chains 4, error handling 1 (nesting depth added 4). None of this is in the body itself: all 17 points belong to one function literal inside it that branches (line 30). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
workspace-readiness.readSeedManifestSummary (cognitive 17) server/src/services/workspace-readiness.ts:59— workspace-readiness.readSeedManifestSummary has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 3, boolean chains 2, error handling 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.
companies.companyRoutes::resolveImportTransferBody (cognitive 17) server/src/routes/companies.ts:946— companies.companyRoutes::resolveImportTransferBody has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, 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.
skill-sources.skillSourceService.detail (cognitive 17) server/src/services/skill-sources.ts:41— skill-sources.skillSourceService.detail has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (10 pts), boolean chains 4, if/else 1 (2 pts), loops 1 (nesting depth added 7). 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.
agent-ai-connection-default.defaultAiConnectionForHire (cognitive 17) server/src/services/agent-ai-connection-default.ts:22— agent-ai-connection-default.defaultAiConnectionForHire has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (6 pts), boolean chains 5, if/else 4 (5 pts), loops 1 (nesting depth added 3). Of this number, 16 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.
workspace-runtime-service-authz.assertAgentCanManageRuntimeServicesForWorkspace (cognitive 17) server/src/routes/workspace-runtime-service-authz.ts:68— workspace-runtime-service-authz.assertAgentCanManageRuntimeServicesForWorkspace has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, ternaries 6, boolean chains 3, 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.
runtime-api.collectReachableInterfaceHosts (cognitive 17) REDACTED:94— runtime-api.collectReachableInterfaceHosts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 9). Of this number, 16 points are the body's own statements and 1 belongs to one function literal 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.
access.accessRoutes::createCompanyInviteForCompany (cognitive 17) REDACTED:3030— access.accessRoutes::createCompanyInviteForCompany has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts), ternaries 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.
native-workspace-sync-retention.nativeWorkspaceSyncRetentionService.expireFolder (cognitive 17) server/src/services/native-runtime/native-workspace-sync-retention.ts:287— native-workspace-sync-retention.nativeWorkspaceSyncRetentionService.expireFolder has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2, ternaries 1 (nesting depth added 2). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 301). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
historical-cleanup-verification.historicalCleanupVerificationService.run (cognitive 17) server/src/services/historical-cleanup-verification.ts:21— historical-cleanup-verification.historicalCleanupVerificationService.run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 5 (6 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 2). None of this is in the body itself: all 17 points belong to 2 function items inside it that branch (inspect, a function literal at line 70). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
RepositoryEditor.RepositoryEditor (cognitive 17) ui/src/components/RepositoryEditor.tsx:26— RepositoryEditor.RepositoryEditor has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (15 pts), boolean chains 1, if/else 1 (nesting depth added 8). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals 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.
ProjectRepositoryInput.ProjectRepositoryInput (cognitive 17) ui/src/components/ProjectRepositoryInput.tsx:9— ProjectRepositoryInput.ProjectRepositoryInput has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (15 pts), boolean chains 2 (nesting depth added 10). 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.
AgentCharacter.AgentCharacter (cognitive 17) ui/src/components/AgentCharacter.tsx:17— AgentCharacter.AgentCharacter has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 6, ternaries 3. Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 24, 32, 37, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
cross-tab-poll.stableFingerprint::visit (cognitive 17) ui/src/lib/cross-tab-poll.ts:200— cross-tab-poll.stableFingerprint::visit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 3 (6 pts), loops 2 (3 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.
issue-reference.rewriteMarkdownTree (cognitive 17) ui/src/lib/issue-reference.ts:132— issue-reference.rewriteMarkdownTree has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 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.
case-reference.rewriteMarkdownTree (cognitive 17) ui/src/lib/case-reference.ts:63— case-reference.rewriteMarkdownTree has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 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.
Sidebar.production.Sidebar (cognitive 17) ui/src/components/Sidebar.production.tsx:47— Sidebar.production.Sidebar has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 14 (15 pts), boolean chains 2 (nesting depth added 1). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
issue-monitor.deriveMonitorState (cognitive 17) ui/src/lib/issue-monitor.ts:176— issue-monitor.deriveMonitorState has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6, ternaries 4 (6 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
LiveUpdatesProvider.applyRunLiveStatusPatchToCaches (cognitive 17) ui/src/context/LiveUpdatesProvider.tsx:700— LiveUpdatesProvider.applyRunLiveStatusPatchToCaches has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, loops 3 (5 pts) (nesting depth added 4). Of this number, 11 points are the body's own statements and 6 belong to 3 function literals 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.
DispositionRecoveryNotice.dispositionRetryUnavailableReason (cognitive 17) ui/src/components/DispositionRecoveryNotice.tsx:40— DispositionRecoveryNotice.dispositionRetryUnavailableReason has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, boolean chains 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.
transcript-adapter.paperclipRunnerActivityItems (cognitive 17) ui/src/components/task-chat/transcript-adapter.ts:1212— transcript-adapter.paperclipRunnerActivityItems has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 7, match/switch 1 (nesting depth added 5). None of this is in the body itself: all 17 points belong to 2 function literals inside it that branch (lines 1218, 1216). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TaskChatRunnerTurn.RunnerTurnStatus (cognitive 17) ui/src/components/task-chat/TaskChatRunnerTurn.tsx:65— TaskChatRunnerTurn.RunnerTurnStatus has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 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.
issue-chat-messages.compactIssueChatTranscript (cognitive 17) ui/src/lib/issue-chat-messages.ts:462— issue-chat-messages.compactIssueChatTranscript has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 5 (6 pts), 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.
DocumentFrameHeader.DocumentFrameHeader (cognitive 17) ui/src/components/DocumentFrameHeader.tsx:70— DocumentFrameHeader.DocumentFrameHeader has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (15 pts), boolean chains 2 (nesting depth added 6). Of this number, 13 points are the body's own statements and 4 belong to one function literal 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.
relation-controls.RemovableIssueReferencePill (cognitive 17) ui/src/components/issue-properties/relation-controls.tsx:25— relation-controls.RemovableIssueReferencePill has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (15 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.
TaskDetailRelationsPanel.TaskDetailSubtasksPanel (cognitive 17) ui/src/components/task-detail/TaskDetailRelationsPanel.tsx:118— TaskDetailRelationsPanel.TaskDetailSubtasksPanel has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 10 (16 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.
TaskBrowserFooter.TaskBrowserFooter (cognitive 17) ui/src/components/task-side-panel/TaskBrowserFooter.tsx:38— TaskBrowserFooter.TaskBrowserFooter has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 12, ternaries 4, if/else 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.
SidePanelFrame.SidePanelFrame (cognitive 17) ui/src/components/side-panel/SidePanelFrame.tsx:26— SidePanelFrame.SidePanelFrame has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (9 pts), boolean chains 8 (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.
RunnerInspector.RunnerInspector::deleteTrace (cognitive 17) ui/src/components/RunnerInspector.tsx:938— RunnerInspector.RunnerInspector::deleteTrace has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 1 (3 pts), boolean chains 2, error handling 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. This shape REPEATS in the file: one other method here (RunnerInspector.RunnerInspector) 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.
IssueRunLedger.stopReasonLabel (cognitive 17) ui/src/components/IssueRunLedger.tsx:308— IssueRunLedger.stopReasonLabel has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, ternaries 3 (5 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.
FileViewerContext.writeBrowseStateToSearch (cognitive 17) ui/src/context/FileViewerContext.tsx:176— FileViewerContext.writeBrowseStateToSearch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 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.
FileViewerSheet.FileViewerBody (cognitive 17) ui/src/components/FileViewerSheet.tsx:964— FileViewerSheet.FileViewerBody has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 1 (3 pts), boolean chains 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.
TaskChatStatusPill.useHeldSelfTalk (cognitive 17) ui/src/components/task-chat/TaskChatStatusPill.tsx:147— TaskChatStatusPill.useHeldSelfTalk has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 1 (nesting depth added 3). None of this is in the body itself: all 17 points belong to 8 function literals inside it that branch (lines 158, 241, 159, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AuditFeed.AuditRow (cognitive 17) ui/src/pages/audit/AuditFeed.tsx:209— AuditFeed.AuditRow has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (10 pts), boolean chains 7 (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.
AgentDetail.RunListItem (cognitive 17) ui/src/pages/AgentDetail.tsx:3280— AgentDetail.RunListItem has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (10 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.
ProjectWorkspacesContent.ProjectWorkspacesContent (cognitive 17) ui/src/components/ProjectWorkspacesContent.tsx:11— ProjectWorkspacesContent.ProjectWorkspacesContent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 2 (nesting depth added 5). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 30, 43, 108, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ActivityFeed.ActivityFeed::renderItem (cognitive 17) ui/src/components/ActivityFeed.tsx:470— ActivityFeed.ActivityFeed::renderItem has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (7 pts), boolean chains 5, if/else 4 (5 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.
GitHubBotManagement.GitHubRepositoryAccess (cognitive 17) ui/src/pages/apps/chat/GitHubBotManagement.tsx:41— GitHubBotManagement.GitHubRepositoryAccess has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, ternaries 4, if/else 3. Of this number, 10 points are the body's own statements and 7 belong to 4 function literals inside it that branch. 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.
AdapterManager.AdapterRow (cognitive 17) ui/src/pages/AdapterManager.tsx:36— AdapterManager.AdapterRow has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 13, ternaries 4. 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.
NewAgentSetup.NewAgentSetup (cognitive 17) ui/src/components/new-agent/NewAgentSetup.tsx:83— NewAgentSetup.NewAgentSetup has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (10 pts), boolean chains 5, if/else 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.
editable-sections.production.TriggersSection (cognitive 17) ui/src/components/routine-sections/editable-sections.production.tsx:420— editable-sections.production.TriggersSection has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 5, if/else 1 (nesting depth added 2). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
GalleryPreview.GalleryPreview (cognitive 17) ui/src/artifact-directions/directions/d1-solid/GalleryPreview.tsx:54— GalleryPreview.GalleryPreview has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (17 pts) (nesting depth added 9). 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.
PanelCard.PanelCard (cognitive 17) ui/src/artifact-directions/directions/d1-solid/PanelCard.tsx:48— PanelCard.PanelCard has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 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.
JsonSchemaForm.validateJsonSchemaForm (cognitive 17) REDACTED:278— JsonSchemaForm.validateJsonSchemaForm has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, loops 1 (nesting depth added 8). Of this number, 9 points are the body's own statements and 8 belong to one function literal 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.
CaseDocumentPreview.CaseDocumentPreview (cognitive 17) ui/src/components/cases/CaseDocumentPreview.tsx:14— CaseDocumentPreview.CaseDocumentPreview has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (15 pts), boolean chains 2 (nesting depth added 6). Of this number, 16 points are the body's own statements and 1 belongs to one function literal 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.
AiConnectionUsageReview.AiConnectionUsageReview (cognitive 17) ui/storybook/prototypes/AiConnectionUsageReview.tsx:132— AiConnectionUsageReview.AiConnectionUsageReview has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2, boolean chains 1, loops 1 (nesting depth added 5). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 139, 162). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AiConnectorPages.Setup (cognitive 17) ui/storybook/prototypes/AiConnectorPages.tsx:157— AiConnectorPages.Setup has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (11 pts), boolean chains 4, if/else 2 (nesting depth added 4). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 5 function items inside it that branch (complete, a function literal at line 174, a function literal at line 178, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentSettingsPreview.AgentSettingsPreview (cognitive 17) ui/storybook/prototypes/agent-settings/AgentSettingsPreview.tsx:66— AgentSettingsPreview.AgentSettingsPreview has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 5, boolean chains 4 (nesting depth added 4). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 94, 80, 91, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ButtonSpecimen.ButtonSpecimen (cognitive 17) ui/storybook/support/design-proposals/ButtonSpecimen.tsx:9— ButtonSpecimen.ButtonSpecimen has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 7, if/else 2 (nesting depth added 1). Of this number, 11 points are the body's own statements and 6 belong to 3 function items inside it that branch. 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.
mcp-auth.withMcpOsLock (cognitive 16) cli/src/client/mcp-auth.ts:64— mcp-auth.withMcpOsLock has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 2 (3 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.
common.printOutput (cognitive 16) REDACTED:193— common.printOutput has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, 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.
plugin.streamPluginBridge (cognitive 16) cli/src/commands/client/plugin.ts:955— plugin.streamPluginBridge has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 2, ternaries 2, error handling 1, 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.
server-utils.normalizeConfiguredPaperclipRuntimeSkills (cognitive 16) REDACTED:4084— server-utils.normalizeConfiguredPaperclipRuntimeSkills has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (8 pts), boolean chains 4, if/else 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.
server-utils.acquireMaterializeLock (cognitive 16) REDACTED:4454— server-utils.acquireMaterializeLock has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), ternaries 1 (3 pts), error handling 1 (2 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.
workspace-seed-cache.publishWorkspaceSeedGeneration (cognitive 16) packages/adapter-utils/src/workspace-seed-cache.ts:161— workspace-seed-cache.publishWorkspaceSeedGeneration has cognitive complexity 16 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 13, ternaries 3 (4 pts), loops 3, error handling 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. This shape REPEATS in the file: one other method here (workspace-seed-cache.publishWorkspaceSeedGeneration::capacity) 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.
command-managed-runtime.assertPostUploadCommandsConfined (cognitive 16) packages/adapter-utils/src/command-managed-runtime.ts:236— command-managed-runtime.assertPostUploadCommandsConfined has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). Of this number, 15 points are the body's own statements and 1 belongs to one function literal 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.
command-managed-runtime.createCommandManagedRuntimeClient::fallbackSyncIn (cognitive 16) packages/adapter-utils/src/command-managed-runtime.ts:438— command-managed-runtime.createCommandManagedRuntimeClient::fallbackSyncIn has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 4 (8 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.
command-managed-runtime.prepareCommandManagedRuntime (cognitive 16) packages/adapter-utils/src/command-managed-runtime.ts:539— command-managed-runtime.prepareCommandManagedRuntime has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, ternaries 2 (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.
ssh.startSshEnvLabFixture (cognitive 16) REDACTED:2004— ssh.startSshEnvLabFixture has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, error handling 1 (nesting depth added 3). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
execute.prepareClaudeSkillRuntime (cognitive 16) packages/adapter-utils/src/acpx-engine/execute.ts:1147— execute.prepareClaudeSkillRuntime has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (8 pts), if/else 2 (4 pts), error handling 2 (3 pts), loops 1 (nesting depth added 5). Of this number, 14 points are the body's own statements and 2 belong to one function literal 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.
execute.describeErrorDiagnostics (cognitive 16) packages/adapter-utils/src/acpx-engine/execute.ts:3479— execute.describeErrorDiagnostics has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 9 (10 pts), boolean chains 6 (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.
format-event.printToolResult (cognitive 16) packages/adapters/claude-local/src/cli/format-event.ts:21— format-event.printToolResult has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (4 pts), loops 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.
runtime-config.tomlValue (cognitive 16) packages/adapters/codex-local/src/server/runtime-config.ts:184— runtime-config.tomlValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 2 (4 pts), 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.
format-event.printCursorCloudEvent (cognitive 16) packages/adapters/cursor-cloud/src/cli/format-event.ts:4— format-event.printCursorCloudEvent has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (12 pts), match/switch 1 (2 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.
parse.extractGeminiErrorMessages (cognitive 16) packages/adapters/gemini-local/src/server/parse.ts:241— parse.extractGeminiErrorMessages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 2, error handling 1 (2 pts), loops 1, 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.
grok-home.grokHomeHasSession::inspect (cognitive 16) packages/adapters/grok-local/src/server/grok-home.ts:21— grok-home.grokHomeHasSession::inspect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, error handling 1, 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.
parse-stdout.parseHermesGatewayStdoutLine (cognitive 16) packages/adapters/hermes/src/gateway/ui/parse-stdout.ts:57— parse-stdout.parseHermesGatewayStdoutLine has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, ternaries 1 (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.
parse-stdout.parseAgentEventLine (cognitive 16) packages/adapters/openclaw-gateway/src/ui/parse-stdout.ts:21— parse-stdout.parseAgentEventLine has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 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.
App.LiveRunner (cognitive 16) packages/paperclip-runner/devtools/browser/src/App.tsx:245— App.LiveRunner has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 12 (16 pts), boolean chains 5, loops 2 (3 pts), error handling 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. This shape REPEATS in the file: one other method here (App.LiveRunner::startRun) 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-session-workspace.recordWorkspaceChanges (cognitive 16) packages/paperclip-runner/src/drivers/codex/codex-session-workspace.ts:10— codex-session-workspace.recordWorkspaceChanges has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (9 pts), boolean chains 5, if/else 2 (nesting depth added 3). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 19, 51, 57). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
codex-session-notifications.mapNotification (cognitive 16) packages/paperclip-runner/src/drivers/codex/codex-session-notifications.ts:61— codex-session-notifications.mapNotification has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (10 pts), error handling 2 (3 pts), loops 1 (2 pts), if/else 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-session-server-requests.handleServerRequest (cognitive 16) packages/paperclip-runner/src/drivers/codex/codex-session-server-requests.ts:31— codex-session-server-requests.handleServerRequest has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (10 pts), error handling 2 (3 pts), loops 1 (2 pts), if/else 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.
mcp-bridge.normalizeTools (cognitive 16) packages/paperclip-runner/src/drivers/opencode/mcp-bridge.ts:104— mcp-bridge.normalizeTools has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 3 (6 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.
runnerd-codex-transport.readLocalProcessStartedAt (cognitive 16) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:110— runnerd-codex-transport.readLocalProcessStartedAt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 2 (4 pts), loops 1 (2 pts), ternaries 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.
route.capabilityRouteHref (cognitive 16) packages/paperclip-runner/devtools/issue-thread/src/route.ts:80— route.capabilityRouteHref has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 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.
build-copilot-distribution.buildPinnedCopilotDistribution (cognitive 16) packages/paperclip-runner/scripts/build-copilot-distribution.mjs:14— build-copilot-distribution.buildPinnedCopilotDistribution has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, 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.
provider-pack-runtime-tree.removePnpmStoreEntries (cognitive 16) packages/paperclip-runner/scripts/provider-pack-runtime-tree.mjs:39— provider-pack-runtime-tree.removePnpmStoreEntries has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, loops 2 (nesting depth added 5). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (visit, a function literal at line 41, a function literal at line 48). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
check-clean-consumers.packRunnerRuntimeDependencies (cognitive 16) packages/paperclip-runner/scripts/check-clean-consumers.mjs:104— check-clean-consumers.packRunnerRuntimeDependencies has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 6). Of this number, 12 points are the body's own statements and 4 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.
protocol-contract.projectAcpxProperty (cognitive 16) REDACTED:513— protocol-contract.projectAcpxProperty has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 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.
installed-provider-authority.resolveInstalledProviderAuthority (cognitive 16) packages/paperclip-runner/src/drivers/acpx/installed-provider-authority.ts:5— installed-provider-authority.resolveInstalledProviderAuthority has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, 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.
public-eval-chat.publicChatView.turns (cognitive 16) packages/paperclip-runner/scripts/public-eval-chat.mjs:86— public-eval-chat.publicChatView.turns has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 3 (6 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.
runner-tool-bridge.normalizeTools (cognitive 16) packages/paperclip-runner/src/drivers/runner-tool-bridge.ts:418— runner-tool-bridge.normalizeTools has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 3 (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.
grok-credentials.stageManagedGrokCredential (cognitive 16) packages/paperclip-runner/src/drivers/acpx/grok-credentials.ts:12— grok-credentials.stageManagedGrokCredential has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, error handling 1 (2 pts), ternaries 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.
stdio-mcp.stdioMcpLaunchBindings (cognitive 16) packages/paperclip-runner/src/drivers/stdio-mcp.ts:16— stdio-mcp.stdioMcpLaunchBindings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 7, error handling 1. Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 25, 36, 39). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
codex-runtime-adapter.runtimePort::closeRuntime (cognitive 16) packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts:1254— codex-runtime-adapter.runtimePort::closeRuntime has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4 (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. This shape REPEATS in the file: one other method here (codex-runtime-adapter.runtimePort) 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.
native-backend-factory.createNativeSessionBackend (cognitive 16) packages/paperclip-runner/src/backends/native-backend-factory.ts:53— native-backend-factory.createNativeSessionBackend has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 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.
LocalRunnerController.#handleLine (cognitive 16) packages/paperclip-runner/src/mock-core/local-runner.ts:371— LocalRunnerController.#handleLine has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 1 (2 pts), boolean chains 1, error handling 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.
opencode-proxy-command.trustedOpenCodeLaunchBinding::materializeForSpawn (cognitive 16) packages/paperclip-runner/src/cli/opencode-proxy-command.ts:121— opencode-proxy-command.trustedOpenCodeLaunchBinding::materializeForSpawn has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 3 (5 pts), 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. This shape REPEATS in the file: one other method here (opencode-proxy-command.trustedOpenCodeLaunchBinding) 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.
opencode-proxy-command.trustedOpenCodeLaunchBinding (cognitive 16) packages/paperclip-runner/src/cli/opencode-proxy-command.ts:34— opencode-proxy-command.trustedOpenCodeLaunchBinding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (19 pts), error handling 6 (13 pts), boolean chains 7, loops 2 (5 pts), ternaries 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. This shape REPEATS in the file: one other method here (opencode-proxy-command.trustedOpenCodeLaunchBinding::materializeForSpawn) 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.
control-plane-port.runControlPlanePortConformance (cognitive 16) packages/paperclip-runner/src/conformance/control-plane-port.ts:85— control-plane-port.runControlPlanePortConformance has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, error handling 5, 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.
MockControlPlaneAdapter.appendEvent (cognitive 16) packages/paperclip-runner/src/mock-core/mock-control-plane-adapter.ts:49— MockControlPlaneAdapter.appendEvent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals 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.
CapabilitySemanticToolRuntime.#startExtensionExecution (cognitive 16) packages/paperclip-runner/src/tools/capability-semantic-tool-runtime.ts:816— CapabilitySemanticToolRuntime.#startExtensionExecution has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 2, ternaries 1 (2 pts), error handling 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.
workflow-harness.deterministicObservation (cognitive 16) packages/paperclip-runner/src/eval/workflow-harness.ts:75— workflow-harness.deterministicObservation has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10 (14 pts), boolean chains 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.
native-session-runtime.goalFromEvent (cognitive 16) packages/paperclip-runner/src/native-session-runtime.ts:1432— native-session-runtime.goalFromEvent has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (7 pts), if/else 6, boolean chains 3 (nesting depth added 1). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
LiveConsoleScriptedSession.#runTurn (cognitive 16) packages/paperclip-runner/src/mock-core/live-console-scripted-driver.ts:452— LiveConsoleScriptedSession.#runTurn has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, ternaries 3, 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.
execution-preparation-timing.measure (cognitive 16) server/src/services/execution-preparation-timing.ts:139— execution-preparation-timing.measure has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 4, error handling 2, if/else 2 (nesting depth added 1). Of this number, 9 points are the body's own statements and 7 belong to 5 function items inside it that branch. 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.
remote-deliverable-file.readVerifiedRemoteWorkspaceFile (cognitive 16) server/src/services/native-runtime/remote-deliverable-file.ts:75— remote-deliverable-file.readVerifiedRemoteWorkspaceFile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 4, ternaries 2 (3 pts) (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.
execute.executeProcess (cognitive 16) server/src/adapters/process/execute.ts:38— execute.executeProcess has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 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.
remote-http-endpoint-guard.resolveApprovedRemoteHttpAddresses (cognitive 16) server/src/services/remote-http-endpoint-guard.ts:62— remote-http-endpoint-guard.resolveApprovedRemoteHttpAddresses has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 7, error handling 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.
remote-http-endpoint-guard.isPrivateOrReservedIpv6 (cognitive 16) server/src/services/remote-http-endpoint-guard.ts:202— remote-http-endpoint-guard.isPrivateOrReservedIpv6 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 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.
ai-connections.aiConnectionService.selectDecision (cognitive 16) server/src/services/ai-connections.ts:400— ai-connections.aiConnectionService.selectDecision has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, ternaries 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.
ai-connections.aiConnectionService.selectFastResponse (cognitive 16) server/src/services/ai-connections.ts:434— ai-connections.aiConnectionService.selectFastResponse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, ternaries 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. This shape REPEATS in the file: one other method here (ai-connections.aiConnectionService.selectPromptInjectionPrevention) 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.
ai-connections.aiConnectionService.selectPromptInjectionPrevention (cognitive 16) server/src/services/ai-connections.ts:467— ai-connections.aiConnectionService.selectPromptInjectionPrevention has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, ternaries 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. This shape REPEATS in the file: one other method here (ai-connections.aiConnectionService.selectFastResponse) 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.
cloud-runtime-identity.verifyCloudControlAssertion (cognitive 16) server/src/services/cloud-runtime-identity.ts:504— cloud-runtime-identity.verifyCloudControlAssertion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 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.
case-access.assertActorCanWriteCase (cognitive 16) server/src/services/case-access.ts:20— case-access.assertActorCanWriteCase has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 5, ternaries 3, 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.
chat-question-forms.parseFormField (cognitive 16) server/src/services/chat-question-forms.ts:422— chat-question-forms.parseFormField has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (7 pts), loops 1 (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.
PaperclipChatSdkStateAdapter.queueDepth (cognitive 16) server/src/services/chat-sdk-state.ts:426— PaperclipChatSdkStateAdapter.queueDepth has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 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.
chat-github-attachments.githubAttachmentCommentRequest (cognitive 16) REDACTED:417— chat-github-attachments.githubAttachmentCommentRequest has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 4 (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.
voice-session-store.voiceSessionStore.enqueuePublication (cognitive 16) server/src/services/voice/voice-session-store.ts:444— voice-session-store.voiceSessionStore.enqueuePublication has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 6). Of this number, 10 points are the body's own statements and 6 belong to 2 function literals 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.
voice-inbound-service.voiceInboundService.saveConfiguration (cognitive 16) server/src/services/voice/voice-inbound-service.ts:63— voice-inbound-service.voiceInboundService.saveConfiguration has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, ternaries 1 (nesting depth added 1). Of this number, 12 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
issue-tree-control.buildAffectedAgents (cognitive 16) server/src/services/issue-tree-control.ts:333— issue-tree-control.buildAffectedAgents has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 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.
tool-content-guards.validateToolContent (cognitive 16) REDACTED:310— tool-content-guards.validateToolContent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 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.
finance.createFinanceEventInTransaction (cognitive 16) server/src/services/finance.ts:40— finance.createFinanceEventInTransaction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 1, 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.
plugin-job-scheduler.createPluginJobScheduler.tick (cognitive 16) server/src/services/plugin-job-scheduler.ts:248— plugin-job-scheduler.createPluginJobScheduler.tick has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 1 (2 pts), error handling 1, 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.
completion.createSlackCompletion.sendSetupMessage (cognitive 16) server/src/services/connectors/slack/setup/completion.ts:39— completion.createSlackCompletion.sendSetupMessage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, boolean chains 5, ternaries 3, 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.
execution-workspace-policy.parseExecutionWorkspaceStrategy (cognitive 16) server/src/services/execution-workspace-policy.ts:33— execution-workspace-policy.parseExecutionWorkspaceStrategy has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 7, if/else 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.
git-restore-point-ledger.gitRestorePointRetentionService.evaluateActive (cognitive 16) server/src/services/git-restore-point-ledger.ts:72— git-restore-point-ledger.gitRestorePointRetentionService.evaluateActive has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 4 (5 pts), boolean chains 4 (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.
git-workspace-contents.validateGitWorkspaceContents (cognitive 16) server/src/services/git-workspace-contents.ts:98— git-workspace-contents.validateGitWorkspaceContents has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 3 (4 pts), loops 1 (nesting depth added 1). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
execution-workspace-repositories.executionWorkspaceRepositoryService.prepareConfiguredRepositoryCopy::verify (cognitive 16) server/src/services/execution-workspace-repositories.ts:228— execution-workspace-repositories.executionWorkspaceRepositoryService.prepareConfiguredRepositoryCopy::verify has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, 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.
local-service-supervisor.isLocalServiceCommandLineComparable (cognitive 16) server/src/services/local-service-supervisor.ts:325— local-service-supervisor.isLocalServiceCommandLineComparable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 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.
workspaces.ensureManagedProjectWorkspace (cognitive 16) server/src/services/heartbeat/workspaces.ts:445— workspaces.ensureManagedProjectWorkspace has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, ternaries 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.
chat-github-webhook-config.resyncGitHubAppWebhook (cognitive 16) server/src/services/chat-github-webhook-config.ts:690— chat-github-webhook-config.resyncGitHubAppWebhook has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, error handling 2, 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.
connection-intents.connectionIntentService.validate (cognitive 16) server/src/services/connection-intents.ts:162— connection-intents.connectionIntentService.validate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 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.
slack-conversation-lifecycle.settleExternalConversation (cognitive 16) server/src/services/slack-conversation-lifecycle.ts:7— slack-conversation-lifecycle.settleExternalConversation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 5, ternaries 1. Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 9, 47). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat-publication-text-parts.nativePublicationTextSize (cognitive 16) server/src/services/chat-publication-text-parts.ts:75— chat-publication-text-parts.nativePublicationTextSize has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 2, if/else 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.
resolution.createChatPublicationResolution.replayPublication (cognitive 16) server/src/services/chat-channels/publications/resolution.ts:27— resolution.createChatPublicationResolution.replayPublication has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 3). Of this number, 13 points are the body's own statements and 3 belong to one function literal 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.
chat-provider-links.telegramConversationLink (cognitive 16) server/src/services/chat-provider-links.ts:100— chat-provider-links.telegramConversationLink has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, ternaries 4 (6 pts), if/else 4 (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.
wakeup-notices.createInboundWakeNotices.authorizeInboundWakePublication (cognitive 16) server/src/services/chat-channels/inbound/wakeup-notices.ts:306— wakeup-notices.createInboundWakeNotices.authorizeInboundWakePublication has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, 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.
conversation-queue.createChatConversationDeliveryQueue.nextInboundDeliveryAt (cognitive 16) server/src/services/chat-channels/inbound/conversation-queue.ts:713— conversation-queue.createChatConversationDeliveryQueue.nextInboundDeliveryAt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 1 (3 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.
aggregator-app-discovery.inventoryPayload (cognitive 16) server/src/services/aggregator-app-discovery.ts:14— aggregator-app-discovery.inventoryPayload has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 1 (3 pts), boolean chains 2, loops 1 (2 pts) (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.
client-registration.createOAuthClientRegistration::oauthClientBindingMatches (cognitive 16) server/src/services/tool-access/oauth/client-registration.ts:232— client-registration.createOAuthClientRegistration::oauthClientBindingMatches has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 7, ternaries 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.
external-objects.createPluginProviderDetector.detect (cognitive 16) server/src/services/external-objects.ts:269— external-objects.createPluginProviderDetector.detect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (3 pts), error handling 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.
github-external-object-provider.createGitHubExternalObjectProvider::resolver (cognitive 16) server/src/services/github-external-object-provider.ts:432— github-external-object-provider.createGitHubExternalObjectProvider::resolver has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 2, error handling 2, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
github-pull-request-merge.createPullRequestMergeDetailsResolver (cognitive 16) server/src/services/github-pull-request-merge.ts:89— github-pull-request-merge.createPullRequestMergeDetailsResolver has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10 (11 pts), boolean chains 3, if/else 2 (nesting depth added 1). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 93). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
issue-thread-interactions.issueThreadInteractionService.createConnectionIntent (cognitive 16) server/src/services/issue-thread-interactions.ts:2605— issue-thread-interactions.issueThreadInteractionService.createConnectionIntent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, loops 1 (2 pts), ternaries 1 (nesting depth added 2). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2643, 2665, 2717). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
issue-thread-interactions.issueThreadInteractionService.expireRequestConfirmationsSupersededByComment (cognitive 16) server/src/services/issue-thread-interactions.ts:4369— issue-thread-interactions.issueThreadInteractionService.expireRequestConfirmationsSupersededByComment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, loops 1 (nesting depth added 3). Of this number, 8 points are the body's own statements and 8 belong to 2 function literals 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.
setup-token-session.addressMatchesEntry (cognitive 16) server/src/services/setup-token-session.ts:510— setup-token-session.addressMatchesEntry has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, ternaries 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.
agent-runner-selection.resolveAgentRunnerTargetForCompany (cognitive 16) server/src/services/agent-runner-selection.ts:291— agent-runner-selection.resolveAgentRunnerTargetForCompany has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 6, error handling 1 (2 pts), ternaries 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.
muse-identity.inspectMuseConnectionCredential (cognitive 16) server/src/services/muse-identity.ts:106— muse-identity.inspectMuseConnectionCredential has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 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.
dot-assignment-follow-up.consumeDotHistoryReceipt (cognitive 16) server/src/services/dot-assignment-follow-up.ts:53— dot-assignment-follow-up.consumeDotHistoryReceipt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 2 (3 pts), boolean chains 2, loops 2 (nesting depth added 2). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 73, 60, 58). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
muse-assignment-follow-up.consumeMuseHistoryReceipt (cognitive 16) server/src/services/muse-assignment-follow-up.ts:49— muse-assignment-follow-up.consumeMuseHistoryReceipt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 2 (3 pts), boolean chains 2, loops 2 (nesting depth added 2). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 69, 56, 54). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
task-watchdogs.isUniqueConstraintConflict (cognitive 16) server/src/services/task-watchdogs.ts:765— task-watchdogs.isUniqueConstraintConflict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, 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.
workspace-realization.buildWorkspaceRealizationRecord (cognitive 16) server/src/services/workspace-realization.ts:168— workspace-realization.buildWorkspaceRealizationRecord has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 9 (15 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.
environment-runtime.environmentRuntimeService.destroyReusableSandboxLeases (cognitive 16) server/src/services/environment-runtime.ts:4436— environment-runtime.environmentRuntimeService.destroyReusableSandboxLeases has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (4 pts), loops 2 (3 pts), 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.
runner-goals.normalizedPrpGoal (cognitive 16) server/src/services/runner-goals.ts:583— runner-goals.normalizedPrpGoal has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8, boolean chains 5, if/else 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.
native-codex-runner.resolveRemotePaperclipRunnerBinary (cognitive 16) server/src/services/native-runtime/native-codex-runner.ts:211— native-codex-runner.resolveRemotePaperclipRunnerBinary has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (7 pts), boolean chains 5, if/else 3, error handling 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.
stopped-codex-turn.completionScriptInput::literal (cognitive 16) server/src/services/native-runtime/stopped-codex-turn.ts:37— stopped-codex-turn.completionScriptInput::literal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 2 (5 pts), boolean chains 4, 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.
remote-pi-companion.inventoryRemoteCompanion (cognitive 16) server/src/services/native-runtime/remote-pi-companion.ts:49— remote-pi-companion.inventoryRemoteCompanion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, ternaries 2 (3 pts), loops 1 (nesting depth added 3). None of this is in the body itself: all 16 points belong to 2 function items inside it that branch (visit, a function literal at line 73). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
agent-instruction-files.assertInstructionPathSafe (cognitive 16) server/src/services/agent-instruction-files.ts:55— agent-instruction-files.assertInstructionPathSafe has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, loops 1 (nesting depth added 6). Of this number, 14 points are the body's own statements and 2 belong to one function literal 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.
agent-file-store.scanAgentFiles::walk (cognitive 16) server/src/services/agent-file-store.ts:134— agent-file-store.scanAgentFiles::walk has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 1 (2 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.
runtime-context.collectDirectoryFiles (cognitive 16) server/src/services/native-runtime/runtime-context.ts:48— runtime-context.collectDirectoryFiles has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 5). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (visit). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
runtime-context.resolveNativeRuntimeMcpSnapshot (cognitive 16) server/src/services/native-runtime/runtime-context.ts:196— runtime-context.resolveNativeRuntimeMcpSnapshot has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, ternaries 6. Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 199, 233, 198). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
case-mutation-authorization.authorizeCaseRunMutation (cognitive 16) server/src/services/case-mutation-authorization.ts:11— case-mutation-authorization.authorizeCaseRunMutation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, ternaries 2 (4 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.
runner-api-client.validateRunnerApiCall (cognitive 16) server/src/services/native-runtime/runner-api-client.ts:52— runner-api-client.validateRunnerApiCall has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6 (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.
runner-task-attachments.readTaskAttachment (cognitive 16) server/src/services/native-runtime/runner-task-attachments.ts:119— runner-task-attachments.readTaskAttachment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (2 pts), ternaries 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.
heartbeat-run-privacy.canActorReadWorkspaceOperation (cognitive 16) server/src/services/heartbeat-run-privacy.ts:206— heartbeat-run-privacy.canActorReadWorkspaceOperation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, loops 2, ternaries 1 (nesting depth added 5). Of this number, 15 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.
work-products.refreshPullRequestWorkProductMetadata (cognitive 16) server/src/services/work-products.ts:89— work-products.refreshPullRequestWorkProductMetadata has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 9 (10 pts), if/else 3, boolean chains 2, error handling 1 (nesting depth added 1). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 93). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
company-skills.companySkillService.materializedVersionSnapshotMatches (cognitive 16) server/src/services/company-skills.ts:5983— company-skills.companySkillService.materializedVersionSnapshotMatches has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 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.
company-skills.companySkillService.materializeVersionSnapshotLocked (cognitive 16) server/src/services/company-skills.ts:6026— company-skills.companySkillService.materializeVersionSnapshotLocked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 1 (2 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 5). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 6030). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
native-board-response-wait.readNativeBoardResponseWaitSource (cognitive 16) server/src/services/native-runtime/native-board-response-wait.ts:175— native-board-response-wait.readNativeBoardResponseWaitSource has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, boolean chains 6, ternaries 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.
status-decision-committer.assertPendingEffectTarget (cognitive 16) server/src/services/native-runtime/status-decision-committer.ts:183— status-decision-committer.assertPendingEffectTarget 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.
native-session-executor.providerSessionIdentityFromDurableProviderState (cognitive 16) server/src/services/native-runtime/native-session-executor.ts:5735— native-session-executor.providerSessionIdentityFromDurableProviderState has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (6 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 4). Of this number, 14 points are the body's own statements and 2 belong to 3 function items inside it that branch. 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.
native-session-executor.steerNativeSession (cognitive 16) server/src/services/native-runtime/native-session-executor.ts:6870— native-session-executor.steerNativeSession has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 1 (2 pts), boolean chains 1, 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.
native-session-executor.executePaperclipNativeSessionWithinScope::observeAccountingEvent (cognitive 16) server/src/services/native-runtime/native-session-executor.ts:8392— native-session-executor.executePaperclipNativeSessionWithinScope::observeAccountingEvent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 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. This shape REPEATS in the file: one other method here (native-session-executor.executePaperclipNativeSessionWithinScope) 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.
native-session-executor.verifyRemoteRunnerReattachment (cognitive 16) server/src/services/native-runtime/native-session-executor.ts:11124— native-session-executor.verifyRemoteRunnerReattachment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, loops 1, 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.
run-state.createHeartbeatRunState.clearTaskSessions (cognitive 16) server/src/services/heartbeat/run-state.ts:1674— run-state.createHeartbeatRunState.clearTaskSessions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 6). Of this number, 8 points are the body's own statements and 8 belong to one function literal 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.
postgres.buildTransaction.findNextDeferredWake (cognitive 16) server/src/modules/wake-queue/adapters/postgres.ts:222— postgres.buildTransaction.findNextDeferredWake has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (6 pts), if/else 2 (5 pts), boolean chains 2, error handling 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.
queued-comment-use-cases.createDiscardQueuedComment (cognitive 16) server/src/modules/wake-queue/application/queued-comment-use-cases.ts:246— queued-comment-use-cases.createDiscardQueuedComment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 4 (nesting depth added 3). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 250). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
use-cases.promoteDeferredWake (cognitive 16) server/src/modules/wake-queue/application/use-cases.ts:326— use-cases.promoteDeferredWake has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, 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.
run-control.createHeartbeatRunControl.completedRunTerminationProof (cognitive 16) server/src/services/heartbeat/run-control.ts:1067— run-control.createHeartbeatRunControl.completedRunTerminationProof has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, boolean chains 5, ternaries 3 (5 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.
run-lifecycle.createHeartbeatLifecycle.terminalizeRunOnLeaseRelease (cognitive 16) server/src/services/heartbeat/run-lifecycle.ts:1240— run-lifecycle.createHeartbeatLifecycle.terminalizeRunOnLeaseRelease has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 2 (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.
session-preparation.resolveHeartbeatAdapterSession (cognitive 16) server/src/services/heartbeat/session-preparation.ts:249— session-preparation.resolveHeartbeatAdapterSession has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, ternaries 3 (4 pts) (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.
runtime-execution.executeHeartbeatRuntime::completeWorkspace (cognitive 16) server/src/services/heartbeat/runtime-execution.ts:930— runtime-execution.executeHeartbeatRuntime::completeWorkspace has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 pts), error handling 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (runtime-execution.executeHeartbeatRuntime) 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.
exec.executeInSandbox (cognitive 16) packages/plugins/sandbox-providers/cloudflare/bridge-template/src/exec.ts:87— exec.executeInSandbox has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 3 (4 pts), boolean chains 2, error handling 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.
file-sync.validateArchive (cognitive 16) packages/plugins/sandbox-providers/createos/src/file-sync.ts:31— file-sync.validateArchive has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 3). Of this number, 15 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.
DaytonaIdleActivity.confirm (cognitive 16) packages/plugins/sandbox-providers/daytona/src/idle-activity.ts:108— DaytonaIdleActivity.confirm has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (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.
file-sync.syncOutFileMappings (cognitive 16) packages/plugins/sandbox-providers/daytona/src/file-sync.ts:1161— file-sync.syncOutFileMappings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (5 pts), loops 4, error handling 3, ternaries 1 (3 pts), boolean chains 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 1 belongs to one function literal 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.
frontmatter.stringifyYamlArray (cognitive 16) REDACTED:326— frontmatter.stringifyYamlArray has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 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.
ai-connections.isAiConnectionCompatible (cognitive 16) packages/shared/src/ai-connections.ts:119— ai-connections.isAiConnectionCompatible has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 3, ternaries 2 (3 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.
worktree-port-registry.readProcessIdentity (cognitive 16) packages/shared/src/worktree-port-registry.ts:185— worktree-port-registry.readProcessIdentity has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (5 pts), error handling 2 (3 pts), 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.
catalog-builder.classifyCatalogFile (cognitive 16) packages/teams-catalog/src/catalog-builder.ts:830— catalog-builder.classifyCatalogFile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 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.
ingest-app-definitions.validateApp (cognitive 16) scripts/ingest-app-definitions.mjs:2054— ingest-app-definitions.validateApp has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, loops 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.
request-hot-restart.readArgs (cognitive 16) scripts/request-hot-restart.ts:18— request-hot-restart.readArgs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 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.
local-ai-login.localAiLoginService.check (cognitive 16) server/src/services/local-ai-login.ts:150— local-ai-login.localAiLoginService.check has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (9 pts), boolean chains 3, if/else 3, error handling 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.
ai-connections.assertAiConnectionCreateAccess (cognitive 16) server/src/routes/ai-connections.ts:54— ai-connections.assertAiConnectionCreateAccess has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 4). Of this number, 15 points are the body's own statements and 1 belongs to one function literal 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.
github-connection-events.githubConnectionEventService.applyInstallationEvent (cognitive 16) server/src/services/github-connection-events.ts:276— github-connection-events.githubConnectionEventService.applyInstallationEvent has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10 (11 pts), boolean chains 3, if/else 2 (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.
tool-oauth-legacy-backfill.backfillLegacyToolOAuthTokens (cognitive 16) server/src/services/tool-oauth-legacy-backfill.ts:293— tool-oauth-legacy-backfill.backfillLegacyToolOAuthTokens has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 332). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
teams-catalog.teamsCatalogService.prepareSkillInstalls (cognitive 16) server/src/services/teams-catalog.ts:867— teams-catalog.teamsCatalogService.prepareSkillInstalls has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (6 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.
environment-custom-images.environmentCustomImageService.resolveSetupProvider (cognitive 16) server/src/services/environment-custom-images.ts:361— environment-custom-images.environmentCustomImageService.resolveSetupProvider has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 3). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
environment-custom-images.environmentCustomImageService.finishSetupSession (cognitive 16) server/src/services/environment-custom-images.ts:904— environment-custom-images.environmentCustomImageService.finishSetupSession has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, ternaries 5 (6 pts), boolean chains 2, error handling 2 (nesting depth added 1). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
agent-instance-secrets.agentInstanceSecretService.apply (cognitive 16) server/src/services/agent-instance-secrets.ts:16— agent-instance-secrets.agentInstanceSecretService.apply has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 4, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 2). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 22, 19). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
customer-success.customerSuccessRoutes (cognitive 16) server/src/routes/customer-success.ts:73— customer-success.customerSuccessRoutes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 5, error handling 1. None of this is in the body itself: all 16 points belong to 2 function literals inside it that branch (lines 87, 79). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
auth.resolveCloudTenantActorOnce (cognitive 16) server/src/middleware/auth.ts:606— auth.resolveCloudTenantActorOnce has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 6, error handling 1, ternaries 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.
skill-source-scan-limit.createSkillSourceScanLimiter (cognitive 16) server/src/services/skill-source-scan-limit.ts:4— skill-source-scan-limit.createSkillSourceScanLimiter has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 6, boolean chains 1 (nesting depth added 4). None of this is in the body itself: all 16 points belong to 3 function literals inside it that branch (lines 6, 31, 38). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
skill-source-sync.adoptProjectSkillRepository (cognitive 16) server/src/services/skill-source-sync.ts:53— skill-source-sync.adoptProjectSkillRepository has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 3, ternaries 2 (3 pts) (nesting depth added 1). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 61). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
teams-catalog.teamsCatalogRoutes (cognitive 16) server/src/routes/teams-catalog.ts:19— teams-catalog.teamsCatalogRoutes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5 (nesting depth added 2). None of this is in the body itself: all 16 points belong to 3 function items inside it that branch (assertCanInstallCatalogTeam, firstQueryString, canCreateAgents). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
agent-project-access.addAgentProjectAccess (cognitive 16) server/src/services/agent-project-access.ts:25— agent-project-access.addAgentProjectAccess has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 4, loops 2 (nesting depth added 1). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 28). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
task-interruption-presentation.taskInterruptionPresentations (cognitive 16) server/src/services/task-interruption-presentation.ts:81— task-interruption-presentation.taskInterruptionPresentations has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (7 pts), loops 4 (5 pts), if/else 2 (3 pts), boolean chains 1 (nesting depth added 3). Of this number, 13 points are the body's own statements and 3 belong to 3 function literals inside it that branch. 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.
invite-grants.grantsFromDefaults (cognitive 16) server/src/services/invite-grants.ts:6— invite-grants.grantsFromDefaults has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, ternaries 1 (2 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.
access.grantsFromDefaults (cognitive 16) REDACTED:2218— access.grantsFromDefaults has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, ternaries 1 (2 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.
plugin-host-services.isPrivateIP (cognitive 16) server/src/services/plugin-host-services.ts:120— plugin-host-services.isPrivateIP 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.
plugin-host-services.buildHostServices.queuePluginInteractionContinuationWakeup (cognitive 16) server/src/services/plugin-host-services.ts:1066— plugin-host-services.buildHostServices.queuePluginInteractionContinuationWakeup has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 5, ternaries 3 (4 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.
app.createManagedBundledPluginWorkerRecovery (cognitive 16) REDACTED:413— app.createManagedBundledPluginWorkerRecovery has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, ternaries 2 (4 pts), boolean chains 3, error handling 2 (nesting depth added 2). None of this is in the body itself: all 16 points belong to 3 function items inside it that branch (a function literal at line 459, discardDeadRecoveryHandle, a function literal at line 453). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
native-harness-backup-expiration.sessionRetentionBlocker (cognitive 16) server/src/services/native-runtime/native-harness-backup-expiration.ts:154— native-harness-backup-expiration.sessionRetentionBlocker has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 2, ternaries 1 (2 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.
native-workspace-sync-retention.retentionBlocker (cognitive 16) server/src/services/native-runtime/native-workspace-sync-retention.ts:141— native-workspace-sync-retention.retentionBlocker has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 3, ternaries 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.
index.startServerWithDatabaseTeardown::ensureMigrations (cognitive 16) REDACTED:303— index.startServerWithDatabaseTeardown::ensureMigrations has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 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. This shape REPEATS in the file: one other method here (index.startServerWithDatabaseTeardown) 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.
PrimaryAgentPresentation.SetPrimaryAgentButton (cognitive 16) ui/src/components/primary-agent/PrimaryAgentPresentation.tsx:42— PrimaryAgentPresentation.SetPrimaryAgentButton has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, ternaries 5 (6 pts), if/else 4 (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.
normalize-markdown.normalizeMarkdown (cognitive 16) ui/src/lib/normalize-markdown.ts:6— normalize-markdown.normalizeMarkdown has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 1 (3 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.
MarkdownEditor.autocompleteOptionMatchesLink (cognitive 16) REDACTED:625— MarkdownEditor.autocompleteOptionMatchesLink has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 7. 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.
agent-order.sortAgentsByDefaultSidebarOrder (cognitive 16) ui/src/lib/agent-order.ts:114— agent-order.sortAgentsByDefaultSidebarOrder has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 6). Of this number, 11 points are the body's own statements and 5 belong to one function literal 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.
SharedPollingCoordinator.publish (cognitive 16) ui/src/lib/cross-tab-poll.ts:643— SharedPollingCoordinator.publish has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, ternaries 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.
workspace-file-parser.looksLikeWorkspacePath (cognitive 16) ui/src/lib/workspace-file-parser.ts:48— workspace-file-parser.looksLikeWorkspacePath has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, loops 1, 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.
keyboardShortcuts.resolveIssueDetailGoKeyAction (cognitive 16) ui/src/lib/keyboardShortcuts.ts:181— keyboardShortcuts.resolveIssueDetailGoKeyAction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, ternaries 3 (6 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.
AgentRunnerSelect.AgentRunnerSelect (cognitive 16) ui/src/components/AgentRunnerSelect.tsx:6— AgentRunnerSelect.AgentRunnerSelect has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (11 pts), boolean chains 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.
config-fields.ClaudeLocalAdvancedFields (cognitive 16) ui/src/adapters/claude-local/config-fields.tsx:75— config-fields.ClaudeLocalAdvancedFields has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, ternaries 7. Of this number, 13 points are the body's own statements and 3 belong to 8 function literals inside it that branch. 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.
SecretPicker.buildFolderGroup (cognitive 16) ui/src/components/environment-variables-editor/SecretPicker.tsx:54— SecretPicker.buildFolderGroup has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, loops 1, 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.
model.rowsFromValue (cognitive 16) ui/src/components/environment-variables-editor/model.ts:69— model.rowsFromValue has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 5, boolean chains 1 (nesting depth added 5). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 71). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
FoldCurtain.FoldCurtain (cognitive 16) ui/src/components/FoldCurtain.tsx:61— FoldCurtain.FoldCurtain has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 3, if/else 2 (nesting depth added 3). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
TaskChatRichInput.TaskChatRichInput (cognitive 16) ui/src/components/task-chat/TaskChatRichInput.tsx:27— TaskChatRichInput.TaskChatRichInput has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (7 pts), if/else 4, boolean chains 3, error handling 2 (nesting depth added 2). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (uploadImage, chooseImage, a function literal at line 48). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TaskChatProtocolCard.ResultCard (cognitive 16) ui/src/components/task-chat/TaskChatProtocolCard.tsx:938— TaskChatProtocolCard.ResultCard has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (15 pts), boolean chains 1 (nesting depth added 8). Of this number, 10 points are the body's own statements and 6 belong to 2 function literals 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.
interrupt-handoff.computeComposerHandoffPreview (cognitive 16) ui/src/lib/interrupt-handoff.ts:216— interrupt-handoff.computeComposerHandoffPreview has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (7 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.
IssueBlockedNotice.SuccessfulRunRetryNowControl (cognitive 16) ui/src/components/IssueBlockedNotice.tsx:74— IssueBlockedNotice.SuccessfulRunRetryNowControl has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 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.
IssueChatThread.ExpiredRequestConfirmationActivity (cognitive 16) ui/src/components/IssueChatThread.tsx:2979— IssueChatThread.ExpiredRequestConfirmationActivity has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10 (11 pts), boolean chains 5 (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.
TaskChatThread.semanticProgressCommentIds (cognitive 16) ui/src/components/TaskChatThread.tsx:340— TaskChatThread.semanticProgressCommentIds has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 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.
IssuePullRequestLinks.IssuePullRequestLinks (cognitive 16) ui/src/components/IssuePullRequestLinks.tsx:9— IssuePullRequestLinks.IssuePullRequestLinks has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 4 (nesting depth added 4). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 15). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
TaskChatThinking.TaskChatThinking (cognitive 16) ui/src/components/task-chat/TaskChatThinking.tsx:10— TaskChatThinking.TaskChatThinking has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (9 pts), boolean chains 5, if/else 2 (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.
TaskChatLiveRunPill.TaskChatLiveRunPill (cognitive 16) ui/src/components/task-chat/TaskChatLiveRunPill.tsx:47— TaskChatLiveRunPill.TaskChatLiveRunPill has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 4 (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.
DesignSandboxTaskThread.DesignSandboxTaskThread (cognitive 16) ui/src/components/design-sandbox/DesignSandboxTaskThread.tsx:29— DesignSandboxTaskThread.DesignSandboxTaskThread has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 2, if/else 2 (nesting depth added 4). Of this number, 15 points are the body's own statements and 1 belongs to one function literal 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.
ActiveAgentsPanel.AgentRunCard (cognitive 16) ui/src/components/ActiveAgentsPanel.tsx:171— ActiveAgentsPanel.AgentRunCard has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 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.
agent-skill-source.buildAgentSkillSourceMeta (cognitive 16) ui/src/pages/agent-skills/agent-skill-source.ts:91— agent-skill-source.buildAgentSkillSourceMeta has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 6, ternaries 2 (4 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.
MembershipAction.MembershipAction (cognitive 16) ui/src/components/MembershipAction.tsx:17— MembershipAction.MembershipAction has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (11 pts), if/else 3, boolean chains 2 (nesting depth added 3). Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
Workspaces.Workspaces (cognitive 16) ui/src/pages/Workspaces.tsx:79— Workspaces.Workspaces has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 4, boolean chains 1 (nesting depth added 5). Of this number, 12 points are the body's own statements and 4 belong to one function literal 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.
RoutineHistoryTab.RevisionList (cognitive 16) ui/src/components/RoutineHistoryTab.tsx:407— RoutineHistoryTab.RevisionList has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (11 pts), boolean chains 5 (nesting depth added 6). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 436). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
RoutineHistoryTab.compareEnv (cognitive 16) ui/src/components/RoutineHistoryTab.tsx:1180— RoutineHistoryTab.compareEnv has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 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.
RoutineTriggers.TriggerSetup (cognitive 16) ui/src/components/routine-triggers/RoutineTriggers.tsx:314— RoutineTriggers.TriggerSetup has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 6 (7 pts), error handling 1 (nesting depth added 5). None of this is in the body itself: all 16 points belong to 4 function literals inside it that branch (lines 335, 391, 357, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ExecutionWorkspaceDetail.readConfiguredRuntimeServicePorts (cognitive 16) ui/src/pages/ExecutionWorkspaceDetail.tsx:181— ExecutionWorkspaceDetail.readConfiguredRuntimeServicePorts has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, ternaries 4 (5 pts), if/else 4 (nesting depth added 1). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 2 function items inside it that branch (a function literal at line 187, addServices). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ArtifactCard.VideoPreview (cognitive 16) ui/src/components/artifacts/ArtifactCard.tsx:55— ArtifactCard.VideoPreview has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, ternaries 4, boolean chains 3, error handling 1. Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 5 function items inside it that branch (loadThumbnailFrame, handleLoadedData, a function literal at line 61, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
DecisionCard.executionRow (cognitive 16) ui/src/components/DecisionCard.tsx:137— DecisionCard.executionRow has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 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.
ProfileWizard.StepAssign (cognitive 16) ui/src/pages/tools/profiles/ProfileWizard.tsx:558— ProfileWizard.StepAssign has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), loops 3 (4 pts), boolean chains 3, ternaries 3 (nesting depth added 4). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 587, 626, 631). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Browse.upstreamAccountState (cognitive 16) ui/src/pages/apps/Browse.tsx:247— Browse.upstreamAccountState has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (15 pts), boolean chains 1 (nesting depth added 10). 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.
GitHubConnectionComplete.GitHubConnectionComplete (cognitive 16) ui/src/pages/apps/chat/GitHubConnectionComplete.tsx:22— GitHubConnectionComplete.GitHubConnectionComplete has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (12 pts), boolean chains 3, if/else 1 (nesting depth added 6). Of this number, 15 points are the body's own statements and 1 belongs to one function literal 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.
CompanySkills.SkillVersionDiffDialog (cognitive 16) ui/src/pages/CompanySkills.tsx:2503— CompanySkills.SkillVersionDiffDialog has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (7 pts), boolean chains 4, if/else 3, loops 2 (nesting depth added 3). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 2523, 2527, 2552, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SkillSources.DisconnectSourceDialog (cognitive 16) ui/src/pages/SkillSources.tsx:209— SkillSources.DisconnectSourceDialog has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 7, if/else 1 (nesting depth added 1). Of this number, 12 points are the body's own statements and 4 belong to 3 function literals inside it that branch. 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.
SkillStudio.SkillStudio (cognitive 16) ui/src/pages/SkillStudio.tsx:276— SkillStudio.SkillStudio has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, boolean chains 5, ternaries 4 (5 pts) (nesting depth added 1). Of this number, 12 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
CompanySkills.production.SkillVersionDiffDialog (cognitive 16) ui/src/pages/CompanySkills.production.tsx:2593— CompanySkills.production.SkillVersionDiffDialog has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (7 pts), boolean chains 4, if/else 3, loops 2 (nesting depth added 3). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 2613, 2617, 2642, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PanelCard.PanelCard (cognitive 16) ui/src/artifact-directions/directions/d2-tint/PanelCard.tsx:59— PanelCard.PanelCard has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 14 (16 pts) (nesting depth added 2). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
kinds.metaParts (cognitive 16) ui/src/artifact-directions/directions/d4-hybrid/kinds.ts:102— kinds.metaParts has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (8 pts), if/else 6 (7 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.
ThreadAttachments.ThreadAttachments (cognitive 16) ui/src/artifact-directions/directions/today/ThreadAttachments.tsx:24— ThreadAttachments.ThreadAttachments has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (14 pts), boolean chains 2 (nesting depth added 6). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 68, 34, 60). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WorkspaceAccessCard.WorkspaceAccessCard (cognitive 16) ui/src/components/WorkspaceAccessCard.tsx:50— WorkspaceAccessCard.WorkspaceAccessCard has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 8. 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.
SkillSourceConnectionRepair.SkillSourceConnectionRepair (cognitive 16) ui/src/components/skill-studio/SkillSourceConnectionRepair.tsx:13— SkillSourceConnectionRepair.SkillSourceConnectionRepair has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 4, ternaries 1. Of this number, 11 points are the body's own statements and 5 belong to 3 function literals inside it that branch. 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.
WorkTimelineChart.formatVisibleDurationMinutes (cognitive 16) ui/src/components/timeline/WorkTimelineChart.tsx:140— WorkTimelineChart.formatVisibleDurationMinutes has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 5, 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.
ConnectionSetupFlow.MethodConfigField (cognitive 16) ui/src/features/connections/ConnectionSetupFlow.tsx:4164— ConnectionSetupFlow.MethodConfigField has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (11 pts), boolean chains 4, if/else 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.
oauthHandoff.postCloudHandoff (cognitive 16) ui/src/lib/oauthHandoff.ts:62— oauthHandoff.postCloudHandoff has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 3, error handling 1 (2 pts), loops 1, 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.
layout.nearestSourceBar (cognitive 16) ui/src/lib/timeline/layout.ts:377— layout.nearestSourceBar has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 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.
AgentDetail.production.RunListItem (cognitive 16) ui/src/pages/AgentDetail.production.tsx:3109— AgentDetail.production.RunListItem has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 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.
AuditTab.lifecycleSummary (cognitive 16) ui/src/pages/tools/AuditTab.tsx:90— AuditTab.lifecycleSummary has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (8 pts), if/else 3 (5 pts), boolean chains 2, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AiReviewFrame.aiReviewContext (cognitive 16) ui/storybook/prototypes/AiReviewFrame.tsx:34— AiReviewFrame.aiReviewContext has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 3, 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.
ConversationTypographyPreview.ConversationTypographyPreview (cognitive 16) ui/storybook/support/design-proposals/ConversationTypographyPreview.tsx:11— ConversationTypographyPreview.ConversationTypographyPreview has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 4, boolean chains 3, loops 1 (nesting depth added 4). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 16, 35, 43). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PrimaryAgentStory.PrimaryPage (cognitive 16) ui/storybook/support/primary-agent/PrimaryAgentStory.tsx:242— PrimaryAgentStory.PrimaryPage has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 4 (5 pts), boolean chains 2 (nesting depth added 6). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 247). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
client.http (cognitive 16) server/src/services/scripts/v2/client.py:60— client.http has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, boolean chains 4, error handling 4, ternaries 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.
Client.historical_input_source (cognitive 16) server/src/services/scripts/v9/client.py:452— Client.historical_input_source has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, 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.
AcpxSidecarTransport::request_inner (cognitive 16) packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs:443— AcpxSidecarTransport::request_inner has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), 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.
Cross-context type Json (paperclip-runner → cli) cli/src/client/mcp-auth.ts:132— Json (context paperclip-runner) is exposed in cli's public surface via mcp-auth.mcpRpc — couples the contexts.
Cross-context type AdapterBillingType (adapter-utils → claude-local) packages/adapters/claude-local/src/server/acp.ts:165— AdapterBillingType (context adapter-utils) is exposed in claude-local's public surface via acp.resolveClaudeAcpBillingIdentity — couples the contexts.
Cross-context type LoginRunnerOutcome (adapter-utils → claude-local) packages/adapters/claude-local/src/server/setup-token-runner.ts:119— LoginRunnerOutcome (context adapter-utils) is exposed in claude-local's public surface via SetupTokenOutcome.SetupTokenOutcome — couples the contexts.
Cross-context type AdapterBillingType (adapter-utils → codex-local) packages/adapters/codex-local/src/server/acp.ts:339— AdapterBillingType (context adapter-utils) is exposed in codex-local's public surface via acp.resolveCodexAcpBillingIdentity — couples the contexts.
Cross-context type LoginRunnerOutcome (adapter-utils → codex-local) packages/adapters/codex-local/src/server/device-login-runner.ts:75— LoginRunnerOutcome (context adapter-utils) is exposed in codex-local's public surface via DeviceLoginOutcome.DeviceLoginOutcome — couples the contexts.
Cross-context type AdapterExecutionTarget (adapter-utils → cursor-local) packages/adapters/cursor-local/src/server/remote-command.ts:171— AdapterExecutionTarget (context adapter-utils) is exposed in cursor-local's public surface via remote-command.prepareCursorSandboxCommand — couples the contexts.
Cross-context type Provider (ui → hermes) packages/adapters/hermes/src/server/detect-model.ts:137— Provider (context ui) is exposed in hermes's public surface via detect-model.resolveProvider — couples the contexts.
Cross-context type Review (ui → server) server/src/services/native-runtime/status-arbiter.ts:95— Review (context ui) is exposed in server's public surface via status-arbiter.arbitrateNativeStatus — couples the contexts.
Cross-context type Action (ui → server) server/src/services/chat-inbound-wakeup-publications.ts:67— Action (context ui) is exposed in server's public surface via chat-inbound-wakeup-publications.resolveInboundWakeReceipt — couples the contexts.
Cross-context type PaperclipSemanticToolResult (paperclip-runner → server) server/src/services/native-runtime/runner-semantic-authority.ts:104— PaperclipSemanticToolResult (context paperclip-runner) is exposed in server's public surface via PaperclipRunnerSemanticAuthority.dispatch — couples the contexts.
Cross-context type ChatEndpointStatus (ui → shared) packages/shared/src/types/chat-channels.ts:265— ChatEndpointStatus (context ui) is exposed in shared's public surface via ChatEndpoint.status — couples the contexts.
Cross-context type ButtonVariant (plugin-llm-wiki → ui) ui/storybook/support/design-proposals/ButtonSpecimen.tsx:9— ButtonVariant (context plugin-llm-wiki) is exposed in ui's public surface via ButtonSpecimen.ButtonSpecimen — couples the contexts.
Cross-context type ButtonSize (plugin-llm-wiki → ui) ui/storybook/support/design-proposals/ButtonSpecimen.tsx:9— ButtonSize (context plugin-llm-wiki) is exposed in ui's public surface via ButtonSpecimen.ButtonSpecimen — couples the contexts.
D4 · Code Duplication· Near-duplicate member family (9 members, 10 shared lines) · ×1
Near-duplicate member family (9 members, 10 shared lines) server/src/services/scripts/v1/client.py:140— server/src/services/scripts/v1/client.py:140-158 | server/src/services/scripts/v2/client.py:181-199 | server/src/services/scripts/v3/client.py:199-217 | server/src/services/scripts/v4/client.py:239-257 | server/src/services/scripts/v5/client.py:239-257 | server/src/services/scripts/v6/client.py:241-259 | server/src/services/scripts/v7/client.py:318-336 | server/src/services/scripts/v8/client.py:318-336 | server/src/services/scripts/v9/client.py:350-368 — These 9 members are variants of one another: a block of 10 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 9 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 9 times.
Near-duplicate member pair (42 shared lines) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1955— packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1955-2034 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:641-751 — 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· Members sharing a duplicated core (15 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (15 members, 50+ identical tokens) server/src/services/scripts/v1/client.py:23— server/src/services/scripts/v1/client.py:23-32 | server/src/services/scripts/v2/client.py:26-35 | server/src/services/scripts/v3/client.py:27-36 | server/src/services/scripts/v4/client.py:28-37 | server/src/services/scripts/v4/client.py:39-48 | server/src/services/scripts/v5/client.py:28-37 | server/src/services/scripts/v5/client.py:39-48 | server/src/services/scripts/v6/client.py:28-37 | server/src/services/scripts/v6/client.py:39-48 | server/src/services/scripts/v7/client.py:28-37 | server/src/services/scripts/v7/client.py:39-48 | server/src/services/scripts/v8/client.py:28-37 | server/src/services/scripts/v8/client.py:39-48 | server/src/services/scripts/v9/client.py:28-37 | server/src/services/scripts/v9/client.py:39-48 — These 15 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 15 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 15 times.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (4 members, 50+ identical tokens) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:1061— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:1061-1099 | packages/paperclip-runner/runner/crates/runner-core/src/external_provider_backend.rs:464-491 | packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:949-990 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2186-2234 — 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.
Duplicated block (19 lines × 3) server/src/services/scripts/v7/client.py:167— server/src/services/scripts/v7/client.py:167-185 | server/src/services/scripts/v8/client.py:167-185 | server/src/services/scripts/v9/client.py:188-206 — `server/src/services/scripts/v7/client.py` and `server/src/services/scripts/v8/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 31 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (17 lines × 8) server/src/services/scripts/v2/client.py:61— server/src/services/scripts/v2/client.py:61-77 | server/src/services/scripts/v3/client.py:62-78 | server/src/services/scripts/v4/client.py:86-102 | server/src/services/scripts/v5/client.py:86-102 | server/src/services/scripts/v6/client.py:86-102 | server/src/services/scripts/v7/client.py:86-102 | server/src/services/scripts/v8/client.py:86-102 | server/src/services/scripts/v9/client.py:86-102 — `server/src/services/scripts/v2/client.py` and `server/src/services/scripts/v3/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 17 separate duplicated blocks between them, totalling at least 122 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (15 lines × 7) server/src/services/scripts/v3/client.py:83— server/src/services/scripts/v3/client.py:83-97 | server/src/services/scripts/v4/client.py:107-121 | server/src/services/scripts/v5/client.py:107-121 | server/src/services/scripts/v6/client.py:107-121 | server/src/services/scripts/v7/client.py:107-121 | server/src/services/scripts/v8/client.py:107-121 | server/src/services/scripts/v9/client.py:107-121 — `server/src/services/scripts/v3/client.py` and `server/src/services/scripts/v4/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 17 separate duplicated blocks between them, totalling at least 131 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 lines × 9) server/src/services/scripts/v1/client.py:167— server/src/services/scripts/v1/client.py:167-176 | server/src/services/scripts/v2/client.py:208-217 | server/src/services/scripts/v3/client.py:226-235 | server/src/services/scripts/v4/client.py:266-275 | server/src/services/scripts/v5/client.py:266-275 | server/src/services/scripts/v6/client.py:268-277 | server/src/services/scripts/v7/client.py:345-354 | server/src/services/scripts/v8/client.py:345-354 | server/src/services/scripts/v9/client.py:377-386 — `server/src/services/scripts/v1/client.py` and `server/src/services/scripts/v2/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 67 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `server/src/services/scripts/v1/client.py:167` 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 × 8) server/src/services/scripts/v2/client.py:42— server/src/services/scripts/v2/client.py:42-51 | server/src/services/scripts/v3/client.py:43-52 | server/src/services/scripts/v4/client.py:67-76 | server/src/services/scripts/v5/client.py:67-76 | server/src/services/scripts/v6/client.py:67-76 | server/src/services/scripts/v7/client.py:67-76 | server/src/services/scripts/v8/client.py:67-76 | server/src/services/scripts/v9/client.py:67-76 — `server/src/services/scripts/v2/client.py` and `server/src/services/scripts/v3/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 17 separate duplicated blocks between them, totalling at least 122 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 (10 lines × 6) server/src/services/scripts/v4/client.py:51— server/src/services/scripts/v4/client.py:51-60 | server/src/services/scripts/v5/client.py:51-60 | server/src/services/scripts/v6/client.py:51-60 | server/src/services/scripts/v7/client.py:51-60 | server/src/services/scripts/v8/client.py:51-60 | server/src/services/scripts/v9/client.py:51-60 — `server/src/services/scripts/v4/client.py` and `server/src/services/scripts/v5/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 160 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 (6–7 lines × 9) server/src/services/scripts/v1/client.py:214— server/src/services/scripts/v1/client.py:214-220 | server/src/services/scripts/v2/client.py:257-262 | server/src/services/scripts/v3/client.py:276-281 | server/src/services/scripts/v4/client.py:317-322 | server/src/services/scripts/v5/client.py:317-322 | server/src/services/scripts/v6/client.py:319-324 | server/src/services/scripts/v7/client.py:480-485 | server/src/services/scripts/v8/client.py:480-485 | server/src/services/scripts/v9/client.py:581-586 — `server/src/services/scripts/v1/client.py` and `server/src/services/scripts/v2/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 67 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 (1–5 lines × 9) server/src/services/scripts/v1/client.py:137— server/src/services/scripts/v1/client.py:137-137 | server/src/services/scripts/v2/client.py:178-178 | server/src/services/scripts/v3/client.py:196-196 | server/src/services/scripts/v4/client.py:233-237 | server/src/services/scripts/v5/client.py:233-237 | server/src/services/scripts/v6/client.py:235-239 | server/src/services/scripts/v7/client.py:312-316 | server/src/services/scripts/v8/client.py:312-316 | server/src/services/scripts/v9/client.py:344-348 — `server/src/services/scripts/v1/client.py` and `server/src/services/scripts/v2/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 67 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `server/src/services/scripts/v2/client.py:176` calls `remember_identity` and `server/src/services/scripts/v1/client.py:135` 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 (5 lines × 3) server/src/services/scripts/v7/client.py:434— server/src/services/scripts/v7/client.py:434-438 | server/src/services/scripts/v8/client.py:434-438 | server/src/services/scripts/v9/client.py:534-538 — `server/src/services/scripts/v7/client.py` and `server/src/services/scripts/v8/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 31 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 (4–5 lines × 3) server/src/services/scripts/v7/client.py:451— server/src/services/scripts/v7/client.py:451-455 | server/src/services/scripts/v8/client.py:451-455 | server/src/services/scripts/v9/client.py:555-558 — `server/src/services/scripts/v7/client.py` and `server/src/services/scripts/v8/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 31 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 × 15) server/src/services/scripts/v1/client.py:23— server/src/services/scripts/v1/client.py:23-27 | server/src/services/scripts/v2/client.py:26-30 | server/src/services/scripts/v3/client.py:27-31 | server/src/services/scripts/v4/client.py:28-32 | server/src/services/scripts/v4/client.py:39-43 | server/src/services/scripts/v5/client.py:28-32 | server/src/services/scripts/v5/client.py:39-43 | server/src/services/scripts/v6/client.py:28-32 | server/src/services/scripts/v6/client.py:39-43 | server/src/services/scripts/v7/client.py:28-32 | server/src/services/scripts/v7/client.py:39-43 | server/src/services/scripts/v8/client.py:28-32 | server/src/services/scripts/v8/client.py:39-43 | server/src/services/scripts/v9/client.py:28-32 | server/src/services/scripts/v9/client.py:39-43 — `server/src/services/scripts/v1/client.py` and `server/src/services/scripts/v2/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 67 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (7 lines × 6) server/src/services/scripts/v1/client.py:186— server/src/services/scripts/v1/client.py:186-192 | server/src/services/scripts/v2/client.py:228-234 | server/src/services/scripts/v3/client.py:246-252 | server/src/services/scripts/v4/client.py:286-292 | server/src/services/scripts/v5/client.py:286-292 | server/src/services/scripts/v6/client.py:288-294 — `server/src/services/scripts/v1/client.py` and `server/src/services/scripts/v2/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 67 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `server/src/services/scripts/v2/client.py:236` calls `generation` and `server/src/services/scripts/v1/client.py:194` 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 (12 lines × 8) server/src/services/scripts/v2/client.py:125— server/src/services/scripts/v2/client.py:125-136 | server/src/services/scripts/v3/client.py:143-154 | server/src/services/scripts/v4/client.py:171-182 | server/src/services/scripts/v5/client.py:171-182 | server/src/services/scripts/v6/client.py:173-184 | server/src/services/scripts/v7/client.py:250-261 | server/src/services/scripts/v8/client.py:250-261 | server/src/services/scripts/v9/client.py:282-293 — `server/src/services/scripts/v2/client.py` and `server/src/services/scripts/v3/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 17 separate duplicated blocks between them, totalling at least 122 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `server/src/services/scripts/v4/client.py:170` calls `publish_delegation_skill` and `server/src/services/scripts/v2/client.py:124` 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 (5 lines × 8) server/src/services/scripts/v2/client.py:277— server/src/services/scripts/v2/client.py:277-281 | server/src/services/scripts/v3/client.py:297-301 | server/src/services/scripts/v4/client.py:338-342 | server/src/services/scripts/v5/client.py:338-342 | server/src/services/scripts/v6/client.py:340-344 | server/src/services/scripts/v7/client.py:501-505 | server/src/services/scripts/v8/client.py:501-505 | server/src/services/scripts/v9/client.py:602-606 — `server/src/services/scripts/v2/client.py` and `server/src/services/scripts/v3/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 17 separate duplicated blocks between them, totalling at least 122 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `server/src/services/scripts/v2/client.py:277` 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 × 7) server/src/services/scripts/v3/client.py:99— server/src/services/scripts/v3/client.py:99-104 | server/src/services/scripts/v4/client.py:123-128 | server/src/services/scripts/v5/client.py:123-128 | server/src/services/scripts/v6/client.py:123-128 | server/src/services/scripts/v7/client.py:123-128 | server/src/services/scripts/v8/client.py:123-128 | server/src/services/scripts/v9/client.py:123-128 — `server/src/services/scripts/v3/client.py` and `server/src/services/scripts/v4/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 17 separate duplicated blocks between them, totalling at least 131 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (5 lines × 7) server/src/services/scripts/v3/client.py:285— server/src/services/scripts/v3/client.py:285-289 | server/src/services/scripts/v4/client.py:326-330 | server/src/services/scripts/v5/client.py:326-330 | server/src/services/scripts/v6/client.py:328-332 | server/src/services/scripts/v7/client.py:489-493 | server/src/services/scripts/v8/client.py:489-493 | server/src/services/scripts/v9/client.py:590-594 — `server/src/services/scripts/v3/client.py` and `server/src/services/scripts/v4/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 17 separate duplicated blocks between them, totalling at least 131 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `server/src/services/scripts/v3/client.py:285` 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 × 6) server/src/services/scripts/v4/client.py:156— server/src/services/scripts/v4/client.py:156-160 | server/src/services/scripts/v5/client.py:156-160 | server/src/services/scripts/v6/client.py:156-160 | server/src/services/scripts/v7/client.py:233-237 | server/src/services/scripts/v8/client.py:233-237 | server/src/services/scripts/v9/client.py:265-269 — `server/src/services/scripts/v4/client.py` and `server/src/services/scripts/v5/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 160 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (6 lines × 6) server/src/services/scripts/v4/client.py:191— server/src/services/scripts/v4/client.py:191-196 | server/src/services/scripts/v5/client.py:191-196 | server/src/services/scripts/v6/client.py:193-198 | server/src/services/scripts/v7/client.py:270-275 | server/src/services/scripts/v8/client.py:270-275 | server/src/services/scripts/v9/client.py:302-307 — `server/src/services/scripts/v4/client.py` and `server/src/services/scripts/v5/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 160 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (8 lines × 6) server/src/services/scripts/v4/client.py:302— server/src/services/scripts/v4/client.py:302-309 | server/src/services/scripts/v5/client.py:302-309 | server/src/services/scripts/v6/client.py:304-311 | server/src/services/scripts/v7/client.py:465-472 | server/src/services/scripts/v8/client.py:465-472 | server/src/services/scripts/v9/client.py:566-573 — `server/src/services/scripts/v4/client.py` and `server/src/services/scripts/v5/client.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 160 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (27 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:1023— packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:1023-1049 | packages/paperclip-runner/runner/crates/runner-core/src/local_runner.rs:761-787 — 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 (23 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1864— packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1864-1886 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:287-309 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 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 (20–22 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:2452— packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:2452-2471 | packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:2588-2609 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1972— packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1972-1993 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:680-701 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:2343— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:2343-2358 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:312-327 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14–15 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:392— packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:392-405 | packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs:416-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.
Duplicated block (9–11 lines × 3) packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:639— packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:639-649 | packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:1873-1881 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:296-304 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10–11 lines × 3) packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:4237— packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:4237-4247 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:4300-4310 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:4314-4323 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10–11 lines × 2) packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3533— packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3533-3543 | packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs:3548-3557 — both copies are in the same file, so extract the block into 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 × 3) packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:1024— packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs:1024-1033 | packages/paperclip-runner/runner/crates/runner-core/src/durable/transport.rs:1330-1339 | packages/paperclip-runner/runner/crates/runner-core/src/local_runner.rs:762-771 — 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–8 lines × 4) packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:1072— packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs:1072-1079 | packages/paperclip-runner/runner/crates/runner-core/src/external_provider_backend.rs:476-481 | packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs:965-972 | packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs:2211-2218 — before extracting anything, compare `packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs` and `packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Coverage not measured — JavaScript/TypeScript suite — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — the repository root runs vitest but declares no coverage provider, so the suite can run and still produce no lcov — add `@vitest/coverage-v8` (or `@vitest/coverage-istanbul`) as a devDependency. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan. Alternatively, commit the lcov/Cobertura report your CI produces and it is read without a re-run.
Hollow method — returns a constant without doing the work server/src/services/company-portability.ts:3012— `readCompanyApprovalDefault` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
P12 · CI test-gate honesty· Coverage collected but not gated · ×1
Coverage collected but not gated — CI collects a coverage report but no step enforces a minimum — coverage could halve and CI stays green. Add a step that fails the build when coverage drops below a floor (your coverage tool's minimum-threshold flag, or a coverage-gate action) so the number guards something. What was searched, so you can tell an absence from a miss: this repository's CI files AND its coverage configuration — the well-known coverage and test-runner config files, read at the repository root and inside workspace package directories two levels down, so a floor declared beside the tests rather than in the pipeline is credited — matched against the threshold settings this check knows by name. A floor set in your coverage service's web UI rather than in a committed file, or under a setting whose name is not one of those, is not seen here.
P3 · Security & performance tooling· SAST runs, but gates no merge · ×1
SAST runs, but gates no merge — `REDACTED` run(s) a static-analysis scan, but no workflow that runs one is triggered by a pull request (or a merge queue, or an unfiltered push) — the scan fires on a schedule or a manual dispatch only. A vulnerable change therefore merges clean and is reported on the next scheduled run, by which time it is on the default branch and the only remedy is a follow-up fix. Add the pull-request trigger to the workflow that runs the scan so the finding arrives before the merge rather than after it.
Duplication concentrated across 6 sibling directories (289 clone groups) scripts/ensure-workspace-package-links.ts:9— 289 duplicated blocks under the repository root have copies in at least two of the sibling directories cli, docker, packages, scripts, server, ui — 175 of them are reported below, and 114 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 289 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 289 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 289 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 11 sibling directories (198 clone groups) packages/adapters/gemini-local/src/server/execute.ts:99— 198 duplicated blocks under packages/adapters/ have copies in at least two of the sibling directories claude-local, codex-local, cursor-cloud, cursor-local, gemini-local, grok-local (+5 more sibling(s) not listed) — 179 of them are reported below, and 19 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 198 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 198 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 198 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 10 sibling directories (191 clone groups) server/src/modules/wake-queue/domain/context.ts:28— 191 duplicated blocks under server/src/ have copies in at least two of the sibling directories adapters, auth, lib, middleware, modules, realtime (+4 more sibling(s) not listed) — 94 of them are reported below, and 97 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 191 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 191 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 191 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 8 sibling directories (169 clone groups) server/src/services/connectors/slack-catalog.ts:94— 169 duplicated blocks under server/src/services/ have copies in at least two of the sibling directories chat-channels, connectors, grok-bot, heartbeat, native-runtime, recovery (+2 more sibling(s) not listed) — 77 of them are reported below, and 92 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 169 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 169 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 169 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 11 sibling directories (96 clone groups) packages/skills-catalog/src/catalog-builder.ts:72— 96 duplicated blocks under packages/ have copies in at least two of the sibling directories adapter-utils, adapters, db, google-sheets-mcp-server, kv-demo-mcp-server, mcp-server (+5 more sibling(s) not listed) — 58 of them are reported below, and 38 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 96 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 96 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 96 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 21 sibling directories (60 clone groups) packages/paperclip-runner/src/protocol/semantic-tool-receipts.ts:86— 60 duplicated blocks under packages/paperclip-runner/src/ have copies in at least two of the sibling directories backends, browser, catalog, cli, conformance, contracts (+15 more sibling(s) not listed) — 38 of them are reported below, and 22 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 60 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 60 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 60 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 10 sibling directories (55 clone groups) server/src/services/chat-channels/discord/publication-preparation.ts:18— 55 duplicated blocks under server/src/services/chat-channels/ have copies in at least two of the sibling directories discord, github, imessage-photon, inbound, interactions, microsoft-teams (+4 more sibling(s) not listed) — 29 of them are reported below, and 26 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 55 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 55 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 55 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 3 sibling directories (50 clone groups) packages/paperclip-runner/devtools/browser/src/live/use-live-console.ts:1— 50 duplicated blocks under packages/paperclip-runner/ have copies in at least two of the sibling directories devtools, scripts, src — 41 of them are reported below, and 9 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 50 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 50 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 50 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 7 sibling directories (32 clone groups) packages/plugins/sandbox-providers/daytona/src/file-sync.ts:258— 32 duplicated blocks under packages/plugins/sandbox-providers/ have copies in at least two of the sibling directories cloudflare, daytona, e2b, exe-dev, kubernetes, modal (+1 more sibling(s) not listed) — 23 of them are reported below, and 9 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 32 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 32 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 32 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 5 sibling directories (20 clone groups) packages/paperclip-runner/src/drivers/codex/codex-harness-session.ts:508— 20 duplicated blocks under packages/paperclip-runner/src/drivers/ have copies in at least two of the sibling directories acpx, codex, dot, external, opencode — 16 of them are reported below, and 4 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 20 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 20 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 20 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 6 sibling directories (14 clone groups) server/src/services/tool-access/catalog/discovery.ts:275— 14 duplicated blocks under server/src/services/tool-access/ have copies in at least two of the sibling directories activity, catalog, connections, oauth, profiles, token-broker — 10 of them are reported below, and 4 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 14 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 14 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 14 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 12 sibling directories (13 clone groups) ui/src/adapters/claude-local/config-fields.tsx:76— 13 duplicated blocks under ui/src/adapters/ have copies in at least two of the sibling directories claude-local, codex-local, cursor, gemini-local, grok-local, hermes-gateway (+6 more sibling(s) not listed) — 11 of them are reported below, and 2 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 13 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 13 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 13 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 3 sibling directories (12 clone groups) ui/src/artifact-directions/directions/d2-tint/Content.tsx:1— 12 duplicated blocks under ui/src/artifact-directions/directions/ have copies in at least two of the sibling directories d1-solid, d2-tint, d4-hybrid — 11 of them are reported below, and 1 is counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 12 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 12 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 12 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 2 sibling directories (8 clone groups) packages/plugins/plugin-llm-wiki/src/ui/app.tsx:839— 8 duplicated blocks under packages/plugins/plugin-llm-wiki/src/ have copies in at least two of the sibling directories ui, wiki — 0 of them are reported below, and 8 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 8 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 8 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 8 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 5 sibling directories (6 clone groups) cli/src/checks/llm-check.ts:22— 6 of the duplicated blocks reported below have copies in at least two of the sibling directories checks, client, commands, config, services under cli/src/. That concentration is one structural fact, not 6 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 6 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Wholesale file copy (1625 identical lines × 2 files) ui/src/components/IssuesList.tsx:1— ui/src/components/IssuesList.tsx:1 · ui/src/components/LegacyIssuesList.tsx:2 — these 2 files are line-for-line copies of one another — 1625 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Wholesale file copy (987 identical lines × 2 files) ui/src/pages/Routines.production.tsx:1— ui/src/pages/Routines.production.tsx:1 · ui/src/pages/Routines.tsx:1 — these 2 files are line-for-line copies of one another — 987 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Wholesale file copy (598 identical lines × 2 files) ui/src/pages/RoutineDetail.production.tsx:1— ui/src/pages/RoutineDetail.production.tsx:1 · ui/src/pages/RoutineDetail.tsx:1 — these 2 files are line-for-line copies of one another — 598 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Wholesale file copy (485 identical lines × 2 files) ui/src/components/SidebarAgents.production.tsx:1— ui/src/components/SidebarAgents.production.tsx:1 · ui/src/components/SidebarAgents.tsx:1 — these 2 files are line-for-line copies of one another — 485 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Wholesale file copy (427 identical lines × 2 files) ui/src/pages/OrgChart.production.tsx:1— ui/src/pages/OrgChart.production.tsx:1 · ui/src/pages/OrgChart.tsx:1 — these 2 files are line-for-line copies of one another — 427 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Wholesale file copy (420 identical lines × 2 files) ui/src/pages/Agents.production.tsx:1— ui/src/pages/Agents.production.tsx:1 · ui/src/pages/Agents.tsx:1 — these 2 files are line-for-line copies of one another — 420 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (396 matched lines × 2 locations) · ×1
Duplicated block with local edits (396 matched lines × 2 locations) packages/adapters/gemini-local/src/server/execute.ts:99— packages/adapters/gemini-local/src/server/execute.ts:99 · packages/adapters/kimi-local/src/server/execute.ts:136 — the two spans are one implementation copied and then locally edited — 2470 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Wholesale file copy (345 identical lines × 2 files) packages/paperclip-runner/devtools/browser/src/live/use-live-console.ts:1— packages/paperclip-runner/devtools/browser/src/live/use-live-console.ts:1 · packages/paperclip-runner/src/react/use-runner-console.ts:1 — these 2 files are line-for-line copies of one another — 345 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Wholesale file copy (250 identical lines × 2 files) packages/paperclip-runner/devtools/browser/src/live/transcript-model.ts:2— packages/paperclip-runner/devtools/browser/src/live/transcript-model.ts:2 · packages/paperclip-runner/src/browser/transcript-model.ts:2 — these 2 files are line-for-line copies of one another — 250 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Wholesale file copy (241 identical lines × 2 files) ui/src/components/SidebarCompanyMenu.production.tsx:1— ui/src/components/SidebarCompanyMenu.production.tsx:1 · ui/src/components/SidebarCompanyMenu.tsx:1 — these 2 files are line-for-line copies of one another — 241 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (193 matched lines × 2 locations) · ×1
Duplicated block with local edits (193 matched lines × 2 locations) packages/adapters/gemini-local/src/server/execute.ts:249— packages/adapters/gemini-local/src/server/execute.ts:249 · packages/adapters/opencode-local/src/server/execute.ts:249 — the two spans are one implementation copied and then locally edited — 1361 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Wholesale file copy (169 identical lines × 2 files) ui/src/components/SidebarAccountMenu.production.tsx:2— ui/src/components/SidebarAccountMenu.production.tsx:2 · ui/src/components/SidebarAccountMenu.tsx:2 — these 2 files are line-for-line copies of one another — 169 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Duplicated block (163 lines × 2 locations) packages/paperclip-runner/devtools/browser/src/live/SessionPanel.tsx:33— packages/paperclip-runner/devtools/browser/src/live/SessionPanel.tsx:33 · packages/paperclip-runner/src/react/session-timeline.tsx:61 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication· Duplicated block with local edits (156 matched lines × 2 locations) · ×1
Duplicated block with local edits (156 matched lines × 2 locations) packages/skills-catalog/src/catalog-builder.ts:72— packages/skills-catalog/src/catalog-builder.ts:72 · packages/teams-catalog/src/catalog-builder.ts:68 — the two spans are one implementation copied and then locally edited — 1163 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Wholesale file copy (148 identical lines × 2 files) ui/src/components/SidebarStarredProjects.production.tsx:1— ui/src/components/SidebarStarredProjects.production.tsx:1 · ui/src/components/SidebarStarredProjects.tsx:1 — these 2 files are line-for-line copies of one another — 148 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (146 matched lines × 2 locations) · ×1
Duplicated block with local edits (146 matched lines × 2 locations) server/src/services/chat-teams-inline-images.ts:33— server/src/services/chat-teams-inline-images.ts:33 · server/src/services/chat-telegram-photo.ts:18 — the two spans are one implementation copied and then locally edited — 997 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Wholesale file copy (145 identical lines × 2 files) packages/paperclip-runner/devtools/browser/src/live/Inspector.tsx:1— packages/paperclip-runner/devtools/browser/src/live/Inspector.tsx:1 · packages/paperclip-runner/src/react/inspector.tsx:1 — these 2 files are line-for-line copies of one another — 145 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (141 matched lines × 2 locations) · ×1
Duplicated block with local edits (141 matched lines × 2 locations) server/src/services/activity.ts:145— server/src/services/activity.ts:145 · server/src/services/heartbeat/run-lifecycle.ts:2752 — the two spans are one implementation copied and then locally edited — 906 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (140 matched lines × 2 locations) · ×1
Duplicated block with local edits (140 matched lines × 2 locations) server/src/services/chat-channels/slack/task-start-resolution.ts:274— server/src/services/chat-channels/slack/task-start-resolution.ts:274 · server/src/services/chat-channels/slack/task-start.ts:639 — the two spans are one implementation copied and then locally edited — 645 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (137 lines × 2 locations) server/src/services/secrets.ts:5307— server/src/services/secrets.ts:5307 · server/src/services/secrets.ts:5464 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication· Duplicated block with local edits (134 matched lines × 2 locations) · ×1
Duplicated block with local edits (134 matched lines × 2 locations) server/src/services/decision-models.ts:38— server/src/services/decision-models.ts:38 · server/src/services/prompt-injection-prevention.ts:37 — the two spans are one implementation copied and then locally edited — 2211 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Complex function OnboardingWizardInner (cyclomatic 436, cognitive 327) ui/src/components/OnboardingWizard.tsx:490— OnboardingWizardInner has cyclomatic complexity 436 and cognitive complexity 327; 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 (anonymous) (cyclomatic 403, cognitive 445) server/src/routes/issues.ts:13693— (anonymous) has cyclomatic complexity 403 and cognitive complexity 445; 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 TaskDetailSurface (cyclomatic 396, cognitive 352) ui/src/pages/IssueDetail.tsx:3146— TaskDetailSurface has cyclomatic complexity 396 and cognitive complexity 352; 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 AgentConfigForm (cyclomatic 396, cognitive 341) ui/src/components/AgentConfigForm.tsx:345— AgentConfigForm has cyclomatic complexity 396 and cognitive complexity 341; 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 (anonymous) (cyclomatic 387, cognitive 659) tests/runner-e2e/runner.spec.ts:588— (anonymous) has cyclomatic complexity 387 and cognitive complexity 659; 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 executeRunAttempt (cyclomatic 380, cognitive 478) server/src/services/heartbeat.ts:1764— executeRunAttempt has cyclomatic complexity 380 and cognitive complexity 478; 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 IssueProperties (cyclomatic 378, cognitive 349) ui/src/components/issue-properties/IssueProperties.tsx:233— IssueProperties has cyclomatic complexity 378 and cognitive complexity 349; 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 importBundle (cyclomatic 360, cognitive 768) server/src/services/company-portability.ts:5255— importBundle has cyclomatic complexity 360 and cognitive complexity 768; 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 connectGalleryApp (cyclomatic 336, cognitive 422) server/src/services/tool-access.ts:1592— connectGalleryApp has cyclomatic complexity 336 and cognitive complexity 422; 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 (anonymous) (cyclomatic 313, cognitive 371) server/src/services/heartbeat/queue.ts:2812— (anonymous) has cyclomatic complexity 313 and cognitive complexity 371; 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 executeFixture (cyclomatic 298, cognitive 386) server/src/__tests__/native-status-arbiter-corpus.test.ts:559— executeFixture has cyclomatic complexity 298 and cognitive complexity 386; 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 StandardConnectionSetupFlow (cyclomatic 281, cognitive 235) ui/src/features/connections/ConnectionSetupFlow.tsx:634— StandardConnectionSetupFlow has cyclomatic complexity 281 and cognitive complexity 235; 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 exportBundle (cyclomatic 257, cognitive 417) server/src/services/company-portability.ts:3877— exportBundle has cyclomatic complexity 257 and cognitive complexity 417; 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 Setup (cyclomatic 254, cognitive 198) ui/src/components/new-agent/NewAgentSetup.tsx:109— Setup has cyclomatic complexity 254 and cognitive complexity 198; 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 executeEnvironmentTask (cyclomatic 242, cognitive 259) server/src/services/environment-task-runtime.ts:32— executeEnvironmentTask has cyclomatic complexity 242 and cognitive complexity 259; 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 resolveQuestionResponseChain (cyclomatic 240, cognitive 184) server/src/services/native-runtime/external-chat-question-response.ts:206— resolveQuestionResponseChain has cyclomatic complexity 240 and cognitive complexity 184; 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 (anonymous) (cyclomatic 237, cognitive 452) ui/src/components/TaskChatThread.tsx:1512— (anonymous) has cyclomatic complexity 237 and cognitive complexity 452; 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 #resume (cyclomatic 225, cognitive 256) packages/paperclip-runner/src/live/runnerd-codex-transport.ts:5146— #resume has cyclomatic complexity 225 and cognitive complexity 256; 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 renderPaperclipWakePromptBody (cyclomatic 223, cognitive 354) REDACTED:2264— renderPaperclipWakePromptBody has cyclomatic complexity 223 and cognitive complexity 354; 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 createRunnerdBackendWithinSessionClaim (cyclomatic 218, cognitive 215) server/src/services/native-runtime/native-session-executor.ts:11789— createRunnerdBackendWithinSessionClaim has cyclomatic complexity 218 and cognitive complexity 215; 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.
R3 · Large Files· server/src/routes/issues.ts · ×1
server/src/routes/issues.ts: 19001 lines of code server/src/routes/issues.ts:1— server/src/routes/issues.ts has 19001 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/native-runtime/native-session-executor.ts · ×1
server/src/services/native-runtime/native-session-executor.ts: 13856 lines of code server/src/services/native-runtime/native-session-executor.ts:1— server/src/services/native-runtime/native-session-executor.ts has 13856 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/issues.ts · ×1
server/src/services/issues.ts: 13250 lines of code server/src/services/issues.ts:1— server/src/services/issues.ts has 13250 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/routes/openapi.ts · ×1
server/src/routes/openapi.ts: 11856 lines of code server/src/routes/openapi.ts:1— server/src/routes/openapi.ts has 11856 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/tool-gateway.ts · ×1
server/src/services/tool-gateway.ts: 11359 lines of code server/src/services/tool-gateway.ts:1— server/src/services/tool-gateway.ts has 11359 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/workspace-runtime.ts · ×1
server/src/services/workspace-runtime.ts: 8672 lines of code server/src/services/workspace-runtime.ts:1— server/src/services/workspace-runtime.ts has 8672 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· ui/src/pages/IssueDetail.tsx · ×1
ui/src/pages/IssueDetail.tsx: 8593 lines of code ui/src/pages/IssueDetail.tsx:1— ui/src/pages/IssueDetail.tsx has 8593 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/paperclip-runner/src/live/runnerd-codex-transport.ts · ×1
packages/paperclip-runner/src/live/runnerd-codex-transport.ts: 7345 lines of code packages/paperclip-runner/src/live/runnerd-codex-transport.ts:1— packages/paperclip-runner/src/live/runnerd-codex-transport.ts has 7345 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/routes/agents.ts · ×1
server/src/routes/agents.ts: 7331 lines of code server/src/routes/agents.ts:1— server/src/routes/agents.ts has 7331 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/company-skills.ts · ×1
server/src/services/company-skills.ts: 7006 lines of code server/src/services/company-skills.ts:1— server/src/services/company-skills.ts has 7006 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/plugins/plugin-llm-wiki/src/ui/app.tsx · ×1
packages/plugins/plugin-llm-wiki/src/ui/app.tsx: 6653 lines of code packages/plugins/plugin-llm-wiki/src/ui/app.tsx:1— packages/plugins/plugin-llm-wiki/src/ui/app.tsx has 6653 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· ui/src/components/IssueChatThread.tsx · ×1
ui/src/components/IssueChatThread.tsx: 6539 lines of code ui/src/components/IssueChatThread.tsx:1— ui/src/components/IssueChatThread.tsx has 6539 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 6193 lines of code REDACTED:1— REDACTED has 6193 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/company-portability.ts · ×1
server/src/services/company-portability.ts: 6122 lines of code server/src/services/company-portability.ts:1— server/src/services/company-portability.ts has 6122 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/adapter-utils/src/acpx-engine/execute.ts · ×1
packages/adapter-utils/src/acpx-engine/execute.ts: 5736 lines of code packages/adapter-utils/src/acpx-engine/execute.ts:1— packages/adapter-utils/src/acpx-engine/execute.ts has 5736 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/secrets.ts · ×1
server/src/services/secrets.ts: 5521 lines of code server/src/services/secrets.ts:1— server/src/services/secrets.ts has 5521 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· ui/src/pages/CompanySkills.production.tsx · ×1
ui/src/pages/CompanySkills.production.tsx: 5411 lines of code ui/src/pages/CompanySkills.production.tsx:1— ui/src/pages/CompanySkills.production.tsx has 5411 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· ui/src/pages/CompanySkills.tsx · ×1
ui/src/pages/CompanySkills.tsx: 5388 lines of code ui/src/pages/CompanySkills.tsx:1— ui/src/pages/CompanySkills.tsx has 5388 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/issue-thread-interactions.ts · ×1
server/src/services/issue-thread-interactions.ts: 5081 lines of code server/src/services/issue-thread-interactions.ts:1— server/src/services/issue-thread-interactions.ts has 5081 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/execution-workspaces.ts · ×1
server/src/services/execution-workspaces.ts: 4913 lines of code server/src/services/execution-workspaces.ts:1— server/src/services/execution-workspaces.ts has 4913 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/heartbeat/queue.ts · ×1
server/src/services/heartbeat/queue.ts: 4745 lines of code server/src/services/heartbeat/queue.ts:1— server/src/services/heartbeat/queue.ts has 4745 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 4716 lines of code REDACTED:1— REDACTED has 4716 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 4696 lines of code REDACTED:1— REDACTED has 4696 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/tool-access.ts · ×1
server/src/services/tool-access.ts: 4694 lines of code server/src/services/tool-access.ts:1— server/src/services/tool-access.ts has 4694 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/plugins/plugin-llm-wiki/src/wiki/core.ts · ×1
packages/plugins/plugin-llm-wiki/src/wiki/core.ts: 4662 lines of code packages/plugins/plugin-llm-wiki/src/wiki/core.ts:1— packages/plugins/plugin-llm-wiki/src/wiki/core.ts has 4662 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
ui/src/pages/Secrets.tsx: 4650 lines of code ui/src/pages/Secrets.tsx:1— ui/src/pages/Secrets.tsx has 4650 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· ui/src/pages/AgentDetail.tsx · ×1
ui/src/pages/AgentDetail.tsx: 4557 lines of code ui/src/pages/AgentDetail.tsx:1— ui/src/pages/AgentDetail.tsx has 4557 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· ui/src/features/connections/ConnectionSetupFlow.tsx · ×1
ui/src/features/connections/ConnectionSetupFlow.tsx: 4556 lines of code ui/src/features/connections/ConnectionSetupFlow.tsx:1— ui/src/features/connections/ConnectionSetupFlow.tsx has 4556 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/environment-runtime.ts · ×1
server/src/services/environment-runtime.ts: 4491 lines of code server/src/services/environment-runtime.ts:1— server/src/services/environment-runtime.ts has 4491 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 4388 lines of code REDACTED:1— REDACTED has 4388 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· ui/src/pages/AgentDetail.production.tsx · ×1
ui/src/pages/AgentDetail.production.tsx: 4274 lines of code ui/src/pages/AgentDetail.production.tsx:1— ui/src/pages/AgentDetail.production.tsx has 4274 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· cli/src/commands/worktree.ts · ×1
cli/src/commands/worktree.ts: 4231 lines of code cli/src/commands/worktree.ts:1— cli/src/commands/worktree.ts has 4231 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· ui/src/components/AgentConfigForm.tsx · ×1
ui/src/components/AgentConfigForm.tsx: 4098 lines of code ui/src/components/AgentConfigForm.tsx:1— ui/src/components/AgentConfigForm.tsx has 4098 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/heartbeat.ts · ×1
server/src/services/heartbeat.ts: 3985 lines of code server/src/services/heartbeat.ts:1— server/src/services/heartbeat.ts has 3985 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· ui/src/components/IssueThreadInteractionCard.tsx · ×1
ui/src/components/IssueThreadInteractionCard.tsx: 3823 lines of code ui/src/components/IssueThreadInteractionCard.tsx:1— ui/src/components/IssueThreadInteractionCard.tsx has 3823 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 3668 lines of code REDACTED:1— REDACTED has 3668 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/plugin-worker-manager.ts · ×1
server/src/services/plugin-worker-manager.ts: 3647 lines of code server/src/services/plugin-worker-manager.ts:1— server/src/services/plugin-worker-manager.ts has 3647 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· server/src/services/heartbeat/workspaces.ts · ×1
server/src/services/heartbeat/workspaces.ts: 3546 lines of code server/src/services/heartbeat/workspaces.ts:1— server/src/services/heartbeat/workspaces.ts has 3546 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/plugins/sandbox-providers/daytona/src/plugin.ts · ×1
packages/plugins/sandbox-providers/daytona/src/plugin.ts: 3510 lines of code packages/plugins/sandbox-providers/daytona/src/plugin.ts:1— packages/plugins/sandbox-providers/daytona/src/plugin.ts has 3510 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· ui/src/components/OnboardingWizard.tsx · ×1
ui/src/components/OnboardingWizard.tsx: 3490 lines of code ui/src/components/OnboardingWizard.tsx:1— ui/src/components/OnboardingWizard.tsx has 3490 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R6 · Tooling· The declared test suite includes a file that cannot be loaded · ×1
The declared test suite includes a file that cannot be loaded cli/src/__tests__/worktree.test.ts:1687— This repository declares test tooling, and the ✓ above records that declaration — but cli/src/__tests__/worktree.test.ts and 12 other test file(s) in this workspace cannot be loaded at all: it imports a module that names no file in this repository, so the runner throws while collecting it and none of its cases execute. The wiring is present and the suite it points at does not run as written, which is why the tooling tick must not be read as a statement that the tests pass. Fix the unloadable file(s) — each one is reported with its failing import under Test Coverage — then the declared script exercises what it claims to.
Dead file (~481 LoC) ui/src/components/OnboardingChat.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~436 LoC) scripts/benchmark-chat-native-progress.mjs— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~338 LoC) ui/src/components/ArtifactsPanel.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~230 LoC) ui/src/artifact-directions/directions/d3-tactile/kind.ts— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 16 in-repo import(s) from 16 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/GalleryItem.tsx, ui/src/artifact-directions/directions/d3-tactile/GalleryStacks.tsx, ui/src/artifact-directions/directions/d3-tactile/MetaLine.tsx and 13 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~222 LoC) scripts/smoke/muse-qualification.ts— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~221 LoC) server/src/services/plugin-runtime-sandbox.ts— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~178 LoC) ui/src/artifact-directions/directions/d3-tactile/GalleryStacks.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/index.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~175 LoC) ui/src/artifact-directions/directions/d3-tactile/objects/Paper.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 5 in-repo import(s) from 5 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/objects/ArtifactObject.tsx, ui/src/artifact-directions/directions/d3-tactile/objects/Formats.tsx, ui/src/artifact-directions/directions/d3-tactile/objects/Print.tsx and 2 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~170 LoC) ui/src/artifact-directions/directions/d3-tactile/index.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~167 LoC) ui/src/artifact-directions/directions/d2-tint/index.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~166 LoC) ui/src/artifact-directions/directions/d1-solid/KindBlock.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 6 in-repo import(s) from 6 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/ExcerptSheet.tsx, ui/src/artifact-directions/directions/d1-solid/GalleryPreview.tsx, ui/src/artifact-directions/directions/d1-solid/PanelCard.tsx and 3 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~154 LoC) ui/src/artifact-directions/directions/d3-tactile/ThreadAttachments.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/index.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~143 LoC) ui/src/artifact-directions/directions/d3-tactile/PanelItem.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/PanelBody.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~142 LoC) ui/src/artifact-directions/directions/d1-solid/index.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~135 LoC) ui/src/artifact-directions/directions/d1-solid/PanelCard.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/PanelBody.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~129 LoC) ui/src/artifact-directions/directions/d1-solid/StackTile.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/Gallery.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~128 LoC) ui/src/artifact-directions/directions/d5-v1-mvp/Sheet.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d5-v1-mvp/Front.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~127 LoC) ui/src/pages/Org.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~123 LoC) ui/src/artifact-directions/directions/d5-v1-mvp/GalleryView.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d5-v1-mvp/index.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~121 LoC) ui/src/artifact-directions/directions/d5-v1-mvp/Stack.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d5-v1-mvp/Tile.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~120 LoC) ui/src/artifact-directions/directions/d2-tint/PanelCard.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d2-tint/PanelSection.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~118 LoC) ui/src/artifact-directions/directions/d3-tactile/objects/Sheets.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/objects/ArtifactObject.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~117 LoC) ui/src/artifact-directions/directions/d3-tactile/gallery-model.ts— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 5 in-repo import(s) from 5 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/GalleryItem.tsx, ui/src/artifact-directions/directions/d3-tactile/GalleryStack.tsx, ui/src/artifact-directions/directions/d3-tactile/GalleryStacks.tsx and 2 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~114 LoC) ui/src/artifact-directions/directions/d1-solid/Gallery.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/index.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~112 LoC) ui/src/artifact-directions/directions/d1-solid/kinds.ts— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 13 in-repo import(s) from 13 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/Gallery.tsx, ui/src/artifact-directions/directions/d1-solid/GalleryPreview.tsx, ui/src/artifact-directions/directions/d1-solid/KindBlock.tsx and 10 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~110 LoC) packages/paperclip-runner/scripts/copilot-profile-identity.mjs— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~109 LoC) ui/src/artifact-directions/directions/d3-tactile/objects/ArtifactObject.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 6 in-repo import(s) from 6 other file(s) do name it (ui/src/artifact-directions/directions/d3-tactile/GalleryItem.tsx, ui/src/artifact-directions/directions/d3-tactile/GalleryStacks.tsx, ui/src/artifact-directions/directions/d3-tactile/PanelBody.tsx and 3 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~108 LoC) ui/src/artifact-directions/directions/d2-tint/ThreadAttachments.tsx— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/artifact-directions/directions/d2-tint/index.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~107 LoC) ui/src/artifact-directions/directions/d1-solid/gallery-model.ts— no import path from any entry point (1808 application, 304 tooling, 4289 test roots considered), but 4 in-repo import(s) from 4 other file(s) do name it (ui/src/artifact-directions/directions/d1-solid/Gallery.tsx, ui/src/artifact-directions/directions/d1-solid/GalleryPreview.tsx, ui/src/artifact-directions/directions/d1-solid/GalleryTile.tsx and 1 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Unused dependency '@anthropic-ai/sdk' — Declared in packages/adapters/claude-local/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency '@agentclientprotocol/sdk' — Declared in REDACTED but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency '@discordjs/ws' — Declared in server/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
X14 · Bypassable address classification· IP classification is bypassable through an IPv4-in-IPv6 embedding · ×1
IP classification is bypassable through an IPv4-in-IPv6 embedding server/src/services/plugin-host-services.ts:139— This function unwraps IPv4-MAPPED IPv6 (`::ffff:`, line 124) and then rejects `10.0.0.0/8` on its IPv4 path — but the IPv6 decision at line 139 classifies the address as written, and IPv4 reaches IPv6 through three MORE embeddings this function never mentions: IPv4-compatible (`::a.b.c.d`), 6to4 (`2002::/16`) and NAT64 (`64:ff9b::/96`). So `::10.0.0.1`, `2002:0a00:0001::` and `64:ff9b::10.0.0.0` all name a host inside `10.0.0.0/8` — the range this same function declares non-public — and all reach the IPv6 decision un-unwrapped, taking the opposite verdict. Unwrap every embedding to its IPv4 form before classifying, or reject any IPv6 address carrying an embedded IPv4 outright.
Mock-dominated test: does not open a skill when keyboard-activating its actions button ui/src/pages/CompanySkills.test.tsx:550— This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: creates an unused conversation only for the first %s and updates its canonical cache ui/src/pages/IssueDetail.test.tsx:1564— This test sets up 4 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 8 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: reconciles %s watched runs outside the preview after reconnecting ui/src/pages/IssueDetail.test.tsx:1768— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: retains every recent run observed during an open task ui/src/pages/IssueDetail.test.tsx:1810— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: coordinates %s with the initial cards and supporting history ui/src/pages/IssueDetail.test.tsx:1828— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: retains the production breadcrumb side-panel toggle when Streamlined UI is off ui/src/pages/IssueDetail.test.tsx:2096— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: maximizes the desktop pane once per viewer=full deep link ui/src/pages/IssueDetail.test.tsx:2365— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: opens the mobile properties sheet for a document deep link ui/src/pages/IssueDetail.test.tsx:2492— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: uses history Back for a live inbox origin and a route fallback for direct links ui/src/pages/IssueDetail.test.tsx:3148— This test sets up 4 test doubles (for example `vi
.spyOn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: reveals the planning-mode task sidebar when its plan document exists ui/src/pages/IssueDetail.test.tsx:4560— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: keeps the Show properties button clickable on the first task and reveals the sidebar on demand ui/src/pages/IssueDetail.test.tsx:4583— This test sets up 6 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 5 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: reveals the properties sidebar on the first onboarding task once a plan document exists ui/src/pages/IssueDetail.test.tsx:4631— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: shows the properties sidebar immediately on a non-first task ui/src/pages/IssueDetail.test.tsx:4651— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: stops the selected queued Grok run without cancelling a different running run ui/src/pages/IssueDetail.test.tsx:4907— This test sets up 5 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: uses the background Cloud handoff returned with an imported OAuth connection ui/src/pages/tools/PasteConfigTab.test.tsx:416— This test sets up 3 test doubles (for example `vi.spyOn`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: normalizes the retired post-OAuth Setup URL into Permissions ui/src/pages/apps/AppDetail.test.tsx:753— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: reconnects an OAuth warning through the connection's existing personal identity ui/src/pages/apps/AppDetail.test.tsx:1457— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: keeps personal managed authorization in the tenant until the provider is ready ui/src/pages/apps/AppDetail.test.tsx:1634— This test sets up 4 test doubles (for example `vi.spyOn`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: redirects a provider application to its live connection Permissions page ui/src/pages/apps/AppNotConnected.test.tsx:224— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: prefills a custom MCP reconnect from the stored transport URL ui/src/pages/apps/AppNotConnected.test.tsx:375— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 1 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: inline aggregator reuses an eligible account without changing its access ui/src/pages/apps/AppsConnect.test.tsx:677— This test sets up 4 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: reuses saved Composio accounts for a targeted app setup URL ui/src/pages/apps/AppsConnect.test.tsx:785— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: returns completed Arcade gateway setup to Apps without creating an agent task ui/src/pages/apps/AppsConnect.test.tsx:810— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: binds OAuth to the task even when setup resumes in the page host ui/src/pages/apps/AppsConnect.test.tsx:1667— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: revalidates a cached pending enrollment before continuing (expiry %s) ui/src/pages/apps/AppsConnect.test.tsx:1678— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
+ 101 more in this group — see findings.md.
P2 · Observability· Console output used as the logging channel · ×39
Console output used as the logging channel packages/db/src/backup.ts:74— `packages/db/src/backup.ts` reports through `console.*` at line 74 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/db/src/backup.ts:75— `packages/db/src/backup.ts` reports through `console.*` at line 75 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/db/src/backup.ts:76— `packages/db/src/backup.ts` reports through `console.*` at line 76 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/db/src/backup.ts:86— `packages/db/src/backup.ts` reports through `console.*` at line 86 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/db/src/backup.ts:88— `packages/db/src/backup.ts` reports through `console.*` at line 88 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/db/src/backup.ts:90— `packages/db/src/backup.ts` reports through `console.*` at line 90 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/db/src/backup.ts:92— `packages/db/src/backup.ts` reports through `console.*` at line 92 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/db/src/migrate.ts:7— `packages/db/src/migrate.ts` reports through `console.*` at line 7 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/db/src/migrate.ts:12— `packages/db/src/migrate.ts` reports through `console.*` at line 12 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/db/src/migrate.ts:16— `packages/db/src/migrate.ts` reports through `console.*` at line 16 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/db/src/migrate.ts:23— `packages/db/src/migrate.ts` reports through `console.*` at line 23 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/db/src/response-capture.ts:153— `packages/db/src/response-capture.ts` reports through `console.*` at line 153 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/db/src/test-embedded-postgres.ts:453— `packages/db/src/test-embedded-postgres.ts` reports through `console.*` at line 453 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/db/src/test-embedded-postgres.ts:692— `packages/db/src/test-embedded-postgres.ts` reports through `console.*` at line 692 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/db/src/__fixtures__/postgres-connection-recovery.mjs:118— `packages/db/src/__fixtures__/postgres-connection-recovery.mjs` reports through `console.*` at line 118 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/plugins/sandbox-providers/daytona/src/file-sync.ts:946— `packages/plugins/sandbox-providers/daytona/src/file-sync.ts` reports through `console.*` at line 946 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/plugins/sandbox-providers/daytona/src/plugin.ts:494— `packages/plugins/sandbox-providers/daytona/src/plugin.ts` reports through `console.*` at line 494 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/plugins/sandbox-providers/daytona/src/plugin.ts:1775— `packages/plugins/sandbox-providers/daytona/src/plugin.ts` reports through `console.*` at line 1775 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/plugins/sandbox-providers/daytona/src/plugin.ts:2929— `packages/plugins/sandbox-providers/daytona/src/plugin.ts` reports through `console.*` at line 2929 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/plugins/sandbox-providers/daytona/src/plugin.ts:2948— `packages/plugins/sandbox-providers/daytona/src/plugin.ts` reports through `console.*` at line 2948 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/plugins/sandbox-providers/e2b/src/plugin.ts:195— `packages/plugins/sandbox-providers/e2b/src/plugin.ts` reports through `console.*` at line 195 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/plugins/sandbox-providers/e2b/src/plugin.ts:208— `packages/plugins/sandbox-providers/e2b/src/plugin.ts` reports through `console.*` at line 208 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/plugins/sandbox-providers/kubernetes/src/plugin.ts:319— `packages/plugins/sandbox-providers/kubernetes/src/plugin.ts` reports through `console.*` at line 319 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/plugins/sandbox-providers/kubernetes/src/plugin.ts:323— `packages/plugins/sandbox-providers/kubernetes/src/plugin.ts` reports through `console.*` at line 323 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel packages/plugins/sandbox-providers/modal/src/plugin.ts:177— `packages/plugins/sandbox-providers/modal/src/plugin.ts` reports through `console.*` at line 177 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Silent fallback default in catch cli/src/config/env.ts:23— `parseEnvFile` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch cli/src/commands/heartbeat-run.ts:51— `asErrorText` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch REDACTED:500— `resolvePathValue` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch REDACTED:3806— `listPaperclipSkillEntries` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch REDACTED:4680— `removeMaintainerOnlySkillSymlinks` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapter-utils/src/billing.ts:24— `inferOpenAiCompatibleBiller` swallows every exception into `return "unknown"` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/claude-local/src/cli/format-event.ts:16— `asErrorText` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/claude-local/src/ui/parse-stdout.ts:25— `errorText` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/codex-local/src/cli/format-event.ts:29— `errorText` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/codex-local/src/server/quota.ts:269— `readResponseTextPrefix` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/codex-local/src/ui/parse-stdout.ts:37— `errorText` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/cursor-local/src/server/parse.ts:26— `asErrorText` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/gemini-local/src/cli/format-event.ts:39— `errorText` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/gemini-local/src/server/parse.ts:48— `asErrorText` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/gemini-local/src/ui/parse-stdout.ts:47— `errorText` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/grok-local/src/server/parse.ts:28— `errorText` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/hermes/src/gateway/server/execute.ts:302— `parseHeaders` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/kimi-local/src/server/parse.ts:49— `errorText` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/opencode-local/src/cli/format-event.ts:37— `errorText` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/opencode-local/src/server/parse.ts:17— `errorText` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/opencode-local/src/server/models.ts:359— `listOpenCodeModels` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/opencode-local/src/server/runtime-config.ts:102— `readJsonObject` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/opencode-local/src/ui/parse-stdout.ts:37— `errorText` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch packages/adapters/pi-local/src/server/models.ts:202— `listPiModels` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Silent fallback default in catch REDACTED:362— `listJournalMigrationEntries` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Interpolated log message defeats structured logging REDACTED:1320— `error` at line 1320 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:313— `warn` at line 313 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:323— `warn` at line 323 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:335— `info` at line 335 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:356— `info` at line 356 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:563— `warn` at line 563 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:575— `warn` at line 575 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:581— `warn` at line 581 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:584— `info` at line 584 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:608— `info` at line 608 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:881— `info` at line 881 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:907— `info` at line 907 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:921— `error` at line 921 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:985— `warn` at line 985 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:1055— `info` at line 1055 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:2039— `info` at line 2039 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging REDACTED:2049— `info` at line 2049 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging server/src/services/external-objects.ts:593— `warn` at line 593 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging server/src/services/plugin-host-services.ts:1821— `error` at line 1821 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging server/src/services/plugin-host-services.ts:1822— `warn` at line 1822 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging server/src/services/plugin-host-services.ts:1823— `debug` at line 1823 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging server/src/services/plugin-host-services.ts:1824— `info` at line 1824 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging server/src/services/plugin-lifecycle.ts:366— `info` at line 366 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging server/src/services/plugin-lifecycle.ts:569— `info` at line 569 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging server/src/services/plugin-tool-registry.ts:332— `info` at line 332 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Duplicated predicate ui/src/components/IssuesList.tsx:627— `!!costSummary && (costSummary.runCount > 0 || totalTokens > 0)` appears character-identically in 2 files — ui/src/components/IssuesList.tsx, ui/src/components/LegacyIssuesList.tsx. 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 ui/src/pages/AgentDetail.production.tsx:899— `!!resolvedCompanyId && !!agent?.id && shouldLoadHeartbeats` appears character-identically in 2 files — ui/src/pages/AgentDetail.production.tsx, ui/src/pages/AgentDetail.tsx. 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 ui/src/pages/AgentDetail.production.tsx:825— `!!resolvedCompanyId && builtInAgentsEnabled` appears character-identically in 2 files — ui/src/pages/AgentDetail.production.tsx, ui/src/pages/AgentDetail.tsx. 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 server/src/services/heartbeat.ts:1825— `!!run.processGroupId && isProcessGroupAlive(run.processGroupId)` appears character-identically in 2 files — server/src/services/heartbeat.ts, server/src/services/heartbeat/recovery.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 server/src/services/heartbeat.ts:1823— `!!run.processPid && isProcessAlive(run.processPid)` appears character-identically in 2 files — server/src/services/heartbeat.ts, server/src/services/heartbeat/recovery.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 ui/src/pages/RoutineDetail.production.tsx:232— `!!selectedCompanyId && !!routineId && !!routine` appears character-identically in 2 files — ui/src/pages/RoutineDetail.production.tsx, ui/src/pages/RoutineDetail.tsx. 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 ui/src/components/SidebarAgents.production.tsx:325— `!!selectedCompanyId && builtInAgentsEnabled` appears character-identically in 4 files — ui/src/components/SidebarAgents.production.tsx, ui/src/components/SidebarAgents.tsx, ui/src/pages/Agents.production.tsx, ui/src/pages/Agents.tsx. 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 ui/src/pages/Agents.production.tsx:220— `!!selectedCompanyId && effectiveView === "org"` appears character-identically in 2 files — ui/src/pages/Agents.production.tsx, ui/src/pages/Agents.tsx. 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 ui/src/components/ProjectProperties.tsx:270— `!!selectedCompanyId && environmentsEnabled` appears character-identically in 3 files — ui/src/components/ProjectProperties.tsx, ui/src/pages/Agents.production.tsx, ui/src/pages/Agents.tsx. 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 ui/src/components/IssuesList.tsx:970— `!!selectedCompanyId && isolatedWorkspacesEnabled` appears character-identically in 4 files — ui/src/components/IssuesList.tsx, ui/src/components/LegacyIssuesList.tsx, ui/src/pages/Inbox.tsx, ui/src/pages/LegacyInbox.tsx. 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 ui/src/components/IssuesList.tsx:935— `!!selectedCompanyId && normalizedIssueSearch.length > 0 && !searchWithinLoadedIssues` appears character-identically in 2 files — ui/src/components/IssuesList.tsx, ui/src/components/LegacyIssuesList.tsx. 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 ui/src/pages/Inbox.tsx:1123— `!!selectedCompanyId && normalizedSearchQuery.length > 0` appears character-identically in 2 files — ui/src/pages/Inbox.tsx, ui/src/pages/LegacyInbox.tsx. 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 ui/src/components/IssuesList.tsx:961— `!!selectedCompanyId && viewState.viewMode === "board" && !searchWithinLoadedIssues` appears character-identically in 2 files — ui/src/components/IssuesList.tsx, ui/src/components/LegacyIssuesList.tsx. 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 ui/src/pages/AgentDetail.production.tsx:1657— `!!snapshotIssueId && !issuesById.has(snapshotIssueId)` appears character-identically in 2 files — ui/src/pages/AgentDetail.production.tsx, ui/src/pages/AgentDetail.tsx. 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 packages/shared/src/external-objects-server.ts:80— `!".,!?;:".includes(last) && last !== ")" && last !== "]"` appears character-identically in 2 files — packages/shared/src/external-objects-server.ts, packages/shared/src/issue-references.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 ui/src/pages/audit/AuditFeed.production.tsx:334— `!(error instanceof ApiError && error.status === 403) && count < 2` appears character-identically in 2 files — ui/src/pages/audit/AuditFeed.production.tsx, ui/src/pages/audit/AuditFeed.tsx. 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 ui/src/components/IssuesList.tsx:1490— `!(target instanceof HTMLElement) || isKeyboardShortcutTextInputTarget(target) || hasBlockingShortcutDialog(document) || e.metaKey || e.ctrlK…` appears character-identically in 4 files — ui/src/components/IssuesList.tsx, ui/src/components/LegacyIssuesList.tsx, ui/src/pages/Inbox.tsx, ui/src/pages/LegacyInbox.tsx. 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 server/src/realtime/runner-prp-outbound.ts:113— `!/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(header.name) || !header.value` appears character-identically in 2 files — server/src/realtime/runner-prp-outbound.ts, server/src/services/environment-runtime.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 ui/src/lib/case-reference.ts:64— `!Array.isArray(node.children) || node.children.length === 0` appears character-identically in 3 files — ui/src/lib/case-reference.ts, ui/src/lib/issue-reference.ts, ui/src/lib/remark-workspace-file-refs.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 packages/paperclip-runner/src/conformance/semantic-conformance.ts:304— `!Array.isArray(value) && prototype !== Object.prototype && prototype !== null` appears character-identically in 2 files — packages/paperclip-runner/src/conformance/semantic-conformance.ts, REDACTED. 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 packages/paperclip-runner/src/drivers/acpx/cursor-usage-notice.ts:65— `!Array.isArray(values) || values.length < 1 || values.length > 8 || (group < details.length - 1 && values.length !== 8)` appears character-identically in 2 files — packages/paperclip-runner/src/drivers/acpx/cursor-usage-notice.ts, packages/paperclip-runner/src/live/cursor-usage-notice.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 packages/paperclip-runner/src/drivers/acpx/cursor-usage-notice.ts:76— `!COUNTERS.has(key) || !Number.isSafeInteger(number) || Number(number) < 0` appears character-identically in 2 files — packages/paperclip-runner/src/drivers/acpx/cursor-usage-notice.ts, packages/paperclip-runner/src/live/cursor-usage-notice.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 packages/paperclip-runner/src/live/live-session.ts:2163— `!Number.isFinite(maxSessionListCostUsd) || maxSessionListCostUsd <= 0` appears character-identically in 2 files — packages/paperclip-runner/src/live/live-session.ts, server/src/services/native-runtime/provider-profile.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 REDACTED:337— `!Number.isFinite(numeric) || (validation.inputType === "integer" && !Number.isInteger(numeric))` appears character-identically in 3 files — REDACTED, REDACTED, ui/src/components/task-chat/QuestionForm.tsx. 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 packages/shared/src/telemetry/client.ts:55— `!Number.isFinite(seconds) || seconds < 0` appears character-identically in 2 files — packages/shared/src/telemetry/client.ts, ui/src/lib/issue-output.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.
Hand-rolled JSON/XML parsing via regex ui/src/lib/run-log-chunks.ts:142— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex server/src/services/chat-publication-projection.ts:23— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex server/src/services/chat-publication-projection.ts:24— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex server/src/services/chat-publication-projection.ts:25— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex server/src/services/chat-publication-projection.ts:26— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex server/src/services/documents.ts:36— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex server/src/services/native-runtime/native-session-executor.ts:1160— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex packages/paperclip-runner/scripts/capability-aws-agentcore-smoke.mjs:120— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Orphaned file packages/db/scripts/clean-poisoned-claude-sessions.ts: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 packages/plugins/sandbox-providers/novita/src/plugin.ts: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 server/src/services/adapter-plugin-store.ts: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 ui/src/components/ReportsToPicker.tsx: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 ui/src/hooks/useDateRange.ts: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 ui/src/adapters/metadata.ts: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 packages/plugins/sandbox-providers/novita/src/manifest.ts: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.
No app-layer HTTPS enforcement detected docker/openclaw-smoke/server.mjs:100— `server.listen(…)` serves plain HTTP on a network address, and nothing in its package enforces HTTPS: no TLS served (`https.createServer`, Fastify `https`, Nest `httpsOptions`), no redirect of plain requests to `https://`, no `Strict-Transport-Security` (helmet sends it by default), and no TLS-terminating proxy configuration committed beside it — so a browser may talk to it in clear text. (−2.0 on this card.)
No app-layer HTTPS enforcement detected packages/adapter-utils/src/local-process-sandbox.ts:299— `server.listen(…)` serves plain HTTP on a network address, and nothing in its package enforces HTTPS: no TLS served (`https.createServer`, Fastify `https`, Nest `httpsOptions`), no redirect of plain requests to `https://`, no `Strict-Transport-Security` (helmet sends it by default), and no TLS-terminating proxy configuration committed beside it — so a browser may talk to it in clear text. (−2.0 on this card.)
No app-layer HTTPS enforcement detected REDACTED:1162— `server.listen(…)` serves plain HTTP on a network address, and nothing in its package enforces HTTPS: no TLS served (`https.createServer`, Fastify `https`, Nest `httpsOptions`), no redirect of plain requests to `https://`, no `Strict-Transport-Security` (helmet sends it by default), and no TLS-terminating proxy configuration committed beside it — so a browser may talk to it in clear text. (−2.0 on this card.)
No app-layer HTTPS enforcement detected packages/google-sheets-mcp-server/src/http.ts:118— `server.listen(…)` serves plain HTTP on a network address, and nothing in its package enforces HTTPS: no TLS served (`https.createServer`, Fastify `https`, Nest `httpsOptions`), no redirect of plain requests to `https://`, no `Strict-Transport-Security` (helmet sends it by default), and no TLS-terminating proxy configuration committed beside it — so a browser may talk to it in clear text. (−2.0 on this card.)
No app-layer HTTPS enforcement detected REDACTED:190— `server.listen(…)` serves plain HTTP on a network address, and nothing in its package enforces HTTPS: no TLS served (`https.createServer`, Fastify `https`, Nest `httpsOptions`), no redirect of plain requests to `https://`, no `Strict-Transport-Security` (helmet sends it by default), and no TLS-terminating proxy configuration committed beside it — so a browser may talk to it in clear text. (−2.0 on this card.)
No app-layer HTTPS enforcement detected scripts/serve-storybook-static.mjs:92— `server.listen(…)` serves plain HTTP on a network address, and nothing in its package enforces HTTPS: no TLS served (`https.createServer`, Fastify `https`, Nest `httpsOptions`), no redirect of plain requests to `https://`, no `Strict-Transport-Security` (helmet sends it by default), and no TLS-terminating proxy configuration committed beside it — so a browser may talk to it in clear text. (−2.0 on this card.)
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 461 significant file(s) lose their only recent owner: packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs, packages/plugins/plugin-llm-wiki/src/wiki/core.ts, packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs, cli/src/commands/worktree.ts, packages/paperclip-runner/runner/crates/runner-core/src/managed_provider_backend.rs, packages/paperclip-runner/runner/crates/runner-core/src/aws_agentcore_provider.rs, ui/src/pages/Inbox.tsx, server/src/services/chat-sdk-runtime.ts (+453 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 30 significant file(s) lose their only recent owner: server/src/services/chat-control-recovery-stop.ts, packages/plugins/sandbox-providers/cloudflare/bridge-template/src/routes.ts, packages/plugins/paperclip-plugin-fake-sandbox/src/plugin.ts, packages/adapter-utils/src/workspace-restore-diagnostics.ts, packages/shared/src/portability-zip.ts, packages/plugins/sandbox-providers/cloudflare/src/plugin.ts, ui/src/lib/angle-bracket-markdown.ts, ui/src/lib/sentry.ts (+22 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 19 significant file(s) lose their only recent owner: packages/adapter-utils/src/http2-bridge-server.ts, packages/db/src/check-migration-safety.ts, server/src/services/setup-token-transport-binding.ts, packages/adapters/grok-local/src/server/adapter-auth-promotion.ts, packages/plugins/sandbox-providers/daytona/src/login-pty.ts, packages/adapter-utils/src/duplex-observability.ts, packages/plugins/sandbox-providers/daytona/src/duplex-command-stream.ts, server/src/modules/wake-queue/application/queued-comment-use-cases.ts (+11 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 6 significant file(s) lose their only recent owner: ui/src/connect-flow-preview-main.tsx, ui/src/components/onboarding/onboarding-motion.ts, ui/src/components/PaperclipLockup.tsx, ui/src/components/onboarding/ModelSourceTiles.tsx, ui/src/components/onboarding/Stepper.tsx, ui/src/components/onboarding/FooterNav.tsx. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 4 significant file(s) lose their only recent owner: ui/src/components/task-chat/task-chat-fixtures.ts, ui/src/pages/TaskChatLab.tsx, ui/src/components/DocumentAnnotationPopover.tsx, ui/src/components/task-chat/TaskChatDescriptionBubble.tsx. Pair on, review, or document these before any departure.
Fat interface: WakeQueueTransaction (19 required operations) server/src/modules/wake-queue/application/ports.ts:111— `WakeQueueTransaction` declares 19 required operations: `findInvokableAgent`, `findNextDeferredWake`, `getQueuedCommentLiveness`, `cancelDeferredWake`, `normalizeDeferredWakeCommentIds`, `failDeferredWake`, `getPauseHoldFacts`, `getCommentSelfAuthorship`, `isCompletedDelegationMention`, `reopenIssue`, `isCompletedOnboardingHandoffWake`, `claimDeferredWakeForPromotion`, `finalizePromotedWake`, `hasExistingExecutionPath`, `hasExplicitBlockerPath`, `isAutomaticRecoverySuppressedByPauseHold`, `isImmediateRecoverySourceBlocked`, `queueReviewParticipantRecoveryRun`, `queueImmediateRecoveryRun`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: HeartbeatRecoveryDependencies (16 required operations) server/src/services/heartbeat/recovery.ts:97— `HeartbeatRecoveryDependencies` declares 16 required operations: `enterShutdown`, `getRun`, `executeRun`, `scheduleNativeSessionResumeDispatch`, `cancelHeartbeatNativeRun`, `terminateHeartbeatRunProcess`, `setRunStatus`, `setRunStatusFromLive`, `mergeRunStopMetadataForAgent`, `classifyAndPersistRunLiveness`, `releaseEnvironmentLeasesForRun`, `acknowledgeRemoteStop`, `resumeRemoteStopComments`, `dispatchPendingNativeStatusWakeups`, `cancelRunInternal`, `startNextQueuedRunForAgent`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: HeartbeatQueueDependencies (16 required operations) server/src/services/heartbeat/queue.ts:179— `HeartbeatQueueDependencies` declares 16 required operations: `isHeartbeatRunTerminalStatus`, `isSameTaskScope`, `runTaskKey`, `filterZombieCoalesceTarget`, `getSchedulingSuppression`, `canStartNewExternalBotWork`, `executeRun`, `releaseIssueExecutionAndPromote`, `applyWakeQueuePostCommitEffects`, `publishRunLifecyclePluginEvent`, `cancelRunInternal`, `cancelActiveForAgentInternal`, `resumeExecutionWaitComments`, `resumeQueuedCommentInterrupt`, `resumeSavedLegacyComments`, `formatIssueIdentifierLink`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: PluginIssuesClient (19 required operations) packages/plugins/sdk/src/types.ts:1462— `PluginIssuesClient` declares 19 required operations: `list`, `get`, `create`, `update`, `assertCheckoutOwner`, `getSubtree`, `requestWakeup`, `requestWakeups`, `listComments`, `createComment`, `createInteraction`, `suggestTasks`, `askUserQuestions`, `requestConfirmation`, `requestCheckboxConfirmation`, `listInteractions`, `respondInteraction`, `listAttachments`, `getAttachmentContent`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Silent fallback default on parse failure server/src/services/scripts/v7/client.py:140— `input_uuid` returns `False` when `(ValueError, TypeError, AttributeError)` 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.
Silent fallback default on parse failure server/src/services/scripts/v8/client.py:140— `input_uuid` returns `False` when `(ValueError, TypeError, AttributeError)` 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.
Silent fallback default on parse failure server/src/services/scripts/v9/client.py:156— `input_uuid` returns `False` when `(ValueError, TypeError, AttributeError)` 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 packages/paperclip-runner/src/drivers/codex/codex-thread-normalization.ts:191— `path.startsWith("//")` can never decide this `||` — every value satisfying `path.startsWith("//")` also satisfies `path.startsWith("/")`, 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.
Subsumed condition operand packages/paperclip-runner/src/drivers/codex/codex-turn-diff.ts:64— `candidate.startsWith("//")` can never decide this `||` — every value satisfying `candidate.startsWith("//")` also satisfies `candidate.startsWith("/")`, 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.
Subsumed condition operand cli/src/commands/run.ts:194— `normalized.endsWith("@paperclipai/REDACTED")` can never decide this `||` — every value satisfying `normalized.endsWith("@paperclipai/REDACTED")` also satisfies `normalized.endsWith("/REDACTED")`, 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.
C2 · Access Controls· No named authorization policies · ×1
No named authorization policies — Authorization IS enforced here (by route guards, auth middleware or checks that refuse a caller) — this is NOT a claim that endpoints are unprotected. What's missing is a NAMED rule set: who may do what is encoded inline where it is checked, so the rules can't be listed, reviewed or tested apart from the code that applies them. Recommendation, not a defect.
Partial audit-trail evidence — An audit mechanism is present, but the trail is not yet complete — missing: an ORM write hook every change flows through (a TypeORM/MikroORM subscriber, a Sequelize or Mongoose hook, Prisma middleware or a query extension, or an event-store append), per-model coverage (@Audited, or a change-history plugin such as mongoose-history or sequelize-paper-trail applied to each model).
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 3 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 (524 single-owned of 3000 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; 3000 of the 4530 production source files in this repository met that bar). They are anonymized user #6 (2 file(s)), anonymized user #7 (1 file(s)), anonymized user #8 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: packages/plugins/sandbox-providers/kubernetes/src/sandbox-cr-orchestrator.ts, server/src/middleware/trust-proxy.ts, server/src/services/connector-telemetry.ts, ui/src/components/ReportsToPicker.tsx.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 10 of 42 project(s) overshoot their size bounds, lowering Project Cohesion to 5.2/10. The most over is `server` (542261 LoC, 2418 module-visible types across 81 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.
D28 · Secrets (history)· Rotate the exposed credentials · ×1
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 7 of 3000 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (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; 3000 of the 4530 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: packages/db/scripts/clean-poisoned-claude-sessions.ts, packages/plugins/sandbox-providers/novita/src/plugin.ts, server/src/services/adapter-plugin-store.ts, ui/src/components/ReportsToPicker.tsx, ui/src/hooks/useDateRange.ts, packages/plugins/sandbox-providers/novita/src/manifest.ts, ui/src/adapters/metadata.ts. 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.
Classify ADR enforcement: ADR 0001: Runner, Testing, and Eval Package Boundaries packages/paperclip-runner/docs/adr/0001-runner-testing-eval-package-boundaries.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Logging is not universal — Only 19/29 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `.`, `packages/adapter-utils`, `packages/google-sheets-mcp-server`, `packages/kv-demo-mcp-server` and 5 more.
R8 · Dependency Hygiene· Type-only dependency 'json-schema-to-ts' in production deps · ×1
Type-only dependency 'json-schema-to-ts' in production deps packages/paperclip-runner/src/protocol/replay-contract.ts:2— Every import is type-only — move it to devDependencies.
X2 · Cancellation propagation· Not all async functions that make a request accept an AbortSignal · ×1
Not all async functions that make a request accept an AbortSignal — Only 121/162 async functions that make a cancellable request (fetch, axios, ky, ofetch) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
Null assertions (`!`) reduce the strict null checking score — ~4.0 `!` null assertions per 1k TypeScript source lines — 5195 assertion(s) across the 1298419 source line(s) of the 4409 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: ui/src/pages/IssueDetail.tsx (119), ui/src/pages/CompanySkills.production.tsx (94), ui/src/pages/CompanySkills.tsx (94). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
Skipped (documented): (unnamed test) ui/src/pages/CompanyEnvironments.test.tsx:97— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) tests/runner-e2e/copilot-local-process-observer.test.ts:16— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/feedback-shutdown-process.test.ts:12— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/installed-cli.test.ts:100— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/installed-cli.test.ts:169— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/installed-cli.test.ts:179— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/installed-cli.test.ts:194— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/installed-cli.test.ts:200— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/installed-daytona-plugin.test.ts:79— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/process-tree-owner.test.ts:20— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/process-tree-owner.test.ts:30— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/process-tree-owner.test.ts:41— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/process-tree-owner.test.ts:53— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/process-tree-owner.test.ts:66— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/process-tree-owner.test.ts:76— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/process-tree-owner.test.ts:86— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/process-tree-owner.test.ts:97— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/process-tree-owner.test.ts:109— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/process-tree-owner.test.ts:124— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/process-tree-owner.test.ts:153— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/process-tree-owner.test.ts:165— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/remote-native-fixtures.test.ts:431— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) tests/runner-e2e/server-restart-preservation-process.test.ts:12— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/server-restart-preservation.test.ts:48— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/runner-e2e/server-restart-preservation.test.ts:67— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Outdated: aws-config — `aws-config` is locked at 1.11.0 but 1.13.0 is the current stable release on crates.io, and it already satisfies the `"1.11"` requirement declared in packages/paperclip-runner/runner/crates/runner-core/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-sdk-bedrockagentcore — `aws-sdk-bedrockagentcore` is locked at 1.65.0 but 1.80.0 is the current stable release on crates.io, and it already satisfies the `"1.63"` requirement declared in packages/paperclip-runner/runner/crates/runner-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-sdk-bedrockagentcore` and commit the updated REDACTED.
Outdated: aws-sdk-s3 — `aws-sdk-s3` is locked at 1.144.0 but 1.155.0 is the current stable release on crates.io, and it already satisfies the `"1.112"` requirement declared in packages/paperclip-runner/runner/crates/runner-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-sdk-s3` and commit the updated REDACTED.
Outdated: aws-sdk-sts — `aws-sdk-sts` is locked at 1.113.0 but 1.122.0 is the current stable release on crates.io, and it already satisfies the `"1.112"` requirement declared in packages/paperclip-runner/runner/crates/runner-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-sdk-sts` and commit the updated REDACTED.
Outdated: aws-smithy-types — `aws-smithy-types` is locked at 1.6.2 but 1.9.0 is the current stable release on crates.io, and it already satisfies the `"1.6"` requirement declared in packages/paperclip-runner/runner/crates/runner-core/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.5.0 but 1.7.0 is the current stable release on crates.io, and it already satisfies the `"1.3"` requirement declared in packages/paperclip-runner/runner/crates/runner-core/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: notify — `notify` is locked at 8.2.0 but 8.2.1 is the current stable release on crates.io, and it already satisfies the `"8.2"` requirement declared in packages/paperclip-runner/runner/crates/runner-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p notify` and commit the updated REDACTED.
Outdated: rustix — `rustix` is locked at 1.1.4 but 1.1.5 is the current stable release on crates.io, and it already satisfies the `"1.1"` requirement declared in packages/paperclip-runner/runner/crates/runner-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rustix` and commit the updated REDACTED.
Outdated: rustls — `rustls` is locked at 0.23.45 but 0.23.46 is the current stable release on crates.io, and it already satisfies the `"0.23"` requirement declared in packages/paperclip-runner/runner/crates/runner-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rustls` and commit the updated REDACTED.
Outdated: rustls-native-certs — `rustls-native-certs` is locked at 0.8.4 but 0.8.5 is the current stable release on crates.io, and it already satisfies the `"0.8"` requirement declared in packages/paperclip-runner/runner/crates/runner-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rustls-native-certs` and commit the updated REDACTED.
Outdated: serde_json — `serde_json` is locked at 1.0.151 but 1.0.154 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in packages/paperclip-runner/runner/crates/runner-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde_json` and commit the updated REDACTED.
Outdated: tokio — `tokio` is locked at 1.53.1 but 1.54.1 is the current stable release on crates.io, and it already satisfies the `"1.50"` requirement declared in packages/paperclip-runner/runner/crates/runner-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tokio` and commit the updated REDACTED.
Outdated: uuid — `uuid` is locked at 1.26.0 but 1.29.0 is the current stable release on crates.io, and it already satisfies the `"1.22"` requirement declared in packages/paperclip-runner/runner/crates/runner-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p uuid` and commit the updated REDACTED.
Off the main sequence: @paperclipai/shared — @paperclipai/shared: abstractness 0.00, instability 0.00, distance 1.00 — 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. semgrep could not parse 451 file(s) — `.agents/skills/pr-gardening/scripts/lib.mjs`, `.github/scripts/check-pr-linked-issue.mjs`, `packages/adapter-utils/src/acpx-engine/run-contracts.ts`, `packages/adapter-utils/src/paperclip-runner-permissions.ts`, `REDACTED`, … (+446 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
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 01a178d0-d80f-7179-8242-6ffa25bdc37a · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 261 · Warnings: 9530 · Recommendations: 328 · Info: 193 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 26-10-2026 @ 15:25 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.