Public report of danny-avila/LibreChat, 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, 18:36 UTC · Survey ID cd_c26927d1c2d34ad888547b39de3eb65e
danny-avila/LibreChat
Measured 26 October 2026, 18:07 UTC, at code version a378657
Regression: 1 dimension fell since the last survey
A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.
CAI scoreAdequate
CriticalWeakAdequateStrongExemplary
No change 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: 749,440 lines of product code in 9 projects, tests not counted · Estimated rebuild effort: about 13.4 person-years · Weakest lens: Production Readiness, 36
Findings by how serious they are
396 critical5562 serious1646 minor
8 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, 18:07 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.
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 ▸
99of 99 dimensions measured by tools.
7561of 7604 findings point to an exact file and line, so you can open each one in the code. The other 43 concern the repository as a whole, such as missing documentation.
99dimensions across 8 lenses, read from 749,440 lines of product code in 9 projects.
danny-avila/LibreChat falls short of our standard for a preview release because we found no automated security scanning of the code, its secrets or its dependencies, and it has uses of packages that aren't listed. It scores 48 out of 100 and is rated Adequate, and 332 of its 396 critical findings are security problems.
Production Readiness, at 36, is the weakest lens and counts most in the score. The best first steps are fixing the password or key in the code and replacing the two packages under a banned licence, each worth about 9 points. Raising Production Readiness to 62 would lift the score to about 57.
231 pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Fifty-five weaknesses in the code could be used by an attacker, and fourteen secrets can leak from the build pipeline. Pinning each tool to an exact version, fixing the weaknesses the scanner points to and limiting each secret to its own step would close these risks. Correcting the flagged pipeline settings would fix the five weaknesses in the build pipeline's configuration, and the four places where the code runs text as code or as a command need a direct call instead. The 22 uses of packages that aren't listed need adding to the project's list of dependencies.
The product code is 749,440 lines, about €1,900,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 Production Readiness rose from 36 to 62, the lowest score rated Strong, the score would rise from 48 to about 57.
Code composition: what the lines of code are
Product code 41%Tests 59%
New since the last survey: 1408 findings
These 1408 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: 2261 findings
These 2261 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.
€650,000 to €3,200,000, for 10,753 to 34,114 hours of work, about 13.4 person-years for 7 to 26 engineers
Difficulty of the problem
Standard, 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 48. 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: 749,440 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 1 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED.
Add a SAST step to CI running what this repository's stack ships: CodeQL's javascript-typescript pack, `semgrep --config=p/typescript`, or eslint-plugin-security — so a security regression fails the build instead of landing.
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 €1,900,000 to build again, about 13.4 person-years of work. Its weakest lens is Production Readiness, at 36 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 1 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 9 points for low effort, because it clears the 1 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 5.9 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 5% to 12% on every change. The history of the code shows how much it changes: about 1,672,368 lines over the last 90 days, which is about 6,782,381 lines a year. At that pace, the extra work comes to an estimated 901.7 to 5410 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.
1785 modules, with 1981 dependencies between them. Every module uses only modules listed above it, so there are no loops.
The table shows the 40 modules with the most connections; 1745 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.
client.src.components.Chat.Messages.Content uses packages.data-provider.src.schemas, so a change to packages.data-provider.src.schemas can break client.src.components.Chat.Messages.Content, while a change to client.src.components.Chat.Messages.Content can't break packages.data-provider.src.schemas.
Position
Below the diagonal: client.src.components.Chat.Messages.Content uses a module listed above it, which is the healthy direction.
client.src.components.Chat.Messages.Content uses packages.data-provider.src.types.agents, so a change to packages.data-provider.src.types.agents can break client.src.components.Chat.Messages.Content, while a change to client.src.components.Chat.Messages.Content can't break packages.data-provider.src.types.agents.
Position
Below the diagonal: client.src.components.Chat.Messages.Content uses a module listed above it, which is the healthy direction.
client.src.components.Chat.Messages.Content.Parts uses client.src.hooks.useLocalize, so a change to client.src.hooks.useLocalize can break client.src.components.Chat.Messages.Content.Parts, while a change to client.src.components.Chat.Messages.Content.Parts can't break client.src.hooks.useLocalize.
Position
Below the diagonal: client.src.components.Chat.Messages.Content.Parts uses a module listed above it, which is the healthy direction.
client.src.components.Chat.Messages.Content.Parts uses packages.data-provider.src.schemas, so a change to packages.data-provider.src.schemas can break client.src.components.Chat.Messages.Content.Parts, while a change to client.src.components.Chat.Messages.Content.Parts can't break packages.data-provider.src.schemas.
Position
Below the diagonal: client.src.components.Chat.Messages.Content.Parts uses a module listed above it, which is the healthy direction.
client.src.components.SidePanel.Agents.Tools.items.types uses client.src.common.types, so a change to client.src.common.types can break client.src.components.SidePanel.Agents.Tools.items.types, while a change to client.src.components.SidePanel.Agents.Tools.items.types can't break client.src.common.types.
Position
Below the diagonal: client.src.components.SidePanel.Agents.Tools.items.types uses a module listed above it, which is the healthy direction.
client.src.hooks.Input uses packages.data-provider.src.types.agents, so a change to packages.data-provider.src.types.agents can break client.src.hooks.Input, while a change to client.src.hooks.Input can't break packages.data-provider.src.types.agents.
Position
Below the diagonal: client.src.hooks.Input uses a module listed above it, which is the healthy direction.
client.src.utils uses client.src.hooks.useLocalize, so a change to client.src.hooks.useLocalize can break client.src.utils, while a change to client.src.utils can't break client.src.hooks.useLocalize.
Position
Below the diagonal: client.src.utils uses a module listed above it, which is the healthy direction.
client.src.utils uses packages.data-provider.src.accessPermissions, so a change to packages.data-provider.src.accessPermissions can break client.src.utils, while a change to client.src.utils can't break packages.data-provider.src.accessPermissions.
Position
Below the diagonal: client.src.utils uses a module listed above it, which is the healthy direction.
client.src.utils uses packages.data-provider.src.schemas, so a change to packages.data-provider.src.schemas can break client.src.utils, while a change to client.src.utils can't break packages.data-provider.src.schemas.
Position
Below the diagonal: client.src.utils uses a module listed above it, which is the healthy direction.
client.src.utils uses packages.data-provider.src.types, so a change to packages.data-provider.src.types can break client.src.utils, while a change to client.src.utils can't break packages.data-provider.src.types.
Position
Below the diagonal: client.src.utils uses a module listed above it, which is the healthy direction.
client.src.utils uses packages.data-provider.src.types.agents, so a change to packages.data-provider.src.types.agents can break client.src.utils, while a change to client.src.utils can't break packages.data-provider.src.types.agents.
Position
Below the diagonal: client.src.utils uses a module listed above it, which is the healthy direction.
packages.api.src.agents.files uses packages.api.src.agents.execution, so a change to packages.api.src.agents.execution can break packages.api.src.agents.files, while a change to packages.api.src.agents.files can't break packages.api.src.agents.execution.
Position
Below the diagonal: packages.api.src.agents.files uses a module listed above it, which is the healthy direction.
packages.api.src.agents.hitl uses packages.api.src.agents.openai.service, so a change to packages.api.src.agents.openai.service can break packages.api.src.agents.hitl, while a change to packages.api.src.agents.hitl can't break packages.api.src.agents.openai.service.
Position
Below the diagonal: packages.api.src.agents.hitl uses a module listed above it, which is the healthy direction.
packages.api.src.agents.hitl uses packages.data-provider.src.types.agents, so a change to packages.data-provider.src.types.agents can break packages.api.src.agents.hitl, while a change to packages.api.src.agents.hitl can't break packages.data-provider.src.types.agents.
Position
Below the diagonal: packages.api.src.agents.hitl uses a module listed above it, which is the healthy direction.
packages.api.src.mcp.types uses packages.data-schemas.src.types.user, so a change to packages.data-schemas.src.types.user can break packages.api.src.mcp.types, while a change to packages.api.src.mcp.types can't break packages.data-schemas.src.types.user.
Position
Below the diagonal: packages.api.src.mcp.types uses a module listed above it, which is the healthy direction.
packages.api.src.skills.import uses packages.api.src.agents.openai.service, so a change to packages.api.src.agents.openai.service can break packages.api.src.skills.import, while a change to packages.api.src.skills.import can't break packages.api.src.agents.openai.service.
Position
Below the diagonal: packages.api.src.skills.import uses a module listed above it, which is the healthy direction.
packages.api.src.stream.interfaces.IJobStore uses packages.data-provider.src.types.agents, so a change to packages.data-provider.src.types.agents can break packages.api.src.stream.interfaces.IJobStore, while a change to packages.api.src.stream.interfaces.IJobStore can't break packages.data-provider.src.types.agents.
Position
Below the diagonal: packages.api.src.stream.interfaces.IJobStore uses a module listed above it, which is the healthy direction.
packages.api.src.stream.interfaces.IJobStore uses packages.data-schemas.src.types.convo, so a change to packages.data-schemas.src.types.convo can break packages.api.src.stream.interfaces.IJobStore, while a change to packages.api.src.stream.interfaces.IJobStore can't break packages.data-schemas.src.types.convo.
Position
Below the diagonal: packages.api.src.stream.interfaces.IJobStore uses a module listed above it, which is the healthy direction.
packages.data-schemas.src.app uses packages.api.src.agents.openai.service, so a change to packages.api.src.agents.openai.service can break packages.data-schemas.src.app, while a change to packages.data-schemas.src.app can't break packages.api.src.agents.openai.service.
Position
Below the diagonal: packages.data-schemas.src.app uses a module listed above it, which is the healthy direction.
packages.data-schemas.src.app uses packages.data-provider.src.accessPermissions, so a change to packages.data-provider.src.accessPermissions can break packages.data-schemas.src.app, while a change to packages.data-schemas.src.app can't break packages.data-provider.src.accessPermissions.
Position
Below the diagonal: packages.data-schemas.src.app uses a module listed above it, which is the healthy direction.
packages.data-schemas.src.methods uses packages.data-provider.src.accessPermissions, so a change to packages.data-provider.src.accessPermissions can break packages.data-schemas.src.methods, while a change to packages.data-schemas.src.methods can't break packages.data-provider.src.accessPermissions.
Position
Below the diagonal: packages.data-schemas.src.methods uses a module listed above it, which is the healthy direction.
packages.data-schemas.src.methods uses packages.data-schemas.src.types.convo, so a change to packages.data-schemas.src.types.convo can break packages.data-schemas.src.methods, while a change to packages.data-schemas.src.methods can't break packages.data-schemas.src.types.convo.
Position
Below the diagonal: packages.data-schemas.src.methods uses a module listed above it, which is the healthy direction.
packages.data-schemas.src.methods uses packages.data-schemas.src.types.user, so a change to packages.data-schemas.src.types.user can break packages.data-schemas.src.methods, while a change to packages.data-schemas.src.methods can't break packages.data-schemas.src.types.user.
Position
Below the diagonal: packages.data-schemas.src.methods uses a module listed above it, which is the healthy direction.
packages.data-schemas.src.models uses packages.data-schemas.src.types.convo, so a change to packages.data-schemas.src.types.convo can break packages.data-schemas.src.models, while a change to packages.data-schemas.src.models can't break packages.data-schemas.src.types.convo.
Position
Below the diagonal: packages.data-schemas.src.models uses a module listed above it, which is the healthy direction.
packages.data-schemas.src.models uses packages.data-schemas.src.types.user, so a change to packages.data-schemas.src.types.user can break packages.data-schemas.src.models, while a change to packages.data-schemas.src.models can't break packages.data-schemas.src.types.user.
Position
Below the diagonal: packages.data-schemas.src.models uses a module listed above it, which is the healthy direction.
packages.api.src.agents.responses.types uses client.src.components.SidePanel.Agents.Tools.items.types, so a change to client.src.components.SidePanel.Agents.Tools.items.types can break packages.api.src.agents.responses.types, while a change to packages.api.src.agents.responses.types can't break client.src.components.SidePanel.Agents.Tools.items.types.
Position
Below the diagonal: packages.api.src.agents.responses.types uses a module listed above it, which is the healthy direction.
packages.api.src.utils uses packages.data-provider.src.schemas, so a change to packages.data-provider.src.schemas can break packages.api.src.utils, while a change to packages.api.src.utils can't break packages.data-provider.src.schemas.
Position
Below the diagonal: packages.api.src.utils uses a module listed above it, which is the healthy direction.
packages.api.src.utils uses packages.data-schemas.src.types.user, so a change to packages.data-schemas.src.types.user can break packages.api.src.utils, while a change to packages.api.src.utils can't break packages.data-schemas.src.types.user.
Position
Below the diagonal: packages.api.src.utils uses a module listed above it, which is the healthy direction.
packages.api.src.utils uses packages.api.src.skills.import, so a change to packages.api.src.skills.import can break packages.api.src.utils, while a change to packages.api.src.utils can't break packages.api.src.skills.import.
Position
Below the diagonal: packages.api.src.utils uses a module listed above it, which is the healthy direction.
packages.api.src.admin uses packages.api.src.agents.openai.service, so a change to packages.api.src.agents.openai.service can break packages.api.src.admin, while a change to packages.api.src.admin can't break packages.api.src.agents.openai.service.
Position
Below the diagonal: packages.api.src.admin uses a module listed above it, which is the healthy direction.
packages.api.src.admin uses packages.data-provider.src.accessPermissions, so a change to packages.data-provider.src.accessPermissions can break packages.api.src.admin, while a change to packages.api.src.admin can't break packages.data-provider.src.accessPermissions.
Position
Below the diagonal: packages.api.src.admin uses a module listed above it, which is the healthy direction.
packages.api.src.admin uses packages.data-provider.src.types, so a change to packages.data-provider.src.types can break packages.api.src.admin, while a change to packages.api.src.admin can't break packages.data-provider.src.types.
Position
Below the diagonal: packages.api.src.admin uses a module listed above it, which is the healthy direction.
packages.api.src.admin uses packages.api.src.skills.import, so a change to packages.api.src.skills.import can break packages.api.src.admin, while a change to packages.api.src.admin can't break packages.api.src.skills.import.
Position
Below the diagonal: packages.api.src.admin uses a module listed above it, which is the healthy direction.
packages.api.src.admin uses packages.api.src.agents.responses.types, so a change to packages.api.src.agents.responses.types can break packages.api.src.admin, while a change to packages.api.src.admin can't break packages.api.src.agents.responses.types.
Position
Below the diagonal: packages.api.src.admin uses a module listed above it, which is the healthy direction.
packages.api.src.agents uses packages.api.src.agents.execution, so a change to packages.api.src.agents.execution can break packages.api.src.agents, while a change to packages.api.src.agents can't break packages.api.src.agents.execution.
Position
Below the diagonal: packages.api.src.agents uses a module listed above it, which is the healthy direction.
packages.api.src.agents uses packages.api.src.agents.openai.service, so a change to packages.api.src.agents.openai.service can break packages.api.src.agents, while a change to packages.api.src.agents can't break packages.api.src.agents.openai.service.
Position
Below the diagonal: packages.api.src.agents uses a module listed above it, which is the healthy direction.
packages.api.src.agents uses packages.data-provider.src.accessPermissions, so a change to packages.data-provider.src.accessPermissions can break packages.api.src.agents, while a change to packages.api.src.agents can't break packages.data-provider.src.accessPermissions.
Position
Below the diagonal: packages.api.src.agents uses a module listed above it, which is the healthy direction.
packages.api.src.agents uses packages.data-provider.src.schemas, so a change to packages.data-provider.src.schemas can break packages.api.src.agents, while a change to packages.api.src.agents can't break packages.data-provider.src.schemas.
Position
Below the diagonal: packages.api.src.agents uses a module listed above it, which is the healthy direction.
packages.api.src.agents uses packages.data-provider.src.types.agents, so a change to packages.data-provider.src.types.agents can break packages.api.src.agents, while a change to packages.api.src.agents can't break packages.data-provider.src.types.agents.
Position
Below the diagonal: packages.api.src.agents uses a module listed above it, which is the healthy direction.
packages.api.src.agents uses packages.data-schemas.src.types.convo, so a change to packages.data-schemas.src.types.convo can break packages.api.src.agents, while a change to packages.api.src.agents can't break packages.data-schemas.src.types.convo.
Position
Below the diagonal: packages.api.src.agents uses a module listed above it, which is the healthy direction.
packages.api.src.agents uses packages.data-schemas.src.types.user, so a change to packages.data-schemas.src.types.user can break packages.api.src.agents, while a change to packages.api.src.agents can't break packages.data-schemas.src.types.user.
Position
Below the diagonal: packages.api.src.agents uses a module listed above it, which is the healthy direction.
packages.api.src.agents uses packages.api.src.agents.files, so a change to packages.api.src.agents.files can break packages.api.src.agents, while a change to packages.api.src.agents can't break packages.api.src.agents.files.
Position
Below the diagonal: packages.api.src.agents uses a module listed above it, which is the healthy direction.
packages.api.src.agents uses packages.api.src.mcp.types, so a change to packages.api.src.mcp.types can break packages.api.src.agents, while a change to packages.api.src.agents can't break packages.api.src.mcp.types.
Position
Below the diagonal: packages.api.src.agents uses a module listed above it, which is the healthy direction.
packages.api.src.agents uses packages.api.src.skills.import, so a change to packages.api.src.skills.import can break packages.api.src.agents, while a change to packages.api.src.agents can't break packages.api.src.skills.import.
Position
Below the diagonal: packages.api.src.agents uses a module listed above it, which is the healthy direction.
packages.api.src.agents uses packages.api.src.stream.interfaces.IJobStore, so a change to packages.api.src.stream.interfaces.IJobStore can break packages.api.src.agents, while a change to packages.api.src.agents can't break packages.api.src.stream.interfaces.IJobStore.
Position
Below the diagonal: packages.api.src.agents uses a module listed above it, which is the healthy direction.
packages.api.src.agents uses packages.api.src.agents.responses.types, so a change to packages.api.src.agents.responses.types can break packages.api.src.agents, while a change to packages.api.src.agents can't break packages.api.src.agents.responses.types.
Position
Below the diagonal: packages.api.src.agents uses a module listed above it, which is the healthy direction.
packages.api.src.agents.triggers uses packages.data-schemas.src.types.convo, so a change to packages.data-schemas.src.types.convo can break packages.api.src.agents.triggers, while a change to packages.api.src.agents.triggers can't break packages.data-schemas.src.types.convo.
Position
Below the diagonal: packages.api.src.agents.triggers uses a module listed above it, which is the healthy direction.
packages.api.src.agents.triggers uses packages.api.src.stream.interfaces.IJobStore, so a change to packages.api.src.stream.interfaces.IJobStore can break packages.api.src.agents.triggers, while a change to packages.api.src.agents.triggers can't break packages.api.src.stream.interfaces.IJobStore.
Position
Below the diagonal: packages.api.src.agents.triggers uses a module listed above it, which is the healthy direction.
packages.api.src.agents.triggers uses packages.api.src.agents.responses.types, so a change to packages.api.src.agents.responses.types can break packages.api.src.agents.triggers, while a change to packages.api.src.agents.triggers can't break packages.api.src.agents.responses.types.
Position
Below the diagonal: packages.api.src.agents.triggers uses a module listed above it, which is the healthy direction.
packages.api.src.app uses packages.api.src.agents.openai.service, so a change to packages.api.src.agents.openai.service can break packages.api.src.app, while a change to packages.api.src.app can't break packages.api.src.agents.openai.service.
Position
Below the diagonal: packages.api.src.app uses a module listed above it, which is the healthy direction.
packages.api.src.app uses packages.api.src.agents.responses.types, so a change to packages.api.src.agents.responses.types can break packages.api.src.app, while a change to packages.api.src.app can't break packages.api.src.agents.responses.types.
Position
Below the diagonal: packages.api.src.app uses a module listed above it, which is the healthy direction.
packages.api.src.auth uses packages.data-provider.src.types, so a change to packages.data-provider.src.types can break packages.api.src.auth, while a change to packages.api.src.auth can't break packages.data-provider.src.types.
Position
Below the diagonal: packages.api.src.auth uses a module listed above it, which is the healthy direction.
packages.api.src.auth uses packages.data-schemas.src.types.user, so a change to packages.data-schemas.src.types.user can break packages.api.src.auth, while a change to packages.api.src.auth can't break packages.data-schemas.src.types.user.
Position
Below the diagonal: packages.api.src.auth uses a module listed above it, which is the healthy direction.
packages.api.src.auth uses packages.api.src.skills.import, so a change to packages.api.src.skills.import can break packages.api.src.auth, while a change to packages.api.src.auth can't break packages.api.src.skills.import.
Position
Below the diagonal: packages.api.src.auth uses a module listed above it, which is the healthy direction.
packages.api.src.auth uses packages.api.src.agents.responses.types, so a change to packages.api.src.agents.responses.types can break packages.api.src.auth, while a change to packages.api.src.auth can't break packages.api.src.agents.responses.types.
Position
Below the diagonal: packages.api.src.auth uses a module listed above it, which is the healthy direction.
packages.api.src.code uses packages.api.src.agents.execution, so a change to packages.api.src.agents.execution can break packages.api.src.code, while a change to packages.api.src.code can't break packages.api.src.agents.execution.
Position
Below the diagonal: packages.api.src.code uses a module listed above it, which is the healthy direction.
packages.api.src.code uses packages.api.src.agents.openai.service, so a change to packages.api.src.agents.openai.service can break packages.api.src.code, while a change to packages.api.src.code can't break packages.api.src.agents.openai.service.
Position
Below the diagonal: packages.api.src.code uses a module listed above it, which is the healthy direction.
packages.api.src.code uses packages.api.src.skills.import, so a change to packages.api.src.skills.import can break packages.api.src.code, while a change to packages.api.src.code can't break packages.api.src.skills.import.
Position
Below the diagonal: packages.api.src.code uses a module listed above it, which is the healthy direction.
packages.api.src.code uses packages.api.src.agents.responses.types, so a change to packages.api.src.agents.responses.types can break packages.api.src.code, while a change to packages.api.src.code can't break packages.api.src.agents.responses.types.
Position
Below the diagonal: packages.api.src.code uses a module listed above it, which is the healthy direction.
packages.api.src.langfuse uses packages.api.src.agents.openai.service, so a change to packages.api.src.agents.openai.service can break packages.api.src.langfuse, while a change to packages.api.src.langfuse can't break packages.api.src.agents.openai.service.
Position
Below the diagonal: packages.api.src.langfuse uses a module listed above it, which is the healthy direction.
packages.api.src.langfuse uses packages.api.src.agents.responses.types, so a change to packages.api.src.agents.responses.types can break packages.api.src.langfuse, while a change to packages.api.src.langfuse can't break packages.api.src.agents.responses.types.
Position
Below the diagonal: packages.api.src.langfuse uses a module listed above it, which is the healthy direction.
packages.api.src.mcp uses client.src.components.Chat.Input.Composer, so a change to client.src.components.Chat.Input.Composer can break packages.api.src.mcp, while a change to packages.api.src.mcp can't break client.src.components.Chat.Input.Composer.
Position
Below the diagonal: packages.api.src.mcp uses a module listed above it, which is the healthy direction.
packages.api.src.mcp uses packages.api.src.mcp.types, so a change to packages.api.src.mcp.types can break packages.api.src.mcp, while a change to packages.api.src.mcp can't break packages.api.src.mcp.types.
Position
Below the diagonal: packages.api.src.mcp uses a module listed above it, which is the healthy direction.
packages.api.src.mcp uses packages.api.src.agents.responses.types, so a change to packages.api.src.agents.responses.types can break packages.api.src.mcp, while a change to packages.api.src.mcp can't break packages.api.src.agents.responses.types.
Position
Below the diagonal: packages.api.src.mcp uses a module listed above it, which is the healthy direction.
packages.api.src.middleware uses packages.api.src.agents.openai.service, so a change to packages.api.src.agents.openai.service can break packages.api.src.middleware, while a change to packages.api.src.middleware can't break packages.api.src.agents.openai.service.
Position
Below the diagonal: packages.api.src.middleware uses a module listed above it, which is the healthy direction.
packages.api.src.middleware uses packages.data-provider.src.accessPermissions, so a change to packages.data-provider.src.accessPermissions can break packages.api.src.middleware, while a change to packages.api.src.middleware can't break packages.data-provider.src.accessPermissions.
Position
Below the diagonal: packages.api.src.middleware uses a module listed above it, which is the healthy direction.
packages.api.src.middleware uses packages.data-schemas.src.types.user, so a change to packages.data-schemas.src.types.user can break packages.api.src.middleware, while a change to packages.api.src.middleware can't break packages.data-schemas.src.types.user.
Position
Below the diagonal: packages.api.src.middleware uses a module listed above it, which is the healthy direction.
packages.api.src.middleware uses packages.api.src.skills.import, so a change to packages.api.src.skills.import can break packages.api.src.middleware, while a change to packages.api.src.middleware can't break packages.api.src.skills.import.
Position
Below the diagonal: packages.api.src.middleware uses a module listed above it, which is the healthy direction.
packages.api.src.middleware uses packages.api.src.agents.responses.types, so a change to packages.api.src.agents.responses.types can break packages.api.src.middleware, while a change to packages.api.src.middleware can't break packages.api.src.agents.responses.types.
Position
Below the diagonal: packages.api.src.middleware uses a module listed above it, which is the healthy direction.
packages.api.src.schedules uses packages.data-schemas.src.types.user, so a change to packages.data-schemas.src.types.user can break packages.api.src.schedules, while a change to packages.api.src.schedules can't break packages.data-schemas.src.types.user.
Position
Below the diagonal: packages.api.src.schedules uses a module listed above it, which is the healthy direction.
packages.api.src.schedules uses packages.api.src.mcp.types, so a change to packages.api.src.mcp.types can break packages.api.src.schedules, while a change to packages.api.src.schedules can't break packages.api.src.mcp.types.
Position
Below the diagonal: packages.api.src.schedules uses a module listed above it, which is the healthy direction.
packages.api.src.schedules uses packages.api.src.skills.import, so a change to packages.api.src.skills.import can break packages.api.src.schedules, while a change to packages.api.src.schedules can't break packages.api.src.skills.import.
Position
Below the diagonal: packages.api.src.schedules uses a module listed above it, which is the healthy direction.
packages.api.src.schedules uses packages.api.src.agents.responses.types, so a change to packages.api.src.agents.responses.types can break packages.api.src.schedules, while a change to packages.api.src.schedules can't break packages.api.src.agents.responses.types.
Position
Below the diagonal: packages.api.src.schedules uses a module listed above it, which is the healthy direction.
packages.api.src.skills uses packages.api.src.skills.import, so a change to packages.api.src.skills.import can break packages.api.src.skills, while a change to packages.api.src.skills can't break packages.api.src.skills.import.
Position
Below the diagonal: packages.api.src.skills uses a module listed above it, which is the healthy direction.
packages.api.src.skills uses packages.api.src.agents.responses.types, so a change to packages.api.src.agents.responses.types can break packages.api.src.skills, while a change to packages.api.src.skills can't break packages.api.src.agents.responses.types.
Position
Below the diagonal: packages.api.src.skills uses a module listed above it, which is the healthy direction.
packages.data-provider.src uses packages.api.src.agents.openai.service, so a change to packages.api.src.agents.openai.service can break packages.data-provider.src, while a change to packages.data-provider.src can't break packages.api.src.agents.openai.service.
Position
Below the diagonal: packages.data-provider.src uses a module listed above it, which is the healthy direction.
packages.data-provider.src uses packages.data-provider.src.accessPermissions, so a change to packages.data-provider.src.accessPermissions can break packages.data-provider.src, while a change to packages.data-provider.src can't break packages.data-provider.src.accessPermissions.
Position
Below the diagonal: packages.data-provider.src uses a module listed above it, which is the healthy direction.
packages.data-provider.src uses packages.data-provider.src.schemas, so a change to packages.data-provider.src.schemas can break packages.data-provider.src, while a change to packages.data-provider.src can't break packages.data-provider.src.schemas.
Position
Below the diagonal: packages.data-provider.src uses a module listed above it, which is the healthy direction.
packages.data-provider.src uses packages.data-provider.src.types, so a change to packages.data-provider.src.types can break packages.data-provider.src, while a change to packages.data-provider.src can't break packages.data-provider.src.types.
Position
Below the diagonal: packages.data-provider.src uses a module listed above it, which is the healthy direction.
packages.data-provider.src uses packages.api.src.agents.responses.types, so a change to packages.api.src.agents.responses.types can break packages.data-provider.src, while a change to packages.data-provider.src can't break packages.api.src.agents.responses.types.
Position
Below the diagonal: packages.data-provider.src uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 58% · Adequate · gated by D1, D2, X4 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
494
High / Critical
A02:2025 — Security Misconfiguration
28
High / Critical
A07:2025 — Authentication Failures
14
High / Critical
A03:2025 — Software Supply Chain Failures
11
High / Critical
Roadmap
Immediately resolve the leaked secret in REDACTED and the two banned licenses in REDACTED to address critical compliance and security risks. Strengthen the development pipeline by integrating a SAST step into CI to prevent security regressions and improve dependency hygiene by removing unused packages and correctly scoping dev dependencies. Finally, ensure system resilience by bounding all outbound HTTP calls with timeouts, retries, and circuit breakers.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 1 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED.
Add a SAST step to CI running what this repository's stack ships: CodeQL's javascript-typescript pack, `semgrep --config=p/typescript`, or eslint-plugin-security — so a security regression fails the build instead of landing.
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.
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 — 396
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 — 5562
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 — 1646
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 8
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. 99 of 99 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 — 99 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, 7561 of 7604 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.
D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — the dependency install for the repository root could not reach cdn.sheetjs.com, which the analyzer sandbox's egress allowlist does not carry (npm error 403 403 Forbidden - GET https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz), so the suite never ran. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo. In the meantime, commit (or publish into the working tree) the lcov/Cobertura report your CI produces and the real number is read on the next scan. You can widen what we reach: optional: commit the lcov/Cobertura report your CI produces, and the real number is read on the next scan.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT MEASURED: the JavaScript/TypeScript suite could not be re-run in the analyzer sandbox — the dependency install for the repository root could not reach cdn.sheetjs.com, which the analyzer sandbox's egress allowlist does not carry (npm error 403 403 Forbidden - GET https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz), so the suite never ran. This is OUR limitation, not a defect in the repo — it is excluded from the score.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the jest suite in the repository root was NOT MEASURED: the dependency install for the repository root could not reach cdn.sheetjs.com, which the analyzer sandbox's egress allowlist does not carry (npm error 403 403 Forbidden - GET https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the jest suite in api/ was NOT MEASURED: the dependency install for api/ could not reach cdn.sheetjs.com, which the analyzer sandbox's egress allowlist does not carry (npm error 403 403 Forbidden - GET https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the jest suite in client/ was NOT MEASURED: the dependency install for client/ could not reach cdn.sheetjs.com, which the analyzer sandbox's egress allowlist does not carry (npm error 403 403 Forbidden - GET https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the jest suite in packages/api/ was NOT MEASURED: the dependency install for packages/api/ could not reach cdn.sheetjs.com, which the analyzer sandbox's egress allowlist does not carry (npm error 403 403 Forbidden - GET https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the jest suite in packages/chat/ was NOT MEASURED: the dependency install for packages/chat/ could not reach cdn.sheetjs.com, which the analyzer sandbox's egress allowlist does not carry (npm error 403 403 Forbidden - GET https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the jest suite in packages/client/ was NOT MEASURED: the dependency install for packages/client/ could not reach cdn.sheetjs.com, which the analyzer sandbox's egress allowlist does not carry (npm error 403 403 Forbidden - GET https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the jest suite in packages/data-provider/ was NOT MEASURED: the dependency install for packages/data-provider/ could not reach cdn.sheetjs.com, which the analyzer sandbox's egress allowlist does not carry (npm error 403 403 Forbidden - GET https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the jest suite in packages/data-schemas/ was NOT MEASURED: the dependency install for packages/data-schemas/ could not reach cdn.sheetjs.com, which the analyzer sandbox's egress allowlist does not carry (npm error 403 403 Forbidden - GET https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
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.
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. 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.
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. `client/src/components/Balance/Summary.tsx`, `client/src/components/Chat/Input/Files/Table/ColumnVisibilityDropdown.tsx`, `client/src/components/Chat/Messages/Content/Wakeup.tsx`, `client/src/components/Chat/Messages/MultiMessage.tsx`, `client/src/components/Chat/Subagents/SubagentActivity.tsx`, … (+67 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.
D41 Kernel & Syscall Confinement — 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. Helm/librechat-rag-api/templates/rag-deployment.yaml:2, helm/librechat/templates/deployment.yaml:2, REDACTED:15 did not read as a pod spec (a templated manifest such as Helm's that is not YAML until rendered, or a workload whose pod spec this check does not locate), so the seccomp/AppArmor profile in force there was not judged and no row about them can appear on this card.
AX1 Captive dependencies — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in packages/api/src/mcp/tools.ts, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
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 (REDACTED). compose up failed (exit 15 — the compose project is invalid) — error while interpolating services.langfuse-fanout-collector.environment.[]: required variable LANGFUSE_FANOUT_CENTRAL_AUTH_HEADER is missing a value: Set LANGFUSE_FANOUT_CENTRAL_AUTH_HEADER to central Langfuse Basic auth header; 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. 45 further occurrence(s) are not listed individually; the score already reflects all 85.
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. 287 further occurrence(s) are not listed individually; the score already reflects all 327.
P7 Outbound HTTP resilience — 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. 5 further occurrence(s) are not listed individually; the score already reflects all 45.
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. 1434 further occurrence(s) are not listed individually; the score already reflects all 1474.
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. 32 further occurrence(s) are not listed individually; the score already reflects all 72.
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. 382 further occurrence(s) are not listed individually; the score already reflects all 422.
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. 41 further occurrence(s) are not listed individually; the score already reflects all 81.
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. 15 further occurrence(s) are not listed individually; the score already reflects all 55.
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. 10 further occurrence(s) are not listed individually; the score already reflects all 50.
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. 178 further occurrence(s) are not listed individually; the score already reflects all 218.
X4 Structured logging — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 1557 further occurrence(s) are not listed individually; the score already reflects all 1597.
Repo exclusion declarations: 3 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.
Limitations & what we did not check
Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 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.
D40 Network Egress Confinement: Egress confinement is read from committed Kubernetes manifests — a policy applied out-of-band (cluster-default deny, a service mesh, or a cloud firewall/security group off-repo) is invisible, and a present NetworkPolicy is declared config, not proof the cluster admission-controller actually enforces it at runtime.
D41 Kernel & Syscall Confinement: Syscall/MAC confinement is read from committed manifests — a profile applied by a cluster-wide PodSecurity default or a mutating webhook off-repo isn't seen, and a declared seccomp/AppArmor profile is config presence, not proof the node's kernel actually loaded and enforced it.
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.
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.
C5 Data-Subject Rights: This control is scored from in-repo evidence only — absence of evidence here means the scan found no in-repo trace, not that the control does not exist.
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.
1448 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was handlers.createToolExecuteHandler.handle at 336. A further 29 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 conversation.validateAgentEventActorSuspension at 27 — they are counted neither in the figure above nor in this dimension's score. 8 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: packages/api/src/files/code/artifactDelivery.ts (artifactDelivery.normalizeArtifactDeliveryFailure at 21), client/src/components/Chat/Messages/SearchMessage.tsx (SearchMessage.areSearchMessagePropsEqual at 18), client/src/utils/imageResize.ts (imageResize.resizeImage at 18), packages/api/src/langfuse/destinations.ts (destinations.resolveCentralProjectIdOutcome at 17), packages/api/src/shared-links/config.ts (config.buildSharedLinkStartupPayload at 17), and 3 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.
+ 1334 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 139 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with handlers.createToolExecuteHandler.handle (cyclomatic 336), SubagentThreadPanel.SubagentThreadPanel (cyclomatic 318), ResumableAgentController (cyclomatic 238). — 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 139 together lifts Cyclomatic Complexity from 2.0 to about 3.6/10, projected with the scoring formula itself and assuming each lands exactly at 60; 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.
+ 1467 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 197 bodies over 60 down to 60 or less in Cognitive Complexity — start with handlers.createToolExecuteHandler.handle (cognitive 547), background.runCheckBackgroundTask (cognitive 375), ResumeAgentController (cognitive 368). — 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 197 together lifts Cognitive Complexity from 2.0 to about 3.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; 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 Classes5.9 / 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.
Resolve the 629 FunctionTooLong finding(s) in God Classes — start with handlers.ts (17), service.ts (15), config.ts (9). — One of this dimension's main actionable groups (629 warning-level).
Resolve the 204 FileTooLong finding(s) in God Classes — start with service.ts (5), handlers.ts (4), config.ts (2). — One of this dimension's main actionable groups (204 warning-level).
Resolve the 34 MethodTooLong finding(s) in God Classes — start with GenerationJobManager.ts (6), MCPManager.ts (4), RedisJobStore.ts (4). — One of this dimension's main actionable groups (34 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.
2 duplicated block group(s) detected. Measured on part of this repository only: .ts, .tsx (99% 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.
Resolve the 1 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with main.go. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with main.go. — One of this dimension's main actionable groups (1 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 · Coupling9.0 / 10Stronggated by 1 serious finding✓ 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.
8 production modules (npm+Go), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 1 module(s) off the main sequence, with abstractness counted on 7 of the 8 (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: librechat-data-provider
What to do
Resolve the 1 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (1 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.
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 3 Low cohesion finding(s) in Cohesion (LCOM4) — start with BaseClient.js, TTSService.js, STTService.js. — One of this dimension's main actionable groups (3 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.
Do you agree with this assessment?
D9 · Test Distribution9.6 / 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.
46289 test methods: 44950 unit, 0 integration, 0 BDD, 1339 e2e. The JavaScript/TypeScript suite contributes 46254 `it`/`test` case(s) across 2758 test file(s) declaring at least one; its tier split is read from package names and paths only. The Go suite contributes 35 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 57 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.
42 skipped, 2 zero-assertion, 13 synchronised by a fixed sleep, no mocking-framework packages referenced (hand-written doubles or no mocking) across 46254 tests.
Skipped test: Skipped: AWS_TEST_BUCKET_NAME not configured · ×42packages/api/src/storage/s3/__tests__/s3.integration.spec.ts:65
Fixed-sleep synchronisation: renews a code environment reference until the guarded write settles · ×13packages/data-schemas/src/methods/agent.spec.ts:3253
No assertions: every field primitive and variant resolves its fill, edge, ring and outline the same way in each state @scenario:field-variant-matrix · ×2e2e/specs/mock/scenarios/field-variants.spec.ts:344
Mock-dominated test: creates schema indexes before the first assistant lookup when auto-indexing is disabled · ×1384packages/data-schemas/src/schema/assistant.spec.ts:12
What to do
Resolve the 42 Skipped test finding(s) in Test Quality — start with REDACTED (6), pinned-row-controls.spec.ts (5), conversation-management.spec.ts (2). — One of this dimension's main actionable groups (42 warning-level).
Resolve the 13 Fixed-sleep synchronisation finding(s) in Test Quality — start with userGroup.spec.ts (3), lifecycle.spec.ts (3), agent.spec.ts. — One of this dimension's main actionable groups (13 warning-level).
Resolve the 2 No assertions finding(s) in Test Quality — start with field-variants.spec.ts, tts-cache.spec.ts. — One of this dimension's main actionable groups (2 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.
4 outdated, 0 author-deprecated direct Go module(s), 0 pinning or checksum defect(s). Whether any of these modules is UNMAINTAINED is not graded — proxy.golang.org publishes no maintenance status, and release age does not stand in for one. Whether any is UNUSED is not graded either: that is a source question, not a registry one. Known CVEs in this module graph are D30's question, read from REDACTED and go.sum there.
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 1 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED. — One of this dimension's main actionable groups (1 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.
2 of 211 shipped npm package(s) use a banned license. Licences were resolved from registry.npmjs.org over the 211 production dependency(ies) this repository's committed lockfile resolves, across 8 product REDACTED manifest(s). Its 192 `devDependencies` declaration(s) are excluded: a consumer installs none of them. ★ DEPTH: this is the DIRECT production set the lockfile resolves, NOT the transitive closure — only one of the four lock dialects this pass reads states a full graph, so a banned licence pulled in only by a dependency's OWN dependencies is outside this verdict, exactly as the JVM arm's declaration-site verdict is. ★ Each licence is the one the registry publishes for the package's CURRENT release rather than for the pinned version, which is the same caveat the Hex and RubyGems arms carry. This repository publishes itself under ISC / MIT, which is its own choice and is not judged here.
Resolve the 2 Banned license finding(s) in License Compliance — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
Enforce License Compliance in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d14_recommendation.md · top locations in Appendix A, every location in findings.md.
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: api/server/controllers/agents/request.js (65×438=28470); packages/api/src/agents/handlers.ts (77×336=25872); packages/api/src/agents/initialize.ts (61×235=14335) Repeated repair below the complexity floor: api/server/services/AuthService.js (8 of 10 changes were fixes); packages/api/src/mcp/registry/MCPServerInspector.ts (8 of 10 changes were fixes); packages/api/src/agents/errors.ts (7 of 12 changes were fixes)
Resolve the 518 Hotspot finding(s) in Churn × Complexity Hotspots — start with initialize.ts (6), config.ts (5), service.ts (5). — One of this dimension's main actionable groups (518 warning-level).
Resolve the 46 Repeated repair finding(s) in Churn × Complexity Hotspots — start with errors.ts (3), AuthService.js, MCPServerInspector.ts. — One of this dimension's main actionable groups (46 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.5 / 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.
305 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is packages/api/src/middleware/modelBoundContent.ts. Counted over 2042 of the 3649 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 · ×2
Further sole-owners (lower concentration)
What to do
Resolve the 2 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (2 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.
21 deducted task-comment markers across 663695 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 21 TodoComment finding(s) in Explicit Debt — start with SetKeyDialog.tsx (3), config.ts (2), useFileHandling.ts (2). — One of this dimension's main actionable groups (21 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.
0 of 1 documentation facets pass in full; short on: F2 example. 32 document(s) read across 1 unit(s).
Documentation: no build, run or usage exampleREADME.md:1
What to do
Resolve the 1 Documentation finding(s) in Documentation Quality — start with README.md. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d19_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: 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.
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.
496 domain type(s) cross context boundaries across 5 contexts.
Cross-context type TAttachment (data-provider → client) · ×49client/src/hooks/Files/useAttachmentPreviewSync.ts:63
Cross-context type TMessageContentParts (data-provider → client) · ×43client/src/components/Chat/Messages/Content/ParallelContent.tsx:36
Cross-context type PrincipalType (data-provider → api) · ×41packages/api/src/acl/accessControlService.ts:129
Cross-context type PrincipalType (data-provider → data-schemas) · ×35packages/data-schemas/src/app/store.ts:62
Cross-context type ResourceType (data-provider → api) · ×25packages/api/src/acl/audit.ts:161
+ 97 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 49 Cross-context type TAttachment (data-provider → client) finding(s) in Boundary Type-Coupling — start with attachmentTypes.ts (7), attachments.ts (5), media.ts (4). — One of this dimension's main actionable groups (49 warning-level).
Resolve the 43 Cross-context type TMessageContentParts (data-provider → client) finding(s) in Boundary Type-Coupling — start with live.ts (6), activityLabels.ts (5), outcome.ts (4). — One of this dimension's main actionable groups (43 warning-level).
Resolve the 41 Cross-context type PrincipalType (data-provider → api) finding(s) in Boundary Type-Coupling — start with roles.ts (9), config.ts (8), grants.ts (6). — One of this dimension's main actionable groups (41 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.
7 of 9 build units (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.
12 finding(s): 0 critical, 12 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
What to do
Resolve the 12 REDACTED finding(s) in Secrets (history) — start with REDACTED (3), REDACTED (3), REDACTED (3). — One of this dimension's main actionable groups (12 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).
496 finding(s): 0 critical, 312 high, 171 medium, 13 low. 231 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 165 file(s) — `.github/scripts/retarget-prs.sh` (line 6), `REDACTED` (lines 61–83), `api/server/controllers/agents/client.js`, `api/server/controllers/agents/request.js`, `REDACTED`, … (+160 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 5 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
+ 23 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 31 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (9), REDACTED (5), REDACTED (4). — One of this dimension's main actionable groups (31 issue-level).
Resolve the 18 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (9), REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (18 issue-level).
No action in Static Analysis (SAST) — all 231 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 (231 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.
Resolve the 3 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2), REDACTED. — One of this dimension's main actionable groups (3 issue-level).
Resolve the 2 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 Low CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 4 High IaC finding(s) in IaC & Container Security — start with REDACTED (3), REDACTED. — One of this dimension's main actionable groups (4 issue-level).
Resolve the 17 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (4), REDACTED (3), REDACTED (3). — One of this dimension's main actionable groups (17 warning-level).
Resolve the 7 Low IaC finding(s) in IaC & Container Security — start with REDACTED (4), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (7 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 2042 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is client/src/hooks/useWakeLock.ts. Counted over 2042 of the 3649 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 7 Boundary-crossing change coupling finding(s) in Change Coupling — start with Selectors.tsx, ServerInitializationSection.tsx, AgentPanelContext.tsx. — One of this dimension's main actionable groups (7 issue-level).
Resolve the 22 Change coupling finding(s) in Change Coupling — start with convos-route-mocks.js (2), api-endpoints.ts (2), tailwind.preset.cjs (2). — One of this dimension's main actionable groups (22 warning-level).
Resolve the 2 Change-coupling hub finding(s) in Change Coupling — start with RedisJobStore.ts, Message.tsx. — One of this dimension's main actionable groups (2 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. — 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 Kubernetes workloads restrict network EGRESS with a NetworkPolicy (or Cilium policy), limiting where a compromised pod can send data or reach a command-and-control server. Presence of committed egress-restricting policy, not runtime enforcement.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn — language-agnostic): Kubernetes workloads gate applicability; credits a NetworkPolicy / Cilium policy that restricts egress (policyTypes: [Egress] / egress rules). Reward-leaning (neutral floor climbing to 10, never a deduction — baseline misconfigs stay with D31). Deterministic.
What it measures: Whether Kubernetes workloads confine the kernel boundary — a seccomp profile (RuntimeDefault/Localhost) plus an AppArmor/SELinux mandatory-access-control layer — shrinking the syscall attack surface a container escape would use. Presence of committed confinement config, not runtime enforcement.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn): on Kubernetes workloads, credits a seccomp profile (RuntimeDefault/Localhost) and an AppArmor/SELinux MAC layer. Reward-leaning (neutral floor climbing to 10); NotApplicable without workloads. Deterministic.
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 alternatives6.6 / 10Strong✓ 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.
A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content. (×2) — client/src/components/Chat/Input/Composer/Waveform.tsx:97, packages/client/src/components/PixelCard.tsx:422
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 & labels6.3 / 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 no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×2) — client/src/components/Chat/Input/Files/FileUpload.tsx:90, client/src/components/SidePanel/Builder/AssistantConversationStarters.tsx:116
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. (×9) — client/src/components/Chat/Menus/Endpoints/CustomMenu.tsx:103, client/src/components/SidePanel/Agents/Tools/ToolsSection.tsx:364, client/src/components/SidePanel/Builder/ActionsAuth.tsx:77, …
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/src/components/Chat/Messages/Feedback.tsx:320
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. (×3) — client/src/components/SidePanel/Builder/ActionsInput.tsx:240, client/src/components/SidePanel/Builder/ActionsInput.tsx:277, client/src/components/SidePanel/Builder/AssistantConversationStarters.tsx:62
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). (×2) — client/src/components/SidePanel/Builder/AssistantTool.tsx:80, client/src/components/SidePanel/Builder/ContextButton.tsx:90
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. — client/src/components/SidePanel/MCPBuilder/MCPServerDialog/MCPServerForm.tsx:42
This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. 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. — packages/client/src/components/MultiSelect.tsx:146
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.
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.
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".
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}. (×3) — client/src/components/Chat/Input/ChatForm.tsx:823, client/src/components/Chat/Input/Composer/Palette.tsx:1304, client/src/components/Chat/Trace/Ledger.tsx:512
This <div> binds mousedown, mouseup, mousemove, wheel 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. — client/src/components/Chat/Messages/Content/DialogImage.tsx:368
This <code> binds double-click and nothing else. 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. (×2) — client/src/components/Chat/Messages/Content/MarkdownComponents.tsx:71, client/src/components/Chat/Messages/Content/MarkdownComponents.tsx:102
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) — client/src/components/Chat/Messages/Content/UIResourceCarousel.tsx:80, client/src/components/Nav/NavToggle.tsx:54, client/src/components/SidePanel/Builder/AssistantTool.tsx:56
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler. (×2) — client/src/components/Chat/Messages/SubRow.tsx:12, client/src/components/Conversations/Convo.tsx:349
This <span> binds double-click and nothing else. 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. — client/src/components/Conversations/ConvoLink.tsx:156
This <div> carries tabIndex={0}, so it is in the tab order and a keyboard user will land on it — but its only behaviour is bound to mousemove, pointer gestures a keyboard cannot produce, and there is no key handler. The tab stop leads nowhere. Bind the same behaviour to a key handler, or provide an equivalent control elsewhere. — client/src/components/Insights/InsightsView.tsx:176
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" hides the element from assistive tech but leaves it keyboard-focusable — a confusing dead stop. Remove aria-hidden or make the element non-focusable. — client/src/components/Nav/SettingsTabs/Data/ImportConversations.tsx:132
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.
<svg> moves — its inline style sets `transition: transform 0.2s ease-in-out` — 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:. — client/src/components/Chat/Input/Files/DragDropOverlay.tsx:36
<div> moves — its inline style sets `transition: transform 300ms cubic-bezier(0.2, 0, 0, 1)` — 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:. (×2) — client/src/components/Prompts/forms/PromptForm.tsx:574, client/src/components/Prompts/forms/PromptForm.tsx:708
<div> moves — its `animate-spin` 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:. — client/src/components/SharePoint/SharePointPickerDialog.tsx:80
<div> 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:. — packages/client/src/components/AnimatedSearchInput.tsx:56
`.select-item` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — packages/client/src/components/Dropdown.css:75, client/src/style.css:2078
`html[data-input-modality='pointer'] :is(.lc-field, .lc-own-focus):focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — packages/client/src/components/Field.css:18
`html:not(.high-contrast) .lc-field:focus-visible` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — packages/client/src/components/Field.css:42
`html:root:not(.high-contrast) textarea.lc-own-focus:focus-visible` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — packages/client/src/components/Field.css:79
`.cm-content:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — client/src/mobile.css:177
`html[data-input-modality='pointer'] :where( input:not([type]), input:is( [type='text'], [type='search'], [type='email'], [type='password'], [type='url'], [type='tel'], [type='number'], [type='date'], [type='datetime-local'], [type='month'], [type='week'], [type='time'] ), textarea ):is(:focus, :focus-visible)` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — client/src/style.css:1966
`.animate-popover` moves (`transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
transform 150ms cubic-bezier(0.4, 0, 0.2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — packages/client/src/components/AnimatePopover.css:4
`.animate-popover-left` moves (`transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
transform 150ms cubic-bezier(0.4, 0, 0.2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. (×2) — packages/client/src/components/AnimatePopover.css:18, client/src/style.css:2132
`.popover-ui` moves (`transition-property: opacity, scale`) 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. (×2) — packages/client/src/components/Dropdown.css:23, client/src/style.css:2034
`.popover-animate` moves (`transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
transform 150ms cubic-bezier(0.4, 0, 0.2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. (×2) — packages/client/src/components/Dropdown.css:42, client/src/style.css:2045
`.rotate` moves (`animation: tuning 2.1s 1`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — client/src/mobile.css:75
`.shake` moves (`animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both`) 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. — client/src/mobile.css:173
`p > small` moves (`animation: fadein 3s forwards`) 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. — client/src/style.css:391
`.scroll-animation-exit-active` moves (`transition: opacity 180ms cubic-bezier(0.4, 0, 1, 1),
transform 180ms cubic-bezier(0.4, 0, 1, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — client/src/style.css:497
`.toast-root[data-state='open']` moves (`animation: toast-open 0.24s cubic-bezier(0.175, 0.885, 0.32, 1.175) both`) 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. — client/src/style.css:1397
`.rotate-adjust-and-back` moves (`animation: rotateAdjustAndBack 10s ease-in-out infinite`) 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. — client/src/style.css:1864
`.animate-popover-top` moves (`transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
transform 150ms cubic-bezier(0.4, 0, 0.2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — client/src/style.css:2117
`.animate-popover-top-left` moves (`transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
transform 150ms cubic-bezier(0.4, 0, 0.2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — client/src/style.css:2155
`.composer-effort-fill[data-dragging]` moves (`transition: width 60ms linear,
opacity 100ms ease-out`) 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. — client/src/style.css:2268
`.animate-gradient-x` moves (`animation: gradient-x 15s ease infinite`) 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. — client/src/style.css:2419
`.animate-pulse-slow` moves (`animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite`) 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. — client/src/style.css:2423
`.animate-fadeIn` moves (`animation: fadeIn 0.5s ease-out forwards`) 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. — client/src/style.css:2438
`.ios-wiggle` moves (`animation: ios-wiggle 0.2s ease-in-out infinite`) 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. — client/src/style.css:2456
`.ghost-badge` moves (`transition: left 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
top 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94)`) 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. — client/src/style.css:2460
`.badge-icon` moves (`transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94)`) 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. — client/src/style.css:2466
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 singleton services avoid mutable shared instance state that concurrent callers would race on.
Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.
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 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.
`AdminRolesDeps` declares 17 required operations: `listRoles`, `countRoles`, `getRoleByName`, `createRoleByName`, `updateRoleByName`, `updateAccessPermissions`, `deleteRoleByName`, `findUser`, `updateUser`, `updateUsersByRole`, `findUserIdsByRole`, `updateUsersRoleByIds`, `listUsersByRole`, `countUsersByRole`, `deleteConfig`, `deleteAclEntries`, `deleteGrantsForPrincipal`. 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/api/src/admin/roles.ts:122
`AdminUsersDeps` declares 17 required operations: `findUsers`, `countUsers`, `beginAgentTriggerUserDeletion`, `cancelAgentTriggerUserDeletion`, `drainAgentTriggerDeliveriesForUser`, `prepareAgentTriggerUserPurge`, `cancelAgentTriggerUserPurge`, `purgeAgentTriggerDeliveriesForUser`, `quiesceUserSchedules`, `restoreUserSchedulesFromDeletion`, `resolveErasure`, `deleteUserById`, `deleteUserCodeEnvironments`, `invalidateCodeEnvironmentConfigCache`, `deleteConfig`, `deleteAclEntries`, `deletePasskeysByUser`. 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/api/src/admin/users.ts:68
`IJobStore` declares 31 required operations: `initialize`, `createJob`, `getJob`, `updateJob`, `transitionStatus`, `claimIdempotencyKey`, `releaseIdempotencyKey`, `deleteJob`, `hasJob`, `getRunningJobs`, `cleanup`, `getJobCount`, `getJobCountByStatus`, `destroy`, `getActiveJobIdsByUser`, `setGraph`, `setContentParts`, `getContentParts`, `getRunSteps`, `appendChunk`, `clearContentState`, `setCollectedUsage`, `getCollectedUsage`, `enqueueSteer`, `drainSteers`, `closeAndDrainSteers`, `peekSteers`, `removeSteer`, `parkSteers`, `claimParkedSteers`, `clearSteers`. 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/api/src/stream/interfaces/IJobStore.ts:963
`IJobStoreV2` declares 57 required operations: `initialize`, `createJob`, `getJob`, `updateJob`, `markProviderExecutionDrained`, `beginProviderExecution`, `getCleanupBlockingJobIdsByUser`, `finalizeTerminalPersistence`, `transitionStatus`, `transitionStatusAndDrainSteers`, `claimIdempotencyKey`, `takeoverIdempotencyKey`, `markIdempotencyKeyStarted`, `adoptIdempotencyKeyForJob`, `releaseIdempotencyKey`, `deleteJob`, `hasJob`, `getRunningJobs`, `cleanup`, `getJobCount`, `getJobCountByStatus`, `destroy`, `getActiveJobIdsByUser`, `setGraph`, `setContentParts`, `getContentParts`, `settleEarlyBufferRecovery`, `finalizeEarlyBufferOverflow`, `hasSubscriberAttached`, `claimFirstSubscriber`, `detachSubscriber`, `hasActiveSubscriber`, `getRunSteps`, `appendChunk`, `clearContentState`, `setCollectedUsage`, `getCollectedUsage`, `enqueueSteer`, `enqueueSteerVersioned`, `enqueueSteerWithReceipt`, and 17 more. 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/api/src/stream/interfaces/IJobStore.ts:1109
`AgentTriggerService` declares 20 required operations: `initialize`, `stop`, `dispatch`, `enqueue`, `getDelivery`, `getDeliveryStatus`, `getDeadLetters`, `requeue`, `retire`, `renewProducerLease`, `persistBackgroundToolResult`, `getBackgroundToolResultClaim`, `getBackgroundCompletionResultBatchSize`, `getBackgroundCompletionReceiptBatching`, `getCompletionWaitMaxIntervalMs`, `expediteCompletionWakeups`, `drainUser`, `prepareUserPurge`, `cancelUserPurge`, `purgeUser`. 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/api/src/agents/triggers/service.ts:197
`OpenIDRefreshRecoveryDeps` declares 23 required operations: `findOpenIDUser`, `getOpenIdConfig`, `getOpenIdEmail`, `getOpenIdIssuer`, `createAuthIdentityContext`, `refreshOpenIDSession`, `storeOpenIDSession`, `setOpenIDAuthTokens`, `getOpenIDAppAuthToken`, `clearOpenIDAuthTokens`, `deleteOpenIDSession`, `createRefreshTokenBridgeFlightKey`, `createOpenIDRefreshFlightKey`, `storeRefreshTokenBridge`, `deleteRefreshTokenBridges`, `acquireOpenIDRefreshFlight`, `completeOpenIDRefreshFlight`, `failOpenIDRefreshFlight`, `waitForOpenIDRefreshFlight`, `assertOpenIDRefreshFlightAvailable`, `assertOpenIDRefreshSessionGenerationAvailable`, `revokeOpenIDRefreshFlights`, `withOpenIDRefreshFlightLease`. 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/api/src/auth/openid/recovery.ts:128
`ScheduleEngineDeps` declares 17 required operations: `getLimits`, `getUserContext`, `isOutOfBalance`, `agentAccess`, `projectAccess`, `hasScheduleAccess`, `resolveFiles`, `enqueueTrigger`, `getTriggerDelivery`, `runInTenantContext`, `getJobStatus`, `abortScheduledJob`, `clearReconciledJob`, `countActiveRunsGlobal`, `isGloballyDisabled`, `isOwnerDeleting`, `withGlobalCapacitySlot`. 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/api/src/schedules/types.ts:184
`SchedulesService` declares 19 required operations: `getLimits`, `fireScheduleNow`, `recordScheduleOutcome`, `recordMCPToolAuthFailure`, `getMCPReceiptRetryPolicy`, `registerMCPSettlement`, `beginScheduledStop`, `acknowledgeScheduledStopPersistence`, `claimScheduleResume`, `releaseScheduleResumeClaim`, `finalizeScheduleResumeClaim`, `releaseScheduleResumeFence`, `isScheduleLive`, `deleteScheduleForOwner`, `quiesceUserSchedules`, `restoreUserSchedulesFromDeletion`, `initializeScheduleEngine`, `initializeScheduleErasureSweep`, `reconcileRetainedJobs`. 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/api/src/schedules/service.ts:216
`SkillsHandlersDeps` declares 16 required operations: `createSkill`, `getSkillById`, `listSkillsByAccess`, `updateSkill`, `deleteSkill`, `deleteSkillById`, `listSkillFiles`, `deleteSkillFile`, `findAccessibleResources`, `findPubliclyAccessibleResources`, `hasPublicPermission`, `grantPermission`, `getSkillFileByPath`, `updateSkillFileContent`, `getStrategyFunctions`, `isValidObjectIdString`. 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/api/src/skills/handlers.ts:66
`MessagePartsHost` declares 19 required operations: `useMessage`, `renderMarkdown`, `useSmoothStreaming`, `useAgent`, `renderAgentIcon`, `useFontSize`, `useShowThinking`, `useAutoExpandTools`, `useLaTeXParsing`, `useChatDirection`, `useUserTextPreferences`, `useUser`, `useFileMap`, `useToast`, `useSandboxStarting`, `useToolArtifactClaim`, `useSteerEscalating`, `usePaneConversationId`, `useLiveAppliedSteer`. 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/chat/src/react/host.tsx:60
`ResumableCache` declares 18 required operations: `invalidateMessages`, `fetchMessages`, `refreshConversation`, `refreshConversationLists`, `refreshPinnedConversations`, `setStreamStatus`, `removeStreamStatus`, `invalidateStreamStatus`, `addActiveJob`, `removeActiveJob`, `fetchConversation`, `setConversation`, `upsertConversation`, `removeConversation`, `getConversation`, `removeConversationQueries`, `queueTitleGeneration`, `addOptimisticConversation`. 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/chat/src/core/resumable/host.ts:167
`SteerHost` declares 17 required operations: `useSteerMessage`, `useSteerMessageAsync`, `useCancelSteer`, `useArmSteer`, `useMarkFilesUsage`, `useEnqueueQueuedTurn`, `useCancelQueuedTurn`, `useQueuedTurns`, `useQueuedTurnCache`, `useFetchStreamStatus`, `useLatestMessage`, `useCodeApprovalMode`, `useLocalize`, `useNotify`, `useFileMap`, `useClearFilesToDelete`, `useSettings`. 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/chat/src/react/steer/host.tsx:82
`MessageMethods` declares 24 required operations: `getPersistedPrivateTextId`, `hasPersistedPrivateText`, `getPrivateMessageTexts`, `saveMessage`, `getConversationTraceRefs`, `hasSampledTraceMessage`, `recordSubagentTaskControlReceipt`, `getSubagentTaskControlReceipt`, `getSubagentTaskControlReplay`, `bulkSaveMessages`, `updateToolCallResult`, `claimBackgroundToolResults`, `confirmBackgroundToolResultClaim`, `releaseBackgroundToolResultClaims`, `updateMessage`, `claimSubagentTaskResult`, `releaseSubagentTaskResultClaim`, `getMessages`, `getMessagesForSubagentThreadView`, `listSubagentTasksForThreads`, `getMessage`, `getMessagesByCursor`, `searchMessages`, `deleteMessages`. 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/data-schemas/src/methods/message.ts:742
`ConversationMethods` declares 50 required operations: `getConvoFiles`, `searchConversation`, `saveConvo`, `stampForcedRetention`, `setConvoPinned`, `appendConvoMessageReference`, `getConvoCodeEnvironmentDecision`, `reserveConvoLaneGitSeq`, `getConvoLaneContext`, `setConvoLaneGit`, `getConvoLaneGit`, `getConvosLaneGit`, `addConvoToolApprovalAllows`, `readAdmittedConvoCodeEnvironmentDecision`, `replaceConvoCodeEnvironmentDecision`, `bulkSaveConvos`, `getConvosByCursor`, `getConvosQueried`, `getConvo`, `getConvoTitleState`, `getSubagentThreadForParent`, `listSubagentThreadsForParent`, `getAgentEventBinding`, `getAgentEventActorSnapshot`, `commitAgentEventActorState`, `storeAgentEventActorSuspension`, `claimAgentEventActorSuspension`, `settleAgentEventActorSuspension`, `cancelAgentEventActorSuspension`, `beginAgentEventActorLegacyTurn`, `completeAgentEventActorLegacyTurn`, `recordAgentEventActorReconciliation`, `resolveAgentEventActorReconciliation`, `clearAgentEventActorReconciliation`, `getAgentEventActorReconciliationStorageMetrics`, `expireLegacyAgentEventActorReceipts`, `reserveSubagentThread`, `acquireSubagentThreadLease`, `renewSubagentThreadLease`, `releaseSubagentThreadLease`, and 10 more. 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/data-schemas/src/methods/conversation.ts:288
`PromptMethods` declares 20 required operations: `getPromptGroups`, `deletePromptGroup`, `getAllPromptGroups`, `getListPromptGroupsByAccess`, `incrementPromptGroupUsage`, `createPromptGroup`, `savePrompt`, `getPrompts`, `getPrompt`, `getPromptGroup`, `getOwnedPromptGroupIds`, `getPromptGroupAccessContext`, `invalidatePromptGroupAccessContext`, `deletePrompt`, `deleteUserPrompts`, `updatePromptGroup`, `makePromptProduction`, `updatePromptLabels`, `findLangfusePromptGroup`, `createLangfusePromptGroup`. 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/data-schemas/src/methods/prompt.ts:114
`SkillLifecycleMethods` declares 32 required operations: `beginSkillDeletion`, `getSkillDeletion`, `discoverUnjournaledDeletions`, `listPendingSkillDeletions`, `listSkillDeletionTombstones`, `noteSkillDeletionAttempt`, `claimSkillDeletion`, `refreshSkillDeletionClaim`, `releaseSkillDeletionClaim`, `completeSkillDeletion`, `reopenSkillDeletion`, `scheduleSkillDeletionRecheck`, `reserveSkillUploadIntent`, `transitionSkillUploadIntent`, `listSkillUploadIntents`, `iterateSkillCleanupFiles`, `iterateSkillCleanupIntents`, `hasInFlightSkillUploads`, `listExistingSkillFileIds`, `getSkillUploadIntent`, `recoverStoppedSkillUploadIntent`, `finishSkillUploadCleanupHold`, `recoverStoppedSkillUploadCleanupHold`, `listAbandonedSkillUploadIntents`, `claimAbandonedSkillUploadIntent`, `refreshAbandonedSkillUploadIntentClaim`, `noteAbandonedSkillUploadIntentAttempt`, `releaseAbandonedSkillUploadIntentClaim`, `skillFileExistsForIntent`, `markSkillUploadIntentCleaned`, `queueCommittedSkillUploadCleanup`, `scheduleAbandonedSkillUploadIntentRecheck`. 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/data-schemas/src/methods/skillLifecycle.ts:58
`AgentQueuedTurnMethods` declares 25 required operations: `ensureAgentQueuedTurnIndexes`, `enqueueAgentQueuedTurn`, `getAgentQueuedTurnByClientRequestId`, `listActiveAgentQueuedTurns`, `listAgentQueuedTurnReceipts`, `findQueuedTurnsNeedingDelivery`, `claimQueuedTurnsForAdmissionReconciliation`, `deferAgentQueuedTurnAdmissionReconciliation`, `reserveAgentQueuedTurnDelivery`, `markQueuedTurnScheduled`, `cancelAgentQueuedTurn`, `claimNextAgentQueuedTurn`, `releaseAgentQueuedTurn`, `beginAgentQueuedTurnAdmission`, `markAgentQueuedTurnAdmitted`, `hasAgentQueuedTurnAdmissionReceipt`, `deadLetterAgentQueuedTurn`, `getEffectiveAgentQueuedTurnPredecessor`, `deleteAgentQueuedTurns`, `prepareAgentQueuedTurnConversationDeletion`, `deletePreparedAgentQueuedTurnConversations`, `markAgentQueuedTurnDeliveryRetired`, `beginAgentQueuedTurnMissingDeliveryRetirement`, `markAgentQueuedTurnMissingDeliveryRetired`, `deleteAllAgentQueuedTurnsForUser`. 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/data-schemas/src/methods/queuedTurn.ts:200
`AgentTriggerDeliveryMethods` declares 54 required operations: `ensureAgentTriggerDeliveryIndexes`, `enqueueAgentTriggerDelivery`, `claimNextAgentTriggerDelivery`, `findEarlierAgentTriggerDelivery`, `getAgentTriggerDeliveryBatch`, `releaseAgentTriggerDelivery`, `beginAgentTriggerDeliveryAttempt`, `deferAgentTriggerDeliveryAttempt`, `completeAgentTriggerDelivery`, `retireAgentTriggerDelivery`, `renewAgentTriggerDeliveryProducerLease`, `getAgentTriggerDeliveryProducerLease`, `listPendingAgentBackgroundToolCompletions`, `listUndeliveredAgentTriggerTaskIds`, `expediteAgentTriggerDeliveries`, `persistAgentBackgroundToolResult`, `getAgentBackgroundToolResult`, `getAgentBackgroundToolResultClaim`, `claimAgentBackgroundToolResults`, `releaseAgentBackgroundToolResultClaims`, `claimAgentBackgroundToolResultBatch`, `getAgentBackgroundToolResultBatch`, `beginAgentBackgroundToolResultBatchDispatch`, `confirmAgentBackgroundToolResultBatch`, `settleAgentTriggerHandlingOutcome`, `admitAgentEventActorAction`, `releaseAgentEventActorAction`, `getAgentEventActorActionAdmission`, `hasAgentEventActorActionAdmission`, `reserveAgentEventActorDetachedAction`, `markAgentEventActorDetachedActionRunning`, `markAgentEventActorDetachedActionLaunchIndeterminate`, `settleAgentEventActorDetachedAction`, `getAgentEventActorDetachedAction`, `settleAgentEventActorReceipt`, `getAgentEventActorReceipt`, `backfillAgentEventActorReceipt`, `getAgentEventActorReceiptStorageMetrics`, `retryAgentTriggerDelivery`, `deadLetterAgentTriggerDelivery`, and 14 more. 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/data-schemas/src/methods/triggerDelivery.ts:360
What to do
Split fat interfaces into focused role-interfaces so clients depend only on what they use.
Do you agree with this assessment?
C1 · Data Protection8.0 / 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. — REDACTED:472
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 Trail10.0 / 10Exemplary✓ Tool-verified
Other · Security — Whether changes to sensitive data are recorded (who, what, when) for compliance + incident response.
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.
Other · Security — Whether GDPR data-subject requests are supported in code — erasure, export/portability, consent.
Method: Roslyn scan: GDPR data-subject-rights corroboration (erasure/export/consent vocabulary co-occurring with subject-id store crossing or explicit GDPR pattern). Deterministic, gated by PII.
Corroborated rights: erasure ✓ · export ✗ · consent ✗. Each tick means this scan found code in the repository implementing that right — a deletion/anonymisation path for erasure, a data-export or portability path for export, and consent state recorded alongside the personal data it authorises. A ✗ therefore means no such code was recognised HERE, not that the right is unsupported: a capability provided by a platform, a manual runbook, or code spelled in a way this scan does not match is not visible to it. Confirm before treating a cross as a gap; where it is one, the right has to be fulfilled manually.
What to do
Implement data export/portability for a data subject (a machine-readable export of their personal data).
Track GDPR consent (lawful basis) alongside the personal data it authorises.
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 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.
client.src.components.SidePanel.Agents.Tools.items.types.BuiltinItem's [id, kind] are judged in client.src.components.SidePanel.Agents.Tools.ItemDialog.ItemDialog, client.src.components.SidePanel.Agents.Tools.ToolCard, client.src.components.SidePanel.Agents.Tools.ToolsMarketplaceDialog — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
packages.api.src.agents.files.manifest.RunFileScope's [conversationId, runId] are judged in packages.api.src.agents.files.manifest, packages.api.src.agents.files.session — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
packages.api.src.agents.subagentCompletionWakeup.GenerationState's [metadata, status] are judged in packages.api.src.agents.backgroundCompletionWakeup, packages.api.src.agents.queuedTurns, packages.api.src.agents.subagentCompletionWakeup — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
packages.api.src.agents.triggers.envelope.AgentContinueTarget's [bindingId, sourceKeyId] are judged in packages.api.src.agents.triggers.batch, packages.api.src.agents.triggers.continuation, packages.api.src.agents.triggers.delivery, packages.api.src.agents.triggers.service — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
packages.api.src.agents.triggers.envelope.AgentTriggerSource's [id, type] are judged in packages.api.src.agents.backgroundCompletionWakeup, packages.api.src.agents.queuedTurns, packages.api.src.agents.subagentCompletionWakeup, packages.api.src.agents.triggers.batch, packages.api.src.agents.triggers.bindingResolver, packages.api.src.agents.triggers.host — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
packages.api.src.agents.triggers.host.AgentTriggerExecutionError's [code, status] are judged in packages.api.src.agents.triggers.engine, packages.api.src.agents.triggers.host — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
packages.api.src.auth.openid.types.OpenIDPublicationGeneration's [key, ownerId] are judged in packages.api.src.auth.openid.recovery, packages.api.src.auth.openid.session — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
packages.api.src.mcp.registry.cache.ReadThroughAllCache.FillToken's [generation, key] are judged in packages.api.src.mcp.registry.cache.ReadThroughAllCache.ReadThroughAllCache, packages.api.src.mcp.registry.cache.ReadThroughCache.ReadThroughCache — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
packages.api.src.schedules.types.JobState's [providerDrained, terminalHostActionPending, terminalPersistencePending] are judged in packages.api.src.schedules.engine, packages.api.src.schedules.erasure — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
packages.api.src.schedules.types.JobState's [scheduleId, scheduledFor] are judged in packages.api.src.schedules.engine, packages.api.src.schedules.erasure — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
packages.api.src.stream.interfaces.IJobStore.SerializableJobData's [createdAt, providerDrained, terminalHostActionPending, terminalPersistencePending] are judged in packages.api.src.schedules.service, packages.api.src.stream.GenerationJobManager.GenerationJobManagerClass — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
packages.api.src.stream.interfaces.IJobStore.SerializableJobData's [createdAt, userId] are judged in packages.api.src.schedules.service, packages.api.src.stream.GenerationJobManager.GenerationJobManagerClass — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
packages.api.src.stream.interfaces.IJobStore.SerializableJobData's [status, terminalPersistencePending] are judged in packages.api.src.stream.GenerationJobManager.GenerationJobManagerClass, packages.api.src.stream.settled — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
packages.api.src.stream.internal.replay.ReplayLimits's [bytes, items] are judged in packages.api.src.stream.implementations.InMemoryEventTransport.InMemoryEventTransport, packages.api.src.stream.implementations.RedisEventTransport.RedisEventTransport — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
packages.chat.src.core.resumable.host.StreamStatusResponse's [active, createdAt] are judged in packages.chat.src.core.resumable.ceiling, packages.chat.src.core.resumable.missing, packages.chat.src.core.resumable.reconcile, packages.chat.src.core.resumable.subscription.ResumableSubscription, packages.chat.src.core.resumable.terminal — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
What to do
Move each repeated judgement onto the type that owns the members it reads, so the rule has one home and cannot drift.
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.
A shipped function's whole body still throws a "not implemented" error — generated scaffolding that was never completed. Implement it or remove the dead surface. — api/app/clients/BaseClient.js:350
What to do
Finish or delete the functions that still throw "not implemented", and replace placeholder text before shipping.
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.
`summarizeMessages` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — api/app/clients/BaseClient.js:350
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. (×2) — api/server/controllers/agents/responses.js:560, client/src/components/SidePanel/Agents/Tools/ToolCard.tsx:53
`createOnTextProgress` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — api/server/services/AssistantService.js:31
The guard above `return 'webm';` also returns `'webm'`, so no input can make it matter. Implement the distinction that was intended, or delete the guard. — api/server/services/Files/Audio/STTService.js:119
`addContentData` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — api/server/services/Runs/StreamRunManager.js:111
`handleThreadCreated` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — api/server/services/Runs/StreamRunManager.js:207
`handleRunStepEvent` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — api/server/services/Runs/StreamRunManager.js:231
`handleRunStepDeltaEvent` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — api/server/services/Runs/StreamRunManager.js:414
`handleErrorEvent` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — api/server/services/Runs/StreamRunManager.js:473
`onRunStepCreated` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — api/server/services/Runs/StreamRunManager.js:616
`onRunStepCompleted` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — api/server/services/Runs/StreamRunManager.js:660
The guard above `return storedSecret;` also returns `storedSecret`, so no input can make it matter. Implement the distinction that was intended, or delete the guard. — api/server/services/twoFactorService.js:171
`setupSaml` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — api/strategies/samlStrategy.js:311
`noRefresh` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — client/src/components/Chat/BackgroundTasks/useTasks.ts:25
`onSave` 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. — client/src/components/Prompts/forms/PromptForm.tsx:227
`handleUIAction` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — client/src/utils/index.ts:160
`validateDockerRunning` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. (×2) — REDACTED:4, config/update.js:44
`showHelp` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — config/flush-cache.js:53
`flushFileCache` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — config/flush-cache.js:228
`restartRecommendation` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — config/flush-cache.js:280
The guard above `return replaceAll;` also returns `replaceAll`, so no input can make it matter. Implement the distinction that was intended, or delete the guard. — packages/api/src/agents/edits.ts:39
`getNoCanonicalFiles` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — packages/api/src/imports.ts:65
`fetchServerInstructions` 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/api/src/mcp/registry/MCPServerInspector.ts:167
`update` 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/api/src/mcp/registry/cache/ServerConfigsCacheInMemory.ts:23
`upsert` 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/api/src/mcp/registry/cache/ServerConfigsCacheInMemory.ts:31
`patch` 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/api/src/mcp/registry/cache/ServerConfigsCacheInMemory.ts:37
`remove` 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/api/src/mcp/registry/cache/ServerConfigsCacheInMemory.ts:73
`reset` 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/api/src/mcp/registry/cache/ServerConfigsCacheInMemory.ts:87
`deleteSkillNode` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it. — packages/data-provider/src/data-service.ts:1579
`observeAgentEventActorReceipt` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — packages/data-schemas/src/methods/triggerDelivery.ts:103
`disconnectTaskRouting` has an empty body — confirm it's an intentional no-op and not an unfinished method. — api/server/services/Endpoints/agents/subagentThreadStore.js:96
`ask` has an empty body — confirm it's an intentional no-op and not an unfinished method. — client/src/Providers/MessagesViewContext.tsx:182
`regenerate` has an empty body — confirm it's an intentional no-op and not an unfinished method. — client/src/Providers/MessagesViewContext.tsx:183
`handleContinue` has an empty body — confirm it's an intentional no-op and not an unfinished method. — client/src/Providers/MessagesViewContext.tsx:184
`setMessages` has an empty body — confirm it's an intentional no-op and not an unfinished method. — client/src/Providers/MessagesViewContext.tsx:186
`retainView` has an empty body — confirm it's an intentional no-op and not an unfinished method. — client/src/components/Nav/KeyboardDeleteDialog.tsx:6
A bare `eslint-disable` or `@ts-nocheck` with no rule list switches every lint rule or the whole type checker off for the rest of the file — hidden debt. Disable the specific rule on the specific line, with a justification, instead. (×2) — config/delete-user.js:3, config/packages.js:2
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
Add a build/run (quick start) section to the root README — the first thing a newcomer needs.
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 6 of 8 project(s) that lack one — worth up to 1.5 pts.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the 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 9/10 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`.
`config/circular-deps.mjs` reports through `console.*` at line 216 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/circular-deps.mjs:216
`config/circular-deps.mjs` reports through `console.*` at line 219 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/circular-deps.mjs:219
`config/circular-deps.mjs` reports through `console.*` at line 221 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/circular-deps.mjs:221
`config/circular-deps.mjs` reports through `console.*` at line 231 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/circular-deps.mjs:231
`config/connect.js` reports through `console.*` at line 33 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/connect.js:33
`config/delete-banner.js` reports through `console.*` at line 29 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/delete-banner.js:29
`config/delete-banner.js` reports through `console.*` at line 30 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/delete-banner.js:30
`config/delete-banner.js` reports through `console.*` at line 31 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/delete-banner.js:31
`config/delete-banner.js` reports through `console.*` at line 32 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/delete-banner.js:32
`config/delete-banner.js` reports through `console.*` at line 44 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/delete-banner.js:44
`config/delete-banner.js` reports through `console.*` at line 53 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/delete-banner.js:53
`config/delete-banner.js` reports through `console.*` at line 54 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/delete-banner.js:54
`config/helpers.js` reports through `console.*` at line 120 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/helpers.js:120
`config/helpers.js` reports through `console.*` at line 121 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/helpers.js:121
`config/helpers.js` reports through `console.*` at line 122 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/helpers.js:122
`config/helpers.js` reports through `console.*` at line 123 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/helpers.js:123
`config/helpers.js` reports through `console.*` at line 124 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/helpers.js:124
`config/helpers.js` reports through `console.*` at line 125 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/helpers.js:125
`config/helpers.js` reports through `console.*` at line 126 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/helpers.js:126
`config/helpers.js` reports through `console.*` at line 127 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/helpers.js:127
`config/helpers.js` reports through `console.*` at line 128 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/helpers.js:128
`config/list-balances.js` reports through `console.*` at line 40 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/list-balances.js:40
`config/list-balances.js` reports through `console.*` at line 41 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/list-balances.js:41
`config/list-users.js` reports through `console.*` at line 15 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/list-users.js:15
`config/list-users.js` 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. — config/list-users.js:16
`config/list-users.js` reports through `console.*` at line 18 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/list-users.js:18
`config/list-users.js` reports through `console.*` at line 19 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/list-users.js:19
`config/list-users.js` reports through `console.*` at line 20 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/list-users.js:20
`config/list-users.js` reports through `console.*` at line 21 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/list-users.js:21
`config/list-users.js` reports through `console.*` at line 22 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/list-users.js:22
`config/list-users.js` 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. — config/list-users.js:23
`config/list-users.js` reports through `console.*` at line 24 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/list-users.js:24
`config/list-users.js` reports through `console.*` at line 25 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/list-users.js:25
`config/list-users.js` reports through `console.*` at line 30 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/list-users.js:30
`config/list-users.js` reports through `console.*` at line 33 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/list-users.js:33
`config/list-users.js` reports through `console.*` at line 36 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/list-users.js:36
`config/migrate-terms-timestamp.js` reports through `console.*` at line 129 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/migrate-terms-timestamp.js:129
`config/migrate-terms-timestamp.js` reports through `console.*` at line 130 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/migrate-terms-timestamp.js:130
`config/reset-meili-sync.js` reports through `console.*` at line 85 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — config/reset-meili-sync.js:85
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.
No static application security testing detected. For this repository's stack, add CodeQL's javascript-typescript pack, `semgrep --config=p/typescript`, or eslint-plugin-security as a CI step. What was searched, so you can tell an absence from a miss: the 266605 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
What to do
Add a SAST step to CI running what this repository's stack ships: CodeQL's javascript-typescript pack, `semgrep --config=p/typescript`, or eslint-plugin-security — so a security regression fails the build instead of landing.
Enable Dependabot/Renovate or a dependency-review gate.
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 releases are traceable — a maintained changelog and explicit version stamping.
Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.
No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
What to do
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
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.
`axios.post(` 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. (×9) — api/app/clients/tools/structured/FluxAPI.js:249, api/app/clients/tools/structured/FluxAPI.js:484, api/app/clients/tools/structured/OpenAIImageTools.js:364, …
`axios.get(` 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. (×6) — api/app/clients/tools/structured/FluxAPI.js:276, api/app/clients/tools/structured/FluxAPI.js:388, api/app/clients/tools/structured/FluxAPI.js:398, …
`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. (×21) — api/app/clients/tools/structured/FluxAPI.js:318, api/app/clients/tools/structured/FluxAPI.js:550, api/app/clients/tools/structured/GoogleSearch.js:58, …
`axios(` 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) — packages/api/src/oauth/tokens.ts:216, packages/api/src/oauth/tokens.ts:323
`fetchFn(` 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) — packages/api/src/pulls/transport.ts:17, packages/api/src/pulls/transport.ts:19
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 · 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 `_call` 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. — api/app/clients/tools/structured/StableDiffusion.js:145
`fs.mkdirSync` in `_call` 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. — api/app/clients/tools/structured/StableDiffusion.js:146
`fs.readFileSync` in `startServer` 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) — REDACTED:538, REDACTED:300
`fs.existsSync` in `prepareImagesLocal` 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. — api/server/services/Files/Local/images.js:86
`fs.mkdirSync` in `prepareImagesLocal` 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. — api/server/services/Files/Local/images.js:87
`fs.rmSync` in `auditPage` 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. — e2e/lighthouse/audit.ts:60
`fs.mkdirSync` in `auditPage` 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. — e2e/lighthouse/audit.ts:61
`fs.existsSync` in `auditPage` 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. — e2e/lighthouse/audit.ts:84
`fs.readdirSync` in `auditPage` 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) — e2e/lighthouse/audit.ts:84, e2e/lighthouse/audit.ts:92
`fs.readFileSync` in `auditPage` 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. — e2e/lighthouse/audit.ts:87
`fs.writeFileSync` in `auditPage` 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. — e2e/lighthouse/audit.ts:88
`fs.readFileSync` in `callback to reports.map` 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. — e2e/lighthouse/audit.ts:95
`fs.readFileSync` in `installReactScan` 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. — e2e/perf/scan.ts:155
`generateKeyPairSync` in `startManagementOidc` 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. — e2e/setup/agent-management.ts:19
`fs.readFileSync` in `anonymous function` 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. — e2e/specs/mock/lia.helpers.ts:22
`fs.readFileSync` in `assertEnabled` 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. — packages/api/openapi/router.smoke.cjs:135
`fs.unlinkSync` in `provisionToVectorDB` 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. — packages/api/src/files/provision/service.ts:462
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 Safety8.7 / 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.
147 duplicated blocks under the repository root have copies in at least two of the sibling directories api, client, config, packages, scripts — 76 of them are reported below, and 71 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 147 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 147 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 147 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. — client/src/components/Chat/Messages/Content/Parts/Thinking.tsx:268
88 duplicated blocks under packages/api/src/ have copies in at least two of the sibling directories acl, actions, admin, agents, apiKeys, app (+29 more sibling(s) not listed) — 40 of them are reported below, and 48 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 88 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 88 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 88 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/api/src/agents/migration.ts:35
87 duplicated blocks under client/src/components/ have copies in at least two of the sibling directories Agents, Appearance, Artifacts, Auth, Bookmarks, Chat (+18 more sibling(s) not listed) — 39 of them are reported below, and 48 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 87 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 87 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 87 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. — client/src/components/Chat/Messages/ui/MessageRender.tsx:29
66 duplicated blocks under packages/ have copies in at least two of the sibling directories api, chat, data-provider, data-schemas — 20 of them are reported below, and 46 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 66 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 66 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 66 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/api/src/agents/usage.ts:436
43 duplicated blocks under client/src/ have copies in at least two of the sibling directories Providers, components, data-provider, hooks, locales, routes (+2 more sibling(s) not listed) — 23 of them are reported below, and 20 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 43 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 43 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 43 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. — client/src/data-provider/mutations.ts:1283
23 duplicated blocks under client/src/components/SidePanel/ have copies in at least two of the sibling directories Agents, Bookmarks, Builder, MCPBuilder, Memories, Parameters (+1 more sibling(s) not listed) — 18 of them are reported below, and 5 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 23 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 23 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 23 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. — client/src/components/SidePanel/Agents/ActionsInput.tsx:37
13 duplicated blocks under api/server/ have copies in at least two of the sibling directories controllers, middleware, routes, services — 7 of them are reported below, and 6 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. — api/server/controllers/agents/client.js:3424
13 duplicated blocks under client/src/components/Chat/ have copies in at least two of the sibling directories BackgroundTasks, Input, Menus, Messages, Subagents, Trace (+1 more sibling(s) not listed) — 7 of them are reported below, and 6 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. — client/src/components/Chat/Menus/Endpoints/ModelSelectorContext.tsx:285
10 duplicated blocks under client/src/data-provider/ have copies in at least two of the sibling directories Agents, Auth, BackgroundTasks, Endpoints, Files, Insights (+7 more sibling(s) not listed) — 2 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 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 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 10 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. — client/src/data-provider/Memories/queries.ts:84
8 duplicated blocks under client/src/hooks/ have copies in at least two of the sibling directories Agents, Chat, Conversations, Files, Input, MCP (+2 more sibling(s) not listed) — 4 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 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. — client/src/hooks/Agents/useAgentUploadTarget.ts:62
8 of the duplicated blocks reported below have copies in at least two of the sibling directories activityLabels, activityPhases, hitl, openai, reasoningLabels, responses (+1 more sibling(s) not listed) under packages/api/src/agents/. 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/api/src/agents/activityPhases/runtime.ts:204
6 duplicated blocks under packages/api/src/endpoints/ have copies in at least two of the sibling directories anthropic, google, openai — 5 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 6 and which does not depend on how exactly each block's copies still match. 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. — packages/api/src/endpoints/google/llm.ts:661
5 duplicated blocks under client/src/components/Nav/SettingsTabs/ have copies in at least two of the sibling directories Account, ApiKeys, Chat, Data, General, Integrations (+2 more sibling(s) not listed) — 4 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 5 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 5 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 5 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. — client/src/components/Nav/SettingsTabs/Data/SharedLinks.tsx:55
5 duplicated blocks under client/src/components/Nav/SettingsTabs/Speech/ have copies in at least two of the sibling directories STT, TTS — 3 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 5 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 5 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 5 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. — client/src/components/Nav/SettingsTabs/Speech/STT/EngineSTTDropdown.tsx:11
5 duplicated blocks under packages/data-schemas/src/ have copies in at least two of the sibling directories app, methods, schema, types — 2 of them are reported below, and 3 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 5 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 5 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 5 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/data-schemas/src/schema/preset.ts:10
api/server/controllers/agents/openai.js:539 · api/server/controllers/agents/responses.js:794 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — api/server/controllers/agents/openai.js:539
client/src/components/SidePanel/Agents/ActionsInput.tsx:37 · client/src/components/SidePanel/Builder/ActionsInput.tsx:25 — the two spans are one implementation copied and then locally edited — 965 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. — client/src/components/SidePanel/Agents/ActionsInput.tsx:37
client/src/components/Chat/Input/Mention.tsx:58 · client/src/components/Chat/Input/PromptsCommand.tsx:81 — the two spans are one implementation copied and then locally edited — 913 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. — client/src/components/Chat/Input/Mention.tsx:58
client/src/components/Nav/SettingsTabs/Data/SharedLinks.tsx:55 · client/src/components/Nav/SettingsTabs/General/ArchivedChatsTable.tsx:61 — the two spans are one implementation copied and then locally edited — 763 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. — client/src/components/Nav/SettingsTabs/Data/SharedLinks.tsx:55
config/migrate-agent-permissions.js:6 · config/migrate-prompt-permissions.js:6 — the two spans are one implementation copied and then locally edited — 908 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. — config/migrate-agent-permissions.js:6
client/src/components/Skills/forms/CreateSkillForm.tsx:98 · client/src/components/Skills/forms/SkillForm.tsx:108 — the two spans are one implementation copied and then locally edited — 635 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. — client/src/components/Skills/forms/CreateSkillForm.tsx:98
client/src/components/Chat/Messages/Content/Parts/BashCall.tsx:40 · client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx:70 — the two spans are one implementation copied and then locally edited — 658 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. — client/src/components/Chat/Messages/Content/Parts/BashCall.tsx:40
client/src/components/Chat/Messages/ui/MessageRender.tsx:29 · client/src/components/Messages/ContentRender.tsx:38 — the two spans are one implementation copied and then locally edited — 626 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. — client/src/components/Chat/Messages/ui/MessageRender.tsx:29
REDACTED:47 · api/server/controllers/assistants/v2.js:21 — the two spans are one implementation copied and then locally edited — 389 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. — REDACTED:47
packages/api/src/agents/added.ts:60 · packages/api/src/agents/load.ts:36 — the two spans are one implementation copied and then locally edited — 686 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/api/src/agents/added.ts:60
packages/api/src/pulls/bitbucket.ts:176 · packages/api/src/pulls/gitlab.ts:151 — the two spans are one implementation copied and then locally edited — 702 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/api/src/pulls/bitbucket.ts:176
REDACTED:104 · REDACTED:33 — the two spans are one implementation copied and then locally edited — 708 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. — REDACTED:104
api/server/controllers/assistants/chatV1.js:539 · REDACTED:360 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — api/server/controllers/assistants/chatV1.js:539
api/server/controllers/assistants/chatV1.js:140 · api/server/controllers/assistants/errors.js:59 — the two spans are one implementation copied and then locally edited — 611 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. — api/server/controllers/assistants/chatV1.js:140
client/src/components/SidePanel/Agents/FileContext.tsx:34 · client/src/components/SidePanel/Agents/FileSearch.tsx:31 — the two spans are one implementation copied and then locally edited — 521 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. — client/src/components/SidePanel/Agents/FileContext.tsx:34
packages/api/src/admin/config.ts:3397 · packages/api/src/admin/config.ts:3730 — the two spans are one implementation copied and then locally edited — 588 tokens are still identical, in the same order in both spans, 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/api/src/admin/config.ts:3397
api/server/controllers/assistants/chatV1.js:692 · REDACTED:520 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — api/server/controllers/assistants/chatV1.js:692
packages/api/src/agents/migration.ts:35 · packages/api/src/prompts/migration.ts:33 — the two spans are one implementation copied and then locally edited — 541 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/api/src/agents/migration.ts:35
packages/api/src/agents/validation.ts:590 · packages/api/src/agents/validation.ts:720 — the two spans are one implementation copied and then locally edited — 780 tokens are still identical, in the same order in both spans, 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/api/src/agents/validation.ts:590
packages/api/src/pulls/github.ts:220 · packages/api/src/pulls/gitlab.ts:143 — the two spans are one implementation copied and then locally edited — 522 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/api/src/pulls/github.ts:220
client/src/components/Chat/Messages/MessageParts.tsx:36 · client/src/components/Messages/ContentRender.tsx:98 — the two spans are one implementation copied and then locally edited — 467 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. — client/src/components/Chat/Messages/MessageParts.tsx:36
packages/api/src/agents/responses/handlers.ts:326 · packages/api/src/agents/responses/handlers.ts:603 — the two spans are one implementation copied and then locally edited — 539 tokens are still identical, in the same order in both spans, 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/api/src/agents/responses/handlers.ts:326
api/app/clients/tools/structured/FluxAPI.js:263 · api/app/clients/tools/structured/FluxAPI.js:497 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — api/app/clients/tools/structured/FluxAPI.js:263
client/src/components/Conversations/ProjectsSection.tsx:189 · client/src/components/Projects/ProjectsView.tsx:40 — the two spans are one implementation copied and then locally edited — 430 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. — client/src/components/Conversations/ProjectsSection.tsx:189
client/src/components/SidePanel/Memories/MemoryCreateDialog.tsx:50 · client/src/components/SidePanel/Memories/MemoryEditDialog.tsx:63 — the two spans are one implementation copied and then locally edited — 521 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. — client/src/components/SidePanel/Memories/MemoryCreateDialog.tsx:50
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.
client/src/hooks/Chat/__tests__/turn.messageIds.spec.ts:5 reaches past another workspace package's public entry into its internals with a relative path (../../../../../packages/api/src/middleware/messageIds) — 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. — client/src/hooks/Chat/__tests__/turn.messageIds.spec.ts:5
config/invite-user.js:7 reaches into another package with a relative path (../api/models) — import the package by name instead. — config/invite-user.js:7
config/invite-user.js:8 reaches into another package with a relative path (../api/server/utils) — import the package by name instead. — config/invite-user.js:8
e2e/specs/mock/scenarios/action-method-labels.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/action-method-labels.spec.ts:3
e2e/specs/mock/scenarios/badge-label.spec.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/badge-label.spec.ts:4
e2e/specs/mock/scenarios/button-roles.spec.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/button-roles.spec.ts:4
e2e/specs/mock/scenarios/chrome-border.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/chrome-border.spec.ts:3
e2e/specs/mock/scenarios/chrome-quiet-surfaces.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/chrome-quiet-surfaces.spec.ts:3
e2e/specs/mock/scenarios/clickhouse-checkbox.spec.ts:5 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/clickhouse-checkbox.spec.ts:5
e2e/specs/mock/scenarios/clickhouse-control-radius.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/clickhouse-control-radius.spec.ts:3
e2e/specs/mock/scenarios/clickhouse-layers.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/clickhouse-layers.spec.ts:3
e2e/specs/mock/scenarios/clickhouse-spacing-mono.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/clickhouse-spacing-mono.spec.ts:3
e2e/specs/mock/scenarios/clickhouse-switch.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/clickhouse-switch.spec.ts:3
e2e/specs/mock/scenarios/clickhouse-table.spec.ts:6 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/clickhouse-table.spec.ts:6
e2e/specs/mock/scenarios/clickhouse-theme-shape.spec.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/clickhouse-theme-shape.spec.ts:4
e2e/specs/mock/scenarios/clickhouse-theme.spec.ts:5 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/clickhouse-theme.spec.ts:5
e2e/specs/mock/scenarios/clickhouse-theme.spec.ts:6 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/data-provider/src/themes/default) — 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. — e2e/specs/mock/scenarios/clickhouse-theme.spec.ts:6
e2e/specs/mock/scenarios/clickhouse-theme.spec.ts:7 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/data-provider/src/themes/dark) — 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. — e2e/specs/mock/scenarios/clickhouse-theme.spec.ts:7
e2e/specs/mock/scenarios/control-border.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/control-border.spec.ts:3
e2e/specs/mock/scenarios/control-border.spec.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/data-provider/src/themes/dark) — 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. — e2e/specs/mock/scenarios/control-border.spec.ts:4
e2e/specs/mock/scenarios/control-spacing.spec.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/control-spacing.spec.ts:4
e2e/specs/mock/scenarios/corner-roles.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/corner-roles.spec.ts:3
e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts:6 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/api/src/html/theme) — 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. — e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts:6
e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts:10 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts:10
e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts:11 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/data-provider/src/themes/registry) — 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. — e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts:11
e2e/specs/mock/scenarios/deployment-theme.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/deployment-theme.spec.ts:3
e2e/specs/mock/scenarios/deployment-theme.spec.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/data-provider/src/themes/default) — 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. — e2e/specs/mock/scenarios/deployment-theme.spec.ts:4
e2e/specs/mock/scenarios/deployment-theme.spec.ts:5 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/data-provider/src/themes/dark) — 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. — e2e/specs/mock/scenarios/deployment-theme.spec.ts:5
e2e/specs/mock/scenarios/dialog-chrome.spec.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/dialog-chrome.spec.ts:4
e2e/specs/mock/scenarios/field-fill.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/field-fill.spec.ts:3
e2e/specs/mock/scenarios/field-focus.spec.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/field-focus.spec.ts:4
e2e/specs/mock/scenarios/field-variants.spec.ts:5 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/field-variants.spec.ts:5
e2e/specs/mock/scenarios/file-tile-theme.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/file-tile-theme.spec.ts:3
e2e/specs/mock/scenarios/focus-outline.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/focus-outline.spec.ts:3
e2e/specs/mock/scenarios/focus-role-utilities.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/focus-role-utilities.spec.ts:3
e2e/specs/mock/scenarios/focus-subtle.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/focus-subtle.spec.ts:3
e2e/specs/mock/scenarios/input-number-disabled.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/input-number-disabled.spec.ts:3
e2e/specs/mock/scenarios/input-number-option-focus.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/input-number-option-focus.spec.ts:3
e2e/specs/mock/scenarios/literal-roles-theme.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/literal-roles-theme.spec.ts:3
e2e/specs/mock/scenarios/media-overlay-theme.spec.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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. — e2e/specs/mock/scenarios/media-overlay-theme.spec.ts:4
What to do
Fix the listed violations: import through public entries (package exports / slice index), never reach into another layer or package's internals.
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.
initializeAgent has cyclomatic complexity 288 and cognitive complexity 332; 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/api/src/agents/initialize.ts:1221
ResumableAgentController has cyclomatic complexity 238 and cognitive complexity 348; 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. — api/server/controllers/agents/request.js:769
ResumeAgentController has cyclomatic complexity 208 and cognitive complexity 335; 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. — api/server/controllers/agents/resume.js:772
(anonymous) has cyclomatic complexity 192 and cognitive complexity 317; 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/api/src/agents/triggers/outcome.ts:323
getOpenAILLMConfig has cyclomatic complexity 159 and cognitive complexity 257; 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/api/src/endpoints/openai/llm.ts:601
startGeneration has cyclomatic complexity 155 and cognitive complexity 234; 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. — api/server/controllers/agents/request.js:2261
SubagentThreadPanel has cyclomatic complexity 150 and cognitive complexity 142; 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. — client/src/components/Chat/Subagents/SubagentThreadPanel.tsx:127
runCheckBackgroundTask has cyclomatic complexity 127 and cognitive complexity 396; 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/api/src/agents/background.ts:2518
deserializeJob has cyclomatic complexity 124 and cognitive complexity 125; 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/api/src/stream/implementations/RedisJobStore.ts:5620
isValidResult has cyclomatic complexity 121 and cognitive complexity 99; 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. — packages/api/src/code/workspace.ts:928
callTool has cyclomatic complexity 117 and cognitive complexity 214; 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/api/src/mcp/MCPManager.ts:1486
subscribeWithResume has cyclomatic complexity 117 and cognitive complexity 192; 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/api/src/stream/GenerationJobManager.ts:6168
updateInterfacePermissions has cyclomatic complexity 117 and cognitive complexity 170; 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/api/src/app/permissions.ts:104
validateSettingDefinitions has cyclomatic complexity 112 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 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/data-provider/src/generate.ts:256
recordScheduleOutcome has cyclomatic complexity 111 and cognitive complexity 141; 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/api/src/schedules/service.ts:1428
createJob has cyclomatic complexity 108 and cognitive complexity 106; 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. — packages/api/src/stream/implementations/RedisJobStore.ts:2053
executeWorkspaceTool has cyclomatic complexity 107 and cognitive complexity 143; 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/api/src/code/workspace.ts:1310
createJob has cyclomatic complexity 106 and cognitive complexity 139; 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/api/src/stream/GenerationJobManager.ts:2542
extractMessageContent has cyclomatic complexity 103 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. — packages/api/src/protection/adapters/messages.ts:781
foldSubagentEvent has cyclomatic complexity 98 and cognitive complexity 152; 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. — client/src/utils/subagentContent.ts:219
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files5.3 / 10Adequate✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
packages/api/src/stream/GenerationJobManager.ts has 9351 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/api/src/stream/GenerationJobManager.ts:1
packages/api/src/agents/handlers.ts has 7557 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/api/src/agents/handlers.ts:1
api/server/controllers/agents/client.js has 6151 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — api/server/controllers/agents/client.js:1
packages/data-provider/src/config.ts has 5730 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/data-provider/src/config.ts:1
packages/api/src/stream/implementations/RedisJobStore.ts has 5703 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/api/src/stream/implementations/RedisJobStore.ts:1
packages/data-schemas/src/methods/triggerDelivery.ts has 4926 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/data-schemas/src/methods/triggerDelivery.ts:1
packages/api/src/admin/config.ts has 4770 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/api/src/admin/config.ts:1
packages/data-schemas/src/methods/conversation.ts has 4429 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/data-schemas/src/methods/conversation.ts:1
packages/data-schemas/src/methods/message.ts has 4282 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/data-schemas/src/methods/message.ts:1
packages/api/src/agents/subagentThreads.ts has 4036 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/api/src/agents/subagentThreads.ts:1
packages/api/src/middleware/modelBoundContent.ts has 3793 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/api/src/middleware/modelBoundContent.ts:1
api/server/controllers/agents/request.js has 3541 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — api/server/controllers/agents/request.js:1
packages/api/src/agents/background.ts has 3220 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/api/src/agents/background.ts:1
packages/api/src/mcp/connection.ts has 3052 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/api/src/mcp/connection.ts:1
packages/api/src/agents/run.ts has 3035 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/api/src/agents/run.ts:1
packages/data-schemas/src/methods/queuedTurn.ts has 2881 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/data-schemas/src/methods/queuedTurn.ts:1
packages/data-schemas/src/app/resolution.ts has 2856 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/data-schemas/src/app/resolution.ts:1
packages/api/src/agents/initialize.ts has 2829 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/api/src/agents/initialize.ts:1
packages/data-provider/src/artifacts.ts has 2790 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/data-provider/src/artifacts.ts:1
packages/api/src/stream/implementations/InMemoryJobStore.ts has 2769 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/api/src/stream/implementations/InMemoryJobStore.ts:1
packages/data-schemas/src/methods/agent.ts has 2592 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/data-schemas/src/methods/agent.ts:1
packages/api/src/mcp/MCPManager.ts has 2586 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/api/src/mcp/MCPManager.ts:1
api/server/services/ToolService.js has 2533 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — api/server/services/ToolService.js:1
packages/api/src/schedules/service.ts has 2440 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/api/src/schedules/service.ts:1
packages/api/src/mcp/MCPConnectionFactory.ts has 2421 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/api/src/mcp/MCPConnectionFactory.ts:1
packages/data-schemas/src/methods/schedule.ts has 2272 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/data-schemas/src/methods/schedule.ts:1
packages/api/src/skills/sync/github.ts has 2259 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/api/src/skills/sync/github.ts:1
api/server/controllers/agents/resume.js has 2246 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — api/server/controllers/agents/resume.js:1
packages/api/src/protection/adapters/submissions.ts has 2184 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/api/src/protection/adapters/submissions.ts:1
api/server/services/Endpoints/agents/initialize.js has 2121 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — api/server/services/Endpoints/agents/initialize.js:1
packages/api/src/mcp/oauth/handler.ts has 2116 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/api/src/mcp/oauth/handler.ts:1
packages/api/src/auth/openid/session.ts has 2106 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/api/src/auth/openid/session.ts:1
REDACTED has 2103 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
packages/data-schemas/src/methods/skill.ts has 2088 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/data-schemas/src/methods/skill.ts:1
packages/api/src/mcp/oauth/tokens.ts has 2044 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/api/src/mcp/oauth/tokens.ts:1
client/src/data-provider/mutations.ts has 1985 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — client/src/data-provider/mutations.ts:1
api/app/clients/BaseClient.js has 1923 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — api/app/clients/BaseClient.js:1
packages/data-schemas/src/methods/file.ts has 1919 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/data-schemas/src/methods/file.ts:1
packages/api/src/admin/secrets.ts has 1886 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/api/src/admin/secrets.ts:1
packages/api/src/stream/implementations/RedisEventTransport.ts has 1845 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/api/src/stream/implementations/RedisEventTransport.ts:1
What to do
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Do you agree with this assessment?
R4 · Test Coverage9.8 / 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.
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. (×40) — scripts/static-checks.mts:1, config/create-error-convo.js:1, scripts/activity-labels/corpus.mts: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.
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.
Do you agree with this assessment?
R7 · Dead Code8.8 / 10Exemplary✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Unreachable from the 376 application, 87 tooling and 2926 test entry point(s) detected in this repo. Gate removals on `npm run build` — an undetected custom entry would make these reachable.
no import path from any entry point (376 application, 87 tooling, 2926 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 (×30) — client/src/components/Chat/Input/MCPConfigDialog.tsx, client/src/components/SidePanel/Agents/AgentTool.tsx, client/src/components/MCP/MCPServerMenuItem.tsx, …
Nothing imports this binding — it is safe to review for removal. (×5) — client/src/components/Agents/SmartLoader.tsx:66, client/src/components/Chat/Messages/Content/ParallelContent.tsx:370, client/src/components/Chat/Steering/identity.ts:22, …
Nothing ultimately consumes this binding: its only referrer is the re-export in client/src/components/Skills/display/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in client/src/components/Skills/display/index.ts in the same commit, or the barrel will import a name that no longer exists. — client/src/components/Skills/display/SkillDetailHeader.tsx:120
Nothing ultimately consumes this binding: its only referrer is the re-export in client/src/components/Skills/tree/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in client/src/components/Skills/tree/index.ts in the same commit, or the barrel will import a name that no longer exists. (×3) — client/src/components/Skills/tree/SkillFileEditor.tsx:14, client/src/components/Skills/tree/SkillFilePreview.tsx:13, client/src/components/Skills/tree/TreeToolbar.tsx:51
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. (×22) — REDACTED:13, REDACTED:12, e2e/setup/fake-mcp-app-server.mjs:10, …
Imported only as a TYPE and declared in no reachable REDACTED. The import is erased at compile time, so nothing is installed and no runtime resolution depends on it — but type-checking a clean clone will fail. Declare the typings it resolves through (or the package itself) in the owning REDACTED. (×3) — api/typedefs.js:208, api/typedefs.js:232, client/src/components/Chat/Subagents/outcome.test.ts:40
Declared in the root 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. (×3)
Every import is type-only — move it to devDependencies. — api/typedefs.js:1662
Only test files import it (first: api/server/controllers/auth/PasskeyController.spec.js:27) — move it to devDependencies. — REDACTED:64
What to do
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
Other · Security — Read from this repository's 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.
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.
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) — client/src/hooks/Mermaid/useMermaid.ts:79, packages/api/src/cache/redisScript.ts:47, packages/api/src/skills/deployment.ts:1113, …
`user.password === password` checks a password against the stored one in plaintext, so the store holds the password itself and whoever reads it holds every account. — packages/api/src/auth/email.ts:234
What to do
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: `client/src/hooks/Mermaid/useMermaid.ts:79` (ts-md5), `packages/api/src/cache/redisScript.ts:47` (createHash("sha1")), `packages/api/src/skills/deployment.ts:1113` (createHash("sha1")), `packages/data-provider/src/actions.ts:50` (createHash("sha1")). 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 `packages/api/src/auth/email.ts:234`.
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.
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 document3.2 / 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.
`getStoredKeyForms` is exported, takes a document from its caller (line 164) and hands it to `scanKeys`, which calls itself at line 134 (`scanKeys`) with a piece of `value` (and at line 144) — and nowhere in `scanKeys` 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 `scanKeys` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/data-schemas/src/methods/encoding.ts:134
`digestMCPAuthorityValue` is exported, takes a document from its caller (line 252) and hands it to `stableStringify`, which calls itself at line 227 (`stableStringify`) with a piece of `value` (and at line 236, line 246) — 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. — packages/data-schemas/src/methods/mcpAuthority.ts:227
`isSameConfigValue` is exported and takes `left: unknown` from its caller, and it calls itself at line 130 (`isSameConfigValue`) with a piece of `left` (and at line 142) — and nowhere in `isSameConfigValue` 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 `isSameConfigValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/data-schemas/src/app/changes.ts:130
`isEffectivelyEmpty` is exported and takes `value: unknown` from its caller, and it calls itself at line 457 (`isEffectivelyEmpty`) with a piece of `value` — and nowhere in `isEffectivelyEmpty` 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 `isEffectivelyEmpty` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/data-schemas/src/app/paths.ts:457
`getAuthFailureReason` is exported, takes a document from its caller (line 267) and hands it to `normalizeAuthLogValue`, which calls itself at line 84 (`normalizeAuthLogValue`) with a piece of `value` — and nowhere in `normalizeAuthLogValue` 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 `normalizeAuthLogValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/api/src/middleware/auth.ts:84
`shrinkJsonToFit` is exported, takes a document from its caller (line 624) and hands it to `capJsonStrings`, which calls itself at line 465 (`capJsonStrings`) with a piece of `value` (and at line 473) — and nowhere in `capJsonStrings` 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 `capJsonStrings` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/api/src/messages/previews.ts:465
`collectEnvReferenceNames` is exported, takes a document from its caller (line 227) and hands it to `visitExpandedStrings`, which calls itself at line 222 (`visitExpandedStrings`) with a piece of `value` — and nowhere in `visitExpandedStrings` 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 `visitExpandedStrings` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/api/src/app/allowlist.ts:222
`getEnvReferenceIssues` is exported and takes `value: unknown` from its caller, and it calls itself at line 405 (`getEnvReferenceIssues`) with a piece of `value` — and nowhere in `getEnvReferenceIssues` 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 `getEnvReferenceIssues` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/api/src/app/allowlist.ts:405
`prepareAgentTriggerDelivery` is exported, takes a document from its caller (line 157) and hands it to `canonicalJson`, which calls itself at line 64 (`canonicalJson`) with a piece of `value` (and at line 69) — 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/api/src/agents/triggers/delivery.ts:64
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 functions that make a cancellable request accept or pass on a context.Context or 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 60/109 functions that make a cancellable request (fetch, axios, ky, ofetch; net/http, net.Dial) accept a context.Context or an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, a cancelled request, a shutdown, an expired deadline. Take a `signal` (Go: `ctx context.Context`) 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.
`requestLabel` 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/activity-labels/run.mts:142
`_put` awaits `axios.put(…)` 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: `axios.put(url, { signal })`. — packages/data-provider/src/request.ts:47
`_delete` awaits `axios.delete(…)` 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: `axios.delete(url, { signal })`. — packages/data-provider/src/request.ts:54
`_patch` awaits `axios.patch(…)` 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: `axios.patch(url, { signal })`. — packages/data-provider/src/request.ts:64
`postCloudFrontCookieRefresh` 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/client/src/utils/cloudfront.ts:100
`loadServiceKey` awaits `axios.get(…)` 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: `axios.get(url, { signal })`. — packages/api/src/utils/key.ts:26
`refreshAccessToken` awaits `axios(…)` 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: `axios(url, { signal })`. — packages/api/src/oauth/tokens.ts:154
`getAccessToken` awaits `axios(…)` 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: `axios(url, { signal })`. — packages/api/src/oauth/tokens.ts:258
`connectTo` awaits `isConnected(…)` 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: `isConnected(url, { signal })`. — packages/api/src/mcp/MCPConnectionFactory.ts:2270
`deleteScore` 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/api/src/langfuse/feedback.ts:67
`createScore` 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/api/src/langfuse/feedback.ts:81
`deleteRagFile` awaits `axios.delete(…)` 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: `axios.delete(url, { signal })`. — packages/api/src/files/rag.ts:27
`uploadDocumentToMistral` awaits `axios.post(…)` 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: `axios.post(url, { signal })`. — packages/api/src/files/mistral/crud.ts:93
`getSignedUrl` awaits `axios.get(…)` 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: `axios.get(url, { signal })`. — packages/api/src/files/mistral/crud.ts:136
`performOCR` awaits `axios.post(…)` 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: `axios.post(url, { signal })`. — packages/api/src/files/mistral/crud.ts:190
`deleteMistralFile` awaits `axios.delete(…)` 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: `axios.delete(url, { signal })`. — packages/api/src/files/mistral/crud.ts:260
`exchangeJWTForAccessToken` awaits `axios.post(…)` 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: `axios.post(url, { signal })`. — packages/api/src/files/mistral/crud.ts:721
`performGoogleVertexOCR` awaits `axios.post(…)` 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: `axios.post(url, { signal })`. — packages/api/src/files/mistral/crud.ts:750
`fetchModels` awaits `axios.get(…)` 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: `axios.get(url, { signal })`. — packages/api/src/endpoints/models.ts:154
`fetchPage` awaits `axios.get(…)` 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: `axios.get(url, { signal })`. — packages/api/src/endpoints/reasoning.ts:475
`resolveSubFromUserinfo` 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/api/src/auth/googleRefresh.ts:68
`fetchGoogleTokenset` 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/api/src/auth/googleRefresh.ts:96
`checkHealth` 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/api/src/app/checks.ts:270
`fetchRemote` awaits `axios.get(…)` 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: `axios.get(url, { signal })`. — packages/api/src/app/loader.ts:126
`handleCreateFileCall` awaits `writeSkillMd(…)` 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: `writeSkillMd(url, { signal })`. — packages/api/src/agents/handlers.ts:4371
`assertNotFound` 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/api/openapi/router.smoke.cjs:53
`assertEnabled` 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/api/openapi/router.smoke.cjs:105
`fetchConvoSnapshot` 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 })`. — client/src/utils/convos.ts:1219
`downloadImage` 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 })`. — client/src/components/Chat/Messages/Content/Image.tsx:58
`fetchAudio` 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 })`. — client/src/components/Chat/Input/StreamAudio.tsx:64
`sendEmailViaMailgun` awaits `axios.post(…)` 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: `axios.post(url, { signal })`. — api/server/utils/sendEmail.js:21
`retrieveRun` awaits `axios.get(…)` 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: `axios.get(url, { signal })`. — api/server/services/Runs/methods.js:20
`fetchAvatarBuffer` 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 })`. — api/server/services/Files/images/avatar.js:29
`saveFileFromURL` awaits `axios(…)` 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: `axios(url, { signal })`. — api/server/services/Files/Local/crud.js:58
`saveURLToFirebase` 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 })`. — api/server/services/Files/Firebase/crud.js:62
`getCodeOutputDownloadStream` awaits `axios(…)` 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: `axios(url, { signal })`. — api/server/services/Files/Code/crud.js:40
`saveURLToAzure` 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 })`. — api/server/services/Files/Azure/crud.js:68
`sttRequest` awaits `axios.post(…)` 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: `axios.post(url, { signal })`. — api/server/services/Files/Audio/STTService.js:299
`ttsRequest` awaits `axios.post(…)` 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: `axios.post(url, { signal })`. — api/server/services/Files/Audio/TTSService.js:268
What to do
Thread a context.Context or an AbortSignal through 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.
`debug` at line 37 is called with an argument built by `JSON.stringify(loadedTurnstile, null, 2)` (line 38), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/data-schemas/src/app/turnstile.ts:37
`debug` at line 489 is called with an argument built by `Object.keys(serverTools)` (line 490), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/api/src/mcp/tools.ts:489
`debug` at line 783 is called with an argument built by `Object.keys(missingFields)` (line 784), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/api/src/app/permissions.ts:783
`debug` at line 5519 is called with an argument built by `JSON.stringify(kindCounts)` (line 5524), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/api/src/agents/handlers.ts:5519
`debug` at line 22 is called with an argument built by `JSON.stringify(decoded, null, 2)` (line 22), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — api/strategies/appleStrategy.js:22
`debug` at line 724 is called with an argument built by `resourceFiles.map((f) => f?.file_id)` (line 726), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — api/server/services/Files/Code/process.js:724
`debug` at line 275 is called with an argument built by `destroyedFileIds.join(', ')` (line 276), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — REDACTED:275
`debug` at line 295 is called with an argument built by `ownedFiles.filter((f) => f.file_id)` (line 297), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — REDACTED:295
`debug` at line 338 is called with an argument built by `authorizedFiles.filter((f) => f.file_id)` (line 340), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — REDACTED:338
`debug` at line 213 is called with an argument built by `serversWithoutTools.join(', ')` (line 214), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — REDACTED:213
`debug` at line 333 is called with an argument built by `Object.keys(fadingTiers)` (line 334), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — api/server/controllers/agents/client.js:333
What to do
Each finding names the diagnostic call and the expression inside its argument whose cost scales with a collection. Confirm from the two that the argument is built before the call — that is JavaScript's evaluation order, not a guess — then put the construction behind the level check the logger offers (`if (logger.isLevelEnabled('debug'))` for pino and winston, `isDebugEnabled()` for log4js, the repository's own debug flag where it has one), or hand the logger the object and a format string (`logger.debug({ payload }, 'raw request')`) so the serialising happens only when the line is written. Moving the call is not the fix: it is the join/projection/stringify in the argument that is paid, wherever the call sits.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped6.0 / 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.
`content` 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:92
`escapedContent` 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. — client/src/utils/markdown.ts:350
`escapeHtml(resolved)` 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) — REDACTED:193, REDACTED:206
`sanitizedHTML` 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:122
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 `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 element6.1 / 10Adequate✓ Tool-verified
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.
This loop runs once per element of `entries`, and the statement it guards acts on the element it is on — `entries[i]`. The test deciding whether that statement runs does not: `snapPointFor(entryTop(el, container), scrollMargin, maxScrollTop) < scrollTop...` reads `entries[0]`, a subscript that does not move, so whatever it answers for that one element it answers for ALL of them. One `if` names the same collection at two different subscripts — the fixed one at line 1499, which is the contradiction: either the test was meant to be per-element, in which case every element that differs from the fixed one is handled wrongly and all in the same direction, or it really is one answer for the whole collection, in which case it is being re-asked on every pass and belongs above the loop. The `if` is in the wrong place under both readings. Give the test the loop variable, or hoist it out. — client/src/components/Chat/Messages/MessageNav.tsx:1506
This loop runs once per element of `entries`, and the statement it guards acts on the element it is on — `entries[i]`. The test deciding whether that statement runs does not: `snapPointFor(entryTop(el, container), scrollMargin, maxScrollTop) > scrollTop...` reads `entries[0]`, a subscript that does not move, so whatever it answers for that one element it answers for ALL of them. One `if` names the same collection at two different subscripts — the fixed one at line 1526, which is the contradiction: either the test was meant to be per-element, in which case every element that differs from the fixed one is handled wrongly and all in the same direction, or it really is one answer for the whole collection, in which case it is being re-asked on every pass and belongs above the loop. The `if` is in the wrong place under both readings. Give the test the loop variable, or hoist it out. — client/src/components/Chat/Messages/MessageNav.tsx:1533
What to do
Each finding names the test and the statement it guards, which index the same collection at two different subscripts — one fixed, one the loop variable. Confirm from the two, then decide which subscript the test meant. If it was meant to be per-element, give it the loop variable so each element is judged on itself. If it really is one answer for the whole collection, hoist the test OUT of the loop, where a reader can see it is asked once and where it is not re-evaluated on every pass — leaving it inside, reading a fixed element, is the one arrangement that cannot be right under either reading.
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.
`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) — scripts/sort-imports.mts:226, scripts/static-checks.mts:667, scripts/static-checks.mts:1099, …
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. (×30) — scripts/activity-labels/variants.mts:50, packages/data-schemas/src/methods/mcpAuthority.ts:1653, packages/data-schemas/src/methods/prompt.ts:788, …
`.then(…, () => {})` 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. — packages/chat/src/components/Summary.tsx:22
What to do
Swallowed exception (caught, then discarded)
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 57 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. — packages/data-schemas/src/utils/retry.ts:57
`warn` at line 67 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. — packages/data-schemas/src/utils/retry.ts:67
`warn` at line 157 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. — packages/data-schemas/src/utils/retry.ts:157
`warn` at line 36 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. — packages/data-schemas/src/utils/tempChatRetention.ts:36
`warn` at line 48 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. — packages/data-schemas/src/utils/tempChatRetention.ts:48
`warn` at line 56 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. — packages/data-schemas/src/utils/tempChatRetention.ts:56
`warn` at line 61 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. — packages/data-schemas/src/utils/tempChatRetention.ts:61
`error` at line 177 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. — packages/data-schemas/src/models/index.ts:177
`warn` at line 144 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:144
`info` at line 493 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:493
`info` at line 500 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:500
`info` at line 506 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:506
`info` at line 508 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:508
`info` at line 549 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:549
`info` at line 566 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:566
`debug` at line 727 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:727
`debug` at line 1052 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:1052
`info` at line 1057 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:1057
`debug` at line 1063 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:1063
`debug` at line 1067 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:1067
`warn` at line 1069 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:1069
`info` at line 1072 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:1072
`warn` at line 1076 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:1076
`warn` at line 1078 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:1078
`error` at line 1082 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:1082
`debug` at line 1090 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:1090
`error` at line 1092 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:1092
`debug` at line 1108 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. — packages/data-schemas/src/models/plugins/mongoMeili.ts:1108
`info` at line 54 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. — packages/data-schemas/src/migrations/promptGroupIndexes.ts:54
`error` at line 60 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. — packages/data-schemas/src/migrations/promptGroupIndexes.ts:60
`info` at line 118 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. — packages/data-schemas/src/migrations/searchTokens.ts:118
`warn` at line 171 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. — packages/data-schemas/src/migrations/searchTokens.ts:171
`error` at line 107 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. — packages/data-schemas/src/migrations/tenantIndexes.ts:107
`info` at line 123 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. — packages/data-schemas/src/migrations/tenantIndexes.ts:123
`info` at line 130 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. — packages/data-schemas/src/migrations/tenantIndexes.ts:130
`error` 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.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. — packages/data-schemas/src/migrations/tenantIndexes.ts:134
`error` at line 266 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. — packages/data-schemas/src/methods/conversation.ts:266
`error` at line 277 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. — packages/data-schemas/src/methods/conversation.ts:277
`debug` at line 2447 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. — packages/data-schemas/src/methods/conversation.ts:2447
`info` at line 2536 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. — packages/data-schemas/src/methods/conversation.ts:2536
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.
~0.6 `!` null assertions per 1k TypeScript source lines — 423 assertion(s) across the 709376 source line(s) of the 3178 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: packages/api/src/mcp/MCPConnectionFactory.ts (53), client/src/components/Chat/Subagents/state.ts (25), packages/api/src/mcp/MCPManager.ts (17). 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 — 4 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
P12 CI test-gate honesty — 6 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 — 5 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 39 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not included — 38 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 analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
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.langfuse-fanout-collector.environment.[]: required variable LANGFUSE_FANOUT_CENTRAL_AUTH_HEADER is missing a value: Set LANGFUSE_FANOUT_CENTRAL_AUTH_HEADER to central Langfuse Basic auth header; 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 measured — JavaScript/TypeScript suite did not run
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D21 Naming Consistency — Naming consistency is measured on C# only; Go, JavaScript, Python, TypeScript, html not measured.
D22 Internal API Consistency — API consistency is measured on C# only; the exposed TypeScript surface was not measured.
D24 Comment Value — D24 reads C# and Visual Basic comments only — this repository's production source is .go, .mts, .py, .ts, .tsx, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D25 ADR Conformance — no ADRs to check
D27 Navigability — D27 reads resolved call sites in the languages it reads only — this repository's production source is .go, .mts, .py, .ts, .tsx, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D32 Data Compliance (PII/GDPR) — 72 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.
D42 Runtime Threat Enforcement — The repository ships application workloads but no cluster-governance resources (CRDs, admission webhooks, or a committed policy engine). Runtime threat-detection (Falco/Tetragon) and admission control (Kyverno/OPA-Gatekeeper/PodSecurity) are cluster-OPERATOR controls owned by the platform, not shipped by an application repo/chart — nothing for this repo to assess.
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage not measured — JavaScript/TypeScript suite
DM1 Aggregate boundaries — 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
DM6 Domain ↔ infrastructure boundary — this TypeScript/JavaScript repository maps no type to a persistence framework (TypeORM/Prisma/MikroORM/Sequelize/Mongoose), so DM6's domain↔infrastructure fusion read has no population to be taken over
DM7 Repository granularity — no repository abstraction detected (e.g. uses a document session)
ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (lcov — `jest --coverage --coverageReporters=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
PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for tinybench, mitata, benchmark.js, benny or vitest `bench(...)` calls in files that import them (or `*.bench.*` files), or one of those in a REDACTED, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
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 1,729 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.
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
AC2 · Forms & labels· <label> that labels no control · ×9
<label> that labels no control client/src/components/Chat/Menus/Endpoints/CustomMenu.tsx:103— 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 client/src/components/SidePanel/Agents/Tools/ToolsSection.tsx:364— 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 client/src/components/SidePanel/Builder/ActionsAuth.tsx:77— 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 client/src/components/SidePanel/Builder/ActionsInput.tsx:262— 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 client/src/components/SidePanel/Builder/ActionsInput.tsx:272— 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 client/src/components/SidePanel/Builder/AssistantPanel.tsx:446— 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 client/src/components/SidePanel/Builder/CapabilitiesForm.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 client/src/components/SidePanel/Builder/Knowledge.tsx:78— 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 client/src/components/Skills/forms/InvocationModePicker.tsx:60— 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: Selectors.tsx ↔ i18n.ts client/src/components/Appearance/Selectors.tsx:1— `client/src/components/Appearance/Selectors.tsx` (context components) and `client/src/locales/i18n.ts` (context locales) 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 `db863e75` ⚙️ refactor: Lazy load locale resources (#13640) (at that commit the file was still `client/src/components/Nav/SettingsTabs/General/General.tsx`); `fcb36340` 🌍 i18n: Support for `Icelandic`, `Lithuanian`, `Nynorsk` and `Slovak… (at that commit the file was still `client/src/components/Nav/SettingsTabs/General/General.tsx`); `f209f616` 🌍 i18n: Add Slovenian Language (#9313) (at that commit the file was still `client/src/components/Nav/SettingsTabs/General/General.tsx`) — run `git show` on any of them.
Boundary-crossing change coupling: ServerInitializationSection.tsx ↔ useMCPServerManager.ts client/src/components/MCP/ServerInitializationSection.tsx:1— `client/src/components/MCP/ServerInitializationSection.tsx` (context components) and `client/src/hooks/MCP/useMCPServerManager.ts` (context hooks) sit in DIFFERENT parts of the tree yet 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) — 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 `038903ab` 📱 fix: Open Sign-In and External Links From iOS Home-Screen Apps (#1…; `10685fca` 🗂️ refactor: Artifacts via Model Specs & Scope Badge Persistence by …; `394bb624` 📦 chore: Bump MCP SDK: Fix Types and MCP OAuth due to Update (#10811) — run `git show` on any of them.
Boundary-crossing change coupling: AgentPanelContext.tsx ↔ AgentConfig.tsx client/src/Providers/AgentPanelContext.tsx:1— `client/src/Providers/AgentPanelContext.tsx` (context Providers) and `client/src/components/SidePanel/Agents/AgentConfig.tsx` (context components) sit in DIFFERENT parts of the tree yet change together 62% of the time (8 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `8a60e899` 🤖 refactor: Side Panel Agent UI To Account For Ephemeral Agents (#9763); `f0599ad3` 🧬 refactor: Optimize MCP Tool Queries with Server-Centric Architecture; `386900fb` 🧰 refactor: Decouple MCP Tools from System Tools (#9748) — run `git show` on any of them.
Boundary-crossing change coupling: agents-types.ts ↔ agent.ts client/src/common/agents-types.ts:1— `client/src/common/agents-types.ts` (context common) and `packages/data-schemas/src/schema/agent.ts` (context data-schemas) sit in DIFFERENT parts of the tree yet 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) — 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 `299dbc60` 📖 Load Repository Instructions for Attached Workspaces (#16008); `aeac7a20` 🪪 feat: Add Per-Agent Git Identity (#15628); `53e369fb` 🧪 feat: stateful_code_sessions capability for warm Code API sandbox … — run `git show` on any of them.
Boundary-crossing change coupling: AgentPanel.tsx ↔ agent.ts client/src/components/SidePanel/Agents/AgentPanel.tsx:1— `client/src/components/SidePanel/Agents/AgentPanel.tsx` (context components) and `packages/data-schemas/src/schema/agent.ts` (context data-schemas) sit in DIFFERENT parts of the tree yet change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `299dbc60` 📖 Load Repository Instructions for Attached Workspaces (#16008); `aeac7a20` 🪪 feat: Add Per-Agent Git Identity (#15628); `53e369fb` 🧪 feat: stateful_code_sessions capability for warm Code API sandbox … — run `git show` on any of them.
Boundary-crossing change coupling: config.ts ↔ tx.ts packages/data-provider/src/config.ts:1— `packages/data-provider/src/config.ts` (context data-provider) and `packages/data-schemas/src/methods/tx.ts` (context data-schemas) sit in DIFFERENT parts of the tree yet change together 56% of the time (48 of the 86 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 48 shared commits counted here, the most recent 3 are `96495419` 💠 feat: Add Gemini 4 Argon Support (#17200); `472d29a3` 🪙 fix: Price 1-Hour Prompt Cache Writes at the 1-Hour Rate (#17208); `214362af` 🎐 feat: Add Claude Haiku 5.5 Support (#17201) — run `git show` on any of them.
Boundary-crossing change coupling: MessageEndpointIcon.tsx ↔ tx.ts client/src/components/Endpoints/MessageEndpointIcon.tsx:1— `client/src/components/Endpoints/MessageEndpointIcon.tsx` (context components) and `packages/data-schemas/src/methods/tx.ts` (context data-schemas) 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 `43055767` ✨ feat: GPT-5 Token Limits, Rates, Icon, Reasoning Support (at that commit the file was still `api/models/tx.js`); `37b50736` 🔧 fix: Google Gemma Support & OpenAI Reasoning Instructions (#7196) (at that commit the file was still `api/models/tx.js`); `52f146dd` 🤖 feat: Support `o4-mini` and `o3` Models (#6928) (at that commit the file was still `api/models/tx.js`) — run `git show` on any of them.
AC2 · Forms & labels· <input> without a programmatic label · ×4
<input> without a programmatic label client/src/components/Chat/Input/Files/FileUpload.tsx:90— 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 client/src/components/SidePanel/Builder/ActionsInput.tsx:277— 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 client/src/components/SidePanel/Builder/AssistantConversationStarters.tsx:62— 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 client/src/components/SidePanel/Builder/AssistantConversationStarters.tsx:116— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC4 · Keyboard semantics· Click handler on a non-interactive <div> · ×4
Click handler on a non-interactive <div> client/src/components/Chat/Input/ChatForm.tsx:823— 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> client/src/components/Chat/Input/Composer/Palette.tsx:1304— 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> client/src/components/Chat/Messages/SubRow.tsx:12— 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> client/src/components/Conversations/Convo.tsx:349— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC4 · Keyboard semantics· Hover-only interaction on <div> · ×3
Hover-only interaction on <div> client/src/components/Chat/Messages/Content/UIResourceCarousel.tsx:80— 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> client/src/components/Nav/NavToggle.tsx:54— 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> client/src/components/SidePanel/Builder/AssistantTool.tsx:56— 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· <button> with no accessible text · ×2
<button> with no accessible text client/src/components/SidePanel/Builder/AssistantTool.tsx:80— 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 client/src/components/SidePanel/Builder/ContextButton.tsx:90— 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).
AC4 · Keyboard semantics· Double-click handler on a non-interactive <code> · ×2
Double-click handler on a non-interactive <code> client/src/components/Chat/Messages/Content/MarkdownComponents.tsx:71— This <code> binds double-click and nothing else. 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.
Double-click handler on a non-interactive <code> client/src/components/Chat/Messages/Content/MarkdownComponents.tsx:102— This <code> binds double-click and nothing else. 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.
Banned license: heic-to client/package.json:83— `heic-to` 1.1.14 is published on registry.npmjs.org under `LGPL-3.0`, which this policy bans, and it is a PRODUCTION dependency this repository's committed lockfile resolves — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package, or record an accepted exception.
Banned license: ua-parser-js REDACTED:126— `ua-parser-js` 1.0.37 is published on registry.npmjs.org under `AGPL-3.0-or-later`, which this policy bans, and it is a PRODUCTION dependency this repository's committed lockfile resolves — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package, or record an accepted exception.
Unlisted import '@langchain/core' REDACTED:13— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import '@langchain/core' api/server/controllers/agents/__tests__/askUserQuestion.e2e.spec.js:19— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import 'uuid' config/__tests__/migrate-code-file-duplicates.spec.js:2— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import 'uuid' api/app/clients/tools/structured/FluxAPI.js:3— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
AC2 · Forms & labels· <textarea> without a programmatic label · ×1
<textarea> without a programmatic label client/src/components/SidePanel/Builder/ActionsInput.tsx:240— 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.
AC4 · Keyboard semantics· Double-click handler on a non-interactive <div> · ×1
Double-click handler on a non-interactive <div> client/src/components/Chat/Messages/Content/DialogImage.tsx:368— This <div> binds mousedown, mouseup, mousemove, wheel 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 <span> · ×1
Click handler on a non-interactive <span> client/src/components/Chat/Trace/Ledger.tsx:512— 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}.
AC4 · Keyboard semantics· Double-click handler on a non-interactive <span> · ×1
Double-click handler on a non-interactive <span> client/src/components/Conversations/ConvoLink.tsx:156— This <span> binds double-click and nothing else. 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.
Focusable <div> isn't keyboard-operable client/src/components/Insights/InsightsView.tsx:176— This <div> carries tabIndex={0}, so it is in the tab order and a keyboard user will land on it — but its only behaviour is bound to mousemove, pointer gestures a keyboard cannot produce, and there is no key handler. The tab stop leads nowhere. Bind the same behaviour to a key handler, or provide an equivalent control elsewhere.
AC5 · ARIA correctness· aria-hidden on a focusable element · ×1
aria-hidden on a focusable element client/src/components/Nav/SettingsTabs/Data/ImportConversations.tsx:132— aria-hidden="true" hides the element from assistive tech but leaves it keyboard-focusable — a confusing dead stop. Remove aria-hidden or make the element non-focusable.
Unlisted import '@modelcontextprotocol/ext-apps' e2e/setup/fake-mcp-app-server.mjs:10— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import '@modelcontextprotocol/sdk' e2e/mcp-apps/server.test.mjs:7— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import '@typescript-eslint/parser' scripts/static-checks.mts:1085— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import 'js-yaml' e2e/mcp-apps/workflow.test.mjs:7— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import 'jsonwebtoken' e2e/setup/agent-management.ts:1— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import 'mongodb' config/__tests__/migrate-prompt-permissions.spec.js:2— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import 'mongodb-memory-server' config/__tests__/migrate-code-file-duplicates.spec.js:5— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import 'mongoose' config/__tests__/migrate-code-file-duplicates.spec.js:1— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import '@langchain/langgraph' api/server/controllers/agents/client.js:5421— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import 'cluster-key-slot' api/server/services/Config/__tests__/getCachedTools.lock.spec.js:2— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import 'zod-to-json-schema' api/server/services/start/tools.js:5— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
S1 · Web-Security Posture· Password hashing without a KDF · ×1
Password hashing without a KDF packages/api/src/auth/email.ts:234— `user.password === 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: conversation.createConversationMethods packages/data-schemas/src/methods/conversation.ts:667— FunctionTooLong — createConversationMethods runs 2631 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2531 over it, 26.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: queuedTurn.createAgentQueuedTurnMethods packages/data-schemas/src/methods/queuedTurn.ts:728— FunctionTooLong — createAgentQueuedTurnMethods runs 1663 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1563 over it, 16.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.
FunctionTooLong: config.createAdminConfigHandlers packages/api/src/admin/config.ts:2584— FunctionTooLong — createAdminConfigHandlers runs 1619 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1519 over it, 16.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: handlers.createToolExecuteHandler packages/api/src/agents/handlers.ts:5649— FunctionTooLong — createToolExecuteHandler runs 1523 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1423 over it, 15.23× 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: handlers.createToolExecuteHandler.handle packages/api/src/agents/handlers.ts:5670— FunctionTooLong — createToolExecuteHandler.handle runs 1503 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1403 over it, 15.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: session.createOpenIDSessionRefreshService packages/api/src/auth/openid/session.ts:211— FunctionTooLong — createOpenIDSessionRefreshService runs 1292 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1192 over it, 12.92× 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: service.createSchedulesService packages/api/src/schedules/service.ts:574— FunctionTooLong — createSchedulesService runs 1194 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1094 over it, 11.94× 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: agent.createAgentMethods packages/data-schemas/src/methods/agent.ts:1055— FunctionTooLong — createAgentMethods runs 1145 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1045 over it, 11.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.
FunctionTooLong: schedule.createScheduleMethods packages/data-schemas/src/methods/schedule.ts:348— FunctionTooLong — createScheduleMethods runs 1091 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 991 over it, 10.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: initialize.initializeAgent packages/api/src/agents/initialize.ts:1221— FunctionTooLong — initializeAgent runs 1071 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 971 over it, 10.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: file.createFileMethods packages/data-schemas/src/methods/file.ts:403— FunctionTooLong — createFileMethods runs 986 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 886 over it, 9.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: MessageNav.MessageNav client/src/components/Chat/Messages/MessageNav.tsx:370— FunctionTooLong — MessageNav runs 949 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 849 over it, 9.49× 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: skill.createSkillMethods packages/data-schemas/src/methods/skill.ts:1018— FunctionTooLong — createSkillMethods runs 755 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 655 over it, 7.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: roles.createAdminRolesHandlers packages/api/src/admin/roles.ts:294— FunctionTooLong — createAdminRolesHandlers runs 658 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 558 over it, 6.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: useFileHandling.useFileHandlingCore client/src/hooks/Files/useFileHandling.ts:199— FunctionTooLong — useFileHandlingCore runs 655 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 555 over it, 6.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: runtime.createActivityPhaseWiring packages/api/src/agents/activityPhases/runtime.ts:822— FunctionTooLong — createActivityPhaseWiring runs 648 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 548 over it, 6.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: conformance.describeConfigStoreConformance packages/data-schemas/src/app/conformance.ts:115— FunctionTooLong — describeConfigStoreConformance runs 632 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 532 over it, 6.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: recovery.createOpenIDRefreshRecoveryService packages/api/src/auth/openid/recovery.ts:229— FunctionTooLong — createOpenIDRefreshRecoveryService runs 630 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 530 over it, 6.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: prompt.createPromptMethods packages/data-schemas/src/methods/prompt.ts:183— FunctionTooLong — createPromptMethods runs 620 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 520 over it, 6.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: ToolService.loadToolDefinitionsWrapper api/server/services/ToolService.js:836— FunctionTooLong — loadToolDefinitionsWrapper runs 588 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 488 over it, 5.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ScheduleDialog.ScheduleDialog client/src/components/SidePanel/Schedules/ScheduleDialog.tsx:183— FunctionTooLong — ScheduleDialog runs 584 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 484 over it, 5.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: http.createCodeEnvironmentHttpHandlers packages/api/src/code/http.ts:291— FunctionTooLong — createCodeEnvironmentHttpHandlers runs 577 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 477 over it, 5.77× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ContentParts.ContentPartsBody client/src/components/Chat/Messages/Content/ContentParts.tsx:465— FunctionTooLong — ContentPartsBody runs 562 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 462 over it, 5.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: submissions.extractStoredMessageContentWithBudget packages/api/src/protection/adapters/submissions.ts:1202— FunctionTooLong — extractStoredMessageContentWithBudget runs 557 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 457 over it, 5.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.
FunctionTooLong: useMCPServerManager.useMCPServerManager client/src/hooks/MCP/useMCPServerManager.ts:79— FunctionTooLong — useMCPServerManager runs 555 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 455 over it, 5.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Hotspot: api/server/controllers/agents/request.js api/server/controllers/agents/request.js:769— api/server/controllers/agents/request.js changed 65 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 438 in request.ResumableAgentController at line 769. 30 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- api/server/controllers/agents/request.js`: 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/api/src/agents/handlers.ts packages/api/src/agents/handlers.ts:5670— packages/api/src/agents/handlers.ts changed 77 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 336 in handlers.createToolExecuteHandler.handle at line 5670. 36 of those changes were fix/bug commits, and the other 41 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/agents/handlers.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: packages/api/src/agents/initialize.ts packages/api/src/agents/initialize.ts:1221— packages/api/src/agents/initialize.ts changed 61 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 235 in initialize.initializeAgent at line 1221. 26 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/agents/initialize.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: api/server/controllers/agents/client.js api/server/controllers/agents/client.js:2366— api/server/controllers/agents/client.js changed 93 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 132 in AgentClient.buildMessages at line 2366. 35 of those changes were fix/bug commits, and the other 58 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- api/server/controllers/agents/client.js`: 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: api/server/services/Endpoints/agents/initialize.js api/server/services/Endpoints/agents/initialize.js:223— api/server/services/Endpoints/agents/initialize.js changed 66 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 153 in initialize.initializeClientWithProvider at line 223. 25 of those changes were fix/bug commits, and the other 41 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- api/server/services/Endpoints/agents/initialize.js`: 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: api/server/controllers/agents/resume.js api/server/controllers/agents/resume.js:772— api/server/controllers/agents/resume.js changed 49 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 192 in resume.ResumeAgentController at line 772. 18 of those changes were fix/bug commits, and the other 31 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- api/server/controllers/agents/resume.js`: 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: client/src/components/Chat/Subagents/SubagentThreadPanel.tsx client/src/components/Chat/Subagents/SubagentThreadPanel.tsx:127— client/src/components/Chat/Subagents/SubagentThreadPanel.tsx changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 318 in SubagentThreadPanel.SubagentThreadPanel at line 127. 9 of those changes were fix/bug commits, and the other 20 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- client/src/components/Chat/Subagents/SubagentThreadPanel.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/api/src/stream/GenerationJobManager.ts packages/api/src/stream/GenerationJobManager.ts:5132— packages/api/src/stream/GenerationJobManager.ts changed 55 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 141 in GenerationJobManagerClass.attachSubscription at line 5132. 25 of those changes were fix/bug commits, and the other 30 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/stream/GenerationJobManager.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: api/server/services/ToolService.js api/server/services/ToolService.js:836— api/server/services/ToolService.js changed 67 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 103 in ToolService.loadToolDefinitionsWrapper at line 836. 32 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- api/server/services/ToolService.js`: 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: client/src/components/Chat/Input/ChatForm.tsx client/src/components/Chat/Input/ChatForm.tsx:151— client/src/components/Chat/Input/ChatForm.tsx changed 62 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 105 in ChatForm.ChatForm at line 151. 21 of those changes were fix/bug commits, and the other 41 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- client/src/components/Chat/Input/ChatForm.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/api/src/agents/run.ts packages/api/src/agents/run.ts:2130— packages/api/src/agents/run.ts changed 54 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 113 in run.createRun at line 2130. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/agents/run.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: packages/data-schemas/src/methods/conversation.ts packages/data-schemas/src/methods/conversation.ts:2405— packages/data-schemas/src/methods/conversation.ts changed 58 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 99 in conversation.createConversationMethods.saveConvo at line 2405. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/data-schemas/src/methods/conversation.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: packages/api/src/stream/implementations/RedisJobStore.ts packages/api/src/stream/implementations/RedisJobStore.ts:5620— packages/api/src/stream/implementations/RedisJobStore.ts changed 43 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 126 in RedisJobStore.deserializeJob at line 5620. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/stream/implementations/RedisJobStore.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: client/src/components/Chat/Messages/Content/ToolCallGroup.tsx client/src/components/Chat/Messages/Content/ToolCallGroup.tsx:84— client/src/components/Chat/Messages/Content/ToolCallGroup.tsx changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 156 in ToolCallGroup.ToolCallGroup at line 84. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- client/src/components/Chat/Messages/Content/ToolCallGroup.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/api/src/mcp/MCPManager.ts packages/api/src/mcp/MCPManager.ts:1486— packages/api/src/mcp/MCPManager.ts changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 140 in MCPManager.callTool at line 1486. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/mcp/MCPManager.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: api/server/controllers/agents/responses.js api/server/controllers/agents/responses.js:526— api/server/controllers/agents/responses.js changed 56 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 72 in responses.executeResponse at line 526. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- api/server/controllers/agents/responses.js`: 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: api/server/controllers/agents/openai.js api/server/controllers/agents/openai.js:288— api/server/controllers/agents/openai.js changed 50 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 80 in openai.executeOpenAIChatCompletion at line 288. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- api/server/controllers/agents/openai.js`: 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: client/src/components/Chat/Messages/Content/ContentParts.tsx client/src/components/Chat/Messages/Content/ContentParts.tsx:465— client/src/components/Chat/Messages/Content/ContentParts.tsx changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 121 in ContentParts.ContentPartsBody at line 465. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- client/src/components/Chat/Messages/Content/ContentParts.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/data-schemas/src/methods/message.ts packages/data-schemas/src/methods/message.ts:2091— packages/data-schemas/src/methods/message.ts changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 97 in message.createMessageMethods.claimBackgroundToolResults at line 2091. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/data-schemas/src/methods/message.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: packages/api/src/agents/background.ts packages/api/src/agents/background.ts:2518— packages/api/src/agents/background.ts changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 130 in background.runCheckBackgroundTask at line 2518. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/agents/background.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: packages/data-provider/src/themes/registry.ts packages/data-provider/src/themes/registry.ts:678— packages/data-provider/src/themes/registry.ts changed 55 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 61 in registry.resolveTheme at line 678. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/data-provider/src/themes/registry.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: api/app/clients/BaseClient.js api/app/clients/BaseClient.js:772— api/app/clients/BaseClient.js changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 95 in BaseClient.sendReservedMessage at line 772. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- api/app/clients/BaseClient.js`: 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: client/src/components/Chat/Input/CodeWorkspaceMenu.tsx client/src/components/Chat/Input/CodeWorkspaceMenu.tsx:449— client/src/components/Chat/Input/CodeWorkspaceMenu.tsx changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 128 in CodeWorkspaceMenu.CodeWorkspaceMenu at line 449. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- client/src/components/Chat/Input/CodeWorkspaceMenu.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/api/src/code/workspace.ts packages/api/src/code/workspace.ts:928— packages/api/src/code/workspace.ts changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 123 in workspace.isValidResult at line 928. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/code/workspace.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: api/server/routes/agents/index.js api/server/routes/agents/index.js:602— api/server/routes/agents/index.js changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 104 in index.router.post("/chat/abort") at line 602. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- api/server/routes/agents/index.js`: 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: stream/GenerationJobManager.ts packages/api/src/stream/GenerationJobManager.ts— FileTooLong — 6114 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: GenerationJobManagerClass (894-9854). The bar is 500 significant lines; this is 5614 over it, 12.23× 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: agents/handlers.ts packages/api/src/agents/handlers.ts— FileTooLong — 5395 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4895 over it, 10.79× 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: agents/client.js api/server/controllers/agents/client.js— FileTooLong — 3971 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 3471 over it, 7.94× 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: methods/triggerDelivery.ts packages/data-schemas/src/methods/triggerDelivery.ts— FileTooLong — 3788 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3288 over it, 7.58× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/config.ts packages/data-provider/src/config.ts— FileTooLong — 3670 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3170 over it, 7.34× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: implementations/RedisJobStore.ts packages/api/src/stream/implementations/RedisJobStore.ts— FileTooLong — 3636 significant lines (blank, comment-only and punctuation-only lines excluded), about 78% of them inside a single declaration: RedisJobStore (1908-5987). The bar is 500 significant lines; this is 3136 over it, 7.27× 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: methods/conversation.ts packages/data-schemas/src/methods/conversation.ts— FileTooLong — 3199 significant lines (blank, comment-only and punctuation-only lines excluded), about 82% of them inside a single declaration: createConversationMethods (667-4597). The bar is 500 significant lines; this is 2699 over it, 6.40× 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: admin/config.ts packages/api/src/admin/config.ts— FileTooLong — 3156 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2656 over it, 6.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: methods/message.ts packages/data-schemas/src/methods/message.ts— FileTooLong — 3075 significant lines (blank, comment-only and punctuation-only lines excluded), about 76% of them inside a single declaration: createMessageMethods (1025-4384). The bar is 500 significant lines; this is 2575 over it, 6.15× 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: agents/subagentThreads.ts packages/api/src/agents/subagentThreads.ts— FileTooLong — 3048 significant lines (blank, comment-only and punctuation-only lines excluded), about 80% of them inside a single declaration: SubagentThreadTaskStore (707-4059). The bar is 500 significant lines; this is 2548 over it, 6.10× 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: middleware/modelBoundContent.ts packages/api/src/middleware/modelBoundContent.ts— FileTooLong — 2946 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2446 over it, 5.89× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: agents/request.js api/server/controllers/agents/request.js— FileTooLong — 2471 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units), about 79% of them inside a single declaration: ResumableAgentController (769-3659). The bar is 500 significant lines; this is 1971 over it, 4.94× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: agents/background.ts packages/api/src/agents/background.ts— FileTooLong — 2201 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1701 over it, 4.40× 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: methods/queuedTurn.ts packages/data-schemas/src/methods/queuedTurn.ts— FileTooLong — 2200 significant lines (blank, comment-only and punctuation-only lines excluded), about 76% of them inside a single declaration: createAgentQueuedTurnMethods (728-2973). The bar is 500 significant lines; this is 1700 over it, 4.40× 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: mcp/connection.ts packages/api/src/mcp/connection.ts— FileTooLong — 2100 significant lines (blank, comment-only and punctuation-only lines excluded), about 65% of them inside a single declaration: MCPConnection (1109-3321). The bar is 500 significant lines; this is 1600 over it, 4.20× 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: implementations/InMemoryJobStore.ts packages/api/src/stream/implementations/InMemoryJobStore.ts— FileTooLong — 2024 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: InMemoryJobStore (151-2916). The bar is 500 significant lines; this is 1524 over it, 4.05× 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: mcp/MCPManager.ts packages/api/src/mcp/MCPManager.ts— FileTooLong — 1995 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: MCPManager (139-2718). The bar is 500 significant lines; this is 1495 over it, 3.99× 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: agents/run.ts packages/api/src/agents/run.ts— FileTooLong — 1891 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1391 over it, 3.78× 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/ToolService.js api/server/services/ToolService.js— FileTooLong — 1871 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 1371 over it, 3.74× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: app/resolution.ts packages/data-schemas/src/app/resolution.ts— FileTooLong — 1800 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1300 over it, 3.60× 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: agents/initialize.ts packages/api/src/agents/initialize.ts— FileTooLong — 1783 significant lines (blank, comment-only and punctuation-only lines excluded), about 60% of them inside a single declaration: initializeAgent (1221-2940). The bar is 500 significant lines; this is 1283 over it, 3.57× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: adapters/submissions.ts packages/api/src/protection/adapters/submissions.ts— FileTooLong — 1739 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1239 over it, 3.48× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: methods/agent.ts packages/data-schemas/src/methods/agent.ts— FileTooLong — 1721 significant lines (blank, comment-only and punctuation-only lines excluded), about 67% of them inside a single declaration: createAgentMethods (1055-2791). The bar is 500 significant lines; this is 1221 over it, 3.44× 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: sync/github.ts packages/api/src/skills/sync/github.ts— FileTooLong — 1718 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1218 over it, 3.44× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: mcp/MCPConnectionFactory.ts packages/api/src/mcp/MCPConnectionFactory.ts— FileTooLong — 1714 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: MCPConnectionFactory (91-2612). The bar is 500 significant lines; this is 1214 over it, 3.43× 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.
Cross-context type TAttachment (data-provider → client) client/src/hooks/Files/useAttachmentPreviewSync.ts:63— TAttachment (context data-provider) is exposed in client's public surface via useAttachmentPreviewSync.useAttachmentPreviewSync — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/hooks/Messages/useSearchResultsByTurn.ts:30— TAttachment (context data-provider) is exposed in client's public surface via useSearchResultsByTurn.useSearchResultsByTurn — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/hooks/Messages/useAttachments.ts:8— TAttachment (context data-provider) is exposed in client's public surface via useAttachments.useAttachments — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx:27— TAttachment (context data-provider) is exposed in client's public surface via MemoryArtifacts.hasMemoryArtifacts — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx:30— TAttachment (context data-provider) is exposed in client's public surface via MemoryArtifacts.MemoryArtifacts — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/attachmentTypes.ts:68— TAttachment (context data-provider) is exposed in client's public surface via attachmentTypes.isInternalSandboxArtifact — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/attachmentTypes.ts:120— TAttachment (context data-provider) is exposed in client's public surface via attachmentTypes.attachmentSalience — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/attachmentTypes.ts:131— TAttachment (context data-provider) is exposed in client's public surface via attachmentTypes.bySalience — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/attachmentTypes.ts:148— TAttachment (context data-provider) is exposed in client's public surface via attachmentTypes.isImageAttachment — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/attachmentTypes.ts:163— TAttachment (context data-provider) is exposed in client's public surface via attachmentTypes.isTextAttachment — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/attachmentTypes.ts:174— TAttachment (context data-provider) is exposed in client's public surface via attachmentTypes.artifactTypeForAttachment — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/attachmentTypes.ts:189— TAttachment (context data-provider) is exposed in client's public surface via attachmentTypes.renderAttachmentKey — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/Attachment.tsx:468— TAttachment (context data-provider) is exposed in client's public surface via Attachment.Attachment — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/Attachment.tsx:504— TAttachment (context data-provider) is exposed in client's public surface via Attachment.AttachmentGroup — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/OpenAIImageGen/OpenAIImageGen.tsx:37— TAttachment (context data-provider) is exposed in client's public surface via OpenAIImageGen.OpenAIImageGen — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/handle.ts:22— TAttachment (context data-provider) is exposed in client's public surface via handle.splitBackgroundAttachments — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx:61— TAttachment (context data-provider) is exposed in client's public surface via ExecuteCode.ExecuteCode — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/SkillCall.tsx:16— TAttachment (context data-provider) is exposed in client's public surface via SkillCall.SkillCall — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/MemoryCall.tsx:27— TAttachment (context data-provider) is exposed in client's public surface via MemoryCall.MemoryCall — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsx:68— TAttachment (context data-provider) is exposed in client's public surface via ReadFileCall.ReadFileCall — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx:103— TAttachment (context data-provider) is exposed in client's public surface via FileAuthoringCall.FileAuthoringCall — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/Parts/BashCall.tsx:29— TAttachment (context data-provider) is exposed in client's public surface via BashCall.BashCall — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/outcome.ts:101— TAttachment (context data-provider) is exposed in client's public surface via outcome.getToolMeta — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/outcome.ts:294— TAttachment (context data-provider) is exposed in client's public surface via outcome.summarizeSpan — couples the contexts.
Cross-context type TAttachment (data-provider → client) client/src/components/Chat/Messages/Content/sources.ts:56— TAttachment (context data-provider) is exposed in client's public surface via sources.getSourceDomains — couples the contexts.
Repeated repair: api/server/services/AuthService.js api/server/services/AuthService.js:312— api/server/services/AuthService.js 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 14 (its worst body is AuthService.verifyEmail at line 312), 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: Apply Base Config Overrides Before Sign-In and Refuse Script Policy Links (#17351)”; “🔐 fix: Hash Passwords on a Worker Pool and Surface API Key Lookup Failures (#17261)”; “🪪 fix: Boot-Paint a Cached Theme Only for Its Signed-In Owner (#16926)”; “🕵️ fix: Redact Email Addresses and IPs From Auth Flow Logs (#16994)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- api/server/services/AuthService.js`: 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/api/src/mcp/registry/MCPServerInspector.ts packages/api/src/mcp/registry/MCPServerInspector.ts:76— packages/api/src/mcp/registry/MCPServerInspector.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 9 (its worst body is MCPServerInspector.inspectServer 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: Recharge Direct OpenID MCP Bearer Sessions (#15704)”; “🧺 fix: Funnel MCP Catalog Work Through a Shared Gate (#15429)”; “✂️ fix: Strip Redundant Server-Name Prefixes from MCP Tool Keys (#14732)”; “📡 fix: Publish App-Level MCP Tool Catalogs Without a Reserved Revision (#14858)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/mcp/registry/MCPServerInspector.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/api/src/agents/errors.ts packages/api/src/agents/errors.ts:124— packages/api/src/agents/errors.ts changed 12 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 14 (its worst body is errors.getModelStreamFailure at line 124), 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: Bound Tool Approval Admission Work (#17387)”; “📡 fix: Explain Model Streams That Die Mid-Response (#16415)”; “📣 fix: Surface MCP Credential Failures During Tool Loading (#16323)”; “🗣️ fix: Keep Provider Error Text on Unclassified Agent Failures (#16034)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/agents/errors.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/api/src/agents/backgroundCompletion.ts packages/api/src/agents/backgroundCompletion.ts:45— packages/api/src/agents/backgroundCompletion.ts changed 9 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 renew at line 45), 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: Settle Background Tool Results Before the Server Shuts Down (#16365)”; “📬 fix: Show Background Results Still Waiting for the Agent (#16363)”; “📮 fix: Count Undelivered Background Results as Outstanding (#16343)”; “⚡ fix: Deliver Waiting Completion Wake-ups the Moment They Are Ready (#16339)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/agents/backgroundCompletion.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: api/server/middleware/abortMiddleware.js api/server/middleware/abortMiddleware.js:168— api/server/middleware/abortMiddleware.js changed 9 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 14 (its worst body is abortMiddleware.handleAbortError at line 168), 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: Restrict Stop to the Generation's Owner and Contain S3 Ingest Stream Errors (#17256)”; “🙈 fix: Mask Emails and Drop Personal Identifiers From Logs (#17048)”; “💰 fix: Bill Stopped Agent Turns From Provider Usage (#15889)”; “⏳ fix: Separate Temporary and General Chat Retention (#15734)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- api/server/middleware/abortMiddleware.js`: 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/api/src/agents/hitl/runtime.ts packages/api/src/agents/hitl/runtime.ts:59— packages/api/src/agents/hitl/runtime.ts changed 7 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 10 (its worst body is runtime.buildHITLRunWiring at line 59), 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: Normalize File Edits Before Approval (#16543)”; “fix: Enforce Tool Approval Policy on Headless Agent Runs (#16467)”; “⛔ fix: Bind Tool Approvals to Generation Scope (#15724)”; “🧷 fix: Verify Scheduled HITL State Before Pausing (#15284)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/agents/hitl/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.
Repeated repair: packages/api/src/utils/errors.ts packages/api/src/utils/errors.ts:20— packages/api/src/utils/errors.ts changed 6 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 11 (its worst body is errors.getSafeErrorMetadata at line 20), 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: Bound Outbound Calls Made Inside a Request (#17263)”; “🦫 fix: Bound Error Text Before URL Redaction (#16532)”; “🍵 fix: Support Renewable MCP Credentials for Schedules (#15908)”; “🔣 fix: Encode Images From Storage Keys (#15851)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/utils/errors.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: api/server/services/Files/Code/crud.js api/server/services/Files/Code/crud.js:200— api/server/services/Files/Code/crud.js 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 12 (its worst body is crud.batchUploadCodeEnvFiles at line 200), 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 Primary Files Until Secondary Cleanup Succeeds (#17228)”; “🧹 fix: Let File Deletes Succeed When the Code API No Longer Serves the Ref's Profile (#16671)”; “🪢 fix: Keep One Code File per Sandbox Destination (#15817)”; “🛟 fix: Recover CodeAPI File Uploads After Throttling (#15784)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- api/server/services/Files/Code/crud.js`: 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: client/src/components/Chat/Messages/Content/Parts/useToolCallState.ts client/src/components/Chat/Messages/Content/Parts/useToolCallState.ts:63— client/src/components/Chat/Messages/Content/Parts/useToolCallState.ts changed 8 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 useToolCallState.useToolCallState 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: Load Full Tool Output So Copy Works on Panels Without a Row (#17262)”; “🪄 fix: Hide Sole Tool Row Under Its Group Header (#16750)”; “🪗 fix: Open the Lone Tool Call Directly and Label Settled Commands Ran (#16547)”; “🪑 fix: Preserve Tool Pane Choices Through Response Finalization (#16152)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- client/src/components/Chat/Messages/Content/Parts/useToolCallState.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: client/src/components/Chat/Messages/Content/disclosure.ts client/src/components/Chat/Messages/Content/disclosure.ts:42— client/src/components/Chat/Messages/Content/disclosure.ts changed 7 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 4 (its worst body is disclosure.useToolDisclosure at line 42), 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 Subagent Content With Shared Chat Rendering (#17290)”; “🪄 fix: Hide Sole Tool Row Under Its Group Header (#16750)”; “🪗 fix: Open the Lone Tool Call Directly and Label Settled Commands Ran (#16547)”; “🪑 fix: Preserve Tool Pane Choices Through Response Finalization (#16152)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- client/src/components/Chat/Messages/Content/disclosure.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/api/src/auth/passwordReset.ts packages/api/src/auth/passwordReset.ts:146— packages/api/src/auth/passwordReset.ts changed 7 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 6 (its worst body is passwordReset.commitPasswordReset at line 146), 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: Hash Passwords on a Worker Pool and Surface API Key Lookup Failures (#17261)”; “🙊 fix: Keep API Keys and Internal Errors Out of Logs and Responses (#17258)”; “🪪 fix: Boot-Paint a Cached Theme Only for Its Signed-In Owner (#16926)”; “🧯 fix: Outlast Failed Auth Cache Eviction on Credential Changes (#16435)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/auth/passwordReset.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/data-schemas/src/methods/config.ts packages/data-schemas/src/methods/config.ts:253— packages/data-schemas/src/methods/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 8 (its worst body is config.createConfigStore.create at line 253), 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: Base-First Config Precedence, Profile Lifecycle and Role Renames That Keep Their Profile (#17352)”; “🔐 fix: Apply Base Config Overrides Before Sign-In and Refuse Script Policy Links (#17351)”; “🔑 fix: Use Admin-Stored Web Search Credentials at Runtime (#17323)”; “🧾 fix: Validate Principal Config Overrides Against configSchema (#16433)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/data-schemas/src/methods/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: client/src/components/Chat/Subagents/SharedSubagentActivityDialog.tsx client/src/components/Chat/Subagents/SharedSubagentActivityDialog.tsx:22— client/src/components/Chat/Subagents/SharedSubagentActivityDialog.tsx 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 13 (its worst body is SharedSubagentActivityDialog.SharedSubagentActivityDialog at line 22), 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 Subagent Content With Shared Chat Rendering (#17290)”; “💬 fix: Mirror Chat Messages, Markdown and Code Blocks for RTL (#17267)”; “🦎 fix: Restore Theme Contrast in Composer and Messages (#16624)”; “🫂 fix: Route Subagent Activity Through the Chat Renderer (#15137)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- client/src/components/Chat/Subagents/SharedSubagentActivityDialog.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: api/server/services/initializeMCPs.js api/server/services/initializeMCPs.js:92— api/server/services/initializeMCPs.js 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 11 (its worst body is initializeMCPs.initializeMCPs at line 92), 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: Bound MCP App Responses and In-Flight Work (#16300)”; “🪂 fix: Release Stalled MCP Catalog Recovery Without Dropping Refreshed Tokens (#15871)”; “🛂 fix: Back Off MCP OAuth Discovery (#15783)”; “📡 fix: Refresh MCP Tools After List-Changed Notifications (#14686)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- api/server/services/initializeMCPs.js`: 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/api/src/cache/cacheFactory.ts packages/api/src/cache/cacheFactory.ts:197— packages/api/src/cache/cacheFactory.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 8 (its worst body is cacheFactory.limiterCache at line 197), 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: Outlast Failed Auth Cache Eviction on Credential Changes (#16435)”; “🔂 fix: Reuse Redis Caches Without Changing TTLs (#16154)”; “🚢 fix: Reconnect Keyv Redis After Replica Failover (#15502)”; “🕯️ fix: Decay Violation Scores With a Configurable TTL (#15153)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/cache/cacheFactory.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: REDACTED REDACTED:22— REDACTED 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 12 (its worst body is csrf.shouldUseSecureCookie at line 22), 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: Boot-Paint a Cached Theme Only for Its Signed-In Owner (#16926)”; “🛖 fix: Scope OAuth Binding Cookies to the Public API Path (#16649)”; “🪢 fix: Restore MCP OAuth Browser Binding (#16634)”; “🔒 fix: Refresh MCP OBO Tokens From the Live OpenID Session (#15334)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02: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.
Repeated repair: client/src/components/Messages/ScrollToBottom.tsx client/src/components/Messages/ScrollToBottom.tsx:29— client/src/components/Messages/ScrollToBottom.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 3 (its worst body is ScrollToBottom.ScrollToBottom at line 29), 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: Mirror Chat Messages, Markdown and Code Blocks for RTL (#17267)”; “🩹 fix: Keep Chrome Surfaces and Destructive Confirms Legible in Quiet-Chrome Themes (#16833)”; “🫣 fix: Hide Scroll-to-Bottom Under Composer Panels (#15746)”; “⬇️ fix: Keep Scroll-to-Bottom Clear of the In-Flight Steer Stack (#14844)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- client/src/components/Messages/ScrollToBottom.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: packages/api/src/mcp/oauth/OAuthReconnectionManager.ts packages/api/src/mcp/oauth/OAuthReconnectionManager.ts:261— packages/api/src/mcp/oauth/OAuthReconnectionManager.ts 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 10 (its worst body is OAuthReconnectionManager.canReconnect at line 261), 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: Stop an MCP Credential Refresh From Fencing Its Own Connection (#15863)”; “🛂 fix: Back Off MCP OAuth Discovery (#15783)”; “🐺 fix: Stop Routine MCP Teardowns From Failing Concurrent Tool Calls (#15333)”; “🛰️ fix: Attach Request-Scoped MCP Servers (#14780)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/mcp/oauth/OAuthReconnectionManager.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/api/src/oauth/tokens.ts packages/api/src/oauth/tokens.ts:14— packages/api/src/oauth/tokens.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 4 (its worst body is tokens.getActionOAuthAgents at line 14), 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 OAuth Credentials Out of Logs (#17409)”; “⏱️ fix: Bound Outbound Calls Made Inside a Request (#17263)”; “🔑 fix: Decode Action OAuth Credentials After Decryption (#14698)”; “🕰️ fix: Guard `expires_in` So a Token Response Cannot Outlive Its Credential (#15321)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/oauth/tokens.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: api/app/clients/tools/util/fileSearch.js api/app/clients/tools/util/fileSearch.js:38— api/app/clients/tools/util/fileSearch.js 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 7 (its worst body is fileSearch.primeFiles 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: Skip Blank RAG Queries Before Embedding (#16231)”; “🔢 fix: Normalize PDF Citation Page Numbers (#15731)”; “🛤️ fix: Align File Search Citation Paths (#15650)”; “🧱 fix: Enforce Agent Runtime File Trust Boundaries (#14577)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- api/app/clients/tools/util/fileSearch.js`: 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: client/src/components/Variables/Editor.tsx client/src/components/Variables/Editor.tsx:63— client/src/components/Variables/Editor.tsx 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 6 (its worst body is Editor.VariableEditor 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: Mirror Agents, Prompts, Skills and Other Pages for RTL (#17268)”; “🎛️ fix: Smooth, Compact Code Workspace, Checkout and Approval Selectors (#16789)”; “🗓️ fix: Hide Unsupported Schedule Variables (#15053)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- client/src/components/Variables/Editor.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: client/src/components/Chat/Messages/Content/ToolCallLimitNotice.tsx client/src/components/Chat/Messages/Content/ToolCallLimitNotice.tsx:25— client/src/components/Chat/Messages/Content/ToolCallLimitNotice.tsx 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 7 (its worst body is ToolCallLimitNotice.ToolCallLimitNotice at line 25), 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: Mirror Chat Messages, Markdown and Code Blocks for RTL (#17267)”; “🫸 fix: Gate MCP App Views and Actions on User Intent (#16297)”; “🗯️ fix: Give Failed Turns Actionable Guidance (#15896)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- client/src/components/Chat/Messages/Content/ToolCallLimitNotice.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: packages/api/src/utils/files.ts packages/api/src/utils/files.ts:298— packages/api/src/utils/files.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 files.sanitizeArtifactPath at line 298), 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: Deliver Opted-In Custom Endpoint Media Safely (#15937)”; “🫙 fix: Surface Document Extraction Failures (#15651)”; “🗂️ fix: Resolve Code Interpreter Destination Collisions (#15449)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/api/src/utils/files.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: client/src/data-provider/SSE/queuedTurns.ts client/src/data-provider/SSE/queuedTurns.ts:96— client/src/data-provider/SSE/queuedTurns.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 8 (its worst body is queuedTurns.useAgentQueuedTurns at line 96), 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 Queued Follow-Ups Through Handoff (#15942)”; “🐝 fix: Keep Polling for Owed Agent Successors (#15537)”; “🧷 fix: Fence Server-Admitted Queue Boundaries (#15393)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- client/src/data-provider/SSE/queuedTurns.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/data-schemas/src/config/winston.ts packages/data-schemas/src/config/winston.ts:39— packages/data-schemas/src/config/winston.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 3 (its worst body is winston.level 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: defer logger serialization to sanitized transports (#17169)”; “🙈 fix: Mask Emails and Drop Personal Identifiers From Logs (#17048)”; “🔐 fix: Preserve Structured JWT Auth Context (#14652)”. 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-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 17:53:16 +02:00' --until='2026-10-24 17:53:16 +02:00' --full-history --no-merges -- packages/data-schemas/src/config/winston.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.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/ParallelContent.tsx:36— TMessageContentParts (context data-provider) is exposed in client's public surface via ParallelContent.groupParallelContent — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/ParallelContent.tsx:247— TMessageContentParts (context data-provider) is exposed in client's public surface via ParallelContent.lastParallelColumnCursorIdx — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/outcome.ts:101— TMessageContentParts (context data-provider) is exposed in client's public surface via outcome.getToolMeta — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/outcome.ts:294— TMessageContentParts (context data-provider) is exposed in client's public surface via outcome.summarizeSpan — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/outcome.ts:322— TMessageContentParts (context data-provider) is exposed in client's public surface via outcome.summarizeSpan.metaOf — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/hydration.tsx:22— TMessageContentParts (context data-provider) is exposed in client's public surface via hydration.isPreviewedToolCallPart — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/hydration.tsx:65— TMessageContentParts (context data-provider) is exposed in client's public surface via hydration.PreviewedToolCallPart — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/live.ts:67— TMessageContentParts (context data-provider) is exposed in client's public surface via live.getStandardToolCall — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/live.ts:80— TMessageContentParts (context data-provider) is exposed in client's public surface via live.needsReader — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/live.ts:234— TMessageContentParts (context data-provider) is exposed in client's public surface via live.blocksLiveFold — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/live.ts:253— TMessageContentParts (context data-provider) is exposed in client's public surface via live.getSpanIconNames — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/live.ts:402— TMessageContentParts (context data-provider) is exposed in client's public surface via live.getLiveActivity — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/live.ts:459— TMessageContentParts (context data-provider) is exposed in client's public surface via live.getFailedLines — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/ActivityPhaseGroup.tsx:540— TMessageContentParts (context data-provider) is exposed in client's public surface via ActivityPhaseGroup.ActivityPhaseGroup — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/editableParts.ts:9— TMessageContentParts (context data-provider) is exposed in client's public surface via editableParts.getPartValue — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/editableParts.ts:19— TMessageContentParts (context data-provider) is exposed in client's public surface via editableParts.getPartText — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/editableParts.ts:24— TMessageContentParts (context data-provider) is exposed in client's public surface via editableParts.withPartText — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/Content/editableParts.ts:45— TMessageContentParts (context data-provider) is exposed in client's public surface via editableParts.isEditablePart — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Messages/MessageNav.tsx:32— TMessageContentParts (context data-provider) is exposed in client's public surface via MessageNav.extractPreviewFromContent — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Subagents/state.ts:512— TMessageContentParts (context data-provider) is exposed in client's public surface via state.nestedToolCallOf — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Subagents/state.ts:527— TMessageContentParts (context data-provider) is exposed in client's public surface via state.collectNestedCalls — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Subagents/adapters.ts:314— TMessageContentParts (context data-provider) is exposed in client's public surface via adapters.standardContent — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Subagents/adapters.ts:369— TMessageContentParts (context data-provider) is exposed in client's public surface via adapters.adaptLivePersistedActivity — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Subagents/SubagentActivity.tsx:402— TMessageContentParts (context data-provider) is exposed in client's public surface via SubagentActivity.getActivityContent — couples the contexts.
Cross-context type TMessageContentParts (data-provider → client) client/src/components/Chat/Subagents/SubagentActivity.tsx:455— TMessageContentParts (context data-provider) is exposed in client's public surface via SubagentActivity.SubagentActivityContent — couples the contexts.
Skipped test: Skipped: AWS_TEST_BUCKET_NAME not configured packages/api/src/storage/s3/__tests__/s3.integration.spec.ts:65— Skipped — switched off by it.skip
Skipped test: (unnamed test) e2e/specs/mock/code-upload.spec.ts:104— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/conversation-management.spec.ts:321— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/conversation-management.spec.ts:407— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/enforced-model-specs.spec.ts:96— Skipped — switched off by test.skip
Skipped test: (unnamed test) REDACTED:404— Skipped — switched off by test.skip
Skipped test: (unnamed test) REDACTED:409— Skipped — switched off by test.skip
Skipped test: (unnamed test) REDACTED:880— Skipped — switched off by test.skip
Skipped test: (unnamed test) REDACTED:1003— Skipped — switched off by test.skip
Skipped test: (unnamed test) REDACTED:1065— Skipped — switched off by test.skip
Skipped test: (unnamed test) REDACTED:1145— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/mcp-tool-list-changed.spec.ts:111— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/message-visual.spec.ts:91— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/model-replay-tools.spec.ts:74— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/model-replay.spec.ts:63— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/stateful-code-bridge.spec.ts:101— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/stateful-code-bridge.spec.ts:104— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/scenarios/chat-context.spec.ts:129— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/scenarios/composer-position.spec.ts:31— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/scenarios/composer-queue.spec.ts:136— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/scenarios/lint.helpers.ts:27— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/scenarios/parts.spec.ts:145— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/scenarios/passkeys.spec.ts:158— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/scenarios/pinned-drag-rules.spec.ts:69— Skipped — switched off by test.skip
Skipped test: (unnamed test) e2e/specs/mock/scenarios/pinned-row-controls.spec.ts:87— Skipped — switched off by test.skip
Cross-context type PrincipalType (data-provider → api) packages/api/src/acl/accessControlService.ts:129— PrincipalType (context data-provider) is exposed in api's public surface via AccessControlService.grantPermission — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/acl/insightsPermissions.ts:76— PrincipalType (context data-provider) is exposed in api's public surface via insightsPermissions.getInsightsPrincipalState — couples the contexts.
Cross-context type PrincipalType (data-provider → api) REDACTED:11— PrincipalType (context data-provider) is exposed in api's public surface via SearchablePrincipalType.SearchablePrincipalType — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/cascade.ts:121— PrincipalType (context data-provider) is exposed in api's public surface via ConfigProfileStore.deleteConfig — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/config.ts:892— PrincipalType (context data-provider) is exposed in api's public surface via AdminConfigDeps.findConfigByPrincipal — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/config.ts:904— PrincipalType (context data-provider) is exposed in api's public surface via AdminConfigDeps.writeConfigDocument — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/config.ts:914— PrincipalType (context data-provider) is exposed in api's public surface via AdminConfigDeps.unsetConfigField — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/config.ts:921— PrincipalType (context data-provider) is exposed in api's public surface via AdminConfigDeps.deleteConfig — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/config.ts:928— PrincipalType (context data-provider) is exposed in api's public surface via AdminConfigDeps.toggleConfigActiveTracked — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/config.ts:940— PrincipalType (context data-provider) is exposed in api's public surface via AdminConfigDeps.setConfigPriority — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/config.ts:953— PrincipalType (context data-provider) is exposed in api's public surface via AdminConfigDeps.principalExists — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/config.ts:1025— PrincipalType (context data-provider) is exposed in api's public surface via config.validatePrincipalType — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/catalog.ts:100— PrincipalType (context data-provider) is exposed in api's public surface via AdminConfigCatalogDeps.principalExists — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/grants.ts:38— PrincipalType (context data-provider) is exposed in api's public surface via AdminGrantsDeps.listGrants — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/grants.ts:44— PrincipalType (context data-provider) is exposed in api's public surface via AdminGrantsDeps.countGrants — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/grants.ts:48— PrincipalType (context data-provider) is exposed in api's public surface via AdminGrantsDeps.getCapabilitiesForPrincipal — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/grants.ts:53— PrincipalType (context data-provider) is exposed in api's public surface via AdminGrantsDeps.getCapabilitiesForPrincipals — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/grants.ts:57— PrincipalType (context data-provider) is exposed in api's public surface via AdminGrantsDeps.grantCapability — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/grants.ts:64— PrincipalType (context data-provider) is exposed in api's public surface via AdminGrantsDeps.revokeCapability — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/groups.ts:84— PrincipalType (context data-provider) is exposed in api's public surface via AdminGroupsDeps.deleteConfig — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/groups.ts:88— PrincipalType (context data-provider) is exposed in api's public surface via AdminGroupsDeps.deleteAclEntries — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/groups.ts:97— PrincipalType (context data-provider) is exposed in api's public surface via AdminGroupsDeps.findConfigByPrincipal — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/resolved.ts:47— PrincipalType (context data-provider) is exposed in api's public surface via AdminConfigReadDeps.findConfigByPrincipal — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/resolved.ts:64— PrincipalType (context data-provider) is exposed in api's public surface via AdminConfigReadDeps.principalExists — couples the contexts.
Cross-context type PrincipalType (data-provider → api) packages/api/src/admin/langfuse.ts:93— PrincipalType (context data-provider) is exposed in api's public surface via AdminLangfuseDeps.findConfigByPrincipal — couples the contexts.
Outbound HTTP without resilience api/app/clients/tools/structured/FluxAPI.js:249— `axios.post(` 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 api/app/clients/tools/structured/FluxAPI.js:276— `axios.get(` 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 api/app/clients/tools/structured/FluxAPI.js:318— `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 api/app/clients/tools/structured/FluxAPI.js:388— `axios.get(` 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 api/app/clients/tools/structured/FluxAPI.js:398— `axios.get(` 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 api/app/clients/tools/structured/FluxAPI.js:484— `axios.post(` 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 api/app/clients/tools/structured/FluxAPI.js:510— `axios.get(` 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 api/app/clients/tools/structured/FluxAPI.js:550— `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 api/app/clients/tools/structured/GoogleSearch.js:58— `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 api/app/clients/tools/structured/OpenAIImageTools.js:364— `axios.post(` 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 api/app/clients/tools/structured/OpenWeather.js:139— `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 api/app/clients/tools/structured/OpenWeather.js:340— `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 api/app/clients/tools/structured/StableDiffusion.js:124— `axios.post(` 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 api/app/clients/tools/structured/TavilySearchResults.js:130— `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 api/app/clients/tools/structured/TraversaalSearch.js:55— `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 REDACTED:63— `axios.get(` 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 api/server/middleware/moderateText.js:91— `axios.post(` 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 api/server/routes/traces.js:20— `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 api/server/services/Files/Audio/STTService.js:324— `axios.post(` 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 api/server/services/Files/Audio/TTSService.js:284— `axios.post(` 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 api/server/services/Files/Azure/crud.js:77— `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 api/server/services/Files/Firebase/crud.js:71— `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 api/server/services/Files/VectorDB/crud.js:66— `axios.post(` 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 api/server/services/Files/images/avatar.js:46— `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 api/server/utils/sendEmail.js:38— `axios.post(` 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.
Boundary violation [package:test-cross-package-internals] client/src/hooks/Chat/__tests__/turn.messageIds.spec.ts:5— client/src/hooks/Chat/__tests__/turn.messageIds.spec.ts:5 reaches past another workspace package's public entry into its internals with a relative path (../../../../../packages/api/src/middleware/messageIds) — 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] config/invite-user.js:7— config/invite-user.js:7 reaches into another package with a relative path (../api/models) — import the package by name instead.
Boundary violation [package:relative-cross-package] config/invite-user.js:8— config/invite-user.js:8 reaches into another package with a relative path (../api/server/utils) — import the package by name instead.
Boundary violation [package:test-cross-package-internals] e2e/specs/mock/scenarios/action-method-labels.spec.ts:3— e2e/specs/mock/scenarios/action-method-labels.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/badge-label.spec.ts:4— e2e/specs/mock/scenarios/badge-label.spec.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/button-roles.spec.ts:4— e2e/specs/mock/scenarios/button-roles.spec.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/chrome-border.spec.ts:3— e2e/specs/mock/scenarios/chrome-border.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/chrome-quiet-surfaces.spec.ts:3— e2e/specs/mock/scenarios/chrome-quiet-surfaces.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/clickhouse-checkbox.spec.ts:5— e2e/specs/mock/scenarios/clickhouse-checkbox.spec.ts:5 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/clickhouse-control-radius.spec.ts:3— e2e/specs/mock/scenarios/clickhouse-control-radius.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/clickhouse-layers.spec.ts:3— e2e/specs/mock/scenarios/clickhouse-layers.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/clickhouse-spacing-mono.spec.ts:3— e2e/specs/mock/scenarios/clickhouse-spacing-mono.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/clickhouse-switch.spec.ts:3— e2e/specs/mock/scenarios/clickhouse-switch.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/clickhouse-table.spec.ts:6— e2e/specs/mock/scenarios/clickhouse-table.spec.ts:6 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/clickhouse-theme-shape.spec.ts:4— e2e/specs/mock/scenarios/clickhouse-theme-shape.spec.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/clickhouse-theme.spec.ts:5— e2e/specs/mock/scenarios/clickhouse-theme.spec.ts:5 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/clickhouse-theme.spec.ts:6— e2e/specs/mock/scenarios/clickhouse-theme.spec.ts:6 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/data-provider/src/themes/default) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/clickhouse-theme.spec.ts:7— e2e/specs/mock/scenarios/clickhouse-theme.spec.ts:7 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/data-provider/src/themes/dark) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/control-border.spec.ts:3— e2e/specs/mock/scenarios/control-border.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/control-border.spec.ts:4— e2e/specs/mock/scenarios/control-border.spec.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/data-provider/src/themes/dark) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/control-spacing.spec.ts:4— e2e/specs/mock/scenarios/control-spacing.spec.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/corner-roles.spec.ts:3— e2e/specs/mock/scenarios/corner-roles.spec.ts:3 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts:6— e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts:6 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/api/src/html/theme) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts:10— e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts:10 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/client/src/theme/themes/clickhouse) — 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:test-cross-package-internals] e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts:11— e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts:11 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/data-provider/src/themes/registry) — 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.
+ 15 more in this group — see findings.md.
R4 · Test Coverage· No test reaches this file · ×40
No test reaches this file scripts/static-checks.mts: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 config/create-error-convo.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file scripts/activity-labels/corpus.mts: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 config/flush-cache.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file scripts/activity-labels/run.mts: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/api/src/openapi/agents.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/sort-imports.mts: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 config/migrate-agent-permissions.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file scripts/activity-labels/variants.mts: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/api/src/openapi/skills.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 config/circular-deps.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/activity-labels/report.mts: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 REDACTED: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/activity-labels/checks.mts: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/activity-labels/prompt.mts: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/api/src/openapi/adapter.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/api/openapi/router.smoke.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/client/jest.setup.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 config/update-banner.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file client/src/components/Chat/Input/MCPConfigDialog.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 client/src/components/SidePanel/Agents/AgentTool.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 config/create-user.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file config/migrate-terms-timestamp.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file config/update.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file config/set-balance.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
+ 15 more in this group — see findings.md.
X2 · Cancellation propagation· Async function without AbortSignal · ×39
Async function without AbortSignal: requestLabel scripts/activity-labels/run.mts:142— `requestLabel` 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: _put packages/data-provider/src/request.ts:47— `_put` awaits `axios.put(…)` 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: `axios.put(url, { signal })`.
Async function without AbortSignal: _delete packages/data-provider/src/request.ts:54— `_delete` awaits `axios.delete(…)` 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: `axios.delete(url, { signal })`.
Async function without AbortSignal: _patch packages/data-provider/src/request.ts:64— `_patch` awaits `axios.patch(…)` 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: `axios.patch(url, { signal })`.
Async function without AbortSignal: postCloudFrontCookieRefresh packages/client/src/utils/cloudfront.ts:100— `postCloudFrontCookieRefresh` 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: loadServiceKey packages/api/src/utils/key.ts:26— `loadServiceKey` awaits `axios.get(…)` 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: `axios.get(url, { signal })`.
Async function without AbortSignal: refreshAccessToken packages/api/src/oauth/tokens.ts:154— `refreshAccessToken` awaits `axios(…)` 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: `axios(url, { signal })`.
Async function without AbortSignal: getAccessToken packages/api/src/oauth/tokens.ts:258— `getAccessToken` awaits `axios(…)` 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: `axios(url, { signal })`.
Async function without AbortSignal: connectTo packages/api/src/mcp/MCPConnectionFactory.ts:2270— `connectTo` awaits `isConnected(…)` 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: `isConnected(url, { signal })`.
Async function without AbortSignal: deleteScore packages/api/src/langfuse/feedback.ts:67— `deleteScore` 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: createScore packages/api/src/langfuse/feedback.ts:81— `createScore` 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: deleteRagFile packages/api/src/files/rag.ts:27— `deleteRagFile` awaits `axios.delete(…)` 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: `axios.delete(url, { signal })`.
Async function without AbortSignal: uploadDocumentToMistral packages/api/src/files/mistral/crud.ts:93— `uploadDocumentToMistral` awaits `axios.post(…)` 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: `axios.post(url, { signal })`.
Async function without AbortSignal: getSignedUrl packages/api/src/files/mistral/crud.ts:136— `getSignedUrl` awaits `axios.get(…)` 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: `axios.get(url, { signal })`.
Async function without AbortSignal: performOCR packages/api/src/files/mistral/crud.ts:190— `performOCR` awaits `axios.post(…)` 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: `axios.post(url, { signal })`.
Async function without AbortSignal: deleteMistralFile packages/api/src/files/mistral/crud.ts:260— `deleteMistralFile` awaits `axios.delete(…)` 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: `axios.delete(url, { signal })`.
Async function without AbortSignal: exchangeJWTForAccessToken packages/api/src/files/mistral/crud.ts:721— `exchangeJWTForAccessToken` awaits `axios.post(…)` 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: `axios.post(url, { signal })`.
Async function without AbortSignal: performGoogleVertexOCR packages/api/src/files/mistral/crud.ts:750— `performGoogleVertexOCR` awaits `axios.post(…)` 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: `axios.post(url, { signal })`.
Async function without AbortSignal: fetchModels packages/api/src/endpoints/models.ts:154— `fetchModels` awaits `axios.get(…)` 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: `axios.get(url, { signal })`.
Async function without AbortSignal: fetchPage packages/api/src/endpoints/reasoning.ts:475— `fetchPage` awaits `axios.get(…)` 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: `axios.get(url, { signal })`.
Async function without AbortSignal: resolveSubFromUserinfo packages/api/src/auth/googleRefresh.ts:68— `resolveSubFromUserinfo` 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: fetchGoogleTokenset packages/api/src/auth/googleRefresh.ts:96— `fetchGoogleTokenset` 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: checkHealth packages/api/src/app/checks.ts:270— `checkHealth` 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: fetchRemote packages/api/src/app/loader.ts:126— `fetchRemote` awaits `axios.get(…)` 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: `axios.get(url, { signal })`.
Async function without AbortSignal: handleCreateFileCall packages/api/src/agents/handlers.ts:4371— `handleCreateFileCall` awaits `writeSkillMd(…)` 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: `writeSkillMd(url, { signal })`.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/app/store.ts:62— PrincipalType (context data-provider) is exposed in data-schemas's public surface via ConfigPrincipal.principalType — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/app/store.ts:70— PrincipalType (context data-provider) is exposed in data-schemas's public surface via ConfigRecord.principalType — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/utils/principal.ts:11— PrincipalType (context data-provider) is exposed in data-schemas's public surface via principal.normalizePrincipalId — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/aclEntry.ts:133— PrincipalType (context data-provider) is exposed in data-schemas's public surface via aclEntry.createAclEntryMethods — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/aclEntry.ts:565— PrincipalType (context data-provider) is exposed in data-schemas's public surface via aclEntry.createAclEntryMethods.moveAclEntriesToPrincipal — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/userGroup.ts:169— PrincipalType (context data-provider) is exposed in data-schemas's public surface via userGroup.createUserGroupMethods — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/userGroup.ts:816— PrincipalType (context data-provider) is exposed in data-schemas's public surface via userGroup.createUserGroupMethods.getUserPrincipals — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/systemGrant.ts:55— PrincipalType (context data-provider) is exposed in data-schemas's public surface via systemGrant.createSystemGrantMethods — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/systemGrant.ts:182— PrincipalType (context data-provider) is exposed in data-schemas's public surface via systemGrant.createSystemGrantMethods.hasAnyConfigReadAccess — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/systemGrant.ts:225— PrincipalType (context data-provider) is exposed in data-schemas's public surface via systemGrant.createSystemGrantMethods.hasCapabilityForPrincipals — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/systemGrant.ts:268— PrincipalType (context data-provider) is exposed in data-schemas's public surface via systemGrant.createSystemGrantMethods.getHeldCapabilities — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/systemGrant.ts:332— PrincipalType (context data-provider) is exposed in data-schemas's public surface via systemGrant.createSystemGrantMethods.grantCapability — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/systemGrant.ts:404— PrincipalType (context data-provider) is exposed in data-schemas's public surface via systemGrant.createSystemGrantMethods.revokeCapability — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/systemGrant.ts:438— PrincipalType (context data-provider) is exposed in data-schemas's public surface via systemGrant.createSystemGrantMethods.getCapabilitiesForPrincipal — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/systemGrant.ts:461— PrincipalType (context data-provider) is exposed in data-schemas's public surface via systemGrant.createSystemGrantMethods.listGrants — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/systemGrant.ts:482— PrincipalType (context data-provider) is exposed in data-schemas's public surface via systemGrant.createSystemGrantMethods.countGrants — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/systemGrant.ts:495— PrincipalType (context data-provider) is exposed in data-schemas's public surface via systemGrant.createSystemGrantMethods.getCapabilitiesForPrincipals — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/systemGrant.ts:590— PrincipalType (context data-provider) is exposed in data-schemas's public surface via systemGrant.createSystemGrantMethods.deleteGrantsForPrincipal — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/systemGrant.ts:612— PrincipalType (context data-provider) is exposed in data-schemas's public surface via systemGrant.createSystemGrantMethods.findGrantsForPrincipal — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/systemGrant.ts:661— PrincipalType (context data-provider) is exposed in data-schemas's public surface via systemGrant.createSystemGrantMethods.moveGrantsToPrincipal — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/systemGrant.ts:746— PrincipalType (context data-provider) is exposed in data-schemas's public surface via systemGrant.createSystemGrantMethods.restoreMovedGrants — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/config.ts:421— PrincipalType (context data-provider) is exposed in data-schemas's public surface via config.createConfigMethods.findConfigByPrincipal — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/config.ts:446— PrincipalType (context data-provider) is exposed in data-schemas's public surface via config.createConfigMethods.upsertConfig — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/config.ts:464— PrincipalType (context data-provider) is exposed in data-schemas's public surface via config.createConfigMethods.patchConfigFields — couples the contexts.
Cross-context type PrincipalType (data-provider → data-schemas) packages/data-schemas/src/methods/config.ts:482— PrincipalType (context data-provider) is exposed in data-schemas's public surface via config.createConfigMethods.tombstoneConfigField — couples the contexts.
MethodTooLong: MCPManager.callTool packages/api/src/mcp/MCPManager.ts:1486— MethodTooLong — callTool runs 605 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 505 over it, 6.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: GenerationJobManagerClass.subscribeWithResume packages/api/src/stream/GenerationJobManager.ts:6168— MethodTooLong — subscribeWithResume runs 478 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 378 over it, 4.78× 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: GenerationJobManagerClass.attachSubscription packages/api/src/stream/GenerationJobManager.ts:5132— MethodTooLong — attachSubscription runs 443 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 343 over it, 4.43× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AccessControlService.bulkUpdateResourcePermissions packages/api/src/acl/accessControlService.ts:472— MethodTooLong — bulkUpdateResourcePermissions runs 358 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 258 over it, 3.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: SubagentThreadTaskStore.start packages/api/src/agents/subagentThreads.ts:1591— MethodTooLong — start runs 338 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 238 over it, 3.38× 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: MCPOAuthHandler.initiateOAuthFlow packages/api/src/mcp/oauth/handler.ts:800— MethodTooLong — initiateOAuthFlow runs 318 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 218 over it, 3.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MCPTokenStorage.storeTokensUnderLease packages/api/src/mcp/oauth/tokens.ts:580— MethodTooLong — storeTokensUnderLease runs 303 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 203 over it, 3.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: RedisJobStore.deserializeJob packages/api/src/stream/implementations/RedisJobStore.ts:5620— MethodTooLong — deserializeJob runs 244 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 144 over it, 2.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MCPConnectionFactory.handleOAuthEvents packages/api/src/mcp/MCPConnectionFactory.ts:1840— MethodTooLong — handleOAuthEvents runs 235 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 135 over it, 2.35× 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: SubagentThreadTaskStore.prepareThread packages/api/src/agents/subagentThreads.ts:3302— MethodTooLong — prepareThread runs 232 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 132 over it, 2.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: UserConnectionManager.getUserConnectionForTarget packages/api/src/mcp/UserConnectionManager.ts:473— MethodTooLong — getUserConnectionForTarget runs 210 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 110 over it, 2.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MCPTokenStorage.executeTokenRefresh packages/api/src/mcp/oauth/tokens.ts:1611— MethodTooLong — executeTokenRefresh runs 210 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 110 over it, 2.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MCPConnection.constructTransport packages/api/src/mcp/connection.ts:1718— MethodTooLong — constructTransport runs 193 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 93 over it, 1.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: MCPManager.runAppOperation packages/api/src/mcp/MCPManager.ts:2325— MethodTooLong — runAppOperation runs 191 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 91 over it, 1.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.
MethodTooLong: MCPConnection.createFetchFunction packages/api/src/mcp/connection.ts:1358— MethodTooLong — createFetchFunction runs 187 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 87 over it, 1.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: MCPConnectionFactory.handleOAuthRequired packages/api/src/mcp/MCPConnectionFactory.ts:2348— MethodTooLong — handleOAuthRequired 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: SubagentPublicRecorder.recordEvent packages/api/src/agents/activity.ts:710— MethodTooLong — recordEvent 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: OpenWeather._call api/app/clients/tools/structured/OpenWeather.js:167— MethodTooLong — _call runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: GenerationJobManagerClass.finishTerminalJobInternal packages/api/src/stream/GenerationJobManager.ts:4378— MethodTooLong — finishTerminalJobInternal runs 138 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 38 over it, 1.38× 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: MCPManager.discoverServerTools packages/api/src/mcp/MCPManager.ts:605— MethodTooLong — discoverServerTools runs 125 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 25 over it, 1.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MCPManager.recoverDirectOpenIDBearerConnection packages/api/src/mcp/MCPManager.ts:1081— MethodTooLong — recoverDirectOpenIDBearerConnection runs 122 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 22 over it, 1.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: GenerationJobManagerClass.recoverCommittedCreate packages/api/src/stream/GenerationJobManager.ts:2266— MethodTooLong — recoverCommittedCreate runs 122 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 22 over it, 1.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: RedisJobStore.overlayHostSteerParts packages/api/src/stream/implementations/RedisJobStore.ts:4111— MethodTooLong — overlayHostSteerParts runs 122 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 22 over it, 1.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MCPConnection.connectClient packages/api/src/mcp/connection.ts:2281— MethodTooLong — connectClient runs 117 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 17 over it, 1.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.
MethodTooLong: RedisJobStore.transitionStatusInternal packages/api/src/stream/implementations/RedisJobStore.ts:3004— MethodTooLong — transitionStatusInternal runs 116 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 16 over it, 1.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Swallowed exception (empty catch) scripts/activity-labels/variants.mts:50— 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) packages/data-schemas/src/methods/mcpAuthority.ts:1653— 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) packages/data-schemas/src/methods/prompt.ts:788— 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) packages/data-schemas/src/methods/prompt.ts:807— 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) packages/data-schemas/src/methods/userGroup.ts:314— 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) packages/data-schemas/src/methods/userGroup.ts:402— 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) packages/data-schemas/src/methods/userGroup.ts:411— 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) packages/data-schemas/src/methods/userGroup.ts:447— 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) packages/data-schemas/src/methods/userGroup.ts:486— 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) packages/data-schemas/src/methods/userGroup.ts:536— 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) packages/data-schemas/src/config/parsers.ts:375— 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) packages/data-schemas/src/config/parsers.ts:570— 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) packages/data-provider/src/request.ts:172— 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) packages/data-provider/src/request.ts:182— 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) packages/data-provider/src/twoFactor.ts:56— 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) packages/data-provider/src/twoFactor.ts:67— 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) packages/data-provider/src/upload.ts:84— 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) packages/client/src/theme/context/ThemeProvider.tsx:248— 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) packages/client/src/theme/context/ThemeProvider.tsx:268— 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) packages/client/src/theme/context/ThemeProvider.tsx:283— 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) packages/chat/src/react/steer/recovery.ts:33— 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) packages/chat/src/react/steer/recovery.ts:40— 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) packages/chat/src/core/resumable/failure.ts:60— 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) packages/chat/src/components/Summary.tsx:22— `.then(…, () => {})` 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) packages/api/jest.setup.cjs:19— 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.
ClassTooLong: GenerationJobManagerClass packages/api/src/stream/GenerationJobManager.ts:894— ClassTooLong — 5585 significant lines (blank, comment-only and punctuation-only lines excluded), 159 methods. The bar is 400 significant lines; this is 5185 over it, 13.96× 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: SubagentThreadTaskStore packages/api/src/agents/subagentThreads.ts:707— ClassTooLong — 2431 significant lines (blank, comment-only and punctuation-only lines excluded), 79 methods. The bar is 400 significant lines; this is 2031 over it, 6.08× 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: MCPConnectionFactory packages/api/src/mcp/MCPConnectionFactory.ts:91— ClassTooLong — 1635 significant lines (blank, comment-only and punctuation-only lines excluded), 62 methods. The bar is 400 significant lines; this is 1235 over it, 4.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: MCPOAuthHandler packages/api/src/mcp/oauth/handler.ts:67— ClassTooLong — 1421 significant lines (blank, comment-only and punctuation-only lines excluded), 38 methods. The bar is 400 significant lines; this is 1021 over it, 3.55× 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: MCPConnection packages/api/src/mcp/connection.ts:1109— ClassTooLong — 1369 significant lines (blank, comment-only and punctuation-only lines excluded), 62 methods. The bar is 400 significant lines; this is 969 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: MCPTokenStorage packages/api/src/mcp/oauth/tokens.ts:234— ClassTooLong — 1242 significant lines (blank, comment-only and punctuation-only lines excluded), 26 methods. The bar is 400 significant lines; this is 842 over it, 3.11× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: MessageNav client/src/components/Chat/Messages/MessageNav.tsx:1— ClassTooLong — 949 significant lines (blank, comment-only and punctuation-only lines excluded), 20 methods. The bar is 400 significant lines; this is 549 over it, 2.37× 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: BackgroundTaskRegistryClass packages/api/src/agents/background.ts:913— ClassTooLong — 744 significant lines (blank, comment-only and punctuation-only lines excluded), 45 methods. The bar is 400 significant lines; this is 344 over it, 1.86× 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: FlowStateManager packages/api/src/flow/manager.ts:179— ClassTooLong — 644 significant lines (blank, comment-only and punctuation-only lines excluded), 28 methods. The bar is 400 significant lines; this is 244 over it, 1.61× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: AccessControlService packages/api/src/acl/accessControlService.ts:102— ClassTooLong — 638 significant lines (blank, comment-only and punctuation-only lines excluded), 13 methods. The bar is 400 significant lines; this is 238 over it, 1.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: ScheduleDialog client/src/components/SidePanel/Schedules/ScheduleDialog.tsx:1— ClassTooLong — 584 significant lines (blank, comment-only and punctuation-only lines excluded), 3 methods. The bar is 400 significant lines; this is 184 over it, 1.46× 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: useMCPServerManager client/src/hooks/MCP/useMCPServerManager.ts:1— ClassTooLong — 555 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 155 over it, 1.39× 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: CodeWorkspaceMenu client/src/components/Chat/Input/CodeWorkspaceMenu.tsx:1— ClassTooLong — 536 significant lines (blank, comment-only and punctuation-only lines excluded), 7 methods. The bar is 400 significant lines; this is 136 over it, 1.34× 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: DataTable packages/client/src/components/DataTable/DataTable.tsx:1— ClassTooLong — 533 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 133 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.
ClassTooLong: RedisSubagentTaskControlTransport packages/api/src/agents/subagentTaskRouting.ts:714— ClassTooLong — 505 significant lines (blank, comment-only and punctuation-only lines excluded), 32 methods. The bar is 400 significant lines; this is 105 over it, 1.26× 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: useQueryParams client/src/hooks/Input/useQueryParams.ts:1— ClassTooLong — 505 significant lines (blank, comment-only and punctuation-only lines excluded), 18 methods. The bar is 400 significant lines; this is 105 over it, 1.26× 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: Artifacts client/src/components/Artifacts/Artifacts.tsx:1— ClassTooLong — 499 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 99 over it, 1.25× 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: chatV1 api/server/controllers/assistants/chatV1.js:1— ClassTooLong — 497 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 97 over it, 1.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: ToolCallGroup client/src/components/Chat/Messages/Content/ToolCallGroup.tsx:1— ClassTooLong — 488 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 88 over it, 1.22× 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: ProjectResources client/src/components/Projects/ProjectResources.tsx:1— ClassTooLong — 467 significant lines (blank, comment-only and punctuation-only lines excluded), 5 methods. The bar is 400 significant lines; this is 67 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: useCodeWorkspace client/src/hooks/Agents/useCodeWorkspace.ts:1— ClassTooLong — 462 significant lines (blank, comment-only and punctuation-only lines excluded), 17 methods. The bar is 400 significant lines; this is 62 over it, 1.16× 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: Viewer client/src/components/Chat/Trace/Viewer.tsx:1— ClassTooLong — 456 significant lines (blank, comment-only and punctuation-only lines excluded), 3 methods. The bar is 400 significant lines; this is 56 over it, 1.14× 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: Breakdown client/src/components/Chat/Input/TokenUsage/Breakdown.tsx:1— ClassTooLong — 454 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 54 over it, 1.14× 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: LangfuseConnection client/src/components/Nav/SettingsTabs/Integrations/LangfuseConnection.tsx:1— ClassTooLong — 435 significant lines (blank, comment-only and punctuation-only lines excluded), 6 methods. The bar is 400 significant lines; this is 35 over it, 1.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: LiaEngine client/src/components/Lia/engine/engine.ts:122— ClassTooLong — 433 significant lines (blank, comment-only and punctuation-only lines excluded), 26 methods. The bar is 400 significant lines; this is 33 over it, 1.08× 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.
+ 5 more in this group — see findings.md.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×27
Animation without a prefers-reduced-motion guard client/src/components/Chat/Input/Files/DragDropOverlay.tsx:36— <svg> moves — its inline style sets `transition: transform 0.2s ease-in-out` — 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 client/src/components/Prompts/forms/PromptForm.tsx:574— <div> moves — its inline style sets `transition: transform 300ms cubic-bezier(0.2, 0, 0, 1)` — 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 client/src/components/Prompts/forms/PromptForm.tsx:708— <div> moves — its inline style sets `transition: transform 300ms cubic-bezier(0.2, 0, 0, 1)` — 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 client/src/components/SharePoint/SharePointPickerDialog.tsx:80— <div> moves — its `animate-spin` 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 packages/client/src/components/AnimatedSearchInput.tsx:56— <div> 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 packages/client/src/components/AnimatePopover.css:4— `.animate-popover` moves (`transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
transform 150ms cubic-bezier(0.4, 0, 0.2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard packages/client/src/components/AnimatePopover.css:18— `.animate-popover-left` moves (`transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
transform 150ms cubic-bezier(0.4, 0, 0.2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard packages/client/src/components/Dropdown.css:23— `.popover-ui` moves (`transition-property: opacity, scale`) 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/client/src/components/Dropdown.css:42— `.popover-animate` moves (`transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
transform 150ms cubic-bezier(0.4, 0, 0.2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard client/src/mobile.css:75— `.rotate` moves (`animation: tuning 2.1s 1`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard client/src/mobile.css:173— `.shake` moves (`animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both`) 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 client/src/style.css:391— `p > small` moves (`animation: fadein 3s forwards`) 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 client/src/style.css:497— `.scroll-animation-exit-active` moves (`transition: opacity 180ms cubic-bezier(0.4, 0, 1, 1),
transform 180ms cubic-bezier(0.4, 0, 1, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard client/src/style.css:1397— `.toast-root[data-state='open']` moves (`animation: toast-open 0.24s cubic-bezier(0.175, 0.885, 0.32, 1.175) both`) 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 client/src/style.css:1864— `.rotate-adjust-and-back` moves (`animation: rotateAdjustAndBack 10s ease-in-out infinite`) 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 client/src/style.css:2034— `.popover-ui` moves (`transition-property: opacity, scale`) 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 client/src/style.css:2045— `.popover-animate` moves (`transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
transform 150ms cubic-bezier(0.4, 0, 0.2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard client/src/style.css:2117— `.animate-popover-top` moves (`transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
transform 150ms cubic-bezier(0.4, 0, 0.2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard client/src/style.css:2132— `.animate-popover-left` moves (`transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
transform 150ms cubic-bezier(0.4, 0, 0.2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard client/src/style.css:2155— `.animate-popover-top-left` moves (`transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
transform 150ms cubic-bezier(0.4, 0, 0.2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard client/src/style.css:2268— `.composer-effort-fill[data-dragging]` moves (`transition: width 60ms linear,
opacity 100ms ease-out`) 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 client/src/style.css:2419— `.animate-gradient-x` moves (`animation: gradient-x 15s ease infinite`) 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 client/src/style.css:2423— `.animate-pulse-slow` moves (`animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite`) 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 client/src/style.css:2438— `.animate-fadeIn` moves (`animation: fadeIn 0.5s ease-out forwards`) 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 client/src/style.css:2456— `.ios-wiggle` moves (`animation: ios-wiggle 0.2s ease-in-out infinite`) 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.
Cross-context type ResourceType (data-provider → api) packages/api/src/acl/audit.ts:161— ResourceType (context data-provider) is exposed in api's public surface via audit.planResourceAudit — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/acl/audit.ts:220— ResourceType (context data-provider) is exposed in api's public surface via audit.runAuditedPermissionUpdate — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/acl/accessControlService.ts:317— ResourceType (context data-provider) is exposed in api's public surface via AccessControlService.findPubliclyAccessibleResources — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/acl/accessControlService.ts:362— ResourceType (context data-provider) is exposed in api's public surface via AccessControlService.getResourcePermissionsMap — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/acl/accessControlService.ts:400— ResourceType (context data-provider) is exposed in api's public surface via AccessControlService.getResourcePermissionsMapForPrincipals — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/acl/accessControlService.ts:444— ResourceType (context data-provider) is exposed in api's public surface via AccessControlService.removeAllPermissions — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/acl/accessControlService.ts:472— ResourceType (context data-provider) is exposed in api's public surface via AccessControlService.bulkUpdateResourcePermissions — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/acl/accessControlService.ts:975— ResourceType (context data-provider) is exposed in api's public surface via AccessControlService.checkPermission — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/acl/accessControlService.ts:1024— ResourceType (context data-provider) is exposed in api's public surface via AccessControlService.hasPublicAccess — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/acl/insightsPermissions.ts:11— ResourceType (context data-provider) is exposed in api's public surface via insightsPermissions.validateInsightsPermissionUpdates — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/acl/insightsPermissions.ts:47— ResourceType (context data-provider) is exposed in api's public surface via insightsPermissions.maskAgentInsightsBit — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/acl/insightsPermissions.ts:61— ResourceType (context data-provider) is exposed in api's public surface via insightsPermissions.sanitizeInsightsPermissionPrincipals — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/agents/deletion.ts:23— ResourceType (context data-provider) is exposed in api's public surface via AgentManagementDeleteDeps.checkPermission — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/agents/files.ts:115— ResourceType (context data-provider) is exposed in api's public surface via AgentManagementFileDeps.checkPermission — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/agents/reads.ts:38— ResourceType (context data-provider) is exposed in api's public surface via AgentManagementReadDeps.findAccessibleResources — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/agents/reads.ts:45— ResourceType (context data-provider) is exposed in api's public surface via AgentManagementReadDeps.checkPermission — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/agents/updates.ts:32— ResourceType (context data-provider) is exposed in api's public surface via AgentManagementUpdateDeps.checkPermission — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/apiKeys/service.ts:11— ResourceType (context data-provider) is exposed in api's public surface via GetRemoteAgentPermissionsDeps.getEffectivePermissions — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/apiKeys/service.ts:45— ResourceType (context data-provider) is exposed in api's public surface via service.checkRemoteAgentAccess — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/apiKeys/middleware.ts:28— ResourceType (context data-provider) is exposed in api's public surface via RemoteAgentAccessDependencies.getEffectivePermissions — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/files/agents/auth.ts:31— ResourceType (context data-provider) is exposed in api's public surface via AgentUploadAuthDeps.checkPermission — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/images/authorization.ts:103— ResourceType (context data-provider) is exposed in api's public surface via ImageAuthorizationDeps.hasPermission — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/prompts/service.ts:447— ResourceType (context data-provider) is exposed in api's public surface via PromptServiceDependencies.grantPermission — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/prompts/handlers.ts:52— ResourceType (context data-provider) is exposed in api's public surface via PromptHandlersDeps.getEffectivePermissions — couples the contexts.
Cross-context type ResourceType (data-provider → api) packages/api/src/schedules/access.ts:24— ResourceType (context data-provider) is exposed in api's public surface via AgentFireAccessDeps.checkPermission — couples the contexts.
Change coupling: data-service.ts ↔ keys.ts packages/data-provider/src/data-service.ts:1— `packages/data-provider/src/data-service.ts` and `packages/data-provider/src/keys.ts` change together 96% of the time (25 of the 26 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 25 shared commits counted here, the most recent 3 are `202756b3` 🧐 feat: Preview Langfuse Prompts in Settings (#16854); `54b887a1` 🛰️ fix: Route Subagent Files Delivered After a Mid-Run Reload (#17212); `6a1a97ad` 🔌 feat: Add a Connected Account Setting for Pull Requests (#16990) — run `git show` on any of them.
Change coupling: convos-route-mocks.js ↔ REDACTED api/server/routes/__test-utils__/convos-route-mocks.js:1— `api/server/routes/__test-utils__/convos-route-mocks.js` and `REDACTED` change together 88% of the time (15 of the 17 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 `52a91b23` ♻️ feat: Share Pull Request Lookups Across Replicas Through Redis (#1…; `ae44437e` 🗂️ feat: Record Lane Git State and Serve Conversation Pull Requests …; `c0ea79ad` 🔎 feat: Filter the Conversation List by Date, Endpoint, Files, and S… — run `git show` on any of them.
Change coupling: api-endpoints.ts ↔ keys.ts packages/data-provider/src/api-endpoints.ts:1— `packages/data-provider/src/api-endpoints.ts` and `packages/data-provider/src/keys.ts` change together 85% of the time (22 of the 26 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 22 shared commits counted here, the most recent 3 are `202756b3` 🧐 feat: Preview Langfuse Prompts in Settings (#16854); `54b887a1` 🛰️ fix: Route Subagent Files Delivered After a Mid-Run Reload (#17212); `6a1a97ad` 🔌 feat: Add a Connected Account Setting for Pull Requests (#16990) — run `git show` on any of them.
Change coupling: AdminSettings.tsx ↔ AdminSettings.tsx client/src/components/Prompts/buttons/AdminSettings.tsx:1— `client/src/components/Prompts/buttons/AdminSettings.tsx` and `client/src/components/SidePanel/Agents/AdminSettings.tsx` 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 `b6dcefc5` 🌐 refactor: Interpolate Localization Keys (#10650) (at that commit the file was still `client/src/components/Prompts/AdminSettings.tsx`); `15d7a3d2` 🎵 feat: Cumulative Transcription Support for External STT (#9318) (at that commit the file was still `client/src/components/Prompts/AdminSettings.tsx`); `d711fc78` 🤝 refactor: Clarify labels for Sharing Permissions (at that commit the file was still `client/src/components/Prompts/AdminSettings.tsx`) — run `git show` on any of them.
Change coupling: tokens.ts ↔ tx.ts packages/api/src/utils/tokens.ts:1— `packages/api/src/utils/tokens.ts` and `packages/data-schemas/src/methods/tx.ts` change together 78% of the time (67 of the 86 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 67 shared commits counted here, the most recent 3 are `96495419` 💠 feat: Add Gemini 4 Argon Support (#17200); `214362af` 🎐 feat: Add Claude Haiku 5.5 Support (#17201); `40bb16ed` 🎼 feat: Add Claude Sonnet 5.5 Support (#16460) — run `git show` on any of them.
Change coupling: useToolCallState.ts ↔ ToolCall.tsx client/src/components/Chat/Messages/Content/Parts/useToolCallState.ts:1— `client/src/components/Chat/Messages/Content/Parts/useToolCallState.ts` and `client/src/components/Chat/Messages/Content/ToolCall.tsx` change together 70% of the time (7 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 7 shared commits counted here, the most recent 3 are `883f12c1` 📋 fix: Load Full Tool Output So Copy Works on Panels Without a Row (…; `34279ca3` 🪄 fix: Hide Sole Tool Row Under Its Group Header (#16750); `5a6316ec` 🪗 fix: Open the Lone Tool Call Directly and Label Settled Commands R… — run `git show` on any of them.
Change coupling: jest.config.cjs ↔ config.ts client/jest.config.cjs:1— `client/jest.config.cjs` and `packages/data-provider/src/config.ts` change together 64% of the time (23 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 23 shared commits counted here, the most recent 3 are `361553f3` 🚀 v0.8.8-rc4 (#16147); `e18606e5` 🚀 v0.8.8-rc3 (#15859); `f9f1b2fb` ✨ v0.8.8-rc2 (#14845) — run `git show` on any of them.
Change coupling: openidStrategy.js ↔ samlStrategy.js api/strategies/openidStrategy.js:1— `api/strategies/openidStrategy.js` and `api/strategies/samlStrategy.js` 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) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `de760f6b` 🪪 fix: Use Shared IdP Avatar Processing (#13422); `77712c82` 🏢 feat: Tenant-Scoped App Config in Auth Login Flows (#12434); `a1471c2f` 📧 fix: Case-Insensitive Domain Matching (#9868) — run `git show` on any of them.
Change coupling: formatMessages.js ↔ client.js api/app/clients/prompts/formatMessages.js:1— `api/app/clients/prompts/formatMessages.js` and `api/server/controllers/agents/client.js` 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) 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 7 shared commits counted here, the most recent 3 are `a2ad0aa0` 🤐 feat: Allow Promptless Sends When Files Are Attached (#13717); `7447fddf` 🙊 refactor: Clarify Ask Question Schema Errors and Retry Guidance (#…; `d9056720` 🛟 fix: persist Vertex Gemini 3 `thoughtSignatures` across DB round-t… — run `git show` on any of them.
Change coupling: SharedLinks.tsx ↔ ArchivedChatsTable.tsx client/src/components/Nav/SettingsTabs/Data/SharedLinks.tsx:1— `client/src/components/Nav/SettingsTabs/Data/SharedLinks.tsx` and `client/src/components/Nav/SettingsTabs/General/ArchivedChatsTable.tsx` 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 `edc6cf59` 🩹 fix: Stop Archived and Shared Chats Dialogs Crashing on Open (#14886); `465cb6e3` 👐 a11y: Bump `@ariakit/react`, Improve a11y of Token Usage, Archived…; `13cea97c` 🔗 feat: More Accessible Link Behaviors and Minor UI Improvements (#1… — run `git show` on any of them.
Change coupling: agents-types.ts ↔ validation.ts client/src/common/agents-types.ts:1— `client/src/common/agents-types.ts` and `packages/api/src/agents/validation.ts` 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 `299dbc60` 📖 Load Repository Instructions for Attached Workspaces (#16008); `aeac7a20` 🪪 feat: Add Per-Agent Git Identity (#15628); `53e369fb` 🧪 feat: stateful_code_sessions capability for warm Code API sandbox … — run `git show` on any of them.
Change coupling: GenerationJobManager.ts ↔ RedisEventTransport.ts packages/api/src/stream/GenerationJobManager.ts:1— `packages/api/src/stream/GenerationJobManager.ts` and `packages/api/src/stream/implementations/RedisEventTransport.ts` 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) 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 10 shared commits counted here, the most recent 3 are `cdfe54c3` 🚦 fix: Downgrade Stale Generation Fence Telemetry (#15452); `b2128a7d` 📡 fix: Preserve Redis Abort Terminal Delivery (#14749); `58cdd9cd` ⚡ feat: Coalesce Redis Streaming Delta Publications into Windowed Bat… — run `git show` on any of them.
Change coupling: ConnectionsRepository.ts ↔ MCPServerInspector.ts packages/api/src/mcp/ConnectionsRepository.ts:1— `packages/api/src/mcp/ConnectionsRepository.ts` and `packages/api/src/mcp/registry/MCPServerInspector.ts` 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) 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 `eb3b3537` 📡 fix: Publish App-Level MCP Tool Catalogs Without a Reserved Revisi…; `acd07e80` 🗝️ fix: Exempt Admin-Trusted Domains from MCP OAuth Validation (#12255); `83184467` 💁 refactor: Better Config UX for MCP STDIO with `customUserVars` (#1… — run `git show` on any of them.
Change coupling: execution.ts ↔ bridge.ts packages/api/src/agents/execution.ts:1— `packages/api/src/agents/execution.ts` and `packages/api/src/code/bridge.ts` change together 54% of the time (7 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 — 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 7 shared commits counted here, the most recent 3 are `3e19b187` 🎯 feat: Tolerant Workspace Edits with Host-Rendered Conflict Diagnos…; `867fd5ea` 🛤️ feat: Route Linked Worktree Requests into Per-Worktree Lanes (#16…; `2df937dd` 🌳 feat: Isolate Attached Workspaces by Conversation (#16107) — run `git show` on any of them.
Change coupling: tailwind.preset.cjs ↔ theme.ts packages/client/tailwind.preset.cjs:1— `packages/client/tailwind.preset.cjs` and `packages/data-provider/src/theme.ts` change together 54% of the time (7 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 — 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 7 shared commits counted here, the most recent 3 are `1b004021` 🔲 refactor: Route Picker Panels Through Theme Radius Roles (#17186); `d738fa43` 📏 feat: Cap the Select List at the Popover's Available Height (#16938); `74e682b7` 🎯 fix: Hold Default Button Heights and the Dialog Close Button at th… — run `git show` on any of them.
Change coupling: tailwind.preset.cjs ↔ registry.ts packages/client/tailwind.preset.cjs:1— `packages/client/tailwind.preset.cjs` and `packages/data-provider/src/themes/registry.ts` change together 54% of the time (7 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 — 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 7 shared commits counted here, the most recent 3 are `1b004021` 🔲 refactor: Route Picker Panels Through Theme Radius Roles (#17186) (at that commit the file was still `packages/client/src/theme/registry.ts`); `74e682b7` 🎯 fix: Hold Default Button Heights and the Dialog Close Button at th… (at that commit the file was still `packages/client/src/theme/registry.ts`); `41825b7b` 🧬 fix: Derive the Theme Cache Version and Align Color Tokens (#16819) (at that commit the file was still `packages/client/src/theme/registry.ts`) — run `git show` on any of them.
Change coupling: api-endpoints.ts ↔ mutations.ts packages/data-provider/src/api-endpoints.ts:1— `packages/data-provider/src/api-endpoints.ts` and `packages/data-provider/src/types/mutations.ts` change together 53% of the time (8 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 8 shared commits counted here, the most recent 3 are `fdc9c77f` 🗄️ feat: Archive All Chats From Data Controls (#14885); `61016e32` 🔄 feat: Continue Shared Conversations as Personal Copies (#13714); `743f57f6` 🔖 feat: Add Pinned Conversations (#13492) — run `git show` on any of them.
Change coupling: convos-route-mocks.js ↔ conversation.ts api/server/routes/__test-utils__/convos-route-mocks.js:1— `api/server/routes/__test-utils__/convos-route-mocks.js` and `packages/data-schemas/src/methods/conversation.ts` change together 53% of the time (9 of the 17 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 `ae44437e` 🗂️ feat: Record Lane Git State and Serve Conversation Pull Requests …; `c0ea79ad` 🔎 feat: Filter the Conversation List by Date, Endpoint, Files, and S…; `78b320cb` 🗜️ fix: Bound Conversation Page Size (#15576) — run `git show` on any of them.
Change coupling: client.js ↔ addedConvo.js api/server/controllers/agents/client.js:1— `api/server/controllers/agents/client.js` and `api/server/services/Endpoints/agents/addedConvo.js` 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) 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 7 shared commits counted here, the most recent 3 are `8fab21d8` 🧬 fix: Skip Re-Embedding Legacy File Search Files After Upgrade (#17…; `5f4a07f4` ⚡ perf: Exclude Agent Version History From Default `getAgent` Reads (…; `74fa60ce` 🔎 fix: Enforce WEB_SEARCH Role Permission on Agents (#15875) — run `git show` on any of them.
Change coupling: Part.tsx ↔ useToolCallState.ts client/src/components/Chat/Messages/Content/Part.tsx:1— `client/src/components/Chat/Messages/Content/Part.tsx` and `client/src/components/Chat/Messages/Content/Parts/useToolCallState.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 `559fd7d6` 🪓 feat: Cancel Background Tool Invocations (#15773); `db675209` 🧩 refactor: Extend Step Status To Remaining Cards; Separate Cancelle…; `88747f0a` 🩺 fix: Render Stopped Run Steps From Explicit Status (#14871) — run `git show` on any of them.
Change coupling: loadConfigModels.js ↔ config.ts api/server/services/Config/loadConfigModels.js:1— `api/server/services/Config/loadConfigModels.js` and `packages/data-provider/src/config.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 `bb220f1a` 👤 feat: AWS Bedrock Custom Inference Profiles (#11308); `e9a85d5c` 🗂️ feat: Add Optional Group Field to ModelSpecs Configuration (#9996); `00b2d026` 🚀 feat: Enhance Model Handling, Logging & xAI Agent Support (#6182) — run `git show` on any of them.
Change coupling: REDACTED ↔ REDACTED api/config/index.js:1— `api/config/index.js` and `REDACTED` 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 `601ed078` 🫧 fix: Retire Cancelled MCP OAuth State (#15702); `56175af0` 🎟️ fix: Reconcile MCP OAuth Readiness Across Pods (#14629); `a7f16911` ⏳ fix: Extend and Decouple MCP OAuth Flow Timeouts (#13622) — run `git show` on any of them.
TodoComment packages/data-provider/src/actions.ts:284— // TODO: maybe doing it in a different way later on. but we want that the user needs to folllow the oauth flow. — 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/data-provider/src/config.ts:4907— // TODO: Add agent models (agentsModels) — 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/data-provider/src/config.ts:4970— // TODO: Add agent models (agentsModels) — 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/data-provider/src/types.ts:286— // TODO `label` needs to be changed to the proper `TranslationKeys` — 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/client/src/components/InputNumber.tsx:11— // TODO help needed — 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/api/src/mcp/ConnectionsRepository.ts:312— //TODO in the future we should use a scoped config getter (APPLevel, UserLevel, Private) — 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/api/src/mcp/registry/MCPServersRegistry.ts:1583— // TODO: Refactor callers to use config.requiresOAuth directly instead of this method. — 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/api/src/agents/handlers.ts:5133— // TODO: PDF artifact support requires a document content block path — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment client/src/utils/files.ts:71— // TODO: make this dynamic to the language — 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 client/src/hooks/SSE/useContentHandler.ts:70— // TODO: handle streaming for non-text — 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 client/src/hooks/Files/useFileHandling.ts:320— // TODO: this should not be a dynamic localize input!! — 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 client/src/hooks/Files/useFileHandling.ts:330— // TODO: this should not be a dynamic localize input!! — 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 client/src/components/SidePanel/Parameters/DynamicDropdown.tsx:36— // TODO: custom logic, add to payload but not to conversation — 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 client/src/components/SidePanel/Parameters/DynamicDropdown.tsx:45— // TODO: custom logic, add to payload but not to conversation — 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 client/src/components/SidePanel/Parameters/DynamicSlider.tsx:59— // TODO: custom logic, add to payload but not to conversation — 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 client/src/components/Sharing/PeoplePicker/SearchPicker.tsx:124— //todo fix focus when set to true — 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 client/src/components/Prompts/forms/PromptForm.tsx:385— // TODO: show toast, cannot be empty. — 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 client/src/components/Input/SetKeyDialog/SetKeyDialog.tsx:182— // TODO: allow endpoint definitions from user — 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 client/src/components/Input/SetKeyDialog/SetKeyDialog.tsx:184— // TODO: add custom endpoint models defined by user — 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 client/src/components/Input/SetKeyDialog/SetKeyDialog.tsx:230— // TODO: handle other user provided options besides baseURL and apiKey — 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 client/src/Providers/AgentPanelContext.tsx:100— //TODO to refactor when tools come from tool box — 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.
Fake-async — async method never awaits api/server/services/AssistantService.js:31— `createOnTextProgress` 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 api/server/services/Runs/StreamRunManager.js:111— `addContentData` 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 api/server/services/Runs/StreamRunManager.js:207— `handleThreadCreated` 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 api/server/services/Runs/StreamRunManager.js:231— `handleRunStepEvent` 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 api/server/services/Runs/StreamRunManager.js:414— `handleRunStepDeltaEvent` 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 api/server/services/Runs/StreamRunManager.js:473— `handleErrorEvent` 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 api/server/services/Runs/StreamRunManager.js:616— `onRunStepCreated` 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 api/server/services/Runs/StreamRunManager.js:660— `onRunStepCompleted` 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 api/strategies/samlStrategy.js:311— `setupSaml` 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 client/src/utils/index.ts:160— `handleUIAction` 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:4— `validateDockerRunning` 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 config/flush-cache.js:53— `showHelp` 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 config/flush-cache.js:228— `flushFileCache` 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 config/flush-cache.js:280— `restartRecommendation` 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 config/update.js:44— `validateDockerRunning` 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/api/src/mcp/registry/MCPServerInspector.ts:167— `fetchServerInstructions` 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/api/src/mcp/registry/cache/ServerConfigsCacheInMemory.ts:23— `update` 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/api/src/mcp/registry/cache/ServerConfigsCacheInMemory.ts:31— `upsert` 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/api/src/mcp/registry/cache/ServerConfigsCacheInMemory.ts:37— `patch` 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/api/src/mcp/registry/cache/ServerConfigsCacheInMemory.ts:73— `remove` 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/api/src/mcp/registry/cache/ServerConfigsCacheInMemory.ts:87— `reset` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
Sync-over-async blocking api/app/clients/tools/structured/StableDiffusion.js:145— `fs.existsSync` in `_call` 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 api/app/clients/tools/structured/StableDiffusion.js:146— `fs.mkdirSync` in `_call` 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 REDACTED:538— `fs.readFileSync` in `startServer` 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 REDACTED:300— `fs.readFileSync` in `startServer` 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 api/server/services/Files/Local/images.js:86— `fs.existsSync` in `prepareImagesLocal` 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 api/server/services/Files/Local/images.js:87— `fs.mkdirSync` in `prepareImagesLocal` 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 e2e/lighthouse/audit.ts:60— `fs.rmSync` in `auditPage` 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 e2e/lighthouse/audit.ts:61— `fs.mkdirSync` in `auditPage` 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 e2e/lighthouse/audit.ts:84— `fs.existsSync` in `auditPage` 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 e2e/lighthouse/audit.ts:84— `fs.readdirSync` in `auditPage` 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 e2e/lighthouse/audit.ts:87— `fs.readFileSync` in `auditPage` 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 e2e/lighthouse/audit.ts:88— `fs.writeFileSync` in `auditPage` 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 e2e/lighthouse/audit.ts:92— `fs.readdirSync` in `auditPage` 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 e2e/lighthouse/audit.ts:95— `fs.readFileSync` in `callback to reports.map` 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 e2e/perf/scan.ts:155— `fs.readFileSync` in `installReactScan` 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 e2e/setup/agent-management.ts:19— `generateKeyPairSync` in `startManagementOidc` 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 e2e/specs/mock/lia.helpers.ts:22— `fs.readFileSync` in `anonymous function` 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 packages/api/openapi/router.smoke.cjs:135— `fs.readFileSync` in `assertEnabled` 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 packages/api/src/files/provision/service.ts:462— `fs.unlinkSync` in `provisionToVectorDB` 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.
Cross-context type TEndpointsConfig (data-provider → client) client/src/hooks/Agents/useGetAgentsConfig.ts:10— TEndpointsConfig (context data-provider) is exposed in client's public surface via useGetAgentsConfig.useGetAgentsConfig — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/hooks/Endpoint/useProviderIcon.ts:13— TEndpointsConfig (context data-provider) is exposed in client's public surface via ProviderIconParams.endpointsConfig — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/hooks/Endpoint/useEndpoints.ts:63— TEndpointsConfig (context data-provider) is exposed in client's public surface via useEndpoints.useEndpoints — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/hooks/Endpoint/useModelReasoning.ts:16— TEndpointsConfig (context data-provider) is exposed in client's public surface via useModelReasoning.usesReasoningCapabilities — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/hooks/Endpoint/useModelReasoning.ts:35— TEndpointsConfig (context data-provider) is exposed in client's public surface via useModelReasoning.useModelReasoning — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/components/Chat/Menus/Endpoints/utils.ts:125— TEndpointsConfig (context data-provider) is exposed in client's public surface via utils.getSelectedIcon — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/components/Conversations/facets.ts:161— TEndpointsConfig (context data-provider) is exposed in client's public surface via facets.selectableEndpoints — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/components/Endpoints/EndpointIcon.tsx:17— TEndpointsConfig (context data-provider) is exposed in client's public surface via EndpointIcon.EndpointIcon — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/components/Nav/SettingsTabs/ProviderKeys/utils.ts:79— TEndpointsConfig (context data-provider) is exposed in client's public surface via utils.getUserKeyEndpoints — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/data-provider/Endpoints/queries.ts:9— TEndpointsConfig (context data-provider) is exposed in client's public surface via queries.useGetEndpointsQuery — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/hooks/Input/useSelectMention.ts:23— TEndpointsConfig (context data-provider) is exposed in client's public surface via useSelectMention.useSelectMention — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/hooks/Nav/useSideNavLinks.ts:39— TEndpointsConfig (context data-provider) is exposed in client's public surface via useSideNavLinks.useSideNavLinks — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/utils/endpoints.ts:55— TEndpointsConfig (context data-provider) is exposed in client's public surface via endpoints.getEndpointsFilter — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/utils/endpoints.ts:66— TEndpointsConfig (context data-provider) is exposed in client's public surface via endpoints.getAvailableEndpoints — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/utils/endpoints.ts:87— TEndpointsConfig (context data-provider) is exposed in client's public surface via endpoints.mapEndpoints — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/utils/endpoints.ts:418— TEndpointsConfig (context data-provider) is exposed in client's public surface via endpoints.getDefaultModelSpec — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → client) client/src/utils/endpoints.ts:487— TEndpointsConfig (context data-provider) is exposed in client's public surface via endpoints.defaultSpecAwaitsAgents — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/hooks/Agents/useAgentFileConfig.ts:12— EModelEndpoint (context data-provider) is exposed in client's public surface via useAgentFileConfig.useAgentFileConfig — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/hooks/Agents/useAgentUploadTarget.ts:15— EModelEndpoint (context data-provider) is exposed in client's public surface via AgentUploadTarget.endpointType — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/common/assistants-types.ts:5— EModelEndpoint (context data-provider) is exposed in client's public surface via ActionsEndpoint.ActionsEndpoint — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/components/Chat/Input/PopoverButtons.tsx:17— EModelEndpoint (context data-provider) is exposed in client's public surface via PopoverButtons.PopoverButtons — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/components/Input/SetKeyDialog/BedrockConfig.tsx:7— EModelEndpoint (context data-provider) is exposed in client's public surface via BedrockConfig.BedrockConfig — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/components/Input/SetKeyDialog/CustomEndpoint.tsx:5— EModelEndpoint (context data-provider) is exposed in client's public surface via CustomEndpoint.CustomEndpoint — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/components/Input/SetKeyDialog/OpenAIConfig.tsx:5— EModelEndpoint (context data-provider) is exposed in client's public surface via OpenAIConfig.OpenAIConfig — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/components/Input/SetKeyDialog/SetKeyDialog.tsx:151— EModelEndpoint (context data-provider) is exposed in client's public surface via SetKeyDialog.SetKeyDialog — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/data-provider/SSE/mutations.ts:72— EModelEndpoint (context data-provider) is exposed in client's public surface via ResumeAgentFields.endpoint — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/data-provider/SSE/mutations.ts:73— EModelEndpoint (context data-provider) is exposed in client's public surface via ResumeAgentFields.endpointType — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/hooks/Files/useAttachExisting.ts:41— EModelEndpoint (context data-provider) is exposed in client's public surface via AttachExistingContext.endpointType — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/hooks/Input/mentions.ts:3— EModelEndpoint (context data-provider) is exposed in client's public surface via mentions.filterMentionEndpoints — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/hooks/Input/useAttachTarget.ts:18— EModelEndpoint (context data-provider) is exposed in client's public surface via AttachTarget.endpointType — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/hooks/Nav/useSideNavLinks.ts:39— EModelEndpoint (context data-provider) is exposed in client's public surface via useSideNavLinks.useSideNavLinks — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/utils/endpoints.ts:667— EModelEndpoint (context data-provider) is exposed in client's public surface via endpoints.getEntity — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/utils/buildDefaultConvo.ts:12— EModelEndpoint (context data-provider) is exposed in client's public surface via buildDefaultConvo.buildDefaultConvo — couples the contexts.
Cross-context type EModelEndpoint (data-provider → client) client/src/utils/getDefaultEndpoint.ts:54— EModelEndpoint (context data-provider) is exposed in client's public surface via getDefaultEndpoint.getDefaultEndpoint — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/agents/activityLabels/runtime.ts:11— Providers (context data-provider) is exposed in api's public surface via ActivityLabelLLM.provider — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/agents/run.ts:357— Providers (context data-provider) is exposed in api's public surface via run.getReasoningKey — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/agents/run.ts:400— Providers (context data-provider) is exposed in api's public surface via run.isDeepSeekReasoningProvider — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/agents/run.ts:422— Providers (context data-provider) is exposed in api's public surface via run.shouldReplayReasoningContent — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/agents/reasoningLabels/host.ts:68— Providers (context data-provider) is exposed in api's public surface via ReasoningLabelUsageRecord.provider — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/files/encode/utils.ts:59— Providers (context data-provider) is exposed in api's public surface via utils.getConfiguredFileSizeLimit — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/files/encode/utils.ts:90— Providers (context data-provider) is exposed in api's public surface via utils.isConfiguredProviderMediaType — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/files/encode/audio.ts:25— Providers (context data-provider) is exposed in api's public surface via audio.encodeAndFormatAudios — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/files/encode/document.ts:298— Providers (context data-provider) is exposed in api's public surface via document.encodeAndFormatDocuments — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/files/encode/video.ts:24— Providers (context data-provider) is exposed in api's public surface via video.encodeAndFormatVideos — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/files/validation.ts:29— Providers (context data-provider) is exposed in api's public surface via validation.validatePdf — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/files/validation.ts:299— Providers (context data-provider) is exposed in api's public surface via validation.validateVideo — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/files/validation.ts:336— Providers (context data-provider) is exposed in api's public surface via validation.validateAudio — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/files/validation.ts:373— Providers (context data-provider) is exposed in api's public surface via validation.validateImage — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/tools/classification.ts:332— Providers (context data-provider) is exposed in api's public surface via BuildToolClassificationParams.provider — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/tools/definitions.ts:61— Providers (context data-provider) is exposed in api's public surface via LoadToolDefinitionsParams.provider — couples the contexts.
Cross-context type Providers (data-provider → api) packages/api/src/types/openai.ts:63— Providers (context data-provider) is exposed in api's public surface via LLMConfigResult.provider — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/admin/config.ts:966— SystemCapability (context data-schemas) is exposed in api's public surface via AdminConfigDeps.hasCapability — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/admin/grants.ts:57— SystemCapability (context data-schemas) is exposed in api's public surface via AdminGrantsDeps.grantCapability — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/admin/grants.ts:64— SystemCapability (context data-schemas) is exposed in api's public surface via AdminGrantsDeps.revokeCapability — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/admin/grants.ts:75— SystemCapability (context data-schemas) is exposed in api's public surface via AdminGrantsDeps.hasCapabilityForPrincipals — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/admin/grants.ts:80— SystemCapability (context data-schemas) is exposed in api's public surface via AdminGrantsDeps.getHeldCapabilities — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/admin/resolved.ts:57— SystemCapability (context data-schemas) is exposed in api's public surface via AdminConfigReadDeps.hasCapability — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/agents/deletion.ts:30— SystemCapability (context data-schemas) is exposed in api's public surface via AgentManagementDeleteDeps.hasCapability — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/agents/files.ts:122— SystemCapability (context data-schemas) is exposed in api's public surface via AgentManagementFileDeps.hasCapability — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/agents/reads.ts:52— SystemCapability (context data-schemas) is exposed in api's public surface via AgentManagementReadDeps.hasCapability — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/agents/updates.ts:39— SystemCapability (context data-schemas) is exposed in api's public surface via AgentManagementUpdateDeps.hasCapability — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/middleware/capabilities.ts:186— SystemCapability (context data-schemas) is exposed in api's public surface via capabilities.generateCapabilityCheck.getHeldCapabilities — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/middleware/capabilities.ts:216— SystemCapability (context data-schemas) is exposed in api's public surface via capabilities.generateCapabilityCheck.hasCapability — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/middleware/capabilities.ts:275— SystemCapability (context data-schemas) is exposed in api's public surface via capabilities.generateCapabilityCheck.requireCapability — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/images/authorization.ts:98— SystemCapability (context data-schemas) is exposed in api's public surface via ImageAuthorizationDeps.hasCapabilityForPrincipals — couples the contexts.
Cross-context type SystemCapability (data-schemas → api) packages/api/src/schedules/access.ts:22— SystemCapability (context data-schemas) is exposed in api's public surface via AgentFireAccessDeps.hasCapability — couples the contexts.
TooManyMethods: GenerationJobManagerClass packages/api/src/stream/GenerationJobManager.ts:894— TooManyMethods — 159 methods. The bar is 30 methods; this is 129 over it, 5.30× 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: RedisJobStore packages/api/src/stream/implementations/RedisJobStore.ts:1908— TooManyMethods — 117 methods. The bar is 30 methods; this is 87 over it, 3.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: InMemoryJobStore packages/api/src/stream/implementations/InMemoryJobStore.ts:151— TooManyMethods — 85 methods. The bar is 30 methods; this is 55 over it, 2.83× the bar. Most of these members implement IJobStore.IJobStoreV2 (60 of 85 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
TooManyMethods: SubagentThreadTaskStore packages/api/src/agents/subagentThreads.ts:707— TooManyMethods — 79 methods. The bar is 30 methods; this is 49 over it, 2.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: AgentClient api/server/controllers/agents/client.js:390— TooManyMethods — 78 methods. The bar is 30 methods; this is 48 over it, 2.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.
TooManyMethods: MCPConnectionFactory packages/api/src/mcp/MCPConnectionFactory.ts:91— TooManyMethods — 62 methods. The bar is 30 methods; this is 32 over it, 2.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MCPConnection packages/api/src/mcp/connection.ts:1109— TooManyMethods — 62 methods. The bar is 30 methods; this is 32 over it, 2.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MCPServersRegistry packages/api/src/mcp/registry/MCPServersRegistry.ts:293— TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: RedisEventTransport packages/api/src/stream/implementations/RedisEventTransport.ts:306— TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MCPManager packages/api/src/mcp/MCPManager.ts:139— TooManyMethods — 53 methods. The bar is 30 methods; this is 23 over it, 1.77× 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: BaseClient api/app/clients/BaseClient.js:212— TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BackgroundTaskRegistryClass packages/api/src/agents/background.ts:913— 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: UserConnectionManager packages/api/src/mcp/UserConnectionManager.ts:137— TooManyMethods — 41 methods. The bar is 30 methods; this is 11 over it, 1.37× 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: MCPOAuthHandler packages/api/src/mcp/oauth/handler.ts:67— TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× 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: RedisSubagentTaskControlTransport packages/api/src/agents/subagentTaskRouting.ts:714— 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.
D10 · Test Quality· Fixed-sleep synchronisation · ×13
Fixed-sleep synchronisation: renews a code environment reference until the guarded write settles packages/data-schemas/src/methods/agent.spec.ts:3253— This test starts work it did not wait for (`guardedWrite`, 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: does not cache access built from a stale membership while its eviction is pending packages/data-schemas/src/methods/prompt.accessContext.spec.ts:528— 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, 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: skips the cache write when the entry is invalidated mid-build packages/data-schemas/src/methods/userGroup.spec.ts:844— This test starts work it did not wait for (`cachedMethods`, 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: starts a fresh build for reads after invalidation instead of joining a stale one packages/data-schemas/src/methods/userGroup.spec.ts:890— This test starts work it did not wait for (`cachedMethods`, 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: runs a delayed second invalidation to evict cross-process stale rewrites packages/data-schemas/src/methods/userGroup.spec.ts:1027— This test starts work it did not wait for (`cachedMethods`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 700))` — 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 a fresh pause persistence fence and provider drain, then parks accepted steers before settlement packages/api/src/schedules/lifecycle.spec.ts:89— This test starts work it did not wait for (`abort`, 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: does not acknowledge volatile job evidence while Mongo cannot persist the denial packages/api/src/schedules/lifecycle.spec.ts:387— This test starts work it did not wait for (`pending`, 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: blocks tool continuation during both-store failure and records the denial after recovery packages/api/src/schedules/lifecycle.spec.ts:419— This test starts work it did not wait for (`pending`, 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: extends a grant that never expires on its first use each day REDACTED:791— This test starts work it did not wait for (`tokens`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 100))` — 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: starts the part read beside access validation and answers only once it passes packages/api/src/messages/parts.spec.ts:349— 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, 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: should join an existing PENDING flow via createFlow instead of deleting it packages/api/src/mcp/__tests__/MCPOAuthRaceCondition.test.ts:755— This test starts work it did not wait for (`monitorPromise`, still running when the sleep starts) and then orders itself against it with `new Promise((r) => setTimeout(r, 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: cannot disable a replacement generation with a stale capability callback packages/api/src/agents/steering/__tests__/runtime.spec.ts:951— This test starts work it did not wait for (`oldPoll`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 2))` — 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: userMessagePromise is awaited before saving response message api/app/clients/specs/BaseClient.test.js:2598— This test starts work it did not wait for (`messagePromise`, 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.
Cross-context type AssistantsEndpoint (data-provider → client) client/src/hooks/Assistants/useAssistantListMap.ts:15— AssistantsEndpoint (context data-provider) is exposed in client's public surface via useAssistantListMap.useAssistantListMap — couples the contexts.
Cross-context type AssistantsEndpoint (data-provider → client) client/src/hooks/Assistants/useSelectAssistant.ts:9— AssistantsEndpoint (context data-provider) is exposed in client's public surface via useSelectAssistant.useSelectAssistant — couples the contexts.
Cross-context type AssistantsEndpoint (data-provider → client) client/src/common/assistants-types.ts:5— AssistantsEndpoint (context data-provider) is exposed in client's public surface via ActionsEndpoint.ActionsEndpoint — couples the contexts.
Cross-context type AssistantsEndpoint (data-provider → client) client/src/components/SidePanel/Builder/ActionsInput.tsx:33— AssistantsEndpoint (context data-provider) is exposed in client's public surface via ActionsInput.ActionsInput — couples the contexts.
Cross-context type AssistantsEndpoint (data-provider → client) client/src/components/SidePanel/Builder/AssistantAvatar.tsx:29— AssistantsEndpoint (context data-provider) is exposed in client's public surface via AssistantAvatar.Avatar — couples the contexts.
Cross-context type AssistantsEndpoint (data-provider → client) client/src/components/SidePanel/Builder/Retrieval.tsx:19— AssistantsEndpoint (context data-provider) is exposed in client's public surface via Retrieval.Retrieval — couples the contexts.
Cross-context type AssistantsEndpoint (data-provider → client) client/src/components/SidePanel/Builder/CodeFiles.tsx:13— AssistantsEndpoint (context data-provider) is exposed in client's public surface via CodeFiles.CodeFiles — couples the contexts.
Cross-context type AssistantsEndpoint (data-provider → client) client/src/components/SidePanel/Builder/CapabilitiesForm.tsx:12— AssistantsEndpoint (context data-provider) is exposed in client's public surface via CapabilitiesForm.CapabilitiesForm — couples the contexts.
Cross-context type AssistantsEndpoint (data-provider → client) client/src/components/SidePanel/Builder/AssistantSelect.tsx:37— AssistantsEndpoint (context data-provider) is exposed in client's public surface via AssistantSelect.AssistantSelect — couples the contexts.
Cross-context type AssistantsEndpoint (data-provider → client) client/src/components/SidePanel/Builder/ContextButton.tsx:16— AssistantsEndpoint (context data-provider) is exposed in client's public surface via ContextButton.ContextButton — couples the contexts.
Cross-context type AssistantsEndpoint (data-provider → client) client/src/components/SidePanel/Builder/Knowledge.tsx:28— AssistantsEndpoint (context data-provider) is exposed in client's public surface via Knowledge.Knowledge — couples the contexts.
Cross-context type AssistantsEndpoint (data-provider → client) client/src/components/Tools/AssistantToolsDialog.tsx:26— AssistantsEndpoint (context data-provider) is exposed in client's public surface via AssistantToolsDialog.AssistantToolsDialog — couples the contexts.
Cross-context type AssistantsEndpoint (data-provider → client) client/src/data-provider/queries.ts:418— AssistantsEndpoint (context data-provider) is exposed in client's public surface via queries.useListAssistantsQuery — couples the contexts.
Cross-context type CodeEnvRef (data-provider → api) packages/api/src/agents/skillFiles.ts:48— CodeEnvRef (context data-provider) is exposed in api's public surface via SkillFileRecord.codeEnvRef — couples the contexts.
Cross-context type CodeEnvRef (data-provider → api) packages/api/src/agents/skillFiles.ts:100— CodeEnvRef (context data-provider) is exposed in api's public surface via PrimeSkillFilesParams.getSessionInfo — couples the contexts.
Cross-context type CodeEnvRef (data-provider → api) packages/api/src/agents/skillFiles.ts:120— CodeEnvRef (context data-provider) is exposed in api's public surface via PrimeSkillFilesParams.updateSkillFileCodeEnvIds — couples the contexts.
Cross-context type CodeEnvRef (data-provider → api) packages/api/src/agents/handlers.ts:563— CodeEnvRef (context data-provider) is exposed in api's public surface via ToolExecuteOptions.getSessionInfo — couples the contexts.
Cross-context type CodeEnvRef (data-provider → api) packages/api/src/agents/handlers.ts:575— CodeEnvRef (context data-provider) is exposed in api's public surface via ToolExecuteOptions.updateSkillFileCodeEnvIds — couples the contexts.
Cross-context type CodeEnvRef (data-provider → api) packages/api/src/files/provision/service.ts:83— CodeEnvRef (context data-provider) is exposed in api's public surface via CodeEnvRefUpdate.ref — couples the contexts.
Cross-context type CodeEnvRef (data-provider → api) packages/api/src/files/provision/service.ts:84— CodeEnvRef (context data-provider) is exposed in api's public surface via CodeEnvRefUpdate.legacyRef — couples the contexts.
Cross-context type CodeEnvRef (data-provider → api) packages/api/src/files/provision/service.ts:89— CodeEnvRef (context data-provider) is exposed in api's public surface via CodeEnvReferenceSetResult.codeEnvRef — couples the contexts.
Cross-context type CodeEnvRef (data-provider → api) packages/api/src/files/code/priming.ts:36— CodeEnvRef (context data-provider) is exposed in api's public surface via priming.getCodeFileInfo — couples the contexts.
Cross-context type CodeEnvRef (data-provider → api) packages/api/src/files/code/priming.ts:102— CodeEnvRef (context data-provider) is exposed in api's public surface via priming.selectCodeFiles — couples the contexts.
Cross-context type CodeEnvRef (data-provider → api) packages/api/src/skills/deployment.ts:339— CodeEnvRef (context data-provider) is exposed in api's public surface via DeploymentSkillRegistry.updateFileCodeEnvRefs — couples the contexts.
Cross-context type PrincipalModel (data-provider → data-schemas) packages/data-schemas/src/app/store.ts:72— PrincipalModel (context data-provider) is exposed in data-schemas's public surface via ConfigRecord.principalModel — couples the contexts.
Cross-context type PrincipalModel (data-provider → data-schemas) packages/data-schemas/src/app/store.ts:423— PrincipalModel (context data-provider) is exposed in data-schemas's public surface via ConfigOperations.replaceOverrides — couples the contexts.
Cross-context type PrincipalModel (data-provider → data-schemas) packages/data-schemas/src/app/store.ts:430— PrincipalModel (context data-provider) is exposed in data-schemas's public surface via ConfigOperations.setFields — couples the contexts.
Cross-context type PrincipalModel (data-provider → data-schemas) packages/data-schemas/src/app/store.ts:437— PrincipalModel (context data-provider) is exposed in data-schemas's public surface via ConfigOperations.tombstoneFields — couples the contexts.
Cross-context type PrincipalModel (data-provider → data-schemas) packages/data-schemas/src/app/store.ts:552— PrincipalModel (context data-provider) is exposed in data-schemas's public surface via store.createConfigOperations.replaceOverrides — couples the contexts.
Cross-context type PrincipalModel (data-provider → data-schemas) packages/data-schemas/src/app/store.ts:580— PrincipalModel (context data-provider) is exposed in data-schemas's public surface via store.createConfigOperations.setFields — couples the contexts.
Cross-context type PrincipalModel (data-provider → data-schemas) packages/data-schemas/src/app/store.ts:607— PrincipalModel (context data-provider) is exposed in data-schemas's public surface via store.createConfigOperations.tombstoneFields — couples the contexts.
Cross-context type PrincipalModel (data-provider → data-schemas) packages/data-schemas/src/methods/config.ts:446— PrincipalModel (context data-provider) is exposed in data-schemas's public surface via config.createConfigMethods.upsertConfig — couples the contexts.
Cross-context type PrincipalModel (data-provider → data-schemas) packages/data-schemas/src/methods/config.ts:464— PrincipalModel (context data-provider) is exposed in data-schemas's public surface via config.createConfigMethods.patchConfigFields — couples the contexts.
Cross-context type PrincipalModel (data-provider → data-schemas) packages/data-schemas/src/methods/config.ts:482— PrincipalModel (context data-provider) is exposed in data-schemas's public surface via config.createConfigMethods.tombstoneConfigField — couples the contexts.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×9
Recursive walk over a caller-supplied document has no depth cap packages/data-schemas/src/methods/encoding.ts:134— `getStoredKeyForms` is exported, takes a document from its caller (line 164) and hands it to `scanKeys`, which calls itself at line 134 (`scanKeys`) with a piece of `value` (and at line 144) — and nowhere in `scanKeys` 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 `scanKeys` 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 packages/data-schemas/src/methods/mcpAuthority.ts:227— `digestMCPAuthorityValue` is exported, takes a document from its caller (line 252) and hands it to `stableStringify`, which calls itself at line 227 (`stableStringify`) with a piece of `value` (and at line 236, line 246) — 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 packages/data-schemas/src/app/changes.ts:130— `isSameConfigValue` is exported and takes `left: unknown` from its caller, and it calls itself at line 130 (`isSameConfigValue`) with a piece of `left` (and at line 142) — and nowhere in `isSameConfigValue` 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 `isSameConfigValue` 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 packages/data-schemas/src/app/paths.ts:457— `isEffectivelyEmpty` is exported and takes `value: unknown` from its caller, and it calls itself at line 457 (`isEffectivelyEmpty`) with a piece of `value` — and nowhere in `isEffectivelyEmpty` 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 `isEffectivelyEmpty` 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 packages/api/src/middleware/auth.ts:84— `getAuthFailureReason` is exported, takes a document from its caller (line 267) and hands it to `normalizeAuthLogValue`, which calls itself at line 84 (`normalizeAuthLogValue`) with a piece of `value` — and nowhere in `normalizeAuthLogValue` 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 `normalizeAuthLogValue` 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 packages/api/src/messages/previews.ts:465— `shrinkJsonToFit` is exported, takes a document from its caller (line 624) and hands it to `capJsonStrings`, which calls itself at line 465 (`capJsonStrings`) with a piece of `value` (and at line 473) — and nowhere in `capJsonStrings` 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 `capJsonStrings` 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 packages/api/src/app/allowlist.ts:222— `collectEnvReferenceNames` is exported, takes a document from its caller (line 227) and hands it to `visitExpandedStrings`, which calls itself at line 222 (`visitExpandedStrings`) with a piece of `value` — and nowhere in `visitExpandedStrings` 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 `visitExpandedStrings` 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 packages/api/src/app/allowlist.ts:405— `getEnvReferenceIssues` is exported and takes `value: unknown` from its caller, and it calls itself at line 405 (`getEnvReferenceIssues`) with a piece of `value` — and nowhere in `getEnvReferenceIssues` 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 `getEnvReferenceIssues` 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 packages/api/src/agents/triggers/delivery.ts:64— `prepareAgentTriggerDelivery` is exported, takes a document from its caller (line 157) and hands it to `canonicalJson`, which calls itself at line 64 (`canonicalJson`) with a piece of `value` (and at line 69) — 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.
Swallowed exception (caught, then discarded) scripts/sort-imports.mts:226— `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) scripts/static-checks.mts:667— `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) scripts/static-checks.mts:1099— `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) packages/data-schemas/src/methods/message.ts:2081— `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) packages/data-schemas/src/methods/userGroup.ts:378— `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) packages/data-schemas/src/config/parsers.ts:258— `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) packages/api/src/web/agent.ts:50— `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) packages/api/src/web/agent.ts:66— `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) packages/api/src/web/web.ts:779— `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.
AC6 · Visual & motion safety· Focus outline removed in CSS without a · ×7
Focus outline removed in CSS without a :focus replacement packages/client/src/components/Dropdown.css:75— `.select-item` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement packages/client/src/components/Field.css:18— `html[data-input-modality='pointer'] :is(.lc-field, .lc-own-focus):focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement packages/client/src/components/Field.css:42— `html:not(.high-contrast) .lc-field:focus-visible` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement packages/client/src/components/Field.css:79— `html:root:not(.high-contrast) textarea.lc-own-focus:focus-visible` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement client/src/mobile.css:177— `.cm-content:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement client/src/style.css:1966— `html[data-input-modality='pointer'] :where( input:not([type]), input:is( [type='text'], [type='search'], [type='email'], [type='password'], [type='url'], [type='tel'], [type='number'], [type='date'], [type='datetime-local'], [type='month'], [type='week'], [type='time'] ), textarea ):is(:focus, :focus-visible)` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement client/src/style.css:2078— `.select-item` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Cross-context type PermissionBits (data-provider → api) packages/api/src/agents/deletion.ts:23— PermissionBits (context data-provider) is exposed in api's public surface via AgentManagementDeleteDeps.checkPermission — couples the contexts.
Cross-context type PermissionBits (data-provider → api) packages/api/src/agents/files.ts:115— PermissionBits (context data-provider) is exposed in api's public surface via AgentManagementFileDeps.checkPermission — couples the contexts.
Cross-context type PermissionBits (data-provider → api) packages/api/src/agents/reads.ts:38— PermissionBits (context data-provider) is exposed in api's public surface via AgentManagementReadDeps.findAccessibleResources — couples the contexts.
Cross-context type PermissionBits (data-provider → api) packages/api/src/agents/reads.ts:45— PermissionBits (context data-provider) is exposed in api's public surface via AgentManagementReadDeps.checkPermission — couples the contexts.
Cross-context type PermissionBits (data-provider → api) packages/api/src/agents/listing.ts:19— PermissionBits (context data-provider) is exposed in api's public surface via listing.getAgentListAccess — couples the contexts.
Cross-context type PermissionBits (data-provider → api) packages/api/src/agents/updates.ts:32— PermissionBits (context data-provider) is exposed in api's public surface via AgentManagementUpdateDeps.checkPermission — couples the contexts.
Cross-context type PermissionBits (data-provider → api) packages/api/src/schedules/access.ts:24— PermissionBits (context data-provider) is exposed in api's public surface via AgentFireAccessDeps.checkPermission — couples the contexts.
Cross-context type ResourceType (data-provider → client) client/src/hooks/Sharing/useResourcePermissionState.ts:16— ResourceType (context data-provider) is exposed in client's public surface via useResourcePermissionState.useResourcePermissionState — couples the contexts.
Cross-context type ResourceType (data-provider → client) client/src/hooks/Sharing/useCanSharePublic.ts:18— ResourceType (context data-provider) is exposed in client's public surface via useCanSharePublic.useCanSharePublic — couples the contexts.
Cross-context type ResourceType (data-provider → client) client/src/hooks/useResourcePermissions.ts:14— ResourceType (context data-provider) is exposed in client's public surface via useResourcePermissions.useResourcePermissions — couples the contexts.
Cross-context type ResourceType (data-provider → client) client/src/components/Sharing/GenericGrantAccessDialog.tsx:39— ResourceType (context data-provider) is exposed in client's public surface via GenericGrantAccessDialog.GenericGrantAccessDialog — couples the contexts.
Cross-context type ResourceType (data-provider → client) client/src/utils/resources.ts:4— ResourceType (context data-provider) is exposed in client's public surface via ResourceConfig.resourceType — couples the contexts.
Cross-context type ResourceType (data-provider → client) client/src/utils/resources.ts:86— ResourceType (context data-provider) is exposed in client's public surface via resources.getResourceConfig — couples the contexts.
Cross-context type ProviderId (data-provider → client) client/src/hooks/Endpoint/useProviderIcon.ts:7— ProviderId (context data-provider) is exposed in client's public surface via ProviderIconResolution.provider — couples the contexts.
Cross-context type ProviderId (data-provider → client) client/src/components/Endpoints/ResolvedProviderIcon.tsx:5— ProviderId (context data-provider) is exposed in client's public surface via ResolvedProviderIcon.ResolvedProviderIcon — couples the contexts.
Cross-context type ProviderId (data-provider → client) client/src/components/Endpoints/URLIcon.tsx:10— ProviderId (context data-provider) is exposed in client's public surface via URLIcon.URLIcon — couples the contexts.
Cross-context type ProviderId (data-provider → client) packages/client/src/icons/provider/registry.ts:153— ProviderId (context data-provider) is exposed in client's public surface via registry.getProviderIconDef — couples the contexts.
Cross-context type ProviderId (data-provider → client) packages/client/src/icons/provider/Icon.tsx:10— ProviderId (context data-provider) is exposed in client's public surface via ProviderIconProps.provider — couples the contexts.
Cross-context type ProviderId (data-provider → client) packages/client/src/icons/provider/Avatar.tsx:11— ProviderId (context data-provider) is exposed in client's public surface via ProviderAvatarProps.provider — couples the contexts.
Cross-context type SubagentThreadStatus (data-provider → client) client/src/components/Chat/Subagents/status.ts:6— SubagentThreadStatus (context data-provider) is exposed in client's public surface via status.isAbnormalTerminalStatus — couples the contexts.
Cross-context type SubagentThreadStatus (data-provider → client) client/src/components/Chat/Subagents/status.ts:9— SubagentThreadStatus (context data-provider) is exposed in client's public surface via status.subagentStatusIcon — couples the contexts.
Cross-context type SubagentThreadStatus (data-provider → client) client/src/components/Chat/Subagents/status.ts:16— SubagentThreadStatus (context data-provider) is exposed in client's public surface via status.subagentStatusLabelKey — couples the contexts.
Cross-context type SubagentThreadStatus (data-provider → client) client/src/components/Chat/Subagents/status.ts:32— SubagentThreadStatus (context data-provider) is exposed in client's public surface via status.subagentStatusDotClass — couples the contexts.
Cross-context type SubagentThreadStatus (data-provider → client) client/src/components/Chat/Subagents/status.ts:41— SubagentThreadStatus (context data-provider) is exposed in client's public surface via status.isLiveSubagentStatus — couples the contexts.
Cross-context type SubagentThreadStatus (data-provider → client) client/src/components/Chat/Subagents/outcome.ts:10— SubagentThreadStatus (context data-provider) is exposed in client's public surface via outcome.hasTerminalOutcome — couples the contexts.
Cross-context type TMessageContentParts (data-provider → api) packages/api/src/stream/GenerationJobManager.ts:4673— TMessageContentParts (context data-provider) is exposed in api's public surface via GenerationJobManagerClass.abortJob — couples the contexts.
Cross-context type TMessageContentParts (data-provider → api) packages/api/src/agents/compaction.ts:26— TMessageContentParts (context data-provider) is exposed in api's public surface via compaction.getSummaryPartText — couples the contexts.
Cross-context type TMessageContentParts (data-provider → api) packages/api/src/agents/compaction.ts:189— TMessageContentParts (context data-provider) is exposed in api's public surface via compaction.resolveFailedTurnContent — couples the contexts.
Cross-context type TMessageContentParts (data-provider → api) packages/api/src/agents/compaction.ts:220— TMessageContentParts (context data-provider) is exposed in api's public surface via compaction.markAbortedCompactionContent — couples the contexts.
Cross-context type TMessageContentParts (data-provider → api) packages/api/src/agents/compaction.ts:700— TMessageContentParts (context data-provider) is exposed in api's public surface via compaction.markCompactionOutcome — couples the contexts.
Cross-context type TMessageContentParts (data-provider → api) packages/api/src/utils/content.ts:160— TMessageContentParts (context data-provider) is exposed in api's public surface via content.filterMalformedContentParts — couples the contexts.
Cross-context type TMessageContentParts (data-provider → chat) packages/chat/src/core/ask.ts:27— TMessageContentParts (context data-provider) is exposed in chat's public surface via ask.isAskUserQuestionPart — couples the contexts.
Cross-context type TMessageContentParts (data-provider → chat) packages/chat/src/core/ask.ts:48— TMessageContentParts (context data-provider) is exposed in chat's public surface via ask.isAnsweredAskUserQuestionPart — couples the contexts.
Cross-context type TMessageContentParts (data-provider → chat) packages/chat/src/core/steps/content.ts:71— TMessageContentParts (context data-provider) is exposed in chat's public surface via content.getEditPrefix — couples the contexts.
Cross-context type TMessageContentParts (data-provider → chat) packages/chat/src/core/steps/content.ts:90— TMessageContentParts (context data-provider) is exposed in chat's public surface via content.calculateContentIndex — couples the contexts.
Cross-context type TMessageContentParts (data-provider → chat) packages/chat/src/core/steer/steer.ts:21— TMessageContentParts (context data-provider) is exposed in chat's public surface via steer.getSteerPart — couples the contexts.
Cross-context type TMessageContentParts (data-provider → chat) packages/chat/src/core/content.ts:50— TMessageContentParts (context data-provider) is exposed in chat's public surface via content.createDualMessageContent — couples the contexts.
Cross-context type CodeEnvRef (data-provider → data-schemas) packages/data-schemas/src/methods/file.ts:403— CodeEnvRef (context data-provider) is exposed in data-schemas's public surface via file.createFileMethods — couples the contexts.
Cross-context type CodeEnvRef (data-provider → data-schemas) packages/data-schemas/src/methods/file.ts:1340— CodeEnvRef (context data-provider) is exposed in data-schemas's public surface via file.createFileMethods.updateFileCodeEnvRef — couples the contexts.
Cross-context type CodeEnvRef (data-provider → data-schemas) packages/data-schemas/src/types/file.ts:211— CodeEnvRef (context data-provider) is exposed in data-schemas's public surface via IMongoFile.metadata — couples the contexts.
Cross-context type CodeEnvRef (data-provider → data-schemas) packages/data-schemas/src/types/skill.ts:142— CodeEnvRef (context data-provider) is exposed in data-schemas's public surface via ISkillFile.codeEnvRef — couples the contexts.
Cross-context type CodeEnvRef (data-provider → data-schemas) packages/data-schemas/src/methods/skill.ts:1018— CodeEnvRef (context data-provider) is exposed in data-schemas's public surface via skill.createSkillMethods — couples the contexts.
Cross-context type CodeEnvRef (data-provider → data-schemas) packages/data-schemas/src/methods/skill.ts:2127— CodeEnvRef (context data-provider) is exposed in data-schemas's public surface via skill.createSkillMethods.updateSkillFileCodeEnvIds — couples the contexts.
Cross-context type ScheduleRunStatus (data-provider → data-schemas) packages/data-schemas/src/types/schedule.ts:59— ScheduleRunStatus (context data-provider) is exposed in data-schemas's public surface via ISchedule.lastRun — couples the contexts.
Cross-context type ScheduleRunStatus (data-provider → data-schemas) packages/data-schemas/src/types/schedule.ts:93— ScheduleRunStatus (context data-provider) is exposed in data-schemas's public surface via IScheduleRun.status — couples the contexts.
Cross-context type ScheduleRunStatus (data-provider → data-schemas) packages/data-schemas/src/methods/schedule.ts:126— ScheduleRunStatus (context data-provider) is exposed in data-schemas's public surface via RecordRunOutcomeParams.status — couples the contexts.
Cross-context type ScheduleRunStatus (data-provider → data-schemas) packages/data-schemas/src/methods/schedule.ts:1698— ScheduleRunStatus (context data-provider) is exposed in data-schemas's public surface via schedule.createScheduleMethods.recordSkippedRun — couples the contexts.
Cross-context type ScheduleRunStatus (data-provider → data-schemas) packages/data-schemas/src/methods/schedule.ts:1895— ScheduleRunStatus (context data-provider) is exposed in data-schemas's public surface via schedule.createScheduleMethods.deleteScheduleRun — couples the contexts.
Cross-context type ScheduleRunStatus (data-provider → data-schemas) packages/data-schemas/src/methods/schedule.ts:1960— ScheduleRunStatus (context data-provider) is exposed in data-schemas's public surface via schedule.createScheduleMethods.getActiveRunsForUser — couples the contexts.
(anonymous) (cognitive 18) REDACTED:355— (anonymous) has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 6, if/else 6, other 3, ternaries 2, 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.
(anonymous) (cognitive 18) REDACTED:432— (anonymous) has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, ternaries 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.
(anonymous) (cognitive 18) REDACTED:641— (anonymous) has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, error handling 1, other 1, 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.
(anonymous) (cognitive 18) REDACTED:709— (anonymous) has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, error handling 1, other 1, 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.
(anonymous) (cognitive 18) api/server/routes/memories.js:180— (anonymous) has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, error handling 1 (nesting depth added 2). Of this number, 17 points are the body's own statements and 1 belongs 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.
Cross-context type Permissions (data-provider → client) client/src/hooks/Roles/useHasAccess.ts:5— Permissions (context data-provider) is exposed in client's public surface via useHasAccess.useHasAccess — couples the contexts.
Cross-context type Permissions (data-provider → client) client/src/components/ui/AdminSettingsDialog.tsx:27— Permissions (context data-provider) is exposed in client's public surface via PermissionConfig.permission — couples the contexts.
Cross-context type Permissions (data-provider → client) client/src/components/ui/AdminSettingsDialog.tsx:41— Permissions (context data-provider) is exposed in client's public surface via AdminSettingsDialogProps.mutation — couples the contexts.
Cross-context type Permissions (data-provider → client) client/src/components/ui/AdminSettingsDialog.tsx:56— Permissions (context data-provider) is exposed in client's public surface via AdminSettingsDialogProps.onPermissionConfirm — couples the contexts.
Cross-context type Permissions (data-provider → client) client/src/components/ui/AdminSettingsDialog.tsx:62— Permissions (context data-provider) is exposed in client's public surface via AdminSettingsDialogProps.confirmPermissions — couples the contexts.
Cross-context type AccessRoleIds (data-provider → client) client/src/components/Sharing/GenericGrantAccessDialog.tsx:39— AccessRoleIds (context data-provider) is exposed in client's public surface via GenericGrantAccessDialog.GenericGrantAccessDialog — couples the contexts.
Cross-context type AccessRoleIds (data-provider → client) client/src/utils/roles.ts:92— AccessRoleIds (context data-provider) is exposed in client's public surface via roles.getRoleLocalizationKeys — couples the contexts.
Cross-context type AccessRoleIds (data-provider → client) client/src/utils/resources.ts:5— AccessRoleIds (context data-provider) is exposed in client's public surface via ResourceConfig.defaultViewerRoleId — couples the contexts.
Cross-context type AccessRoleIds (data-provider → client) client/src/utils/resources.ts:6— AccessRoleIds (context data-provider) is exposed in client's public surface via ResourceConfig.defaultEditorRoleId — couples the contexts.
Cross-context type AccessRoleIds (data-provider → client) client/src/utils/resources.ts:7— AccessRoleIds (context data-provider) is exposed in client's public surface via ResourceConfig.defaultOwnerRoleId — couples the contexts.
Cross-context type EModelEndpoint (data-provider → api) packages/api/src/app/config.ts:60— EModelEndpoint (context data-provider) is exposed in api's public surface via config.getCustomEndpointConfig — couples the contexts.
Cross-context type EModelEndpoint (data-provider → api) packages/api/src/endpoints/openai/llm.ts:601— EModelEndpoint (context data-provider) is exposed in api's public surface via llm.getOpenAILLMConfig — couples the contexts.
Cross-context type EModelEndpoint (data-provider → api) packages/api/src/utils/tokens.ts:616— EModelEndpoint (context data-provider) is exposed in api's public surface via tokens.getModelMaxTokens — couples the contexts.
Cross-context type EModelEndpoint (data-provider → api) packages/api/src/utils/tokens.ts:654— EModelEndpoint (context data-provider) is exposed in api's public surface via tokens.matchModelName — couples the contexts.
Cross-context type EModelEndpoint (data-provider → api) packages/api/src/prompts/artifacts/index.ts:63— EModelEndpoint (context data-provider) is exposed in api's public surface via index.generateArtifactsPrompt — couples the contexts.
Cross-context type TokenExchangeMethodEnum (data-provider → api) packages/api/src/mcp/oauth/methods.ts:13— TokenExchangeMethodEnum (context data-provider) is exposed in api's public surface via methods.getForcedTokenEndpointAuthMethod — couples the contexts.
Cross-context type TokenExchangeMethodEnum (data-provider → api) packages/api/src/mcp/oauth/methods.ts:36— TokenExchangeMethodEnum (context data-provider) is exposed in api's public surface via methods.selectRegistrationAuthMethod — couples the contexts.
Cross-context type TokenExchangeMethodEnum (data-provider → api) packages/api/src/mcp/oauth/methods.ts:68— TokenExchangeMethodEnum (context data-provider) is exposed in api's public surface via methods.resolveTokenEndpointAuthMethod — couples the contexts.
Cross-context type TokenExchangeMethodEnum (data-provider → api) packages/api/src/oauth/tokens.ts:154— TokenExchangeMethodEnum (context data-provider) is exposed in api's public surface via tokens.refreshAccessToken — couples the contexts.
Cross-context type TokenExchangeMethodEnum (data-provider → api) packages/api/src/oauth/tokens.ts:258— TokenExchangeMethodEnum (context data-provider) is exposed in api's public surface via tokens.getAccessToken — couples the contexts.
Cross-context type ChatEvent (data-provider → chat) packages/chat/src/core/resumable/subscription.ts:18— ChatEvent (context data-provider) is exposed in chat's public surface via SubscriptionHandlers.onFrame — couples the contexts.
Cross-context type ChatEvent (data-provider → chat) packages/chat/src/core/resumable/subscription.ts:19— ChatEvent (context data-provider) is exposed in chat's public surface via SubscriptionHandlers.onFailure — couples the contexts.
Cross-context type ChatEvent (data-provider → chat) packages/chat/src/core/resumable/failure.ts:136— ChatEvent (context data-provider) is exposed in chat's public surface via failure.handleTransportFailure — couples the contexts.
Cross-context type ChatEvent (data-provider → chat) packages/chat/src/core/resumable/frames.ts:189— ChatEvent (context data-provider) is exposed in chat's public surface via frames.handleFrame — couples the contexts.
Cross-context type ChatEvent (data-provider → chat) packages/chat/src/core/transport/frames.ts:63— ChatEvent (context data-provider) is exposed in chat's public surface via frames.normalizeFrame — couples the contexts.
X24 · Document value interpolated into markup unescaped· Untrusted text written into markup unescaped · ×5
Untrusted text written into markup unescaped REDACTED:92— `content` 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.
Untrusted text written into markup unescaped client/src/utils/markdown.ts:350— `escapedContent` 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.
Untrusted text written into markup unescaped REDACTED:193— `escapeHtml(resolved)` 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 REDACTED:206— `escapeHtml(resolved)` 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 REDACTED:122— `sanitizedHTML` 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.
(anonymous) (cyclomatic 27) REDACTED:509— (anonymous) has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs 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.
(anonymous) (cyclomatic 27) REDACTED:123— (anonymous) 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.
(anonymous) (cyclomatic 27) REDACTED:102— (anonymous) 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.
(anonymous) (cyclomatic 27) REDACTED:30— (anonymous) 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Cross-context type EToolResources (data-provider → client) client/src/hooks/Files/useFileDeletion.ts:19— EToolResources (context data-provider) is exposed in client's public surface via useFileDeletion.useFileDeletion — couples the contexts.
Cross-context type EToolResources (data-provider → client) client/src/hooks/Files/useUploadOptions.ts:69— EToolResources (context data-provider) is exposed in client's public surface via useUploadOptions.useUploadOptions.getOptions — couples the contexts.
Cross-context type EToolResources (data-provider → client) client/src/components/Chat/Input/Files/FileRow.tsx:21— EToolResources (context data-provider) is exposed in client's public surface via FileRow.FileRow — couples the contexts.
Cross-context type EToolResources (data-provider → client) client/src/utils/files.ts:626— EToolResources (context data-provider) is exposed in client's public surface via files.getViableUploadOptions — couples the contexts.
Cross-context type ComponentType (data-provider → client) client/src/components/Nav/Settings/types.ts:77— ComponentType (context data-provider) is exposed in client's public surface via SettingEntry.Component — couples the contexts.
Cross-context type ComponentType (data-provider → client) client/src/components/Nav/Settings/controls.tsx:12— ComponentType (context data-provider) is exposed in client's public surface via controls.toggleControl — couples the contexts.
Cross-context type ComponentType (data-provider → client) packages/client/src/components/EmptyState.tsx:8— ComponentType (context data-provider) is exposed in client's public surface via EmptyStateProps.icon — couples the contexts.
Cross-context type ComponentType (data-provider → client) packages/client/src/icons/provider/Mark.tsx:7— ComponentType (context data-provider) is exposed in client's public surface via Mark.createMark — couples the contexts.
Cross-context type TToolFavoriteType (data-provider → client) client/src/hooks/Input/useToolFavorites.ts:9— TToolFavoriteType (context data-provider) is exposed in client's public surface via ToolFavorites.isFavorite — couples the contexts.
Cross-context type TToolFavoriteType (data-provider → client) client/src/hooks/Input/useToolFavorites.ts:10— TToolFavoriteType (context data-provider) is exposed in client's public surface via ToolFavorites.toggleFavorite — couples the contexts.
Cross-context type TToolFavoriteType (data-provider → client) client/src/hooks/Input/useToolFavorites.ts:13— TToolFavoriteType (context data-provider) is exposed in client's public surface via useToolFavorites.favoriteKey — couples the contexts.
Cross-context type TToolFavoriteType (data-provider → client) client/src/hooks/Input/usePaletteEntries.tsx:66— TToolFavoriteType (context data-provider) is exposed in client's public surface via PaletteEntry.itemType — couples the contexts.
Cross-context type Permissions (data-provider → api) packages/api/src/agents/memory.ts:598— Permissions (context data-provider) is exposed in api's public surface via memory.isMemoryToolAllowed — couples the contexts.
Cross-context type Permissions (data-provider → api) packages/api/src/middleware/access.ts:31— Permissions (context data-provider) is exposed in api's public surface via CheckAccessParams.permissions — couples the contexts.
Cross-context type Permissions (data-provider → api) packages/api/src/middleware/access.ts:32— Permissions (context data-provider) is exposed in api's public surface via CheckAccessParams.bodyProps — couples the contexts.
Cross-context type Permissions (data-provider → api) packages/api/src/middleware/access.ts:216— Permissions (context data-provider) is exposed in api's public surface via access.generateCheckAccess — couples the contexts.
Cross-context type EToolResources (data-provider → api) packages/api/src/agents/resources.ts:172— EToolResources (context data-provider) is exposed in api's public surface via resources.addFileToResource — couples the contexts.
Cross-context type EToolResources (data-provider → api) packages/api/src/agents/resources.ts:764— EToolResources (context data-provider) is exposed in api's public surface via resources.primeResources — couples the contexts.
Cross-context type EToolResources (data-provider → api) packages/api/src/agents/initialize.ts:1125— EToolResources (context data-provider) is exposed in api's public surface via InitializeAgentDbMethods.getToolFilesByIds — couples the contexts.
Cross-context type EToolResources (data-provider → api) packages/api/src/agents/initialize.ts:472— EToolResources (context data-provider) is exposed in api's public surface via initialize.resolveResendToolResources — couples the contexts.
Cross-context type PermissionTypes (data-provider → api) packages/api/src/middleware/access.ts:30— PermissionTypes (context data-provider) is exposed in api's public surface via CheckAccessParams.permissionType — couples the contexts.
Cross-context type PermissionTypes (data-provider → api) packages/api/src/middleware/access.ts:216— PermissionTypes (context data-provider) is exposed in api's public surface via access.generateCheckAccess — couples the contexts.
Cross-context type PermissionTypes (data-provider → api) packages/api/src/tools/rolePermissions.ts:51— PermissionTypes (context data-provider) is exposed in api's public surface via CheckToolRolePermissionParams.permissionType — couples the contexts.
Cross-context type PermissionTypes (data-provider → api) packages/api/src/app/permissions.ts:104— PermissionTypes (context data-provider) is exposed in api's public surface via permissions.updateInterfacePermissions — couples the contexts.
Cross-context type ToolApprovalAuthKind (data-provider → api) packages/api/src/agents/hitl/modes.ts:53— ToolApprovalAuthKind (context data-provider) is exposed in api's public surface via modes.attachMCPToolApprovalBindings — couples the contexts.
Cross-context type ToolApprovalAuthKind (data-provider → api) packages/api/src/tools/approval.ts:20— ToolApprovalAuthKind (context data-provider) is exposed in api's public surface via approval.bindToolApproval — couples the contexts.
Cross-context type ToolApprovalAuthKind (data-provider → api) packages/api/src/tools/approval.ts:36— ToolApprovalAuthKind (context data-provider) is exposed in api's public surface via approval.getToolApprovalAuthKind — couples the contexts.
Cross-context type ToolApprovalAuthKind (data-provider → api) packages/api/src/mcp/approval.ts:33— ToolApprovalAuthKind (context data-provider) is exposed in api's public surface via approval.getMCPToolApprovalAuthKind — couples the contexts.
P12 · CI test-gate honesty· Test failure does not fail the CI gate · ×4
Test failure does not fail the CI gate REDACTED:138— `continue-on-error: true` lets the step or job that runs `npx playwright test --config=e2e/playwright.config.bombadil.ts --reporter=line,html 2>&1 | tee e2e/.generated/bombadil-ci.log` fail without failing the pipeline — the suite can go red and the change still merges. Remove it from the test step, or quarantine the specific failing tests instead.
Test failure does not fail the CI gate REDACTED:315— `continue-on-error: true` lets the step or job that runs `node --test scripts/eslint/design.test.mjs scripts/eslint/chat.test.mjs` fail without failing the pipeline — the suite can go red and the change still merges. Remove it from the test step, or quarantine the specific failing tests instead.
Test failure does not fail the CI gate REDACTED:405— `continue-on-error: true` lets the step or job that runs `npm run test:config` fail without failing the pipeline — the suite can go red and the change still merges. Remove it from the test step, or quarantine the specific failing tests instead.
Test failure does not fail the CI gate REDACTED:411— `continue-on-error: true` lets the step or job that runs `node --test scripts/i18n.test.mts` fail without failing the pipeline — the suite can go red and the change still merges. Remove it from the test step, or quarantine the specific failing tests instead.
Weak hash algorithm client/src/hooks/Mermaid/useMermaid.ts:79— 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/api/src/cache/redisScript.ts:47— 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/api/src/skills/deployment.ts:1113— 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/data-provider/src/actions.ts:50— 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.
reader.createLangfuseTraceReader.listRecords::nameToolRounds (cognitive 37) packages/api/src/langfuse/reader.ts:936— reader.createLangfuseTraceReader.listRecords::nameToolRounds has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 8, ternaries 3 (8 pts), loops 3 (4 pts), 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: 3 other methods here (reader.createLangfuseTraceReader.listRecords, reader.createLangfuseTraceReader.listRecords::probe, reader.createLangfuseTraceReader.listRecords::segmentOf) 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.
reader.createLangfuseTraceReader.listRecords::probe (cognitive 27) packages/api/src/langfuse/reader.ts:722— reader.createLangfuseTraceReader.listRecords::probe has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 4, loops 3 (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. This shape REPEATS in the file: 3 other methods here (reader.createLangfuseTraceReader.listRecords, reader.createLangfuseTraceReader.listRecords::segmentOf, reader.createLangfuseTraceReader.listRecords::nameToolRounds) 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.
reader.createLangfuseTraceReader.listRecords::segmentOf (cognitive 17) packages/api/src/langfuse/reader.ts:886— reader.createLangfuseTraceReader.listRecords::segmentOf has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 2 (4 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. This shape REPEATS in the file: 3 other methods here (reader.createLangfuseTraceReader.listRecords, reader.createLangfuseTraceReader.listRecords::probe, reader.createLangfuseTraceReader.listRecords::nameToolRounds) 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.
(anonymous) (cognitive 28) api/server/routes/agents/index.js:475— (anonymous) has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 8, loops 1, other 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.
(anonymous) (cognitive 28) REDACTED:630— (anonymous) has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 7, error handling 5 (6 pts), ternaries 2, other 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.
(anonymous) (cognitive 28) REDACTED:30— (anonymous) has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 5, error handling 2, loops 2, other 2 (nesting depth added 3). Of this number, 26 points are the body's own statements and 2 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.
(anonymous) (cognitive 23) REDACTED:135— (anonymous) has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10, boolean chains 8, ternaries 2 (3 pts), error handling 1, other 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.
(anonymous) (cognitive 23) REDACTED:643— (anonymous) has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, ternaries 4 (5 pts), error handling 1, other 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.
(anonymous) (cognitive 23) api/server/routes/files/images.js:44— (anonymous) has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, error handling 3 (4 pts) (nesting depth added 4). Of this number, 22 points are the body's own statements and 1 belongs 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.
Cross-context type PermissionTypes (data-provider → client) client/src/hooks/Roles/useHasAccess.ts:5— PermissionTypes (context data-provider) is exposed in client's public surface via useHasAccess.useHasAccess — couples the contexts.
Cross-context type PermissionTypes (data-provider → client) client/src/hooks/useRoleSelector.ts:7— PermissionTypes (context data-provider) is exposed in client's public surface via useRoleSelector.useRoleSelector — couples the contexts.
Cross-context type PermissionTypes (data-provider → client) client/src/components/ui/AdminSettingsDialog.tsx:33— PermissionTypes (context data-provider) is exposed in client's public surface via AdminSettingsDialogProps.permissionType — couples the contexts.
Cross-context type ValidSource (data-provider → client) client/src/components/Chat/Messages/Content/sources.ts:6— ValidSource (context data-provider) is exposed in client's public surface via sources.collectSources — couples the contexts.
Cross-context type ValidSource (data-provider → client) client/src/components/Chat/Messages/Content/sources.ts:27— ValidSource (context data-provider) is exposed in client's public surface via sources.getUniqueDomainSources — couples the contexts.
Cross-context type ValidSource (data-provider → client) client/src/components/Web/Sources.tsx:364— ValidSource (context data-provider) is exposed in client's public surface via Sources.StackedFavicons — couples the contexts.
Cross-context type FileSources (data-provider → client) client/src/components/Chat/Input/Files/SourceIcon.tsx:26— FileSources (context data-provider) is exposed in client's public surface via SourceIcon.SourceIcon — couples the contexts.
Cross-context type FileSources (data-provider → client) client/src/components/Chat/Input/Files/ImagePreview.tsx:18— FileSources (context data-provider) is exposed in client's public surface via ImagePreview.ImagePreview — couples the contexts.
Cross-context type FileSources (data-provider → client) client/src/components/Chat/Input/Files/Image.tsx:5— FileSources (context data-provider) is exposed in client's public surface via Image.Image — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → api) packages/api/src/admin/catalog.ts:89— TEndpointsConfig (context data-provider) is exposed in api's public surface via AdminConfigCatalogDeps.getEndpointsConfig — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → api) packages/api/src/endpoints/config/endpoints.ts:29— TEndpointsConfig (context data-provider) is exposed in api's public surface via endpoints.createEndpointsConfigService — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → api) packages/api/src/endpoints/config/endpoints.ts:39— TEndpointsConfig (context data-provider) is exposed in api's public surface via endpoints.createEndpointsConfigService.getEndpointsConfig — couples the contexts.
Cross-context type TAttachment (data-provider → api) packages/api/src/agents/memory.ts:756— TAttachment (context data-provider) is exposed in api's public surface via memory.processMemory — couples the contexts.
Cross-context type TAttachment (data-provider → api) packages/api/src/agents/memory.ts:1040— TAttachment (context data-provider) is exposed in api's public surface via memory.createMemoryProcessor — couples the contexts.
Cross-context type TAttachment (data-provider → api) packages/api/src/agents/memory.ts:1209— TAttachment (context data-provider) is exposed in api's public surface via memory.createMemoryCallback — couples the contexts.
Cross-context type HumanInterruptPayload (data-provider → api) REDACTED:811— HumanInterruptPayload (context data-provider) is exposed in api's public surface via policy.buildPendingAction — couples the contexts.
Cross-context type HumanInterruptPayload (data-provider → api) packages/api/src/agents/hitl/modes.ts:777— HumanInterruptPayload (context data-provider) is exposed in api's public surface via modes.captureRunToolApprovalBindings — couples the contexts.
Cross-context type HumanInterruptPayload (data-provider → api) packages/api/src/agents/hitl/modes.ts:784— HumanInterruptPayload (context data-provider) is exposed in api's public surface via modes.describeRememberedToolApprovals — couples the contexts.
Low cohesion: BaseClient (LCOM4 6) api/app/clients/BaseClient.js:212— BaseClient's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: TTSService (LCOM4 6) api/server/services/Files/Audio/TTSService.js:25— TTSService's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: STTService (LCOM4 4) api/server/services/Files/Audio/STTService.js:130— STTService's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
IC1 · Incompleteness & stubs· Guard cannot change the result · ×3
Guard cannot change the result — returns what the code already falls through to api/server/services/Files/Audio/STTService.js:119— The guard above `return 'webm';` also returns `'webm'`, 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 api/server/services/twoFactorService.js:171— The guard above `return storedSecret;` also returns `storedSecret`, 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/api/src/agents/edits.ts:39— The guard above `return replaceAll;` also returns `replaceAll`, so no input can make it matter. Implement the distinction that was intended, or delete the guard.
Hollow method — returns a constant without doing the work client/src/components/Chat/BackgroundTasks/useTasks.ts:25— `noRefresh` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work packages/api/src/imports.ts:65— `getNoCanonicalFiles` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work packages/data-schemas/src/methods/triggerDelivery.ts:103— `observeAgentEventActorReceipt` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Dead file (~22 LoC) packages/client/src/svgs/DarkModeIcon.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~22 LoC) packages/client/src/svgs/DislikeIcon.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~22 LoC) packages/client/src/svgs/LikeIcon.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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
AC1 · Text alternatives· <canvas> without a text alternative · ×2
<canvas> without a text alternative client/src/components/Chat/Input/Composer/Waveform.tsx:97— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative packages/client/src/components/PixelCard.tsx:422— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
mcp.router.get("/:serverName/oauth/callback") (cyclomatic 52) REDACTED:279— mcp.router.get("/:serverName/oauth/callback") has cyclomatic complexity 52 (threshold 15). Of this number, 31 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.
mcp.router.get("/:serverName/oauth/initiate") (cyclomatic 22) REDACTED:135— mcp.router.get("/:serverName/oauth/initiate") 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.
(anonymous) (cyclomatic 34) api/server/routes/config.js:231— (anonymous) 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.
(anonymous) (cyclomatic 34) config/delete-user.js:52— (anonymous) has cyclomatic complexity 34 (threshold 15). Of this number, 33 points are the body's own statements and 1 belongs to 37 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.
design.recipeReader::always (cyclomatic 28) scripts/eslint/design.mjs:494— design.recipeReader::always has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: one other method here (design.recipeReader::alongside) 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.
design.recipeReader::alongside (cyclomatic 16) scripts/eslint/design.mjs:609— design.recipeReader::alongside 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 shape REPEATS in the file: one other method here (design.recipeReader::always) 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.
reader.createLangfuseTraceReader.listRecords::nameToolRounds (cyclomatic 27) packages/api/src/langfuse/reader.ts:936— reader.createLangfuseTraceReader.listRecords::nameToolRounds 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: 2 other methods here (reader.createLangfuseTraceReader.listRecords, reader.createLangfuseTraceReader.listRecords::probe) 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.
reader.createLangfuseTraceReader.listRecords::probe (cyclomatic 18) packages/api/src/langfuse/reader.ts:722— reader.createLangfuseTraceReader.listRecords::probe 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: 2 other methods here (reader.createLangfuseTraceReader.listRecords, reader.createLangfuseTraceReader.listRecords::nameToolRounds) 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.
actions.router.post("/:assistant_id") (cyclomatic 25) REDACTED:30— actions.router.post("/:assistant_id") has cyclomatic complexity 25 (threshold 15). Of this number, 22 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.
actions.router.post("/:agent_id") (cyclomatic 25) REDACTED:102— actions.router.post("/:agent_id") 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.
(anonymous) (cyclomatic 22) api/server/routes/agents/index.js:475— (anonymous) 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.
(anonymous) (cyclomatic 22) REDACTED:643— (anonymous) 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.
(anonymous) (cyclomatic 21) REDACTED:355— (anonymous) 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.
(anonymous) (cyclomatic 21) REDACTED:635— (anonymous) has cyclomatic complexity 21 (threshold 15). Of this number, 19 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.
(anonymous) (cyclomatic 17) REDACTED:709— (anonymous) 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.
(anonymous) (cyclomatic 17) api/server/routes/memories.js:180— (anonymous) has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs 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.
(anonymous) (cyclomatic 16) REDACTED:432— (anonymous) 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.
(anonymous) (cyclomatic 16) REDACTED:641— (anonymous) 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.
No assertions: every field primitive and variant resolves its fill, edge, ring and outline the same way in each state @scenario:field-variant-matrix e2e/specs/mock/scenarios/field-variants.spec.ts:344— 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: audio earlier versions saved to Cache Storage is deleted when the app starts @scenario:tts-legacy-disk-cache-purged-at-startup e2e/specs/mock/scenarios/tts-cache.spec.ts:152— 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.
mcp.router.get("/:serverName/oauth/callback") (cognitive 87) REDACTED:279— mcp.router.get("/:serverName/oauth/callback") has cognitive complexity 87 (threshold 15). Drivers by points: if/else 31 (53 pts), error handling 7 (14 pts), boolean chains 13, ternaries 3 (6 pts), loops 1 (nesting depth added 32). Of this number, 49 points are the body's own statements and 38 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.
mcp.router.get("/:serverName/oauth/initiate") (cognitive 22) REDACTED:135— mcp.router.get("/:serverName/oauth/initiate") has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10, boolean chains 8, ternaries 2 (3 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.
(anonymous) (cognitive 30) REDACTED:189— (anonymous) has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 5, other 3, error handling 1, loops 1 (nesting depth added 5). Of this number, 26 points are the body's own statements and 4 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.
(anonymous) (cognitive 30) REDACTED:102— (anonymous) has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 5, error handling 2, other 2, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
actions.router.post("/:agent_id") (cognitive 28) REDACTED:102— actions.router.post("/:agent_id") has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 5, error handling 2, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
actions.router.post("/:assistant_id") (cognitive 26) REDACTED:30— actions.router.post("/:assistant_id") has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 5, error handling 2, loops 2 (nesting depth added 3). 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, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
getDefaultHandlers::handle (cognitive 19) api/server/controllers/agents/callbacks.js:689— getDefaultHandlers::handle has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 4, other 3, error handling 1 (2 pts), loops 1, 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.
getDefaultHandlers::handle (cognitive 16) api/server/controllers/agents/callbacks.js:480— getDefaultHandlers::handle has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), other 4, ternaries 1 (2 pts), boolean chains 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.
Cross-context type TResolvedPromptResponse (data-provider → client) client/src/hooks/Prompts/usePromptContent.ts:13— TResolvedPromptResponse (context data-provider) is exposed in client's public surface via PromptContent.resolved — couples the contexts.
Cross-context type TResolvedPromptResponse (data-provider → client) client/src/data-provider/prompts.ts:375— TResolvedPromptResponse (context data-provider) is exposed in client's public surface via prompts.useResolvePromptGroup — couples the contexts.
Cross-context type TextData (data-provider → client) client/src/components/Chat/Messages/Content/editableParts.ts:9— TextData (context data-provider) is exposed in client's public surface via editableParts.getPartValue — couples the contexts.
Cross-context type TextData (data-provider → client) client/src/components/Chat/Messages/Content/editableParts.ts:24— TextData (context data-provider) is exposed in client's public surface via editableParts.withPartText — couples the contexts.
Cross-context type AuthType (data-provider → client) client/src/components/SidePanel/Agents/Search/ApiKeyDialog.tsx:16— AuthType (context data-provider) is exposed in client's public surface via ApiKeyDialog.ApiKeyDialog — couples the contexts.
Cross-context type AuthType (data-provider → client) client/src/components/SidePanel/Agents/Search/Action.tsx:17— AuthType (context data-provider) is exposed in client's public surface via Action.Action — couples the contexts.
Cross-context type SearchProviders (data-provider → client) client/src/components/SidePanel/Agents/Search/ApiKeyDialog.tsx:16— SearchProviders (context data-provider) is exposed in client's public surface via ApiKeyDialog.ApiKeyDialog — couples the contexts.
Cross-context type SearchProviders (data-provider → client) client/src/components/SidePanel/Agents/Search/Action.tsx:17— SearchProviders (context data-provider) is exposed in client's public surface via Action.Action — couples the contexts.
Cross-context type ScraperProviders (data-provider → client) client/src/components/SidePanel/Agents/Search/ApiKeyDialog.tsx:16— ScraperProviders (context data-provider) is exposed in client's public surface via ApiKeyDialog.ApiKeyDialog — couples the contexts.
Cross-context type ScraperProviders (data-provider → client) client/src/components/SidePanel/Agents/Search/Action.tsx:17— ScraperProviders (context data-provider) is exposed in client's public surface via Action.Action — couples the contexts.
Cross-context type RerankerTypes (data-provider → client) client/src/components/SidePanel/Agents/Search/ApiKeyDialog.tsx:16— RerankerTypes (context data-provider) is exposed in client's public surface via ApiKeyDialog.ApiKeyDialog — couples the contexts.
Cross-context type RerankerTypes (data-provider → client) client/src/components/SidePanel/Agents/Search/Action.tsx:17— RerankerTypes (context data-provider) is exposed in client's public surface via Action.Action — couples the contexts.
Cross-context type SearchRefType (data-provider → client) client/src/components/Web/Context.tsx:29— SearchRefType (context data-provider) is exposed in client's public surface via Context.useCitation — couples the contexts.
Cross-context type SearchRefType (data-provider → client) client/src/components/Web/Context.tsx:68— SearchRefType (context data-provider) is exposed in client's public surface via Context.useCompositeCitations — couples the contexts.
Cross-context type AccessRoleIds (data-provider → api) packages/api/src/acl/accessControlService.ts:129— AccessRoleIds (context data-provider) is exposed in api's public surface via AccessControlService.grantPermission — couples the contexts.
Cross-context type AccessRoleIds (data-provider → api) packages/api/src/prompts/service.ts:447— AccessRoleIds (context data-provider) is exposed in api's public surface via PromptServiceDependencies.grantPermission — couples the contexts.
D23 · Boundary Type-Coupling· Cross-context type Extra (client → api) · ×2
Cross-context type Extra (client → api) packages/api/src/agents/background.ts:552— Extra (context client) is exposed in api's public surface via background.applyBackgroundToolCalls — couples the contexts.
Cross-context type Extra (client → api) packages/api/src/agents/intent.ts:315— Extra (context client) is exposed in api's public surface via intent.applyIntentLabels — couples the contexts.
Cross-context type BackgroundTaskDelivery (data-provider → api) packages/api/src/agents/background.ts:2258— BackgroundTaskDelivery (context data-provider) is exposed in api's public surface via background.resolveTaskDelivery — couples the contexts.
Cross-context type BackgroundTaskDelivery (data-provider → api) packages/api/src/agents/tasks.ts:78— BackgroundTaskDelivery (context data-provider) is exposed in api's public surface via tasks.toBackgroundTaskSummary — couples the contexts.
Cross-context type ProviderId (data-provider → api) packages/api/src/endpoints/custom/providers.ts:38— ProviderId (context data-provider) is exposed in api's public surface via providers.providerFromBaseURL — couples the contexts.
Cross-context type ProviderId (data-provider → api) packages/api/src/endpoints/custom/providers.ts:64— ProviderId (context data-provider) is exposed in api's public surface via providers.resolveEndpointProviderId — couples the contexts.
Cross-context type FileSources (data-provider → api) packages/api/src/agents/files/manifest.ts:39— FileSources (context data-provider) is exposed in api's public surface via RunFileEntry.source — couples the contexts.
Cross-context type FileSources (data-provider → api) packages/api/src/files/code/process.ts:81— FileSources (context data-provider) is exposed in api's public surface via CodeOutputProcessorDeps.getStrategyFunctions — couples the contexts.
Cross-context type ViolationTypes (data-provider → api) packages/api/src/auth/limiter.ts:20— ViolationTypes (context data-provider) is exposed in api's public surface via TwoFactorLimiterDependencies.logViolation — couples the contexts.
Cross-context type ViolationTypes (data-provider → api) packages/api/src/mcp/apps/limits.ts:32— ViolationTypes (context data-provider) is exposed in api's public surface via MCPAppRateLimiterDependencies.logViolation — couples the contexts.
Cross-context type AgentCapabilities (data-provider → api) packages/api/src/endpoints/config/endpoints.ts:29— AgentCapabilities (context data-provider) is exposed in api's public surface via endpoints.createEndpointsConfigService — couples the contexts.
Cross-context type AgentCapabilities (data-provider → api) packages/api/src/endpoints/config/endpoints.ts:194— AgentCapabilities (context data-provider) is exposed in api's public surface via endpoints.createEndpointsConfigService.checkCapability — couples the contexts.
Cross-context type MessageContentComplex (data-provider → api) REDACTED:225— MessageContentComplex (context data-provider) is exposed in api's public surface via youtube.hasYouTubeVideoParts — couples the contexts.
Cross-context type MessageContentComplex (data-provider → api) REDACTED:293— MessageContentComplex (context data-provider) is exposed in api's public surface via youtube.appendYouTubeVideoParts — couples the contexts.
Cross-context type TTraceErrorCode (data-provider → api) packages/api/src/traces/types.ts:43— TTraceErrorCode (context data-provider) is exposed in api's public surface via TraceReadError.code — couples the contexts.
Cross-context type TTraceErrorCode (data-provider → api) packages/api/src/traces/types.ts:45— TTraceErrorCode (context data-provider) is exposed in api's public surface via TraceReadError.constructor — couples the contexts.
Cross-context type EToolResources (data-provider → data-schemas) packages/data-schemas/src/methods/file.ts:403— EToolResources (context data-provider) is exposed in data-schemas's public surface via file.createFileMethods — couples the contexts.
Cross-context type EToolResources (data-provider → data-schemas) packages/data-schemas/src/methods/file.ts:880— EToolResources (context data-provider) is exposed in data-schemas's public surface via file.createFileMethods.getToolFilesByIds — couples the contexts.
Cross-context type ScheduleDisabledReason (data-provider → data-schemas) packages/data-schemas/src/types/schedule.ts:29— ScheduleDisabledReason (context data-provider) is exposed in data-schemas's public surface via ISchedule.disabledReason — couples the contexts.
Cross-context type ScheduleDisabledReason (data-provider → data-schemas) packages/data-schemas/src/methods/schedule.ts:838— ScheduleDisabledReason (context data-provider) is exposed in data-schemas's public surface via schedule.createScheduleMethods.disableSchedule — couples the contexts.
Cross-context type Phase (client → data-schemas) packages/data-schemas/src/methods/skill.ts:1018— Phase (context client) is exposed in data-schemas's public surface via skill.createSkillMethods — couples the contexts.
Cross-context type Phase (client → data-schemas) packages/data-schemas/src/methods/skill.ts:1275— Phase (context client) is exposed in data-schemas's public surface via skill.createSkillMethods.getSkillByName — couples the contexts.
Change-coupling hub: RedisJobStore.ts → GenerationJobManager.ts, InMemoryJobStore.ts, stream.ts packages/api/src/stream/implementations/RedisJobStore.ts— `packages/api/src/stream/implementations/RedisJobStore.ts` changes together with 3 other files — `packages/api/src/stream/GenerationJobManager.ts`, `packages/api/src/stream/implementations/InMemoryJobStore.ts`, `packages/api/src/types/stream.ts` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: Message.tsx → MessageParts.tsx, SearchMessage.tsx, MessageRender.tsx, ContentRender.tsx client/src/components/Share/Message.tsx— `client/src/components/Share/Message.tsx` changes together with 4 other files — `client/src/components/Chat/Messages/MessageParts.tsx`, `client/src/components/Chat/Messages/SearchMessage.tsx`, `client/src/components/Chat/Messages/ui/MessageRender.tsx`, `client/src/components/Messages/ContentRender.tsx` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
IC1 · Incompleteness & stubs· Both branches are identical · ×2
Both branches are identical — the condition decides nothing api/server/controllers/agents/responses.js:560— 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 client/src/components/SidePanel/Agents/Tools/ToolCard.tsx:53— 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.
P12 · CI test-gate honesty· Runner config excludes tests no gate runs · ×2
Runner config excludes tests no gate runs packages/api/jest.config.mjs:29— `/__tests__/helpers/` removes 6 test(s) in 6 file(s) (e.g. `packages/api/src/mcp/__tests__/helpers/mcpOAuthWorkerBoot.cjs`, `packages/api/src/mcp/__tests__/helpers/mcpOAuthWorkerMain.ts`) from what jest collects, and no other runner or CI command runs them — they are dead tests. Run them (another runner, project or job), or delete them.
Runner config excludes tests no gate runs packages/data-schemas/jest.config.mjs:6— `/misc/` removes 135 test(s) in 15 file(s) (e.g. `packages/data-schemas/misc/documentdb/audit.documentdb.spec.ts`, `packages/data-schemas/misc/documentdb/compat.documentdb.spec.ts`) from what jest collects, and no other runner or CI command runs them — they are dead tests. Run them (another runner, project or job), or delete them.
R10 · Code Duplication· Duplicated block with local edits (113 matched lines × 2 locations) · ×2
Duplicated block with local edits (113 matched lines × 2 locations) packages/api/src/agents/added.ts:60— packages/api/src/agents/added.ts:60 · packages/api/src/agents/load.ts:36 — the two spans are one implementation copied and then locally edited — 686 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 (113 matched lines × 2 locations) packages/api/src/pulls/bitbucket.ts:176— packages/api/src/pulls/bitbucket.ts:176 · packages/api/src/pulls/gitlab.ts:151 — the two spans are one implementation copied and then locally edited — 702 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 (105 matched lines × 2 locations) · ×2
Duplicated block with local edits (105 matched lines × 2 locations) client/src/components/SidePanel/Agents/FileContext.tsx:34— client/src/components/SidePanel/Agents/FileContext.tsx:34 · client/src/components/SidePanel/Agents/FileSearch.tsx:31 — the two spans are one implementation copied and then locally edited — 521 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 (105 matched lines × 2 locations) packages/api/src/admin/config.ts:3397— packages/api/src/admin/config.ts:3397 · packages/api/src/admin/config.ts:3730 — the two spans are one implementation copied and then locally edited — 588 tokens are still identical, in the same order in both spans, 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 (99 matched lines × 2 locations) · ×2
Duplicated block with local edits (99 matched lines × 2 locations) packages/api/src/agents/migration.ts:35— packages/api/src/agents/migration.ts:35 · packages/api/src/prompts/migration.ts:33 — the two spans are one implementation copied and then locally edited — 541 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 (99 matched lines × 2 locations) packages/api/src/agents/validation.ts:590— packages/api/src/agents/validation.ts:590 · packages/api/src/agents/validation.ts:720 — the two spans are one implementation copied and then locally edited — 780 tokens are still identical, in the same order in both spans, 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 (~146 LoC) client/src/components/Chat/Input/MCPConfigDialog.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~146 LoC) client/src/components/SidePanel/Agents/AgentTool.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~37 LoC) client/src/components/Nav/SettingsTabs/Chat/SaveBadgesState.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~37 LoC) client/src/components/Nav/SettingsTabs/Chat/ShowThinking.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~30 LoC) packages/client/src/svgs/LightModeIcon.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~30 LoC) packages/client/src/svgs/SunIcon.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~25 LoC) packages/client/src/svgs/RenameIcon.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~25 LoC) packages/client/src/svgs/SwitchIcon.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~24 LoC) client/src/utils/resetConvo.ts— no import path from any entry point (376 application, 87 tooling, 2926 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 (~24 LoC) packages/client/src/svgs/CautionIcon.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~19 LoC) client/src/components/Chat/Messages/Content/InProgressCall.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~19 LoC) client/src/utils/buildTree.ts— no import path from any entry point (376 application, 87 tooling, 2926 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
X29 · Per-element action decided by a fixed element· Per-element action decided by a fixed element · ×2
Per-element action decided by a fixed element client/src/components/Chat/Messages/MessageNav.tsx:1506— This loop runs once per element of `entries`, and the statement it guards acts on the element it is on — `entries[i]`. The test deciding whether that statement runs does not: `snapPointFor(entryTop(el, container), scrollMargin, maxScrollTop) < scrollTop...` reads `entries[0]`, a subscript that does not move, so whatever it answers for that one element it answers for ALL of them. One `if` names the same collection at two different subscripts — the fixed one at line 1499, which is the contradiction: either the test was meant to be per-element, in which case every element that differs from the fixed one is handled wrongly and all in the same direction, or it really is one answer for the whole collection, in which case it is being re-asked on every pass and belongs above the loop. The `if` is in the wrong place under both readings. Give the test the loop variable, or hoist it out.
Per-element action decided by a fixed element client/src/components/Chat/Messages/MessageNav.tsx:1533— This loop runs once per element of `entries`, and the statement it guards acts on the element it is on — `entries[i]`. The test deciding whether that statement runs does not: `snapPointFor(entryTop(el, container), scrollMargin, maxScrollTop) > scrollTop...` reads `entries[0]`, a subscript that does not move, so whatever it answers for that one element it answers for ALL of them. One `if` names the same collection at two different subscripts — the fixed one at line 1526, which is the contradiction: either the test was meant to be per-element, in which case every element that differs from the fixed one is handled wrongly and all in the same direction, or it really is one answer for the whole collection, in which case it is being re-asked on every pass and belongs above the loop. The `if` is in the wrong place under both readings. Give the test the loop variable, or hoist it out.
AC2 · Forms & labels· <Textarea> field component without a label · ×1
<Textarea> field component without a label client/src/components/Chat/Messages/Feedback.tsx:320— 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> · ×1
<fieldset> without a <legend> client/src/components/SidePanel/MCPBuilder/MCPServerDialog/MCPServerForm.tsx:42— 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.
AC2 · Forms & labels· <Select> field component without a label · ×1
<Select> field component without a label packages/client/src/components/MultiSelect.tsx:146— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. 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.
handlers.createToolExecuteHandler.handle (cyclomatic 336) packages/api/src/agents/handlers.ts:5670— handlers.createToolExecuteHandler.handle has cyclomatic complexity 336 (threshold 15). Most of this is not in the body itself: 14 of the 336 points are its own statements and the rest belongs to 29 function items inside it that branch (a function literal at line 7247, a function literal at line 6955, a function literal at line 5931, …). 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.
SubagentThreadPanel.SubagentThreadPanel (cyclomatic 318) client/src/components/Chat/Subagents/SubagentThreadPanel.tsx:127— SubagentThreadPanel.SubagentThreadPanel has cyclomatic complexity 318 (threshold 15). Of this number, 124 points are the body's own statements and 194 belong to 50 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.
ResumableAgentController (cyclomatic 238) api/server/controllers/agents/request.js:769— ResumableAgentController has cyclomatic complexity 238 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
initialize.initializeAgent (cyclomatic 235) packages/api/src/agents/initialize.ts:1221— initialize.initializeAgent has cyclomatic complexity 235 (threshold 15). Of this number, 217 points are the body's own statements and 18 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.
ResumeAgentController (cyclomatic 235) api/server/controllers/agents/resume.js:772— ResumeAgentController has cyclomatic complexity 235 (threshold 15). Of this number, 208 points are the body's own statements and 27 belong to 37 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.
MessageNav.MessageNav (cyclomatic 221) client/src/components/Chat/Messages/MessageNav.tsx:370— MessageNav.MessageNav has cyclomatic complexity 221 (threshold 15). Of this number, 16 points are the body's own statements and 205 belong to 62 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.
initializeClientWithProvider (cyclomatic 187) api/server/services/Endpoints/agents/initialize.js:223— initializeClientWithProvider has cyclomatic complexity 187 (threshold 15). Of this number, 72 points are the body's own statements and 115 belong to 96 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.
outcome.createAgentEventTerminalHandler (cyclomatic 184) packages/api/src/agents/triggers/outcome.ts:292— outcome.createAgentEventTerminalHandler has cyclomatic complexity 184 (threshold 15). Most of this is not in the body itself: 1 of the 184 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 323, 346). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
buildMessages (cyclomatic 178) api/server/controllers/agents/client.js:2366— buildMessages has cyclomatic complexity 178 (threshold 15). Of this number, 81 points are the body's own statements and 97 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.
llm.getOpenAILLMConfig (cyclomatic 161) packages/api/src/endpoints/openai/llm.ts:601— llm.getOpenAILLMConfig has cyclomatic complexity 161 (threshold 15). Of this number, 157 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.
ResumableAgentController::startGeneration (cyclomatic 155) api/server/controllers/agents/request.js:2261— ResumableAgentController::startGeneration has cyclomatic complexity 155 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Palette.Palette (cyclomatic 151) client/src/components/Chat/Input/Composer/Palette.tsx:197— Palette.Palette has cyclomatic complexity 151 (threshold 15). Of this number, 23 points are the body's own statements and 128 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.
MCPManager.callTool (cyclomatic 140) packages/api/src/mcp/MCPManager.ts:1486— MCPManager.callTool has cyclomatic complexity 140 (threshold 15). Of this number, 114 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.
actor.executeAgentEventActor (cyclomatic 139) packages/api/src/agents/triggers/actor.ts:226— actor.executeAgentEventActor has cyclomatic complexity 139 (threshold 15). Of this number, 137 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.
permissions.updateInterfacePermissions (cyclomatic 136) packages/api/src/app/permissions.ts:104— permissions.updateInterfacePermissions has cyclomatic complexity 136 (threshold 15). Of this number, 111 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.
background.runCheckBackgroundTask (cyclomatic 130) packages/api/src/agents/background.ts:2518— background.runCheckBackgroundTask has cyclomatic complexity 130 (threshold 15). Of this number, 123 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.
CodeWorkspaceMenu.CodeWorkspaceMenu (cyclomatic 128) client/src/components/Chat/Input/CodeWorkspaceMenu.tsx:449— CodeWorkspaceMenu.CodeWorkspaceMenu has cyclomatic complexity 128 (threshold 15). Of this number, 91 points are the body's own statements and 37 belong to 17 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.
RedisJobStore.deserializeJob (cyclomatic 126) packages/api/src/stream/implementations/RedisJobStore.ts:5620— RedisJobStore.deserializeJob has cyclomatic complexity 126 (threshold 15). Of this number, 122 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.
GenerationJobManagerClass.subscribeWithResume (cyclomatic 124) packages/api/src/stream/GenerationJobManager.ts:6168— GenerationJobManagerClass.subscribeWithResume has cyclomatic complexity 124 (threshold 15). Of this number, 106 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.
workspace.isValidResult (cyclomatic 123) packages/api/src/code/workspace.ts:928— workspace.isValidResult has cyclomatic complexity 123 (threshold 15). Of this number, 117 points are the body's own statements and 6 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.
ContentParts.ContentPartsBody (cyclomatic 121) client/src/components/Chat/Messages/Content/ContentParts.tsx:465— ContentParts.ContentPartsBody has cyclomatic complexity 121 (threshold 15). Of this number, 50 points are the body's own statements and 71 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.
messages.extractMessageContent (cyclomatic 115) packages/api/src/protection/adapters/messages.ts:781— messages.extractMessageContent has cyclomatic complexity 115 (threshold 15). Of this number, 94 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.
Queue.QueueRow (cyclomatic 112) client/src/components/Chat/Input/Composer/Queue.tsx:121— Queue.QueueRow has cyclomatic complexity 112 (threshold 15). Of this number, 83 points are the body's own statements and 29 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.
Artifacts.Artifacts (cyclomatic 111) client/src/components/Artifacts/Artifacts.tsx:45— Artifacts.Artifacts has cyclomatic complexity 111 (threshold 15). Of this number, 65 points are the body's own statements and 46 belong to 17 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.
generate.validateSettingDefinitions (cyclomatic 109) packages/data-provider/src/generate.ts:256— generate.validateSettingDefinitions has cyclomatic complexity 109 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
loadToolDefinitionsWrapper (cyclomatic 109) api/server/services/ToolService.js:836— loadToolDefinitionsWrapper has cyclomatic complexity 109 (threshold 15). Of this number, 46 points are the body's own statements and 63 belong to 23 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.
McpSection.McpSection (cyclomatic 106) client/src/components/SidePanel/Agents/Tools/ItemDialog/sections/McpSection.tsx:68— McpSection.McpSection has cyclomatic complexity 106 (threshold 15). Of this number, 61 points are the body's own statements and 45 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.
ChatForm.ChatForm (cyclomatic 105) client/src/components/Chat/Input/ChatForm.tsx:151— ChatForm.ChatForm has cyclomatic complexity 105 (threshold 15). Of this number, 57 points are the body's own statements and 48 belong to 18 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.
modelBoundContent.inspectModelBoundContent (cyclomatic 105) packages/api/src/middleware/modelBoundContent.ts:3507— modelBoundContent.inspectModelBoundContent has cyclomatic complexity 105 (threshold 15). Of this number, 79 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.
sendReservedMessage (cyclomatic 105) api/app/clients/BaseClient.js:772— sendReservedMessage has cyclomatic complexity 105 (threshold 15). Of this number, 95 points are the body's own statements and 10 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.
index.router.post("/chat/abort") (cyclomatic 104) api/server/routes/agents/index.js:602— index.router.post("/chat/abort") has cyclomatic complexity 104 (threshold 15). Of this number, 78 points are the body's own statements and 26 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.
RedisJobStore.createJob (cyclomatic 104) packages/api/src/stream/implementations/RedisJobStore.ts:2053— RedisJobStore.createJob has cyclomatic complexity 104 (threshold 15). To reduce it, name the conditions: bind each compound test to a 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.createSchedulesService.recordScheduleOutcome (cyclomatic 103) packages/api/src/schedules/service.ts:1428— service.createSchedulesService.recordScheduleOutcome has cyclomatic complexity 103 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DataTable.DataTable (cyclomatic 102) packages/client/src/components/DataTable/DataTable.tsx:36— DataTable.DataTable has cyclomatic complexity 102 (threshold 15). Of this number, 26 points are the body's own statements and 76 belong to 27 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.
useAutoSave.useAutoSave (cyclomatic 99) client/src/hooks/Input/useAutoSave.ts:44— useAutoSave.useAutoSave has cyclomatic complexity 99 (threshold 15). Most of this is not in the body itself: 4 of the 99 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 401, 616, 604, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
conversation.createConversationMethods.saveConvo (cyclomatic 99) packages/data-schemas/src/methods/conversation.ts:2405— conversation.createConversationMethods.saveConvo has cyclomatic complexity 99 (threshold 15). Of this number, 88 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.
message.createMessageMethods.claimBackgroundToolResults (cyclomatic 97) packages/data-schemas/src/methods/message.ts:2091— message.createMessageMethods.claimBackgroundToolResults has cyclomatic complexity 97 (threshold 15). Of this number, 95 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.
GenerationJobManagerClass.createJob (cyclomatic 96) packages/api/src/stream/GenerationJobManager.ts:2542— GenerationJobManagerClass.createJob has cyclomatic complexity 96 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VirtualizedAgentGrid.VirtualizedAgentGrid (cyclomatic 95) client/src/components/Agents/VirtualizedAgentGrid.tsx:69— VirtualizedAgentGrid.VirtualizedAgentGrid has cyclomatic complexity 95 (threshold 15). Of this number, 25 points are the body's own statements and 70 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.
AgentPanel.AgentPanel (cyclomatic 94) client/src/components/SidePanel/Agents/AgentPanel.tsx:465— AgentPanel.AgentPanel has cyclomatic complexity 94 (threshold 15). Of this number, 33 points are the body's own statements and 61 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.
AccessControlService.bulkUpdateResourcePermissions (cyclomatic 94) packages/api/src/acl/accessControlService.ts:472— AccessControlService.bulkUpdateResourcePermissions has cyclomatic complexity 94 (threshold 15). Of this number, 80 points are the body's own statements and 14 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.
workspace.executeWorkspaceTool (cyclomatic 94) packages/api/src/code/workspace.ts:1310— workspace.executeWorkspaceTool has cyclomatic complexity 94 (threshold 15). Of this number, 88 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.
SubagentPublicRecorder.recordEvent (cyclomatic 93) packages/api/src/agents/activity.ts:710— SubagentPublicRecorder.recordEvent 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.
updateAgentHandler (cyclomatic 92) REDACTED:1056— updateAgentHandler has cyclomatic complexity 92 (threshold 15). Of this number, 88 points are the body's own statements and 4 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.
request.handleSteerRequestInternal (cyclomatic 91) packages/api/src/agents/steering/request.ts:401— request.handleSteerRequestInternal has cyclomatic complexity 91 (threshold 15). Of this number, 90 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.
Breakdown.Breakdown (cyclomatic 90) client/src/components/Chat/Input/TokenUsage/Breakdown.tsx:112— Breakdown.Breakdown has cyclomatic complexity 90 (threshold 15). Of this number, 71 points are the body's own statements and 19 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.
ToolCall.ToolCall (cyclomatic 89) client/src/components/Chat/Messages/Content/ToolCall.tsx:35— ToolCall.ToolCall has cyclomatic complexity 89 (threshold 15). Of this number, 35 points are the body's own statements and 54 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.
LangfuseConnection.LangfuseConnection (cyclomatic 89) client/src/components/Nav/SettingsTabs/Integrations/LangfuseConnection.tsx:107— LangfuseConnection.LangfuseConnection has cyclomatic complexity 89 (threshold 15). Of this number, 53 points are the body's own statements and 36 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.
chatCompletion (cyclomatic 89) api/server/controllers/agents/client.js:4544— chatCompletion has cyclomatic complexity 89 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cleanup.disposeClient (cyclomatic 88) api/server/cleanup.js:58— cleanup.disposeClient has cyclomatic complexity 88 (threshold 15). Of this number, 85 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.
resumeCompletion (cyclomatic 88) api/server/controllers/agents/client.js:5423— resumeCompletion has cyclomatic complexity 88 (threshold 15). Of this number, 59 points are the body's own statements and 29 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.
SubagentCall.SubagentCall (cyclomatic 87) client/src/components/Chat/Messages/Content/Parts/SubagentCall.tsx:174— SubagentCall.SubagentCall has cyclomatic complexity 87 (threshold 15). Of this number, 41 points are the body's own statements and 46 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.
useCodeWorkspace.useCodeWorkspace (cyclomatic 86) client/src/hooks/Agents/useCodeWorkspace.ts:172— useCodeWorkspace.useCodeWorkspace has cyclomatic complexity 86 (threshold 15). Of this number, 78 points are the body's own statements and 8 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.
subagentContent.foldSubagentEvent (cyclomatic 86) client/src/utils/subagentContent.ts:219— subagentContent.foldSubagentEvent has cyclomatic complexity 86 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
processAgentFileUpload (cyclomatic 86) api/server/services/Files/process.js:809— processAgentFileUpload has cyclomatic complexity 86 (threshold 15). Of this number, 66 points are the body's own statements and 20 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.
ChatRoute.ChatRoute (cyclomatic 85) client/src/routes/ChatRoute.tsx:50— ChatRoute.ChatRoute has cyclomatic complexity 85 (threshold 15). Of this number, 29 points are the body's own statements and 56 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.
llm.getLLMConfig (cyclomatic 85) packages/api/src/endpoints/anthropic/llm.ts:136— llm.getLLMConfig has cyclomatic complexity 85 (threshold 15). Of this number, 81 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.
useMCPServerManager.useMCPServerManager (cyclomatic 84) client/src/hooks/MCP/useMCPServerManager.ts:79— useMCPServerManager.useMCPServerManager has cyclomatic complexity 84 (threshold 15). Most of this is not in the body itself: 7 of the 84 points are its own statements and the rest belongs to 22 function literals inside it that branch (lines 338, 235, 511, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Stage.Stage (cyclomatic 83) client/src/components/Lia/Stage.tsx:81— Stage.Stage has cyclomatic complexity 83 (threshold 15). Most of this is not in the body itself: 3 of the 83 points are its own statements and the rest belongs to 24 function literals inside it that branch (lines 281, 358, 124, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
requirements.resolveScheduledMCPRequirements (cyclomatic 82) packages/api/src/schedules/requirements.ts:33— requirements.resolveScheduledMCPRequirements has cyclomatic complexity 82 (threshold 15). Of this number, 26 points are the body's own statements and 56 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.
llm.getGoogleConfig (cyclomatic 81) packages/api/src/endpoints/google/llm.ts:491— llm.getGoogleConfig has cyclomatic complexity 81 (threshold 15). Of this number, 77 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.
openai.executeOpenAIChatCompletion (cyclomatic 80) api/server/controllers/agents/openai.js:288— openai.executeOpenAIChatCompletion has cyclomatic complexity 80 (threshold 15). Most of this is not in the body itself: 13 of the 80 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 441, 1034, 1046, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useAppBridge.useAppBridge (cyclomatic 80) client/src/hooks/MCP/useAppBridge.ts:154— useAppBridge.useAppBridge has cyclomatic complexity 80 (threshold 15). Most of this is not in the body itself: 1 of the 80 points is its own statement and the rest belongs to 20 function literals inside it that branch (lines 201, 391, 530, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cyclomatic 80) api/server/routes/agents/index.js:602— (anonymous) 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.
ToolApproval.ToolApproval (cyclomatic 79) client/src/components/Chat/Messages/Content/ToolApproval.tsx:97— ToolApproval.ToolApproval has cyclomatic complexity 79 (threshold 15). Of this number, 35 points are the body's own statements and 44 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.
engine.startScheduleEngine (cyclomatic 79) packages/api/src/schedules/engine.ts:44— engine.startScheduleEngine has cyclomatic complexity 79 (threshold 15). Most of this is not in the body itself: 1 of the 79 points is its own statement and the rest belongs to 16 function items inside it that branch (a function literal at line 69, a function literal at line 500, a function literal at line 92, …). 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.
AgentGrid.AgentGrid (cyclomatic 78) client/src/components/Agents/AgentGrid.tsx:27— AgentGrid.AgentGrid has cyclomatic complexity 78 (threshold 15). Of this number, 36 points are the body's own statements and 42 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.
ArtifactCodeEditor.ArtifactCodeEditor (cyclomatic 78) client/src/components/Artifacts/ArtifactCodeEditor.tsx:236— ArtifactCodeEditor.ArtifactCodeEditor has cyclomatic complexity 78 (threshold 15). Most of this is not in the body itself: 7 of the 78 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 509, 384, 640, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AskUserQuestions.AskUserQuestions (cyclomatic 77) client/src/components/Chat/Messages/Content/AskUserQuestions.tsx:22— AskUserQuestions.AskUserQuestions has cyclomatic complexity 77 (threshold 15). Of this number, 30 points are the body's own statements and 47 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.
handlers.handleReadFileCall (cyclomatic 77) packages/api/src/agents/handlers.ts:4635— handlers.handleReadFileCall has cyclomatic complexity 77 (threshold 15). Of this number, 76 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.
modes.createAgentToolApprovalSession.validateExecution (cyclomatic 76) packages/api/src/agents/hitl/modes.ts:397— modes.createAgentToolApprovalSession.validateExecution has cyclomatic complexity 76 (threshold 15). 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, name the conditions: bind each compound test to a 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.createAgentMethods.getListAgentsByAccess (cyclomatic 76) packages/data-schemas/src/methods/agent.ts:2018— agent.createAgentMethods.getListAgentsByAccess has cyclomatic complexity 76 (threshold 15). Of this number, 61 points are the body's own statements and 15 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.
WebSearch.WebSearch (cyclomatic 75) client/src/components/Chat/Messages/Content/WebSearch.tsx:63— WebSearch.WebSearch has cyclomatic complexity 75 (threshold 15). Of this number, 48 points are the body's own statements and 27 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.
Convo.Conversation (cyclomatic 75) client/src/components/Conversations/Convo.tsx:54— Convo.Conversation has cyclomatic complexity 75 (threshold 15). Of this number, 45 points are the body's own statements and 30 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.
fire.fireSchedule (cyclomatic 75) packages/api/src/schedules/fire.ts:126— fire.fireSchedule has cyclomatic complexity 75 (threshold 15). Most of this is not in the body itself: 3 of the 75 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 249, a function literal at line 516, advance, …). 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.
loadToolsForExecution (cyclomatic 75) api/server/services/ToolService.js:2169— loadToolsForExecution has cyclomatic complexity 75 (threshold 15). Of this number, 67 points are the body's own statements and 8 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.
host.startRun (cyclomatic 74) packages/api/src/agents/triggers/host.ts:575— host.startRun has cyclomatic complexity 74 (threshold 15). Of this number, 71 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.
backgroundCompletionWakeup.createBackgroundToolCompletionWakeupResolver::resolve (cyclomatic 74) packages/api/src/agents/backgroundCompletionWakeup.ts:294— backgroundCompletionWakeup.createBackgroundToolCompletionWakeupResolver::resolve has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
resolution.foldConfigLayers (cyclomatic 74) packages/data-schemas/src/app/resolution.ts:2273— resolution.foldConfigLayers has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
files.getOpaqueFields (cyclomatic 73) packages/api/src/protection/files.ts:496— files.getOpaqueFields 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.
submissions.extractStoredMessageContentWithBudget (cyclomatic 73) packages/api/src/protection/adapters/submissions.ts:1202— submissions.extractStoredMessageContentWithBudget has cyclomatic complexity 73 (threshold 15). Of this number, 17 points are the body's own statements and 56 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.
actor.resumeAgentEventActor (cyclomatic 73) packages/api/src/agents/triggers/actor.ts:905— actor.resumeAgentEventActor 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.
responses.executeResponse (cyclomatic 72) api/server/controllers/agents/responses.js:526— responses.executeResponse has cyclomatic complexity 72 (threshold 15). Most of this is not in the body itself: 14 of the 72 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 684, 665, 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.
ProjectResources.ProjectResources (cyclomatic 72) client/src/components/Projects/ProjectResources.tsx:94— ProjectResources.ProjectResources has cyclomatic complexity 72 (threshold 15). Of this number, 36 points are the body's own statements and 36 belong to 17 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.
web.loadWebSearchAuth::checkAuth (cyclomatic 71) packages/api/src/web/web.ts:628— web.loadWebSearchAuth::checkAuth has cyclomatic complexity 71 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mcpAuthority.assertProofIntegrity (cyclomatic 71) packages/data-schemas/src/methods/mcpAuthority.ts:578— mcpAuthority.assertProofIntegrity has cyclomatic complexity 71 (threshold 15). Of this number, 69 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.
Conversations.Conversations (cyclomatic 70) client/src/components/Conversations/Conversations.tsx:225— Conversations.Conversations has cyclomatic complexity 70 (threshold 15). Of this number, 34 points are the body's own statements and 36 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.
parsers.formatToolContent (cyclomatic 70) packages/api/src/mcp/parsers.ts:328— parsers.formatToolContent has cyclomatic complexity 70 (threshold 15). Of this number, 33 points are the body's own statements and 37 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.
loadTools (cyclomatic 70) api/app/clients/tools/util/handleTools.js:136— loadTools has cyclomatic complexity 70 (threshold 15). Of this number, 55 points are the body's own statements and 15 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.
useFileHandling.useFileHandlingCore.processFiles (cyclomatic 69) client/src/hooks/Files/useFileHandling.ts:683— useFileHandling.useFileHandlingCore.processFiles has cyclomatic complexity 69 (threshold 15). Of this number, 55 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.
ToolCallGroup.ToolCallGroup (cyclomatic 69) client/src/components/Chat/Messages/Content/ToolCallGroup.tsx:84— ToolCallGroup.ToolCallGroup 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 (ToolCallGroup.ToolCallGroup::resolveGroupLabel) 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.
usePaletteEntries.usePaletteEntries (cyclomatic 69) client/src/hooks/Input/usePaletteEntries.tsx:147— usePaletteEntries.usePaletteEntries has cyclomatic complexity 69 (threshold 15). Most of this is not in the body itself: 6 of the 69 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 266, 221, 521, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useDrawerSwipe.useDrawerSwipe (cyclomatic 69) client/src/hooks/Nav/useDrawerSwipe.ts:289— useDrawerSwipe.useDrawerSwipe 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 12 function literals inside it that branch (lines 510, 306, 577, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.createRun (cyclomatic 68) packages/api/src/agents/run.ts:2130— run.createRun 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. This shape REPEATS in the file: one other method here (run.createRun::buildAgentInput) 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.
callbacks.getDefaultHandlers (cyclomatic 67) api/server/controllers/agents/callbacks.js:341— callbacks.getDefaultHandlers has cyclomatic complexity 67 (threshold 15). Most of this is not in the body itself: 14 of the 67 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 592, a function literal at line 480, a function literal at line 689, …). 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.
Effort.Effort (cyclomatic 67) client/src/components/Chat/Input/Composer/Effort.tsx:114— Effort.Effort has cyclomatic complexity 67 (threshold 15). Of this number, 43 points are the body's own statements and 24 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.
PromptForm.PromptForm (cyclomatic 67) client/src/components/Prompts/forms/PromptForm.tsx:271— PromptForm.PromptForm has cyclomatic complexity 67 (threshold 15). Of this number, 42 points are the body's own statements and 25 belong to 12 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.
admission.canAgentGraphPause (cyclomatic 67) packages/api/src/agents/hitl/admission.ts:370— admission.canAgentGraphPause has cyclomatic complexity 67 (threshold 15). Of this number, 35 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.
RedisJobStore.getContentParts (cyclomatic 67) packages/api/src/stream/implementations/RedisJobStore.ts:4354— RedisJobStore.getContentParts 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.
reducer.reduceStep (cyclomatic 67) packages/chat/src/core/reducer.ts:50— reducer.reduceStep has cyclomatic complexity 67 (threshold 15). Of this number, 61 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.
message.createMessageMethods.settleToolCallResult (cyclomatic 67) packages/data-schemas/src/methods/message.ts:1626— message.createMessageMethods.settleToolCallResult has cyclomatic complexity 67 (threshold 15). Of this number, 36 points are the body's own statements and 31 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.
workspace.isValidRequest (cyclomatic 66) packages/api/src/code/workspace.ts:829— workspace.isValidRequest has cyclomatic complexity 66 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MCPTokenStorage.storeTokensUnderLease (cyclomatic 66) packages/api/src/mcp/oauth/tokens.ts:580— MCPTokenStorage.storeTokensUnderLease has cyclomatic complexity 66 (threshold 15). Of this number, 62 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.
turn.buildTurn (cyclomatic 65) client/src/hooks/Chat/ask/turn.ts:109— turn.buildTurn has cyclomatic complexity 65 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useConversationSeen.useConversationSeen (cyclomatic 65) client/src/hooks/Conversations/useConversationSeen.ts:32— useConversationSeen.useConversationSeen 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 10 function literals inside it that branch (lines 132, 89, 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.
config.createAdminConfigHandlers.upsertConfigOverrides (cyclomatic 65) packages/api/src/admin/config.ts:3397— config.createAdminConfigHandlers.upsertConfigOverrides has cyclomatic complexity 65 (threshold 15). Of this number, 54 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.
resources.computeProvisionState (cyclomatic 65) packages/api/src/agents/resources.ts:443— resources.computeProvisionState has cyclomatic complexity 65 (threshold 15). Of this number, 51 points are the body's own statements and 14 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.
view.createSubagentThreadViewHandler (cyclomatic 65) packages/api/src/agents/view.ts:598— view.createSubagentThreadViewHandler 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 4 function literals inside it that branch (lines 599, 679, 732, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
EditContentParts.EditContentParts (cyclomatic 64) client/src/components/Chat/Messages/Content/EditContentParts.tsx:38— EditContentParts.EditContentParts has cyclomatic complexity 64 (threshold 15). Most of this is not in the body itself: 13 of the 64 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 209, a function literal at line 331, 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.
GenerationJobManagerClass.abortJob (cyclomatic 64) packages/api/src/stream/GenerationJobManager.ts:4673— GenerationJobManagerClass.abortJob 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.
executeResponse::execute (cyclomatic 64) api/server/controllers/agents/responses.js:684— executeResponse::execute 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.
GenericGrantAccessDialog.GenericGrantAccessDialog (cyclomatic 63) client/src/components/Sharing/GenericGrantAccessDialog.tsx:39— GenericGrantAccessDialog.GenericGrantAccessDialog has cyclomatic complexity 63 (threshold 15). Of this number, 38 points are the body's own statements and 25 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.
GenerationJobManagerClass.emitChunkNow (cyclomatic 63) packages/api/src/stream/GenerationJobManager.ts:7013— GenerationJobManagerClass.emitChunkNow has cyclomatic complexity 63 (threshold 15). Of this number, 56 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.
modelBoundContent.projectModelBoundProviderContent (cyclomatic 63) packages/api/src/middleware/modelBoundContent.ts:2778— modelBoundContent.projectModelBoundProviderContent has cyclomatic complexity 63 (threshold 15). Of this number, 60 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.
storage.createDeleteFileWithSecondaryStorage (cyclomatic 63) packages/api/src/files/storage.ts:76— storage.createDeleteFileWithSecondaryStorage 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 7 function literals inside it that branch (lines 117, 101, 132, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
UserConnectionManager.createUserConnectionInternal (cyclomatic 63) packages/api/src/mcp/UserConnectionManager.ts:743— UserConnectionManager.createUserConnectionInternal has cyclomatic complexity 63 (threshold 15). Of this number, 59 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.
zod.convertJsonSchemaToZod (cyclomatic 63) packages/api/src/mcp/zod.ts:830— zod.convertJsonSchemaToZod has cyclomatic complexity 63 (threshold 15). Of this number, 60 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.
reinitMCPServer (cyclomatic 63) api/server/services/Tools/mcp.js:144— reinitMCPServer has cyclomatic complexity 63 (threshold 15). Of this number, 54 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.
recovery.createOpenIDRefreshRecoveryService.sendOpenIDAuthResponse (cyclomatic 62) packages/api/src/auth/openid/recovery.ts:674— recovery.createOpenIDRefreshRecoveryService.sendOpenIDAuthResponse has cyclomatic complexity 62 (threshold 15). Of this number, 49 points are the body's own statements and 13 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.
conversation.createConversationMethods.getConvosByCursor (cyclomatic 62) packages/data-schemas/src/methods/conversation.ts:3615— conversation.createConversationMethods.getConvosByCursor 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
finalizeResumedTurn (cyclomatic 62) api/server/controllers/agents/resume.js:416— finalizeResumedTurn has cyclomatic complexity 62 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
final.useFinalHandler (cyclomatic 61) client/src/hooks/SSE/final.ts:34— final.useFinalHandler has cyclomatic complexity 61 (threshold 15). Most of this is not in the body itself: 1 of the 61 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 57, 270, 301). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useQueueDrain.useQueueDrain (cyclomatic 61) packages/chat/src/react/steering/useQueueDrain.ts:57— useQueueDrain.useQueueDrain has cyclomatic complexity 61 (threshold 15). Most of this is not in the body itself: 3 of the 61 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 169, 345, 153, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.resolveTheme (cyclomatic 61) packages/data-provider/src/themes/registry.ts:678— registry.resolveTheme 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.
triggerDelivery.createAgentTriggerDeliveryMethods.claimAgentBackgroundToolResultBatch (cyclomatic 61) packages/data-schemas/src/methods/triggerDelivery.ts:3026— triggerDelivery.createAgentTriggerDeliveryMethods.claimAgentBackgroundToolResultBatch has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
loadAgentTools (cyclomatic 61) api/server/services/ToolService.js:1686— loadAgentTools has cyclomatic complexity 61 (threshold 15). Of this number, 47 points are the body's own statements and 14 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.
PinnedSection.PinnedSection (cyclomatic 60) client/src/components/Conversations/PinnedSection.tsx:310— PinnedSection.PinnedSection has cyclomatic complexity 60 (threshold 15). Of this number, 16 points are the body's own statements and 44 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.
GenerationJobManagerClass.attachSubscription (cyclomatic 60) packages/api/src/stream/GenerationJobManager.ts:5132— GenerationJobManagerClass.attachSubscription has cyclomatic complexity 60 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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 (GenerationJobManagerClass.attachSubscription::deliverStoredTerminal) 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.
executeOpenAIChatCompletion::execute (cyclomatic 60) api/server/controllers/agents/openai.js:441— executeOpenAIChatCompletion::execute has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Settings.CodeSettings (cyclomatic 59) client/src/components/SidePanel/Agents/Code/Settings.tsx:45— Settings.CodeSettings has cyclomatic complexity 59 (threshold 15). Of this number, 40 points are the body's own statements and 19 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.
InMemoryJobStore.createJob (cyclomatic 59) packages/api/src/stream/implementations/InMemoryJobStore.ts:277— InMemoryJobStore.createJob has cyclomatic complexity 59 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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 (InMemoryJobStore.createJob::assertOwnerCompatible) 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.
ThemeProvider.ThemeProvider (cyclomatic 59) packages/client/src/theme/context/ThemeProvider.tsx:468— ThemeProvider.ThemeProvider has cyclomatic complexity 59 (threshold 15). Most of this is not in the body itself: 15 of the 59 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 601, 727, 536, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
conversation.createConversationMethods.commitAgentEventActorState (cyclomatic 59) packages/data-schemas/src/methods/conversation.ts:1213— conversation.createConversationMethods.commitAgentEventActorState 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.
AgentDetailContent.AgentDetailContent (cyclomatic 58) client/src/components/Agents/AgentDetailContent.tsx:64— AgentDetailContent.AgentDetailContent has cyclomatic complexity 58 (threshold 15). Of this number, 45 points are the body's own statements and 13 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.
modelBoundContent.projectModelBoundSourceFiles (cyclomatic 58) packages/api/src/middleware/modelBoundContent.ts:432— modelBoundContent.projectModelBoundSourceFiles has cyclomatic complexity 58 (threshold 15). Of this number, 17 points are the body's own statements and 41 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.
MCPOAuthHandler.initiateOAuthFlow (cyclomatic 58) packages/api/src/mcp/oauth/handler.ts:800— MCPOAuthHandler.initiateOAuthFlow 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.
mcpAuthority.createMCPAuthorityMethods.loadCurrentProof (cyclomatic 58) packages/data-schemas/src/methods/mcpAuthority.ts:1098— mcpAuthority.createMCPAuthorityMethods.loadCurrentProof has cyclomatic complexity 58 (threshold 15). Of this number, 39 points are the body's own statements and 19 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.
browserSetup.createBrowserSetupStore.update (cyclomatic 58) packages/data-schemas/src/methods/browserSetup.ts:238— browserSetup.createBrowserSetupStore.update has cyclomatic complexity 58 (threshold 15). 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AuthContext.AuthContextProvider (cyclomatic 57) client/src/hooks/AuthContext.tsx:87— AuthContext.AuthContextProvider has cyclomatic complexity 57 (threshold 15). Most of this is not in the body itself: 6 of the 57 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 323, 397, 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.
ContentParts.ContentParts (cyclomatic 57) client/src/components/Chat/Messages/Content/ContentParts.tsx:1353— ContentParts.ContentParts has cyclomatic complexity 57 (threshold 15). Of this number, 41 points are the body's own statements and 16 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.
recovery.applyRecoveredContent (cyclomatic 57) client/src/components/Chat/Subagents/recovery.ts:43— recovery.applyRecoveredContent has cyclomatic complexity 57 (threshold 15). Of this number, 56 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.
SubagentThreadTaskStore.start (cyclomatic 57) packages/api/src/agents/subagentThreads.ts:1591— SubagentThreadTaskStore.start has cyclomatic complexity 57 (threshold 15). Of this number, 23 points are the body's own statements and 34 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.
chat.extractChatContent (cyclomatic 57) packages/api/src/protection/adapters/chat.ts:95— chat.extractChatContent has cyclomatic complexity 57 (threshold 15). Of this number, 42 points are the body's own statements and 15 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.
OpenAIImageGen.OpenAIImageGen (cyclomatic 56) client/src/components/Chat/Messages/Content/Parts/OpenAIImageGen/OpenAIImageGen.tsx:37— OpenAIImageGen.OpenAIImageGen has cyclomatic complexity 56 (threshold 15). Of this number, 33 points are the body's own statements and 23 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.
modelBoundContent.projectStoredMessageForProvider (cyclomatic 56) packages/api/src/middleware/modelBoundContent.ts:2030— modelBoundContent.projectStoredMessageForProvider has cyclomatic complexity 56 (threshold 15). Of this number, 46 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.
initialize.initializeBedrock (cyclomatic 56) packages/api/src/endpoints/bedrock/initialize.ts:108— initialize.initializeBedrock 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.
mongoMeili.createMeiliMongooseModel (cyclomatic 56) packages/data-schemas/src/models/plugins/mongoMeili.ts:299— mongoMeili.createMeiliMongooseModel has cyclomatic complexity 56 (threshold 15). Of this number, 41 points are the body's own statements and 15 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.
chatV2 (cyclomatic 56) REDACTED:70— chatV2 has cyclomatic complexity 56 (threshold 15). Of this number, 31 points are the body's own statements and 25 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.
SetKeyDialog.SetKeyDialog (cyclomatic 55) client/src/components/Input/SetKeyDialog/SetKeyDialog.tsx:151— SetKeyDialog.SetKeyDialog has cyclomatic complexity 55 (threshold 15). Most of this is not in the body itself: 4 of the 55 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 231, a function literal at line 242, 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.
requests.executeDurableWorkspaceRequest (cyclomatic 55) packages/api/src/code/requests.ts:83— requests.executeDurableWorkspaceRequest has cyclomatic complexity 55 (threshold 15). Of this number, 45 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.
inference.resolveAgentInferenceParameters (cyclomatic 55) packages/api/src/agents/inference.ts:437— inference.resolveAgentInferenceParameters 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.
messages.snapshotExternalMessages (cyclomatic 55) packages/api/src/protection/adapters/messages.ts:417— messages.snapshotExternalMessages has cyclomatic complexity 55 (threshold 15). Of this number, 48 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.
handlers.createSchedulesHandlers.updateSchedule (cyclomatic 55) packages/api/src/schedules/handlers.ts:904— handlers.createSchedulesHandlers.updateSchedule has cyclomatic complexity 55 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
sync.handleSync (cyclomatic 55) packages/chat/src/core/resumable/sync.ts:32— sync.handleSync 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.
saveErrorTurn (cyclomatic 55) api/server/controllers/agents/request.js:376— saveErrorTurn has cyclomatic complexity 55 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
(anonymous) (cyclomatic 55) REDACTED:279— (anonymous) has cyclomatic complexity 55 (threshold 15). Of this number, 31 points are the body's own statements and 24 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.
createOpenAIImageTools (cyclomatic 55) api/app/clients/tools/structured/OpenAIImageTools.js:63— createOpenAIImageTools 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 4 function items inside it that branch (a function literal at line 234, a function literal at line 115, getApiKey, …). 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.
useQueryParams.useQueryParams (cyclomatic 54) client/src/hooks/Input/useQueryParams.ts:62— useQueryParams.useQueryParams has cyclomatic complexity 54 (threshold 15). Most of this is not in the body itself: 4 of the 54 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 569, 236, 698, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useResumeOnLoad.useResumeOnLoad (cyclomatic 54) client/src/hooks/SSE/useResumeOnLoad.ts:49— useResumeOnLoad.useResumeOnLoad has cyclomatic complexity 54 (threshold 15). Of this number, 16 points are the body's own statements and 38 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.
FilePreviewDialog.FilePreviewDialog (cyclomatic 54) client/src/components/Chat/Messages/Content/FilePreviewDialog.tsx:96— FilePreviewDialog.FilePreviewDialog has cyclomatic complexity 54 (threshold 15). Of this number, 36 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.
useDictation.useDictation (cyclomatic 54) client/src/hooks/Input/useDictation.ts:40— useDictation.useDictation 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 10 function literals inside it that branch (lines 106, 145, 306, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
bridge.getCodeBridgeWorkerStatus (cyclomatic 54) packages/api/src/code/bridge.ts:413— bridge.getCodeBridgeWorkerStatus has cyclomatic complexity 54 (threshold 15). Of this number, 53 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.
successor.useOwedSuccessor (cyclomatic 53) client/src/hooks/SSE/successor.ts:34— successor.useOwedSuccessor has cyclomatic complexity 53 (threshold 15). Of this number, 16 points are the body's own statements and 37 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.
config.createAdminConfigHandlers.patchConfigField (cyclomatic 53) packages/api/src/admin/config.ts:3730— config.createAdminConfigHandlers.patchConfigField has cyclomatic complexity 53 (threshold 15). Of this number, 44 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.
resources.primeResources (cyclomatic 53) packages/api/src/agents/resources.ts:764— resources.primeResources 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
queuedTurn.createAgentQueuedTurnMethods.beginAgentQueuedTurnAdmission (cyclomatic 53) packages/data-schemas/src/methods/queuedTurn.ts:1954— queuedTurn.createAgentQueuedTurnMethods.beginAgentQueuedTurnAdmission 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 2 function items inside it that branch (a function literal at line 2001, retireObsoleteClaim). 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.
AskUserQuestion.AskUserQuestionSingle (cyclomatic 52) client/src/components/Chat/Messages/Content/AskUserQuestion.tsx:116— AskUserQuestion.AskUserQuestionSingle has cyclomatic complexity 52 (threshold 15). Of this number, 24 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.
Mermaid.MermaidRenderer (cyclomatic 52) client/src/components/Messages/Content/Mermaid/Mermaid.tsx:198— Mermaid.MermaidRenderer has cyclomatic complexity 52 (threshold 15). Of this number, 44 points are the body's own statements and 8 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.
activity.projectPersistedMessageActivity (cyclomatic 52) packages/api/src/agents/activity.ts:168— activity.projectPersistedMessageActivity has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 2 of the 52 points are its own statements and the rest belongs to one function literal inside it that branches (line 174). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
GenerationJobManagerClass.finishTerminalJobInternal (cyclomatic 52) packages/api/src/stream/GenerationJobManager.ts:4378— GenerationJobManagerClass.finishTerminalJobInternal 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.
GenerationJobManagerClass.getResumeState (cyclomatic 52) packages/api/src/stream/GenerationJobManager.ts:8831— GenerationJobManagerClass.getResumeState 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.
models.createLoadConfigModels (cyclomatic 52) packages/api/src/endpoints/config/models.ts:88— models.createLoadConfigModels 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 4 function literals inside it that branch (lines 91, 242, 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.
zod.sanitizeGeminiSchema (cyclomatic 52) packages/api/src/mcp/zod.ts:673— zod.sanitizeGeminiSchema has cyclomatic complexity 52 (threshold 15). Of this number, 49 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.
service.createSchedulesService.recordMCPToolAuthFailure (cyclomatic 52) packages/api/src/schedules/service.ts:1126— service.createSchedulesService.recordMCPToolAuthFailure has cyclomatic complexity 52 (threshold 15). Of this number, 49 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.
(anonymous) (cyclomatic 51) api/server/routes/agents/index.js:192— (anonymous) has cyclomatic complexity 51 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useNewConvo.useNewConvo.switchToConversation (cyclomatic 50) client/src/hooks/useNewConvo.ts:115— useNewConvo.useNewConvo.switchToConversation has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 1 of the 50 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 116, 278, 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.
BackgroundTaskCard.BackgroundTaskCard (cyclomatic 50) client/src/components/Chat/Messages/Content/BackgroundTaskCard.tsx:33— BackgroundTaskCard.BackgroundTaskCard has cyclomatic complexity 50 (threshold 15). Of this number, 48 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.
SkillFileViewer.SkillFileViewer (cyclomatic 50) client/src/components/Skills/display/SkillFileViewer.tsx:23— SkillFileViewer.SkillFileViewer has cyclomatic complexity 50 (threshold 15). Of this number, 41 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.
activity.projectSubagentActivity (cyclomatic 50) packages/api/src/agents/activity.ts:405— activity.projectSubagentActivity 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, separate the cases: extract each independent 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.createAgentChatCompletion (cyclomatic 50) packages/api/src/agents/openai/service.ts:640— service.createAgentChatCompletion has cyclomatic complexity 50 (threshold 15). Of this number, 46 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.
github.createGitHubPullRequestSource.find (cyclomatic 50) packages/api/src/pulls/github.ts:322— github.createGitHubPullRequestSource.find has cyclomatic complexity 50 (threshold 15). Of this number, 21 points are the body's own statements and 29 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.
MCPConnectionFactory.handleOAuthEvents::handleOAuthEvent (cyclomatic 50) packages/api/src/mcp/MCPConnectionFactory.ts:1850— MCPConnectionFactory.handleOAuthEvents::handleOAuthEvent 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.
service.createSchedulesService (cyclomatic 50) packages/api/src/schedules/service.ts:574— service.createSchedulesService 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 7 function literals inside it that branch (lines 703, 845, 919, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
message.createMessageMethods.saveMessage (cyclomatic 50) packages/data-schemas/src/methods/message.ts:1137— message.createMessageMethods.saveMessage 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.
InsightsView.InsightsView (cyclomatic 49) client/src/components/Insights/InsightsView.tsx:546— InsightsView.InsightsView has cyclomatic complexity 49 (threshold 15). Of this number, 23 points are the body's own statements and 26 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.
useSubagentActivityStream.useSubagentActivityStream (cyclomatic 49) client/src/data-provider/Subagents/useSubagentActivityStream.ts:50— useSubagentActivityStream.useSubagentActivityStream has cyclomatic complexity 49 (threshold 15). Most of this is not in the body itself: 1 of the 49 points is its own statement and the rest belongs to 13 function literals inside it that branch (lines 161, 117, 207, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
added.loadAddedAgent (cyclomatic 49) packages/api/src/agents/added.ts:90— added.loadAddedAgent 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.
transform.transformToOpenAIConfig (cyclomatic 49) packages/api/src/endpoints/openai/transform.ts:30— transform.transformToOpenAIConfig has cyclomatic complexity 49 (threshold 15). Of this number, 37 points are the body's own statements and 12 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
content.updateContent (cyclomatic 49) packages/chat/src/core/steps/content.ts:171— content.updateContent has cyclomatic complexity 49 (threshold 15). Of this number, 48 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.
launch.startGeneration (cyclomatic 49) packages/chat/src/core/resumable/launch.ts:37— launch.startGeneration 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.
index.router.get("/chat/stream/:streamId") (cyclomatic 48) api/server/routes/agents/index.js:192— index.router.get("/chat/stream/:streamId") has cyclomatic complexity 48 (threshold 15). Of this number, 38 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.
useReplyWatcher.mergeTimestamps (cyclomatic 48) client/src/hooks/Conversations/useReplyWatcher.ts:205— useReplyWatcher.mergeTimestamps 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.
useNewConvo.useNewConvo.newConversation (cyclomatic 48) client/src/hooks/useNewConvo.ts:325— useNewConvo.useNewConvo.newConversation has cyclomatic complexity 48 (threshold 15). Of this number, 31 points are the body's own statements and 17 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.
AgentSelect.AgentSelect (cyclomatic 48) client/src/components/SidePanel/Agents/AgentSelect.tsx:25— AgentSelect.AgentSelect 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 8 function literals inside it that branch (lines 144, 77, 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.
queuedTurns.createAgentQueuedTurnResolver (cyclomatic 48) packages/api/src/agents/queuedTurns.ts:467— queuedTurns.createAgentQueuedTurnResolver 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 3 function literals inside it that branch (lines 473, 678, 660). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
definitions.loadToolDefinitions (cyclomatic 48) packages/api/src/tools/definitions.ts:126— definitions.loadToolDefinitions has cyclomatic complexity 48 (threshold 15). Of this number, 42 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.
missing.recoverMissingStream (cyclomatic 48) packages/chat/src/core/resumable/missing.ts:20— missing.recoverMissingStream has cyclomatic complexity 48 (threshold 15). Of this number, 45 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.
useChatFunctions.useChatFunctions.ask (cyclomatic 47) client/src/hooks/Chat/useChatFunctions.ts:182— useChatFunctions.useChatFunctions.ask has cyclomatic complexity 47 (threshold 15). Of this number, 45 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.
ActivityPhaseGroup.ActivityPhaseGroup (cyclomatic 47) client/src/components/Chat/Messages/Content/ActivityPhaseGroup.tsx:540— ActivityPhaseGroup.ActivityPhaseGroup has cyclomatic complexity 47 (threshold 15). Of this number, 32 points are the body's own statements and 15 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.
SkillsCommand.SkillsCommandContent (cyclomatic 47) client/src/components/Chat/Input/SkillsCommand.tsx:80— SkillsCommand.SkillsCommandContent has cyclomatic complexity 47 (threshold 15). Most of this is not in the body itself: 15 of the 47 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 295, 111, 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.
Setup.Review (cyclomatic 47) client/src/components/Code/Setup.tsx:48— Setup.Review has cyclomatic complexity 47 (threshold 15). Of this number, 41 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.
config.createAdminConfigHandlers.applyConfigChanges (cyclomatic 47) packages/api/src/admin/config.ts:4386— config.createAdminConfigHandlers.applyConfigChanges 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: one other method here (config.createAdminConfigHandlers.applyConfigChanges::plan) 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.
import.handleZip (cyclomatic 47) packages/api/src/skills/import.ts:1004— import.handleZip has cyclomatic complexity 47 (threshold 15). Of this number, 44 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.
subagentContent.createSubagentTaskContentHandler (cyclomatic 47) packages/api/src/agents/subagentContent.ts:569— subagentContent.createSubagentTaskContentHandler has cyclomatic complexity 47 (threshold 15). Most of this is not in the body itself: 1 of the 47 points is its own statement and the rest belongs to one function literal inside it that branches (line 575). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
bitbucket.createBitbucketPullRequestSource.find (cyclomatic 47) packages/api/src/pulls/bitbucket.ts:250— bitbucket.createBitbucketPullRequestSource.find has cyclomatic complexity 47 (threshold 15). Of this number, 22 points are the body's own statements and 25 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.
service.createSchedulesService.deleteScheduleForOwner (cyclomatic 47) packages/api/src/schedules/service.ts:2083— service.createSchedulesService.deleteScheduleForOwner has cyclomatic complexity 47 (threshold 15). Of this number, 46 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.
reconcile.reconcileGenerationLifecycle (cyclomatic 47) packages/chat/src/core/resumable/reconcile.ts:25— reconcile.reconcileGenerationLifecycle has cyclomatic complexity 47 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
model.groupSteps (cyclomatic 46) client/src/components/Chat/Trace/model.ts:409— model.groupSteps has cyclomatic complexity 46 (threshold 15). Of this number, 19 points are the body's own statements and 27 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.
DynamicSlider.DynamicSlider (cyclomatic 46) client/src/components/SidePanel/Parameters/DynamicSlider.tsx:11— DynamicSlider.DynamicSlider has cyclomatic complexity 46 (threshold 15). Of this number, 19 points are the body's own statements and 27 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.
models.fetchModels (cyclomatic 46) packages/api/src/endpoints/models.ts:154— models.fetchModels 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.
callback.createProvisionFilesCallback (cyclomatic 46) packages/api/src/files/provision/callback.ts:78— callback.createProvisionFilesCallback 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 13 function items inside it that branch (a function literal at line 120, a function literal at line 197, a function literal at line 258, …). 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.
describe.describeThemeColors (cyclomatic 46) packages/data-provider/src/themes/describe.ts:37— describe.describeThemeColors has cyclomatic complexity 46 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mongoMeili.mongoMeili (cyclomatic 46) packages/data-schemas/src/models/plugins/mongoMeili.ts:952— mongoMeili.mongoMeili has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 8 of the 46 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 1268, 1049, 1211, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
protection.extractNestedSerializedPayloadFragments (cyclomatic 45) packages/api/src/shared-links/protection.ts:1207— protection.extractNestedSerializedPayloadFragments 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.
refreshController (cyclomatic 45) REDACTED:240— refreshController has cyclomatic complexity 45 (threshold 15). Of this number, 25 points are the body's own statements and 20 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.
EditMessage.EditMessage (cyclomatic 44) client/src/components/Chat/Messages/Content/EditMessage.tsx:14— EditMessage.EditMessage has cyclomatic complexity 44 (threshold 15). Of this number, 22 points are the body's own statements and 22 belong to 7 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.
ConnectedAccounts.ConnectedAccounts (cyclomatic 44) client/src/components/Nav/Settings/ConnectedAccounts.tsx:58— ConnectedAccounts.ConnectedAccounts has cyclomatic complexity 44 (threshold 15). Of this number, 20 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.
DynamicInput.DynamicInput (cyclomatic 44) client/src/components/SidePanel/Parameters/DynamicInput.tsx:11— DynamicInput.DynamicInput has cyclomatic complexity 44 (threshold 15). Of this number, 17 points are the body's own statements and 27 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.
useKeyboardShortcuts.useShortcutActions (cyclomatic 44) client/src/hooks/useKeyboardShortcuts.ts:497— useKeyboardShortcuts.useShortcutActions 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 17 function literals inside it that branch (lines 709, 550, 760, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
initialize.initializeOpenAI (cyclomatic 44) packages/api/src/endpoints/openai/initialize.ts:48— initialize.initializeOpenAI has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
enqueue.useQueueEnqueue (cyclomatic 44) packages/chat/src/react/steering/enqueue.ts:47— enqueue.useQueueEnqueue 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 6 function literals inside it that branch (lines 101, 160, 80, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
submit.useSubmitSteer (cyclomatic 44) packages/chat/src/react/steering/submit.ts:35— submit.useSubmitSteer 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 9 function literals inside it that branch (lines 243, 125, 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.
PixelCard.PixelCard (cyclomatic 44) packages/client/src/components/PixelCard.tsx:192— PixelCard.PixelCard 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 11 function items inside it that branch (a function literal at line 235, a function literal at line 293, 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.
parsers.getResponseSender (cyclomatic 44) packages/data-provider/src/parsers.ts:222— parsers.getResponseSender has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BashCall.BashCall (cyclomatic 43) client/src/components/Chat/Messages/Content/Parts/BashCall.tsx:29— BashCall.BashCall has cyclomatic complexity 43 (threshold 15). Of this number, 30 points are the body's own statements and 13 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.
QuoteButton.QuoteButton (cyclomatic 43) client/src/components/Chat/Input/QuoteButton.tsx:321— QuoteButton.QuoteButton 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 14 function literals inside it that branch (lines 393, 454, 602, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
activityLabels.groupActivityPhases (cyclomatic 43) client/src/utils/activityLabels.ts:496— activityLabels.groupActivityPhases has cyclomatic complexity 43 (threshold 15). Of this number, 38 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.
toolTiming.createToolTimingTracker (cyclomatic 43) packages/api/src/agents/toolTiming.ts:192— toolTiming.createToolTimingTracker has cyclomatic complexity 43 (threshold 15). Of this number, 36 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.
metadata.sanitizeJobMetadata (cyclomatic 43) packages/api/src/stream/metadata.ts:9— metadata.sanitizeJobMetadata 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.
subagentContent.readSubagentContent (cyclomatic 43) packages/api/src/agents/subagentContent.ts:405— subagentContent.readSubagentContent 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.
engine.createAgentTriggerDeliveryEngine.processDelivery (cyclomatic 43) packages/api/src/agents/triggers/engine.ts:388— engine.createAgentTriggerDeliveryEngine.processDelivery 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.
MCPTokenStorage.executeTokenRefresh (cyclomatic 43) packages/api/src/mcp/oauth/tokens.ts:1611— MCPTokenStorage.executeTokenRefresh has cyclomatic complexity 43 (threshold 15). Of this number, 42 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.
triggerDelivery.createAgentTriggerDeliveryMethods.recoverLanePublisher (cyclomatic 43) packages/data-schemas/src/methods/triggerDelivery.ts:741— triggerDelivery.createAgentTriggerDeliveryMethods.recoverLanePublisher 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.
DialogImage.DialogImage (cyclomatic 42) client/src/components/Chat/Messages/Content/DialogImage.tsx:23— DialogImage.DialogImage has cyclomatic complexity 42 (threshold 15). Of this number, 17 points are the body's own statements and 25 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.
mutations.useMarkConversationUnreadMutation (cyclomatic 42) client/src/data-provider/mutations.ts:741— mutations.useMarkConversationUnreadMutation 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 6 function literals inside it that branch (lines 801, 898, 787, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
richtext.serializeNode (cyclomatic 42) REDACTED:288— richtext.serializeNode has cyclomatic complexity 42 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
GenerationJobManagerClass.claimTerminalJob (cyclomatic 42) packages/api/src/stream/GenerationJobManager.ts:4045— GenerationJobManagerClass.claimTerminalJob 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.
bridge.validWorkspaceCapabilities (cyclomatic 42) packages/api/src/code/bridge.ts:286— bridge.validWorkspaceCapabilities 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 307, 312). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SubagentThreadTaskStore.prepareThread (cyclomatic 42) packages/api/src/agents/subagentThreads.ts:3302— SubagentThreadTaskStore.prepareThread 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.
host.createRunFileHost (cyclomatic 42) packages/api/src/agents/files/host.ts:77— host.createRunFileHost 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 7 function literals inside it that branch (lines 186, 360, 393, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
router.createCodeSetupRouter (cyclomatic 42) packages/api/src/code/setup/router.ts:114— router.createCodeSetupRouter 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 12 function items inside it that branch (machine, browserSession, a function literal at line 140, …). 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.
MCPConnection.constructTransport (cyclomatic 42) packages/api/src/mcp/connection.ts:1718— MCPConnection.constructTransport has cyclomatic complexity 42 (threshold 15). Of this number, 22 points are the body's own statements and 20 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.
stripUIResourceMarkers.applyCitationTextBoundaries (cyclomatic 42) packages/data-schemas/src/utils/stripUIResourceMarkers.ts:131— stripUIResourceMarkers.applyCitationTextBoundaries has cyclomatic complexity 42 (threshold 15). Of this number, 21 points are the body's own statements and 21 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.
addPreviousAttachments (cyclomatic 42) api/app/clients/BaseClient.js:1930— addPreviousAttachments has cyclomatic complexity 42 (threshold 15). Of this number, 22 points are the body's own statements and 20 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.
Reasoning.useComposerReasoning (cyclomatic 41) client/src/components/Chat/Input/Reasoning.tsx:265— Reasoning.useComposerReasoning has cyclomatic complexity 41 (threshold 15). Of this number, 21 points are the body's own statements and 20 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.
ChatView.ChatView (cyclomatic 41) client/src/components/Chat/ChatView.tsx:57— ChatView.ChatView has cyclomatic complexity 41 (threshold 15). Of this number, 40 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.
SubagentActivity.SubagentControlHistory (cyclomatic 41) client/src/components/Chat/Subagents/SubagentActivity.tsx:135— SubagentActivity.SubagentControlHistory has cyclomatic complexity 41 (threshold 15). Of this number, 17 points are the body's own statements and 24 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.
MemoryEditDialog.MemoryEditDialog (cyclomatic 41) client/src/components/SidePanel/Memories/MemoryEditDialog.tsx:40— MemoryEditDialog.MemoryEditDialog has cyclomatic complexity 41 (threshold 15). Of this number, 28 points are the body's own statements and 13 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.
Citation.CompositeCitation (cyclomatic 41) client/src/components/Web/Citation.tsx:61— Citation.CompositeCitation has cyclomatic complexity 41 (threshold 15). Of this number, 25 points are the body's own statements and 16 belong to 7 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.createRun::buildAgentInput (cyclomatic 41) packages/api/src/agents/run.ts:2402— run.createRun::buildAgentInput 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 (run.createRun) 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.
skillFiles.primeInvokedSkills (cyclomatic 41) packages/api/src/agents/skillFiles.ts:749— skillFiles.primeInvokedSkills has cyclomatic complexity 41 (threshold 15). Of this number, 37 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.
validation.validateGraphSubagentTopology (cyclomatic 41) packages/api/src/agents/validation.ts:206— validation.validateGraphSubagentTopology has cyclomatic complexity 41 (threshold 15). Of this number, 37 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.
request.handleSteerCancelInternal (cyclomatic 41) packages/api/src/agents/steering/request.ts:831— request.handleSteerCancelInternal has cyclomatic complexity 41 (threshold 15). Of this number, 22 points are the body's own statements and 19 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.
MCPOAuthHandler.refreshOAuthTokens (cyclomatic 41) packages/api/src/mcp/oauth/handler.ts:1826— MCPOAuthHandler.refreshOAuthTokens 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.
cleanup.cleanupMCPServerOAuthWithFenceHeld (cyclomatic 41) packages/api/src/mcp/oauth/cleanup.ts:308— cleanup.cleanupMCPServerOAuthWithFenceHeld has cyclomatic complexity 41 (threshold 15). Of this number, 36 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.
bearer.createScheduledMCPBearerHost.bind.resolve (cyclomatic 41) packages/api/src/schedules/bearer.ts:173— bearer.createScheduledMCPBearerHost.bind.resolve has cyclomatic complexity 41 (threshold 15). Of this number, 32 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.
receipts.reconcileServerQueuedTurns (cyclomatic 41) packages/chat/src/core/steer/receipts.ts:128— receipts.reconcileServerQueuedTurns has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 1 of the 41 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 141, 201, 136). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useQueuedTurnReveal.useQueuedTurnReveal (cyclomatic 41) packages/chat/src/react/steering/useQueuedTurnReveal.ts:53— useQueuedTurnReveal.useQueuedTurnReveal has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 1 of the 41 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 64, 111, 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.
assistant.createAssistantMethods.updateAssistantAvatar (cyclomatic 41) packages/data-schemas/src/methods/assistant.ts:69— assistant.createAssistantMethods.updateAssistantAvatar 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.
agent.createAgentMethods.updateAgent (cyclomatic 41) packages/data-schemas/src/methods/agent.ts:1455— agent.createAgentMethods.updateAgent has cyclomatic complexity 41 (threshold 15). Of this number, 37 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.
performSync (cyclomatic 41) api/db/indexSync.js:193— performSync 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.
BackgroundTaskCall.BackgroundTaskCall (cyclomatic 40) client/src/components/Chat/Messages/Content/Parts/BackgroundTaskCall.tsx:21— BackgroundTaskCall.BackgroundTaskCall has cyclomatic complexity 40 (threshold 15). Of this number, 37 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.
Bar.Bar (cyclomatic 40) client/src/components/Chat/Input/Composer/Bar.tsx:217— Bar.Bar has cyclomatic complexity 40 (threshold 15). Of this number, 33 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.
runtime.createReasoningLabelWiring.startStep (cyclomatic 40) packages/api/src/agents/reasoningLabels/runtime.ts:538— runtime.createReasoningLabelWiring.startStep has cyclomatic complexity 40 (threshold 15). To reduce it, name the conditions: bind each compound test to a 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.createSetupService.advance (cyclomatic 40) packages/api/src/code/setup/service.ts:319— service.createSetupService.advance has cyclomatic complexity 40 (threshold 15). Of this number, 32 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.
UserConnectionManager.getUserConnectionForTarget (cyclomatic 40) packages/api/src/mcp/UserConnectionManager.ts:473— UserConnectionManager.getUserConnectionForTarget has cyclomatic complexity 40 (threshold 15). Of this number, 37 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.
service.recordScheduledMCPToolAuthFailure (cyclomatic 40) packages/api/src/schedules/service.ts:336— service.recordScheduledMCPToolAuthFailure has cyclomatic complexity 40 (threshold 15). Of this number, 19 points are the body's own statements and 21 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.
RedisJobStore.transitionStatusInternal (cyclomatic 40) packages/api/src/stream/implementations/RedisJobStore.ts:3004— RedisJobStore.transitionStatusInternal has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ControlCombobox.ControlCombobox (cyclomatic 40) packages/client/src/components/ControlCombobox.tsx:72— ControlCombobox.ControlCombobox has cyclomatic complexity 40 (threshold 15). Of this number, 23 points are the body's own statements and 17 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.
agent.isDuplicateVersion (cyclomatic 40) packages/data-schemas/src/methods/agent.ts:856— agent.isDuplicateVersion 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.
titleConvo (cyclomatic 40) api/server/controllers/agents/client.js:6121— titleConvo has cyclomatic complexity 40 (threshold 15). Of this number, 33 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.
processOpenIDAuth (cyclomatic 40) api/strategies/openidStrategy.js:651— processOpenIDAuth 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.
openIdJwtStrategy.openIdJwtLogin (cyclomatic 39) api/strategies/openIdJwtStrategy.js:128— openIdJwtStrategy.openIdJwtLogin 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 214, 156). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PromptsCommand.PromptsCommand (cyclomatic 39) client/src/components/Chat/Input/PromptsCommand.tsx:64— PromptsCommand.PromptsCommand 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 6 function literals inside it that branch (lines 116, 288, 199, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
preview.buildMessagePreview (cyclomatic 39) client/src/components/Chat/Trace/preview.ts:122— preview.buildMessagePreview has cyclomatic complexity 39 (threshold 15). 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, separate the cases: extract each independent 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.reduceSubagentProgress (cyclomatic 39) client/src/components/Chat/Subagents/state.ts:904— state.reduceSubagentProgress has cyclomatic complexity 39 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
subagentContent.reconcileSubagentMessagePhases (cyclomatic 39) client/src/utils/subagentContent.ts:514— subagentContent.reconcileSubagentMessagePhases has cyclomatic complexity 39 (threshold 15). Of this number, 34 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.
run.shapeSummarizationConfig (cyclomatic 39) packages/api/src/agents/run.ts:1349— run.shapeSummarizationConfig 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.
http.createCodeEnvironmentHttpHandlers.pair (cyclomatic 39) packages/api/src/code/http.ts:675— http.createCodeEnvironmentHttpHandlers.pair 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.
imports.inspectConversationImportContent (cyclomatic 39) packages/api/src/imports.ts:83— imports.inspectConversationImportContent has cyclomatic complexity 39 (threshold 15). Of this number, 35 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.
connection.guardMCPStreamableHTTPResponse (cyclomatic 39) packages/api/src/mcp/connection.ts:366— connection.guardMCPStreamableHTTPResponse has cyclomatic complexity 39 (threshold 15). Of this number, 26 points are the body's own statements and 13 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.
service.createScheduleMCPConsentService (cyclomatic 39) packages/api/src/schedules/authorization/service.ts:113— service.createScheduleMCPConsentService 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.
handlers.createSchedulesHandlers.createSchedule (cyclomatic 39) packages/api/src/schedules/handlers.ts:628— handlers.createSchedulesHandlers.createSchedule has cyclomatic complexity 39 (threshold 15). Of this number, 31 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.
RedisJobStore.overlayHostSteerParts (cyclomatic 39) packages/api/src/stream/implementations/RedisJobStore.ts:4111— RedisJobStore.overlayHostSteerParts 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.
skill.createSkillMethods.updateSkill (cyclomatic 39) packages/data-schemas/src/methods/skill.ts:1499— skill.createSkillMethods.updateSkill 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.
static-checks.unusedCapacity (cyclomatic 39) scripts/static-checks.mts:1231— static-checks.unusedCapacity has cyclomatic complexity 39 (threshold 15). Of this number, 32 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.
useCopyToClipboard.createCitationProcessor.process (cyclomatic 38) client/src/hooks/Messages/useCopyToClipboard.ts:310— useCopyToClipboard.createCitationProcessor.process 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.
FileAuthoringCall.FileAuthoringCall (cyclomatic 38) client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx:103— FileAuthoringCall.FileAuthoringCall has cyclomatic complexity 38 (threshold 15). Of this number, 30 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.
ScheduleDialog.ScheduleDialog (cyclomatic 38) client/src/components/SidePanel/Schedules/ScheduleDialog.tsx:183— ScheduleDialog.ScheduleDialog 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. This shape REPEATS in the file: one other method here (ScheduleDialog.ScheduleDialog::onSubmit) 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.
modelBoundContent.getProviderMessageProvenanceState (cyclomatic 38) packages/api/src/middleware/modelBoundContent.ts:1090— modelBoundContent.getProviderMessageProvenanceState 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.
lifecycle.reconcileCodeEnvironmentLifecycle (cyclomatic 38) packages/api/src/code/lifecycle.ts:24— lifecycle.reconcileCodeEnvironmentLifecycle has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 1 of the 38 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 35, 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.
config.getOpenAIConfig (cyclomatic 38) packages/api/src/endpoints/openai/config.ts:93— config.getOpenAIConfig has cyclomatic complexity 38 (threshold 15). Of this number, 36 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.
agent.decodeAgentSortCursor (cyclomatic 38) packages/data-schemas/src/methods/agent.ts:296— agent.decodeAgentSortCursor 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.
revertAgentVersionHandler (cyclomatic 38) REDACTED:2043— revertAgentVersionHandler has cyclomatic complexity 38 (threshold 15). Of this number, 35 points are the body's own statements and 3 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.
createMCPTool (cyclomatic 38) api/server/services/MCP.js:1057— createMCPTool 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.
HoverButtons.HoverButtons (cyclomatic 37) client/src/components/Chat/Messages/HoverButtons.tsx:96— HoverButtons.HoverButtons has cyclomatic complexity 37 (threshold 15). Of this number, 31 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.
model.buildTraceModel (cyclomatic 37) client/src/components/Chat/Trace/model.ts:671— model.buildTraceModel 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.
Landing.Landing (cyclomatic 37) client/src/components/Chat/Landing.tsx:39— Landing.Landing has cyclomatic complexity 37 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ToolCard.ToolCardImpl (cyclomatic 37) client/src/components/SidePanel/Agents/Tools/ToolCard.tsx:85— ToolCard.ToolCardImpl 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.
Sources.FileItem (cyclomatic 37) client/src/components/Web/Sources.tsx:206— Sources.FileItem has cyclomatic complexity 37 (threshold 15). Of this number, 18 points are the body's own statements and 19 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.
useAskAnswerMode.useAskAnswerMode (cyclomatic 37) client/src/hooks/Input/useAskAnswerMode.ts:43— useAskAnswerMode.useAskAnswerMode has cyclomatic complexity 37 (threshold 15). Of this number, 23 points are the body's own statements and 14 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.
convos.updateConvoInAllQueries (cyclomatic 37) client/src/utils/convos.ts:1610— convos.updateConvoInAllQueries has cyclomatic complexity 37 (threshold 15). Of this number, 16 points are the body's own statements and 21 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.
langfuse.createAdminLangfuseHandlers.updateConnection (cyclomatic 37) packages/api/src/admin/langfuse.ts:510— langfuse.createAdminLangfuseHandlers.updateConnection has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
runtime.createActivityPhaseWiring.handlers (cyclomatic 37) packages/api/src/agents/activityPhases/runtime.ts:1538— runtime.createActivityPhaseWiring.handlers has cyclomatic complexity 37 (threshold 15). Of this number, 17 points are the body's own statements and 20 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.
InMemoryJobStore.cleanup (cyclomatic 37) packages/api/src/stream/implementations/InMemoryJobStore.ts:1202— InMemoryJobStore.cleanup 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.
skillFiles.executePrimeSkillFiles (cyclomatic 37) packages/api/src/agents/skillFiles.ts:409— skillFiles.executePrimeSkillFiles has cyclomatic complexity 37 (threshold 15). Of this number, 33 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.
handlers.handleWorkspaceListCall (cyclomatic 37) packages/api/src/agents/handlers.ts:2549— handlers.handleWorkspaceListCall 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.
load.loadEphemeralAgent (cyclomatic 37) packages/api/src/agents/load.ts:74— load.loadEphemeralAgent 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.
ceiling.settleAfterRetryCeiling (cyclomatic 37) packages/chat/src/core/resumable/ceiling.ts:19— ceiling.settleAfterRetryCeiling has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
toolApprovalGrant.createToolApprovalGrantMethods (cyclomatic 37) packages/data-schemas/src/methods/toolApprovalGrant.ts:39— toolApprovalGrant.createToolApprovalGrantMethods has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 2 of the 37 points are its own statements and the rest belongs to 4 function items inside it that branch (readGrants, a function literal at line 190, a function literal at line 141, …). 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.
triggerDelivery.toRecord (cyclomatic 37) packages/data-schemas/src/methods/triggerDelivery.ts:593— triggerDelivery.toRecord 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.
duplicateAgentHandler (cyclomatic 37) REDACTED:1431— duplicateAgentHandler has cyclomatic complexity 37 (threshold 15). Of this number, 33 points are the body's own statements and 4 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.
logoutController (cyclomatic 37) api/server/controllers/auth/LogoutController.js:31— logoutController 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.
ToolCallGroup.ToolCallGroup::resolveGroupLabel (cyclomatic 36) client/src/components/Chat/Messages/Content/ToolCallGroup.tsx:469— ToolCallGroup.ToolCallGroup::resolveGroupLabel 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. This shape REPEATS in the file: one other method here (ToolCallGroup.ToolCallGroup) 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.
face.drawEye (cyclomatic 36) client/src/components/Lia/engine/face.ts:144— face.drawEye 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, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
files.getCanonicalFileReferenceIds (cyclomatic 36) packages/api/src/protection/files.ts:800— files.getCanonicalFileReferenceIds has cyclomatic complexity 36 (threshold 15). Of this number, 35 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.
files.omitResolvedFileLocators (cyclomatic 36) packages/api/src/protection/files.ts:1004— files.omitResolvedFileLocators has cyclomatic complexity 36 (threshold 15). Of this number, 31 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.
runtime.restoreLegacyOverflowAnchors (cyclomatic 36) packages/api/src/agents/activityPhases/runtime.ts:691— runtime.restoreLegacyOverflowAnchors has cyclomatic complexity 36 (threshold 15). Of this number, 22 points are the body's own statements and 14 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.
modes.createAgentToolApprovalSession.hook (cyclomatic 36) packages/api/src/agents/hitl/modes.ts:662— modes.createAgentToolApprovalSession.hook 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.
bindings.createAgentEventBindingHandlers.register (cyclomatic 36) packages/api/src/agents/triggers/bindings.ts:207— bindings.createAgentEventBindingHandlers.register has cyclomatic complexity 36 (threshold 15). Of this number, 25 points are the body's own statements and 11 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.
gitlab.createGitLabPullRequestSource.find (cyclomatic 36) packages/api/src/pulls/gitlab.ts:208— gitlab.createGitLabPullRequestSource.find has cyclomatic complexity 36 (threshold 15). Of this number, 20 points are the body's own statements and 16 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.
MCPManager.runAppOperation (cyclomatic 36) packages/api/src/mcp/MCPManager.ts:2325— MCPManager.runAppOperation has cyclomatic complexity 36 (threshold 15). Of this number, 23 points are the body's own statements and 13 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.
RedisJobStore.getJobIdsByUser (cyclomatic 36) packages/api/src/stream/implementations/RedisJobStore.ts:3966— RedisJobStore.getJobIdsByUser 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.
receipts.useQueuedTurnReceipts (cyclomatic 36) packages/chat/src/react/steering/receipts.ts:30— receipts.useQueuedTurnReceipts has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 1 of the 36 points is its own statement and the rest belongs to 10 function literals inside it that branch (lines 103, 85, 69, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useTextarea.useTextarea.handlePaste (cyclomatic 35) client/src/hooks/Input/useTextarea.ts:409— useTextarea.useTextarea.handlePaste has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 14 of the 35 points are its own statements and the rest belongs to 7 function items inside it that branch (restorePasteAfterUploadFailure, a function literal at line 572, a function literal at line 617, …). 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.contentPartsToActivity (cyclomatic 35) client/src/components/Chat/Subagents/adapters.ts:103— adapters.contentPartsToActivity 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 107). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
SharedLinkButton.SharedLinkButton (cyclomatic 35) client/src/components/Conversations/ConvoOptions/SharedLinkButton.tsx:75— SharedLinkButton.SharedLinkButton has cyclomatic complexity 35 (threshold 15). Of this number, 21 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.
AssistantPanel.AssistantPanel (cyclomatic 35) client/src/components/SidePanel/Builder/AssistantPanel.tsx:48— AssistantPanel.AssistantPanel has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 15 of the 35 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 93, onSubmit, a function literal at line 185, …). 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.
validationFeedback.toolValidationFeedback (cyclomatic 35) packages/api/src/agents/validationFeedback.ts:7— validationFeedback.toolValidationFeedback 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.
protection.loadThreadUserMessages (cyclomatic 35) packages/api/src/assistants/protection.ts:184— protection.loadThreadUserMessages 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.
lookup.createPullRequestLookup (cyclomatic 35) packages/api/src/pulls/lookup.ts:132— lookup.createPullRequestLookup 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 8 function items inside it that branch (a function literal at line 282, a function literal at line 221, partitionOf, …). 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.createScheduleMCPExecution.resolve (cyclomatic 35) packages/api/src/schedules/authorization/execution.ts:83— execution.createScheduleMCPExecution.resolve has cyclomatic complexity 35 (threshold 15). Of this number, 29 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.
useSteerConvert.useSteerConvert (cyclomatic 35) packages/chat/src/react/steering/useSteerConvert.ts:71— useSteerConvert.useSteerConvert 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 11 function literals inside it that branch (lines 164, 126, 133, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
parsers.redactFormat (cyclomatic 35) packages/data-schemas/src/config/parsers.ts:603— parsers.redactFormat 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.
mcpAuthority.prepareTargets (cyclomatic 35) packages/data-schemas/src/methods/mcpAuthority.ts:474— mcpAuthority.prepareTargets has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 4 of the 35 points are its own statements and the rest belongs to one function literal inside it that branches (line 486). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
createResponsesToolEndCallback (cyclomatic 35) api/server/controllers/agents/callbacks.js:1289— createResponsesToolEndCallback 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 13 function items inside it that branch (a function literal at line 1293, a function literal at line 1305, a function literal at line 1404, …). 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.
BadgeRowContext.BadgeRowProvider (cyclomatic 34) client/src/Providers/BadgeRowContext.tsx:43— BadgeRowContext.BadgeRowProvider 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 3 function literals inside it that branch (lines 85, 182, 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.
MultiMessage.MultiMessage (cyclomatic 34) client/src/components/Chat/Messages/MultiMessage.tsx:19— MultiMessage.MultiMessage has cyclomatic complexity 34 (threshold 15). Of this number, 18 points are the body's own statements and 16 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.
state.storedControlState (cyclomatic 34) client/src/components/Chat/Subagents/state.ts:373— state.storedControlState 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.
SkillsSection.SkillsSection (cyclomatic 34) client/src/components/SidePanel/Agents/Tools/SkillsSection.tsx:116— SkillsSection.SkillsSection has cyclomatic complexity 34 (threshold 15). Of this number, 18 points are the body's own statements and 16 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.
retention.retainMessages (cyclomatic 34) client/src/data-provider/Messages/retention.ts:130— retention.retainMessages 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 7 function items inside it that branch (a function literal at line 236, a function literal at line 202, a function literal at line 145, …). 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.
useSideNavLinks.useSideNavLinks (cyclomatic 34) client/src/hooks/Nav/useSideNavLinks.ts:39— useSideNavLinks.useSideNavLinks 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 101). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into 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.visitNestedStrings (cyclomatic 34) packages/api/src/protection/adapters/nested.ts:426— nested.visitNestedStrings 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.
runtime.createActivityPhaseWiring.hook (cyclomatic 34) packages/api/src/agents/activityPhases/runtime.ts:1424— runtime.createActivityPhaseWiring.hook 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.
InMemoryJobStore.claimParkedSteersDetailed (cyclomatic 34) packages/api/src/stream/implementations/InMemoryJobStore.ts:2437— InMemoryJobStore.claimParkedSteersDetailed 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.
modelBoundContent.createInitialModelBoundAdmissionCallback (cyclomatic 34) packages/api/src/middleware/modelBoundContent.ts:3356— modelBoundContent.createInitialModelBoundAdmissionCallback 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 8 function items inside it that branch (a function literal at line 3450, a function literal at line 3419, a function literal at line 3406, …). 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.createReasoningLabelWiring.schedule (cyclomatic 34) packages/api/src/agents/reasoningLabels/runtime.ts:382— runtime.createReasoningLabelWiring.schedule 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 literals inside it that branch (lines 435, 484, 510). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
queuedTurnHttp.handleAgentQueuedTurnEnqueue (cyclomatic 34) packages/api/src/agents/queuedTurnHttp.ts:272— queuedTurnHttp.handleAgentQueuedTurnEnqueue has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
session.createOpenIDSessionRefreshService.performIdpRefresh (cyclomatic 34) packages/api/src/auth/openid/session.ts:1523— session.createOpenIDSessionRefreshService.performIdpRefresh has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 7 of the 34 points are its own statements and the rest belongs to one function literal inside it that branches (line 1593). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
queued.planCodeFileUploads (cyclomatic 34) packages/api/src/files/code/queued.ts:47— queued.planCodeFileUploads has cyclomatic complexity 34 (threshold 15). Of this number, 21 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.
runtime.createScheduleMCPRuntimeHost.prepare (cyclomatic 34) packages/api/src/schedules/authorization/runtime.ts:129— runtime.createScheduleMCPRuntimeHost.prepare 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 130). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
handlers.createTraceHandlers (cyclomatic 34) packages/api/src/traces/handlers.ts:128— handlers.createTraceHandlers 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 7 function items inside it that branch (record, records, prepareScope, …). 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.
RedisJobStore.applyMembershipSnapshot (cyclomatic 34) packages/api/src/stream/implementations/RedisJobStore.ts:2756— RedisJobStore.applyMembershipSnapshot 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.
view.deriveTokenUsageView (cyclomatic 34) packages/chat/src/core/usage/view.ts:117— view.deriveTokenUsageView 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.
DataTable.DataTable (cyclomatic 34) packages/client/src/components/DataTable.tsx:224— DataTable.DataTable has cyclomatic complexity 34 (threshold 15). Of this number, 19 points are the body's own statements and 15 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.
file-config.buildMergedFileConfig (cyclomatic 34) packages/data-provider/src/file-config.ts:1251— file-config.buildMergedFileConfig 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.
parts.toUIMessage (cyclomatic 34) packages/data-provider/src/parts.ts:911— parts.toUIMessage 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.
processRequiredActions (cyclomatic 34) api/server/services/ToolService.js:433— processRequiredActions has cyclomatic complexity 34 (threshold 15). Of this number, 23 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.
createToolEndCallback (cyclomatic 34) api/server/controllers/agents/callbacks.js:916— createToolEndCallback 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 13 function items inside it that branch (a function literal at line 920, a function literal at line 932, a function literal at line 1038, …). 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.
FavoritesController.updateFavoritesController (cyclomatic 33) api/server/controllers/FavoritesController.js:6— FavoritesController.updateFavoritesController 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.
useChatHelpers.useChatHelpers (cyclomatic 33) client/src/hooks/Chat/useChatHelpers.ts:39— useChatHelpers.useChatHelpers has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 2 of the 33 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 209, 71, 56, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useSSE.useSSE (cyclomatic 33) client/src/hooks/SSE/useSSE.ts:43— useSSE.useSSE has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 2 of the 33 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 231, 171, 150, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PendingSteers.PendingSteers (cyclomatic 33) client/src/components/Chat/Messages/Content/Parts/PendingSteers.tsx:39— PendingSteers.PendingSteers has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 2 of the 33 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 144, resolvePaused, queueSteer, …). 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.
outcome.getToolMeta (cyclomatic 33) client/src/components/Chat/Messages/Content/outcome.ts:101— outcome.getToolMeta 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.
ProgressText.ProgressText (cyclomatic 33) client/src/components/Chat/Messages/Content/ProgressText.tsx:62— ProgressText.ProgressText has cyclomatic complexity 33 (threshold 15). Of this number, 29 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.
Mention.MentionContent (cyclomatic 33) client/src/components/Chat/Input/Mention.tsx:28— Mention.MentionContent has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 8 of the 33 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 192, handleSelect, handleSelect::defaultSelect, …). 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.
Timeline.Timeline (cyclomatic 33) client/src/components/Chat/Trace/Timeline.tsx:38— Timeline.Timeline has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 4 of the 33 points are its own statements and the rest belongs to 11 function items inside it that branch (handleKeyDown, handlePointerMove, a function literal at line 81, …). 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.
ChatGroupItem.ChatGroupItem (cyclomatic 33) client/src/components/Prompts/lists/ChatGroupItem.tsx:35— ChatGroupItem.ChatGroupItem has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 14 of the 33 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 105, a function literal at line 80, a function literal at line 180, …). 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.
ShareView.SharedView (cyclomatic 33) client/src/components/Share/ShareView.tsx:49— ShareView.SharedView has cyclomatic complexity 33 (threshold 15). Of this number, 21 points are the body's own statements and 12 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.
ConversationsSection.ConversationsSection (cyclomatic 33) client/src/components/UnifiedSidebar/ConversationsSection.tsx:40— ConversationsSection.ConversationsSection has cyclomatic complexity 33 (threshold 15). Of this number, 24 points are the body's own statements and 9 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.
subagentContent.reconcileSubagentToolTimings (cyclomatic 33) client/src/utils/subagentContent.ts:611— subagentContent.reconcileSubagentToolTimings has cyclomatic complexity 33 (threshold 15). Of this number, 24 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.
roles.createAdminRolesHandlers.deleteRole (cyclomatic 33) packages/api/src/admin/roles.ts:829— roles.createAdminRolesHandlers.deleteRole has cyclomatic complexity 33 (threshold 15). Of this number, 21 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.
compatibility.planMatcher (cyclomatic 33) REDACTED:393— compatibility.planMatcher 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.
loader.createCustomConfigLoader (cyclomatic 33) packages/api/src/app/loader.ts:122— loader.createCustomConfigLoader 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 133, 142, 237). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
initialize.initializeCustom (cyclomatic 33) packages/api/src/endpoints/custom/initialize.ts:187— initialize.initializeCustom 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.
enrollment.createScheduleMCPEnrollmentResolver (cyclomatic 33) packages/api/src/schedules/authorization/enrollment.ts:40— enrollment.createScheduleMCPEnrollmentResolver 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 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.
reader.createLangfuseTraceReader.listRecords (cyclomatic 33) packages/api/src/langfuse/reader.ts:637— reader.createLangfuseTraceReader.listRecords 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: 2 other methods here (reader.createLangfuseTraceReader.listRecords::probe, reader.createLangfuseTraceReader.listRecords::nameToolRounds) 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.
updateUserPluginsController (cyclomatic 33) api/server/controllers/UserController.js:188— updateUserPluginsController has cyclomatic complexity 33 (threshold 15). Of this number, 32 points are the body's own statements and 1 belongs 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.
useReplyWatcher.useReplyWatcher (cyclomatic 32) client/src/hooks/Conversations/useReplyWatcher.ts:407— useReplyWatcher.useReplyWatcher 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 7 function literals inside it that branch (lines 514, 443, 506, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MessageRow.MessageRow (cyclomatic 32) client/src/components/Chat/Messages/ui/MessageRow.tsx:89— MessageRow.MessageRow 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.
StreamAudio.StreamAudio (cyclomatic 32) client/src/components/Chat/Input/StreamAudio.tsx:33— StreamAudio.StreamAudio has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 2 of the 32 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 64, 196, 59). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Header.Header (cyclomatic 32) client/src/components/Chat/Header.tsx:33— Header.Header 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.
state.foldAcceptedSubagentEvents (cyclomatic 32) client/src/components/Chat/Subagents/state.ts:746— state.foldAcceptedSubagentEvents has cyclomatic complexity 32 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ServerInitializationSection.ServerInitializationSection (cyclomatic 32) client/src/components/MCP/ServerInitializationSection.tsx:17— ServerInitializationSection.ServerInitializationSection 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.
ToolsMarketplaceDialog.ToolsMarketplaceDialog (cyclomatic 32) client/src/components/SidePanel/Agents/Tools/ToolsMarketplaceDialog.tsx:46— ToolsMarketplaceDialog.ToolsMarketplaceDialog 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 4 function literals inside it that branch (lines 120, 199, 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.
AgentFooter.AgentFooter (cyclomatic 32) client/src/components/SidePanel/Agents/AgentFooter.tsx:22— AgentFooter.AgentFooter 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.
AssistantSelect.AssistantSelect (cyclomatic 32) client/src/components/SidePanel/Builder/AssistantSelect.tsx:37— AssistantSelect.AssistantSelect has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 2 of the 32 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 67, 193, 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.
index.MCPServerDialog (cyclomatic 32) client/src/components/SidePanel/MCPBuilder/MCPServerDialog/index.tsx:39— index.MCPServerDialog has cyclomatic complexity 32 (threshold 15). Of this number, 27 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.
LocalizedDateRangePicker.LocalizedDateRangePicker (cyclomatic 32) client/src/components/ui/LocalizedDateRangePicker.tsx:68— LocalizedDateRangePicker.LocalizedDateRangePicker has cyclomatic complexity 32 (threshold 15). Of this number, 24 points are the body's own statements and 8 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.
useComposerHint.composeHint (cyclomatic 32) client/src/hooks/Input/useComposerHint.ts:68— useComposerHint.composeHint 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.
useChatOptions.useChatOptions (cyclomatic 32) client/src/hooks/Sharing/useChatOptions.tsx:46— useChatOptions.useChatOptions has cyclomatic complexity 32 (threshold 15). Of this number, 16 points are the body's own statements and 16 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.
config.createAdminConfigHandlers.tombstoneConfigField (cyclomatic 32) packages/api/src/admin/config.ts:4084— config.createAdminConfigHandlers.tombstoneConfigField 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.
subagentActivity.createSubagentActivityStreamHandler (cyclomatic 32) packages/api/src/agents/subagentActivity.ts:600— subagentActivity.createSubagentActivityStreamHandler 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 2 function literals inside it that branch (lines 604, 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.
handlers.handleAttachedWorkspaceEditFileCall (cyclomatic 32) packages/api/src/agents/handlers.ts:4065— handlers.handleAttachedWorkspaceEditFileCall 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.
protection.assertResumeRuntimeContentAllowed (cyclomatic 32) packages/api/src/agents/hitl/protection.ts:984— protection.assertResumeRuntimeContentAllowed has cyclomatic complexity 32 (threshold 15). Of this number, 26 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.
detachedAction.parseAgentEventDetachedTerminalEvidence (cyclomatic 32) packages/api/src/agents/triggers/detachedAction.ts:33— detachedAction.parseAgentEventDetachedTerminalEvidence 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.
SubagentThreadTaskStore.controlInvocationAndPersist (cyclomatic 32) packages/api/src/agents/subagentThreads.ts:2467— SubagentThreadTaskStore.controlInvocationAndPersist 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.
subagentCompletionWakeup.createSubagentCompletionWakeupResolver (cyclomatic 32) packages/api/src/agents/subagentCompletionWakeup.ts:590— subagentCompletionWakeup.createSubagentCompletionWakeupResolver 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 2 function literals inside it that branch (lines 601, 678). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
bindingResolver.createAgentEventContinueResolver (cyclomatic 32) packages/api/src/agents/triggers/bindingResolver.ts:41— bindingResolver.createAgentEventContinueResolver 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 45). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into 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.createAppConfigService.getAppConfig (cyclomatic 32) packages/api/src/app/service.ts:969— service.createAppConfigService.getAppConfig has cyclomatic complexity 32 (threshold 15). Of this number, 27 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.
deletion.runSkillDeletion (cyclomatic 32) packages/api/src/skills/deletion.ts:55— deletion.runSkillDeletion has cyclomatic complexity 32 (threshold 15). Of this number, 21 points are the body's own statements and 11 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.
frames.handleFrame (cyclomatic 32) packages/chat/src/core/resumable/frames.ts:189— frames.handleFrame 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.
conversation.createConversationMethods.recordAgentEventActorReconciliation (cyclomatic 32) packages/data-schemas/src/methods/conversation.ts:1566— conversation.createConversationMethods.recordAgentEventActorReconciliation 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.
skill.createSkillMethods.upsertSkillFile (cyclomatic 32) packages/data-schemas/src/methods/skill.ts:1920— skill.createSkillMethods.upsertSkillFile 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.
queuedTurn.toRecord (cyclomatic 32) packages/data-schemas/src/methods/queuedTurn.ts:607— queuedTurn.toRecord 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.
startServer (cyclomatic 32) REDACTED:185— startServer has cyclomatic complexity 32 (threshold 15). Of this number, 19 points are the body's own statements and 13 belong to 17 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.
AgentClient.rebaseActivityPhaseBounds (cyclomatic 31) api/server/controllers/agents/client.js:4089— AgentClient.rebaseActivityPhaseBounds 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.
PermissionService.ensureGroupPrincipalExists (cyclomatic 31) api/server/services/PermissionService.js:380— PermissionService.ensureGroupPrincipalExists 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.
Presentation.Presentation (cyclomatic 31) client/src/components/Chat/Presentation.tsx:28— Presentation.Presentation has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 6 of the 31 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 76, 160, 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.
ProjectEditor.ProjectEditor (cyclomatic 31) client/src/components/Projects/ProjectEditor.tsx:35— ProjectEditor.ProjectEditor has cyclomatic complexity 31 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ShareArtifacts.ShareArtifactsContainer (cyclomatic 31) client/src/components/Share/ShareArtifacts.tsx:58— ShareArtifacts.ShareArtifactsContainer has cyclomatic complexity 31 (threshold 15). Of this number, 24 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.
ModelPanel.ModelPanel (cyclomatic 31) client/src/components/SidePanel/Agents/ModelPanel.tsx:35— ModelPanel.ModelPanel 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 10 function literals inside it that branch (lines 248, 179, 123, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useArtifacts.useArtifacts (cyclomatic 31) client/src/hooks/Artifacts/useArtifacts.ts:156— useArtifacts.useArtifacts 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 8 function literals inside it that branch (lines 276, 259, 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.
reasoningLabels.applyReasoningLabel (cyclomatic 31) client/src/utils/reasoningLabels.ts:24— reasoningLabels.applyReasoningLabel 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.
migrate-shared-link-permissions.migrateSharedLinkPermissions (cyclomatic 31) config/migrate-shared-link-permissions.js:21— migrate-shared-link-permissions.migrateSharedLinkPermissions 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 2 function literals inside it that branch (lines 153, 28). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.resolveChatProjectContext (cyclomatic 31) packages/api/src/projects/context.ts:178— context.resolveChatProjectContext 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.
handlers.handleWorkspaceSearchCall (cyclomatic 31) packages/api/src/agents/handlers.ts:2454— handlers.handleWorkspaceSearchCall 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.
handlers.writeSkillMd (cyclomatic 31) packages/api/src/agents/handlers.ts:3562— handlers.writeSkillMd 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.
service.createResponsesEventHandlers (cyclomatic 31) packages/api/src/agents/responses/service.ts:614— service.createResponsesEventHandlers 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 909, 820, 861, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
capabilities.resolveCodeExecutionWorkspaceContext (cyclomatic 31) packages/api/src/code/capabilities.ts:103— capabilities.resolveCodeExecutionWorkspaceContext 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.
image.encodeAndFormatImages (cyclomatic 31) packages/api/src/files/encode/image.ts:89— image.encodeAndFormatImages 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.
handler.createConversationPullRequestsHandler (cyclomatic 31) packages/api/src/pulls/handler.ts:455— handler.createConversationPullRequestsHandler 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 5 function literals inside it that branch (lines 468, 489, 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.
MCPTokenStorage.forceRefreshTokens (cyclomatic 31) packages/api/src/mcp/oauth/tokens.ts:1044— MCPTokenStorage.forceRefreshTokens has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 9 of the 31 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1116, 1217, 1227, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MCPConnection.createFetchFunction::customFetch (cyclomatic 31) packages/api/src/mcp/connection.ts:1455— MCPConnection.createFetchFunction::customFetch 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.
service.createSchedulesService.reconcileRetainedJobs (cyclomatic 31) packages/api/src/schedules/service.ts:1284— service.createSchedulesService.reconcileRetainedJobs 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.
SelectDropDown.SelectDropDown (cyclomatic 31) packages/client/src/components/SelectDropDown.tsx:76— SelectDropDown.SelectDropDown has cyclomatic complexity 31 (threshold 15). 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 literals inside it that branch (lines 129, 237, 133, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
parsers.debugTraverse (cyclomatic 31) packages/data-schemas/src/config/parsers.ts:777— parsers.debugTraverse 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
role.createRoleMethods.updateAccessPermissions (cyclomatic 31) packages/data-schemas/src/methods/role.ts:294— role.createRoleMethods.updateAccessPermissions 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.
queuedTurn.createAgentQueuedTurnMethods.deadLetterAgentQueuedTurn (cyclomatic 31) packages/data-schemas/src/methods/queuedTurn.ts:2336— queuedTurn.createAgentQueuedTurnMethods.deadLetterAgentQueuedTurn 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.
handleRunInterrupt (cyclomatic 31) api/server/controllers/agents/client.js:4339— handleRunInterrupt has cyclomatic complexity 31 (threshold 15). Of this number, 30 points are the body's own statements and 1 belongs 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.
chatV1 (cyclomatic 31) api/server/controllers/assistants/chatV1.js:77— chatV1 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.
_call (cyclomatic 31) api/app/clients/tools/structured/FluxAPI.js:195— _call 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.
generateFinetunedImage (cyclomatic 31) api/app/clients/tools/structured/FluxAPI.js:429— generateFinetunedImage 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.
useReplyAlerts.useReplyAlerts (cyclomatic 30) client/src/hooks/Conversations/useReplyAlerts.ts:213— useReplyAlerts.useReplyAlerts 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 7 function literals inside it that branch (lines 281, 321, 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.
useMessageScrolling.useMessageScrolling (cyclomatic 30) client/src/hooks/Messages/useMessageScrolling.ts:28— useMessageScrolling.useMessageScrolling 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 8 function literals inside it that branch (lines 372, 432, 290, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useSelectorEffects.useSelectorEffects (cyclomatic 30) client/src/hooks/Endpoint/useSelectorEffects.ts:12— useSelectorEffects.useSelectorEffects 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 6 function items inside it that branch (a function literal at line 87, a function literal at line 41, 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.
Button.BackgroundTasksButton (cyclomatic 30) client/src/components/Chat/BackgroundTasks/Button.tsx:22— Button.BackgroundTasksButton 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 (Button.BackgroundTasksButton::jumpToTool) 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.
Inspector.Inspector (cyclomatic 30) client/src/components/Chat/Trace/Inspector.tsx:269— Inspector.Inspector 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.
ActionsInput.ActionsInput (cyclomatic 30) client/src/components/SidePanel/Agents/ActionsInput.tsx:46— ActionsInput.ActionsInput has cyclomatic complexity 30 (threshold 15). 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 (a function literal at line 131, a function literal at line 89, getButtonContent, …). 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.
shortcuts.resolveComposerKeyDown (cyclomatic 30) client/src/utils/shortcuts.ts:266— shortcuts.resolveComposerKeyDown 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.
runtime.createActivityPhaseWiring.close (cyclomatic 30) packages/api/src/agents/activityPhases/runtime.ts:1284— runtime.createActivityPhaseWiring.close has cyclomatic complexity 30 (threshold 15). Of this number, 20 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.
GenerationJobManagerClass.recoverCommittedCreate (cyclomatic 30) packages/api/src/stream/GenerationJobManager.ts:2266— GenerationJobManagerClass.recoverCommittedCreate has cyclomatic complexity 30 (threshold 15). Of this number, 24 points are the body's own statements and 6 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.
matching.findLineWindowMatch (cyclomatic 30) REDACTED:171— matching.findLineWindowMatch has cyclomatic complexity 30 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
resume.attachAskUserQuestionAnswers (cyclomatic 30) packages/api/src/agents/hitl/resume.ts:684— resume.attachAskUserQuestionAnswers 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.
subagentCompletionWakeup.resolveOrchestrationSnapshot (cyclomatic 30) packages/api/src/agents/subagentCompletionWakeup.ts:245— subagentCompletionWakeup.resolveOrchestrationSnapshot has cyclomatic complexity 30 (threshold 15). Of this number, 27 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.
control.createSubagentControlHandler (cyclomatic 30) packages/api/src/agents/control.ts:154— control.createSubagentControlHandler 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 one function literal inside it that branches (line 155). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into 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.createEventChildGenerationLeaseAcquirer (cyclomatic 30) packages/api/src/agents/triggers/lease.ts:41— lease.createEventChildGenerationLeaseAcquirer 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 7 function literals inside it that branch (lines 45, 164, 201, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
queuedTurns.parseQueuedTurnAdmissionSource (cyclomatic 30) packages/api/src/agents/queuedTurns.ts:149— queuedTurns.parseQueuedTurnAdmissionSource 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.
queuedTurns.createAgentQueuedTurnScheduler.recoverPass (cyclomatic 30) packages/api/src/agents/queuedTurns.ts:821— queuedTurns.createAgentQueuedTurnScheduler.recoverPass 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 7 function literals inside it that branch (lines 825, 863, 859, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
command.createAttachedWorkspaceBashTool (cyclomatic 30) packages/api/src/code/command.ts:458— command.createAttachedWorkspaceBashTool has cyclomatic complexity 30 (threshold 15). 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 526). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
title.publishConversationTitle (cyclomatic 30) packages/api/src/conversations/title.ts:24— title.publishConversationTitle 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.
preflight.preflightCodeOutputBatch (cyclomatic 30) packages/api/src/files/code/preflight.ts:129— preflight.preflightCodeOutputBatch 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.
zod.normalizeJsonSchema (cyclomatic 30) packages/api/src/mcp/zod.ts:396— zod.normalizeJsonSchema 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.
RedisEventTransport.deliverMessage (cyclomatic 30) packages/api/src/stream/implementations/RedisEventTransport.ts:1117— RedisEventTransport.deliverMessage 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.
rows.useQueueRows (cyclomatic 30) packages/chat/src/react/steering/rows.ts:35— rows.useQueueRows has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 3 of the 30 points are its own statements and the rest belongs to 16 function literals inside it that branch (lines 60, 210, 233, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
prompt.createPromptMethods.getListPromptGroupsByAccess (cyclomatic 30) packages/data-schemas/src/methods/prompt.ts:383— prompt.createPromptMethods.getListPromptGroupsByAccess 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.
primeFiles (cyclomatic 30) api/server/services/Files/Code/process.js:695— primeFiles has cyclomatic complexity 30 (threshold 15). Of this number, 18 points are the body's own statements and 12 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.
updateResourcePermissions (cyclomatic 30) api/server/controllers/PermissionsController.js:70— updateResourcePermissions has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs 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.
buildEndpointOption (cyclomatic 30) REDACTED:61— buildEndpointOption has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs 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.
useNewChat.useNewChat (cyclomatic 29) client/src/hooks/Conversations/useNewChat.ts:117— useNewChat.useNewChat 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 5 function literals inside it that branch (lines 188, 176, 205, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.Search (cyclomatic 29) client/src/routes/Search.tsx:84— Search.Search 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 9 function literals inside it that branch (lines 222, 278, 193, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
LogContent.LogContent (cyclomatic 29) client/src/components/Chat/Messages/Content/Parts/LogContent.tsx:40— LogContent.LogContent has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 8 of the 29 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 67, renderAttachment, a function literal at line 44, …). 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.
background.parseTask (cyclomatic 29) client/src/components/Chat/Messages/Content/Parts/background.ts:217— background.parseTask 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.
LangfusePromptsDialog.LangfusePromptsDialog (cyclomatic 29) client/src/components/Nav/SettingsTabs/Integrations/LangfusePromptsDialog.tsx:94— LangfusePromptsDialog.LangfusePromptsDialog has cyclomatic complexity 29 (threshold 15). Of this number, 22 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.
CreateSkillDialog.CreateSkillDialog (cyclomatic 29) client/src/components/Skills/dialogs/CreateSkillDialog.tsx:52— CreateSkillDialog.CreateSkillDialog 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 4 function items inside it that branch (a function literal at line 94, a function literal at line 85, 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.
SkillForm.SkillForm (cyclomatic 29) client/src/components/Skills/forms/SkillForm.tsx:56— SkillForm.SkillForm has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 14 of the 29 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 192, onSubmit, 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.
useProjectMenuItem.useProjectMenuItem (cyclomatic 29) client/src/hooks/Chat/useProjectMenuItem.tsx:24— useProjectMenuItem.useProjectMenuItem has cyclomatic complexity 29 (threshold 15). Of this number, 23 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.
submissions.toBoundedJsonValue (cyclomatic 29) packages/api/src/protection/adapters/submissions.ts:2039— submissions.toBoundedJsonValue 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.
GenerationJobManagerClass.saveRunStepFromEvent (cyclomatic 29) packages/api/src/stream/GenerationJobManager.ts:7717— GenerationJobManagerClass.saveRunStepFromEvent has cyclomatic complexity 29 (threshold 15). Of this number, 27 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.
GenerationJobManagerClass.expireStaleApprovals (cyclomatic 29) packages/api/src/stream/GenerationJobManager.ts:9306— GenerationJobManagerClass.expireStaleApprovals 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.
GenerationJobManagerClass.cleanup (cyclomatic 29) packages/api/src/stream/GenerationJobManager.ts:9455— GenerationJobManagerClass.cleanup 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.
client.estimateDocumentBlockTokens (cyclomatic 29) packages/api/src/agents/client.ts:238— client.estimateDocumentBlockTokens 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.
run.resolveAzureSummarization (cyclomatic 29) packages/api/src/agents/run.ts:1040— run.resolveAzureSummarization 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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.createOpenIDRefreshRecoveryService.recoverOpenIDRefreshBridge (cyclomatic 29) packages/api/src/auth/openid/recovery.ts:451— recovery.createOpenIDRefreshRecoveryService.recoverOpenIDRefreshBridge has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 5 of the 29 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 505, 604). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.processMCPEnv (cyclomatic 29) packages/api/src/utils/env.ts:385— env.processMCPEnv 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.
MCPServerCatalogRecoveryTracker.run (cyclomatic 29) packages/api/src/mcp/catalog/recovery.ts:530— MCPServerCatalogRecoveryTracker.run 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 3 function items inside it that branch (a function literal at line 613, trackPublication, a function literal at line 652). 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.
recovery.recoverMCPServerCatalogsWithState (cyclomatic 29) packages/api/src/mcp/catalog/recovery.ts:857— recovery.recoverMCPServerCatalogsWithState 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 3 function literals inside it that branch (lines 943, 875, 892). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MCPConnectionFactory.handleOAuthRequired (cyclomatic 29) packages/api/src/mcp/MCPConnectionFactory.ts:2348— MCPConnectionFactory.handleOAuthRequired 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.
github.syncSource (cyclomatic 29) packages/api/src/skills/sync/github.ts:1625— github.syncSource 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: one other method here (github.syncSource::syncPreparedSkill) 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.
RedisEventTransport.subscribeReplayable (cyclomatic 29) packages/api/src/stream/implementations/RedisEventTransport.ts:1283— RedisEventTransport.subscribeReplayable 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 4 function items inside it that branch (a function literal at line 1329, deliver, unsubscribe, …). 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.
schedule.createScheduleMethods.recordRunOutcome (cyclomatic 29) packages/data-schemas/src/methods/schedule.ts:1490— schedule.createScheduleMethods.recordRunOutcome has cyclomatic complexity 29 (threshold 15). Of this number, 23 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.
browserSetup.createBrowserSetupStore.start (cyclomatic 29) packages/data-schemas/src/methods/browserSetup.ts:117— browserSetup.createBrowserSetupStore.start 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.
useDebouncedMermaid.useDebouncedMermaid (cyclomatic 28) client/src/hooks/Mermaid/useDebouncedMermaid.ts:88— useDebouncedMermaid.useDebouncedMermaid 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 4 function literals inside it that branch (lines 131, 185, 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.
useAttachmentHandler.useAttachmentHandler (cyclomatic 28) client/src/hooks/SSE/useAttachmentHandler.ts:33— useAttachmentHandler.useAttachmentHandler 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 literals inside it that branch (lines 36, 91, 123, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
OutputRenderer.OutputRenderer (cyclomatic 28) client/src/components/Chat/Messages/Content/ToolOutput/OutputRenderer.tsx:129— OutputRenderer.OutputRenderer 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AskUserQuestionCall.AskUserQuestionCall (cyclomatic 28) client/src/components/Chat/Messages/Content/AskUserQuestionCall.tsx:30— AskUserQuestionCall.AskUserQuestionCall 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CreatePromptForm.CreatePromptForm (cyclomatic 28) client/src/components/Prompts/forms/CreatePromptForm.tsx:37— CreatePromptForm.CreatePromptForm has cyclomatic complexity 28 (threshold 15). Of this number, 16 points are the body's own statements and 12 belong to 6 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.
PromptName.PromptName (cyclomatic 28) client/src/components/Prompts/fields/PromptName.tsx:17— PromptName.PromptName has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 10 of the 28 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 82, 58, 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.
AuthSection.AuthSection (cyclomatic 28) client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/AuthSection.tsx:27— AuthSection.AuthSection has cyclomatic complexity 28 (threshold 15). Of this number, 23 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.
UnifiedSidebar.UnifiedSidebar (cyclomatic 28) client/src/components/UnifiedSidebar/UnifiedSidebar.tsx:54— UnifiedSidebar.UnifiedSidebar has cyclomatic complexity 28 (threshold 15). Of this number, 18 points are the body's own statements and 10 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.
Sources.SourcesComponent (cyclomatic 28) client/src/components/Web/Sources.tsx:569— Sources.SourcesComponent 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 6 function literals inside it that branch (lines 601, 664, 574, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
files.getBlockedOpaqueFileField (cyclomatic 28) packages/api/src/protection/files.ts:675— files.getBlockedOpaqueFileField 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.
host.resolveActivityLabelModel (cyclomatic 28) packages/api/src/agents/activityLabels/host.ts:282— host.resolveActivityLabelModel 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.
tools.interruptToolHandler.handle (cyclomatic 28) packages/api/src/agents/steering/tools.ts:46— tools.interruptToolHandler.handle 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 10 function literals inside it that branch (lines 70, 86, 59, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
handlers.handleSandboxFileFallback (cyclomatic 28) packages/api/src/agents/handlers.ts:2224— handlers.handleSandboxFileFallback 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.
handlers.writeBundledSkillFile (cyclomatic 28) packages/api/src/agents/handlers.ts:3743— handlers.writeBundledSkillFile 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.
protection.assertResumeToolContentAllowed (cyclomatic 28) packages/api/src/agents/hitl/protection.ts:393— protection.assertResumeToolContentAllowed has cyclomatic complexity 28 (threshold 15). Of this number, 18 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.
session.createOpenIDSessionRefreshService.hydrateSessionFromResolvedTokens (cyclomatic 28) packages/api/src/auth/openid/session.ts:1771— session.createOpenIDSessionRefreshService.hydrateSessionFromResolvedTokens 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.
operations.isDefinitiveFileStorageFailure (cyclomatic 28) packages/api/src/files/operations.ts:88— operations.isDefinitiveFileStorageFailure has cyclomatic complexity 28 (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.
resume.projectPendingMCPOAuthPrompts (cyclomatic 28) packages/api/src/mcp/oauth/resume.ts:50— resume.projectPendingMCPOAuthPrompts 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.
bearer.createScheduledMCPBearerHeaderResolver (cyclomatic 28) packages/api/src/schedules/bearer.ts:356— bearer.createScheduledMCPBearerHeaderResolver has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 10 of the 28 points are its own statements and the rest belongs to 4 function items inside it that branch (resolver, a function literal at line 397, assertOpen, …). 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.
recoveryCli.runSkillUploadRecoveryCli (cyclomatic 28) packages/api/src/skills/recoveryCli.ts:39— recoveryCli.runSkillUploadRecoveryCli 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.
Dropdown.Dropdown (cyclomatic 28) packages/client/src/components/Dropdown.tsx:65— Dropdown.Dropdown has cyclomatic complexity 28 (threshold 15). Of this number, 16 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.
message.createMessageMethods.recordSubagentTaskControlReceipt (cyclomatic 28) packages/data-schemas/src/methods/message.ts:2580— message.createMessageMethods.recordSubagentTaskControlReceipt 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.
queuedTurn.createAgentQueuedTurnMethods.claimNextAgentQueuedTurn (cyclomatic 28) packages/data-schemas/src/methods/queuedTurn.ts:1706— queuedTurn.createAgentQueuedTurnMethods.claimNextAgentQueuedTurn 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
createToolInstance::_call (cyclomatic 28) api/server/services/MCP.js:1331— createToolInstance::_call 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.
(anonymous) (cyclomatic 28) REDACTED:278— (anonymous) has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs 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.
getMCPTools (cyclomatic 28) REDACTED:135— getMCPTools has cyclomatic complexity 28 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
updateAssistant (cyclomatic 28) api/server/controllers/assistants/v2.js:146— updateAssistant 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.
BaseClient.getTokenCountForMessage::processValue (cyclomatic 27) api/app/clients/BaseClient.js:1573— BaseClient.getTokenCountForMessage::processValue 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.
messages.router.post("/branch") (cyclomatic 27) REDACTED:278— messages.router.post("/branch") 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.
useAutoSave.useAutoSave.restoreFiles (cyclomatic 27) client/src/hooks/Input/useAutoSave.ts:117— useAutoSave.useAutoSave.restoreFiles 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 154, 189). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
EndpointModelItem.EndpointModelItemComponent (cyclomatic 27) client/src/components/Chat/Menus/Endpoints/components/EndpointModelItem.tsx:33— EndpointModelItem.EndpointModelItemComponent has cyclomatic complexity 27 (threshold 15). Of this number, 20 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.
outcome.hasTerminalOutcome (cyclomatic 27) client/src/components/Chat/Subagents/outcome.ts:10— outcome.hasTerminalOutcome has cyclomatic complexity 27 (threshold 15). Of this number, 16 points are the body's own statements and 11 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.
DynamicTags.DynamicTags (cyclomatic 27) client/src/components/SidePanel/Parameters/DynamicTags.tsx:10— DynamicTags.DynamicTags 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 5 function literals inside it that branch (lines 152, 57, 75, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
signIn.watchPullRequestSignIn (cyclomatic 27) client/src/data-provider/PullRequest/signIn.ts:71— signIn.watchPullRequestSignIn 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 5 function items inside it that branch (check, onSettled, resume, …). 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.
createChatSearchParams.createChatSearchParams (cyclomatic 27) client/src/utils/createChatSearchParams.ts:64— createChatSearchParams.createChatSearchParams has cyclomatic complexity 27 (threshold 15). Of this number, 18 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.
files.resolveCanonicalReferences (cyclomatic 27) packages/api/src/protection/files.ts:1216— files.resolveCanonicalReferences has cyclomatic complexity 27 (threshold 15). Of this number, 25 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.
config.createAdminConfigHandlers.applyConfigChanges::plan (cyclomatic 27) packages/api/src/admin/config.ts:4549— config.createAdminConfigHandlers.applyConfigChanges::plan 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 (config.createAdminConfigHandlers.applyConfigChanges) 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.
groups.createAdminGroupsHandlers.createGroup (cyclomatic 27) packages/api/src/admin/groups.ts:200— groups.createAdminGroupsHandlers.createGroup 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.
groups.createAdminGroupsHandlers.deleteGroup (cyclomatic 27) packages/api/src/admin/groups.ts:373— groups.createAdminGroupsHandlers.deleteGroup has cyclomatic complexity 27 (threshold 15). Of this number, 16 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.
toolTiming.applySubagentToolTiming (cyclomatic 27) packages/api/src/agents/toolTiming.ts:107— toolTiming.applySubagentToolTiming has cyclomatic complexity 27 (threshold 15). Of this number, 19 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.
GenerationJobManagerClass.publishTerminalClaim (cyclomatic 27) packages/api/src/stream/GenerationJobManager.ts:4197— GenerationJobManagerClass.publishTerminalClaim 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.
client.createMultiAgentMapper (cyclomatic 27) packages/api/src/agents/client.ts:558— client.createMultiAgentMapper has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 7 of the 27 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 571, 577). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.toLinkedWorktreeRequest (cyclomatic 27) packages/api/src/code/workspace.ts:1193— workspace.toLinkedWorktreeRequest 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.
encode.createRunFileMessageEncoder.encode (cyclomatic 27) packages/api/src/agents/files/encode.ts:138— encode.createRunFileMessageEncoder.encode 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.
service.validateRequest (cyclomatic 27) packages/api/src/agents/openai/service.ts:515— service.validateRequest 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.
service.validateResponseRequest (cyclomatic 27) packages/api/src/agents/responses/service.ts:85— service.validateResponseRequest 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.
service.createAggregatorEventHandlers (cyclomatic 27) packages/api/src/agents/responses/service.ts:1150— service.createAggregatorEventHandlers 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 6 function literals inside it that branch (lines 1228, 1194, 1161, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
compaction.snapshotEntry (cyclomatic 27) packages/api/src/agents/compaction.ts:813— compaction.snapshotEntry 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.
guard.createSubagentThreadTurnGuard (cyclomatic 27) packages/api/src/agents/guard.ts:151— guard.createSubagentThreadTurnGuard 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 one function literal inside it that branches (line 152). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
retention.computeRetentionExpiry (cyclomatic 27) packages/api/src/files/retention.ts:113— retention.computeRetentionExpiry 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.
erasure.settleAbandonedRuns (cyclomatic 27) packages/api/src/schedules/erasure.ts:88— erasure.settleAbandonedRuns 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.
service.createSchedulesService.quiesceUserSchedules (cyclomatic 27) packages/api/src/schedules/service.ts:2310— service.createSchedulesService.quiesceUserSchedules 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.
upload.createSkillUploadHandler (cyclomatic 27) packages/api/src/skills/upload.ts:48— upload.createSkillUploadHandler 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 literals inside it that branch (lines 51, 140, 156). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RedisJobStore.getIndexedTerminalHostActionJobs (cyclomatic 27) packages/api/src/stream/implementations/RedisJobStore.ts:3500— RedisJobStore.getIndexedTerminalHostActionJobs 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.
SecretInput.SecretInput (cyclomatic 27) packages/client/src/components/SecretInput.tsx:35— SecretInput.SecretInput has cyclomatic complexity 27 (threshold 15). Of this number, 22 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.
RequestExecutor.setAuth (cyclomatic 27) packages/data-provider/src/actions.ts:228— RequestExecutor.setAuth 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.
conversation.createConversationMethods.deleteConvos (cyclomatic 27) packages/data-schemas/src/methods/conversation.ts:4013— conversation.createConversationMethods.deleteConvos 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, 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.
triggerDelivery.createAgentTriggerDeliveryMethods.recoverAgentTriggerLanePublications (cyclomatic 27) packages/data-schemas/src/methods/triggerDelivery.ts:1254— triggerDelivery.createAgentTriggerDeliveryMethods.recoverAgentTriggerLanePublications has cyclomatic complexity 27 (threshold 15). Of this number, 24 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.
syncMessages (cyclomatic 27) api/server/services/Threads/manage.js:257— syncMessages has cyclomatic complexity 27 (threshold 15). Of this number, 22 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.
createActionTool._call (cyclomatic 27) api/server/services/ActionService.js:205— createActionTool._call has cyclomatic complexity 27 (threshold 15). Of this number, 20 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.
messages.router.get("/") (cyclomatic 26) REDACTED:123— messages.router.get("/") 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.
moderateText.moderateText (cyclomatic 26) api/server/middleware/moderateText.js:15— moderateText.moderateText 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.
config.router.get("/") (cyclomatic 26) api/server/routes/config.js:231— config.router.get("/") 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.
REDACTED.window.addEventListener("message") (cyclomatic 26) REDACTED:162— REDACTED.window.addEventListener("message") 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.
useCodeWorkspace.useCodeWorkspace.environments (cyclomatic 26) client/src/hooks/Agents/useCodeWorkspace.ts:424— useCodeWorkspace.useCodeWorkspace.environments 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.
useMCPSelect.useMCPSelect (cyclomatic 26) client/src/hooks/MCP/useMCPSelect.ts:15— useMCPSelect.useMCPSelect has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 4 of the 26 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 95, 142, 123, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useGenerationsByLatest.useGenerationsByLatest (cyclomatic 26) client/src/hooks/useGenerationsByLatest.ts:28— useGenerationsByLatest.useGenerationsByLatest 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.
DeploymentTheme.DeploymentTheme (cyclomatic 26) client/src/Providers/DeploymentTheme.tsx:234— DeploymentTheme.DeploymentTheme 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MemoryCall.MemoryCall (cyclomatic 26) client/src/components/Chat/Messages/Content/Parts/MemoryCall.tsx:27— MemoryCall.MemoryCall 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.
state.prependSubagentReplay (cyclomatic 26) client/src/components/Chat/Subagents/state.ts:1027— state.prependSubagentReplay 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.
adapters.mergePersistedAndLiveActivity (cyclomatic 26) client/src/components/Chat/Subagents/adapters.ts:226— adapters.mergePersistedAndLiveActivity 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.
SubagentActivity.toContentPart (cyclomatic 26) client/src/components/Chat/Subagents/SubagentActivity.tsx:331— SubagentActivity.toContentPart 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.
ToolsSection.ToolsSection (cyclomatic 26) client/src/components/SidePanel/Agents/Tools/ToolsSection.tsx:42— ToolsSection.ToolsSection 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 9 function literals inside it that branch (lines 121, 189, 245, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
VersionItem.VersionItem (cyclomatic 26) client/src/components/SidePanel/Agents/Version/VersionItem.tsx:41— VersionItem.VersionItem 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.
flush-cache.flushRedisCache (cyclomatic 26) config/flush-cache.js:88— flush-cache.flushRedisCache 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.
roles.createAdminRolesHandlers.updateRole (cyclomatic 26) packages/api/src/admin/roles.ts:670— roles.createAdminRolesHandlers.updateRole 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.
users.createAdminUsersHandlers.deleteUser (cyclomatic 26) packages/api/src/admin/users.ts:230— users.createAdminUsersHandlers.deleteUser 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.
InMemoryJobStore.transitionStatus (cyclomatic 26) packages/api/src/stream/implementations/InMemoryJobStore.ts:816— InMemoryJobStore.transitionStatus 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.
GenerationJobManagerClass.attachSubscription::deliverStoredTerminal (cyclomatic 26) packages/api/src/stream/GenerationJobManager.ts:5678— GenerationJobManagerClass.attachSubscription::deliverStoredTerminal 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 (GenerationJobManagerClass.attachSubscription) 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.
client.countFormattedMessageTokens::processValue (cyclomatic 26) packages/api/src/agents/client.ts:317— client.countFormattedMessageTokens::processValue 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.
modelBoundContent.appendStoredMessageFileIds (cyclomatic 26) packages/api/src/middleware/modelBoundContent.ts:1499— modelBoundContent.appendStoredMessageFileIds 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.
import.blockFilteredImportContent (cyclomatic 26) packages/api/src/skills/import.ts:183— import.blockFilteredImportContent 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
controller.createResetToolApprovalController (cyclomatic 26) REDACTED:43— controller.createResetToolApprovalController 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 54). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
SubagentThreadTaskStore.replayDurableControl (cyclomatic 26) packages/api/src/agents/subagentThreads.ts:1016— SubagentThreadTaskStore.replayDurableControl 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.
backgroundCompletionWakeup.createBackgroundToolDeadClaimRecovery (cyclomatic 26) packages/api/src/agents/backgroundCompletionWakeup.ts:1078— backgroundCompletionWakeup.createBackgroundToolDeadClaimRecovery 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 1094, 1139, 1155). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.registerPluginHooks::hook (cyclomatic 26) packages/api/src/agents/hooks/runtime.ts:415— runtime.registerPluginHooks::hook 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 (runtime.registerPluginHooks) 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.createOpenIDSessionRefreshService.refreshOpenIDSession (cyclomatic 26) packages/api/src/auth/openid/session.ts:1914— session.createOpenIDSessionRefreshService.refreshOpenIDSession 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.
preflight.assertUploadContentAllowed (cyclomatic 26) packages/api/src/files/preflight.ts:40— preflight.assertUploadContentAllowed 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.
MCPOAuthHandler.completeOAuthFlow (cyclomatic 26) packages/api/src/mcp/oauth/handler.ts:1261— MCPOAuthHandler.completeOAuthFlow 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.
MCPConnectionFactory.discoverToolsInternal (cyclomatic 26) packages/api/src/mcp/MCPConnectionFactory.ts:394— MCPConnectionFactory.discoverToolsInternal 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.
messageFilterPii.createMessageFilterPii (cyclomatic 26) packages/api/src/middleware/messageFilterPii.ts:124— messageFilterPii.createMessageFilterPii 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 125, 221, 179). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
submission.createPrivateTextIngress (cyclomatic 26) packages/api/src/protection/private/submission.ts:150— submission.createPrivateTextIngress 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 155, 235, 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.
actions.useDuringRunActions (cyclomatic 26) packages/chat/src/react/steering/actions.ts:20— actions.useDuringRunActions 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 5 function literals inside it that branch (lines 159, 60, 124, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.resolveCodeWorkspaceInheritance (cyclomatic 26) packages/data-provider/src/code/workspace.ts:363— workspace.resolveCodeWorkspaceInheritance has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to 5 function items inside it that branch (inherits, routeOf, resolveGroup, …). 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.
parts.toToolPart (cyclomatic 26) packages/data-provider/src/parts.ts:494— parts.toToolPart 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.
resolution.deepMerge (cyclomatic 26) packages/data-schemas/src/app/resolution.ts:484— resolution.deepMerge 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.
object-traverse.forEach::walk (cyclomatic 26) packages/data-schemas/src/utils/object-traverse.ts:139— object-traverse.forEach::walk 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.
share.createShareMethods.getSharedMessages (cyclomatic 26) packages/data-schemas/src/methods/share.ts:954— share.createShareMethods.getSharedMessages has cyclomatic complexity 26 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
share.createShareMethods.updateSharedLink (cyclomatic 26) packages/data-schemas/src/methods/share.ts:1438— share.createShareMethods.updateSharedLink 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.
triggerDelivery.createAgentTriggerDeliveryMethods.settleBatchMembers (cyclomatic 26) packages/data-schemas/src/methods/triggerDelivery.ts:1807— triggerDelivery.createAgentTriggerDeliveryMethods.settleBatchMembers 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.
recordActivityLabelUsage (cyclomatic 26) api/server/controllers/agents/client.js:1135— recordActivityLabelUsage has cyclomatic complexity 26 (threshold 15). Of this number, 22 points are the body's own statements and 4 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.
processAttachments (cyclomatic 26) api/app/clients/BaseClient.js:1829— processAttachments 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)::beforePublish (cyclomatic 26) api/server/routes/agents/index.js:786— (anonymous)::beforePublish 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) REDACTED:189— (anonymous) has cyclomatic complexity 26 (threshold 15). Of this number, 22 points are the body's own statements and 4 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.
deleteUserController (cyclomatic 26) api/server/controllers/UserController.js:366— deleteUserController has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
OpenWeather._call (cyclomatic 25) api/app/clients/tools/structured/OpenWeather.js:167— OpenWeather._call 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.
ActionService.createActionTool._call (cyclomatic 25) api/server/services/ActionService.js:205— ActionService.createActionTool._call has cyclomatic complexity 25 (threshold 15). Of this number, 19 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.
useCodeWorkspace.useCodeWorkspace.resolveSelections (cyclomatic 25) client/src/hooks/Agents/useCodeWorkspace.ts:493— useCodeWorkspace.useCodeWorkspace.resolveSelections 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
useNewChat.useNewChat.startNewChat (cyclomatic 25) client/src/hooks/Conversations/useNewChat.ts:303— useNewChat.useNewChat.startNewChat 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 4 function items inside it that branch (collectDiscardWork, a function literal at line 381, a function literal at line 434, …). 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.
useEndpoints.useEndpoints.mappedEndpoints (cyclomatic 25) client/src/hooks/Endpoint/useEndpoints.ts:123— useEndpoints.useEndpoints.mappedEndpoints 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 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.
VerifyEmail.RequestPasswordReset (cyclomatic 25) client/src/components/Auth/VerifyEmail.tsx:13— VerifyEmail.RequestPasswordReset has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 9 of the 25 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 87, 22, 23, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ExecuteCode.ExecuteCode (cyclomatic 25) client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx:61— ExecuteCode.ExecuteCode 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.
ToolIcon.getToolIconType (cyclomatic 25) client/src/components/Chat/Messages/Content/ToolOutput/ToolIcon.tsx:66— ToolIcon.getToolIconType 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.
ParallelContent.groupParallelContent (cyclomatic 25) client/src/components/Chat/Messages/Content/ParallelContent.tsx:36— ParallelContent.groupParallelContent 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 4 function literals inside it that branch (lines 51, 114, 137, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.newestLine (cyclomatic 25) client/src/components/Chat/Messages/Content/live.ts:295— live.newestLine 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.
MessageRender.MessageRender (cyclomatic 25) client/src/components/Chat/Messages/ui/MessageRender.tsx:78— MessageRender.MessageRender 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Ledger.Ledger::renderRow (cyclomatic 25) client/src/components/Chat/Trace/Ledger.tsx:433— Ledger.Ledger::renderRow 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.
state.foldReplaySegments (cyclomatic 25) client/src/components/Chat/Subagents/state.ts:1175— state.foldReplaySegments 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.
state.reduceSubagentReplay (cyclomatic 25) client/src/components/Chat/Subagents/state.ts:1446— state.reduceSubagentReplay has cyclomatic complexity 25 (threshold 15). Of this number, 19 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.
BackupCodesItem.BackupCodesItem (cyclomatic 25) client/src/components/Nav/SettingsTabs/Account/BackupCodesItem.tsx:33— BackupCodesItem.BackupCodesItem has cyclomatic complexity 25 (threshold 15). Of this number, 13 points are the body's own statements and 12 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.
AgentHandoffs.AgentHandoffs (cyclomatic 25) client/src/components/SidePanel/Agents/Advanced/AgentHandoffs.tsx:33— AgentHandoffs.AgentHandoffs 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 11 function items inside it that branch (a function literal at line 135, addHandoff, 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.
ScheduleCard.ScheduleCard (cyclomatic 25) client/src/components/SidePanel/Schedules/ScheduleCard.tsx:157— ScheduleCard.ScheduleCard has cyclomatic complexity 25 (threshold 15). Of this number, 14 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.
useKeyboardShortcuts.useKeyboardShortcuts (cyclomatic 25) client/src/hooks/useKeyboardShortcuts.ts:1070— useKeyboardShortcuts.useKeyboardShortcuts 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 2 function literals inside it that branch (lines 1092, 1080). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
convos.upsertConvoInAllQueries (cyclomatic 25) client/src/utils/convos.ts:582— convos.upsertConvoInAllQueries has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 7 of the 25 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 633, 697, 618, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.prepareChange (cyclomatic 25) packages/api/src/admin/config.ts:2203— config.prepareChange 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.
runtime.stringifyBounded::walk (cyclomatic 25) packages/api/src/agents/activityLabels/runtime.ts:262— runtime.stringifyBounded::walk 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.
subagentTaskRouting.parseRequest (cyclomatic 25) packages/api/src/agents/subagentTaskRouting.ts:566— subagentTaskRouting.parseRequest 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.
json.cloneJsonValue (cyclomatic 25) packages/api/src/agents/json.ts:8— json.cloneJsonValue 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.
handlers.createOpenAIToolCallStream.onRunStepDelta (cyclomatic 25) packages/api/src/agents/openai/handlers.ts:555— handlers.createOpenAIToolCallStream.onRunStepDelta 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.
messages.snapshotNestedSubmittedValue (cyclomatic 25) packages/api/src/protection/adapters/messages.ts:255— messages.snapshotNestedSubmittedValue 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.
provenance.getUserSubmittedPathState (cyclomatic 25) packages/api/src/protection/provenance.ts:307— provenance.getUserSubmittedPathState has cyclomatic complexity 25 (threshold 15). Of this number, 15 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.
session.createOpenIDSessionRefreshService.performIdpRefreshGrant (cyclomatic 25) packages/api/src/auth/openid/session.ts:1027— session.createOpenIDSessionRefreshService.performIdpRefreshGrant 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.
helpers.configureReasoning (cyclomatic 25) packages/api/src/endpoints/anthropic/helpers.ts:75— helpers.configureReasoning 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.
endpoints.createEndpointsConfigService.getEndpointsConfig (cyclomatic 25) packages/api/src/endpoints/config/endpoints.ts:39— endpoints.createEndpointsConfigService.getEndpointsConfig 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.
document.encodeAndFormatDocuments (cyclomatic 25) packages/api/src/files/encode/document.ts:298— document.encodeAndFormatDocuments 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.
errors.extractSSEErrorMessage (cyclomatic 25) packages/api/src/mcp/errors.ts:145— errors.extractSSEErrorMessage 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.
ConnectionsRepository.loadConnection (cyclomatic 25) packages/api/src/mcp/ConnectionsRepository.ts:131— ConnectionsRepository.loadConnection 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.
previews.nestedAttachmentCalls (cyclomatic 25) packages/api/src/messages/previews.ts:255— previews.nestedAttachmentCalls 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.
RedisEventTransport.handleMessage (cyclomatic 25) packages/api/src/stream/implementations/RedisEventTransport.ts:895— RedisEventTransport.handleMessage 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.
RedisJobStore.updateJob (cyclomatic 25) packages/api/src/stream/implementations/RedisJobStore.ts:2415— RedisJobStore.updateJob 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.
Badge.Badge (cyclomatic 25) packages/client/src/components/Badge.tsx:27— Badge.Badge has cyclomatic complexity 25 (threshold 15). Of this number, 20 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.
messages.buildTree (cyclomatic 25) packages/data-provider/src/messages.ts:50— messages.buildTree has cyclomatic complexity 25 (threshold 15). Of this number, 22 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.
triggerDelivery.createAgentTriggerDeliveryMethods.retireAgentTriggerDelivery (cyclomatic 25) packages/data-schemas/src/methods/triggerDelivery.ts:2217— triggerDelivery.createAgentTriggerDeliveryMethods.retireAgentTriggerDelivery has cyclomatic complexity 25 (threshold 15). Of this number, 14 points are the body's own statements and 11 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.
static-checks.main (cyclomatic 25) scripts/static-checks.mts:2252— static-checks.main 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.
chatCompletion::runAgents (cyclomatic 25) api/server/controllers/agents/client.js:4939— chatCompletion::runAgents 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.
handle (cyclomatic 25) api/server/controllers/agents/callbacks.js:132— handle 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.
createGeminiImageTool (cyclomatic 25) api/app/clients/tools/structured/GeminiImageGen.js:312— createGeminiImageTool 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 4 function items inside it that branch (a function literal at line 324, (anonymous)::abortHandler, a function literal at line 410, …). 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.
checkBan.checkBan (cyclomatic 24) api/server/middleware/checkBan.js:82— checkBan.checkBan 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.
useReplyWatcher.reconcileFirstPage (cyclomatic 24) client/src/hooks/Conversations/useReplyWatcher.ts:42— useReplyWatcher.reconcileFirstPage 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.
format.formatMessageContent (cyclomatic 24) client/src/hooks/Conversations/format.ts:111— format.formatMessageContent 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.
useFileHandling.useFileHandlingCore (cyclomatic 24) client/src/hooks/Files/useFileHandling.ts:199— useFileHandling.useFileHandlingCore 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 5 function literals inside it that branch (lines 422, 354, 387, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useTextarea.useTextarea (cyclomatic 24) client/src/hooks/Input/useTextarea.ts:46— useTextarea.useTextarea 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 5 function literals inside it that branch (lines 181, 158, 145, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useHandleKeyUp.useHandleKeyUp (cyclomatic 24) client/src/hooks/Input/useHandleKeyUp.ts:54— useHandleKeyUp.useHandleKeyUp 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 7 function literals inside it that branch (lines 170, 118, 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.
CategoryTabs.CategoryTabs (cyclomatic 24) client/src/components/Agents/CategoryTabs.tsx:25— CategoryTabs.CategoryTabs has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 5 of the 24 points are its own statements and the rest belongs to 4 function items inside it that branch (handleKeyDown, getCategoryDisplayName, a function literal at line 132, …). 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.
Card.TaskCard (cyclomatic 24) client/src/components/Chat/BackgroundTasks/Card.tsx:33— Card.TaskCard 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.
SteerPart.SteerPart (cyclomatic 24) client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx:25— SteerPart.SteerPart has cyclomatic complexity 24 (threshold 15). Of this number, 14 points are the body's own statements and 10 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.
QuoteButton.visibleAnchor (cyclomatic 24) client/src/components/Chat/Input/QuoteButton.tsx:204— QuoteButton.visibleAnchor has cyclomatic complexity 24 (threshold 15). Of this number, 12 points are the body's own statements and 12 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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.buildPreviewIndex (cyclomatic 24) client/src/components/Chat/Trace/preview.ts:305— preview.buildPreviewIndex 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.
ModelSelectorContext.ModelSelectorProvider (cyclomatic 24) client/src/components/Chat/Menus/Endpoints/ModelSelectorContext.tsx:62— ModelSelectorContext.ModelSelectorProvider 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 9 function literals inside it that branch (lines 147, 240, 81, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ConvoOptions.ConvoOptions (cyclomatic 24) client/src/components/Conversations/ConvoOptions/ConvoOptions.tsx:27— ConvoOptions.ConvoOptions 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ConvoLink.ConvoLink (cyclomatic 24) client/src/components/Conversations/ConvoLink.tsx:41— ConvoLink.ConvoLink 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
TwoFactorAuthentication.TwoFactorAuthentication (cyclomatic 24) client/src/components/Nav/SettingsTabs/Account/TwoFactorAuthentication.tsx:40— TwoFactorAuthentication.TwoFactorAuthentication has cyclomatic complexity 24 (threshold 15). Of this number, 12 points are the body's own statements and 12 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.
Passkeys.Passkeys (cyclomatic 24) client/src/components/Nav/SettingsTabs/Account/Passkeys/Passkeys.tsx:38— Passkeys.Passkeys has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 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.
ProjectWorkspace.ProjectWorkspace (cyclomatic 24) client/src/components/Projects/ProjectWorkspace.tsx:69— ProjectWorkspace.ProjectWorkspace has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 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.
ApiKeyDialog.ApiKeyDialog (cyclomatic 24) client/src/components/SidePanel/Agents/Search/ApiKeyDialog.tsx:16— ApiKeyDialog.ApiKeyDialog 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 2 function items inside it that branch (a function literal at line 60, handleVisibleSubmit). 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.
isActiveVersion.isActiveVersion (cyclomatic 24) client/src/components/SidePanel/Agents/Version/isActiveVersion.ts:55— isActiveVersion.isActiveVersion 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 3 function items inside it that branch (toolsMatch, capabilitiesMatch, a function literal at line 66). 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.
MCPServerCard.MCPServerCard (cyclomatic 24) client/src/components/SidePanel/MCPBuilder/MCPServerCard.tsx:28— MCPServerCard.MCPServerCard has cyclomatic complexity 24 (threshold 15). 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 items inside it that branch (getStatusText, handleInitialize, a function literal at line 57, …). 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.
Consent.Consent (cyclomatic 24) client/src/components/SidePanel/Schedules/Consent.tsx:26— Consent.Consent has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 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.
drafts.setFilesDraft (cyclomatic 24) client/src/utils/drafts.ts:1220— drafts.setFilesDraft has cyclomatic complexity 24 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
subagentContent.foldSubagentEventIntoTicker (cyclomatic 24) client/src/utils/subagentContent.ts:825— subagentContent.foldSubagentEventIntoTicker 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.
pattern.createLinearInspector (cyclomatic 24) packages/api/src/protection/detectors/pattern.ts:416— pattern.createLinearInspector 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 3 function items inside it that branch (locate, inspectFragment, a function literal at line 467). 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.
config.createAdminConfigHandlers.deleteConfigField (cyclomatic 24) packages/api/src/admin/config.ts:4246— config.createAdminConfigHandlers.deleteConfigField 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.
runtime.createActivityLabelHook (cyclomatic 24) packages/api/src/agents/activityLabels/runtime.ts:479— runtime.createActivityLabelHook 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 5 function items inside it that branch (a function literal at line 554, a function literal at line 521, a function literal at line 566, …). 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.
InMemoryJobStore.getJobIdsByUser (cyclomatic 24) packages/api/src/stream/implementations/InMemoryJobStore.ts:1468— InMemoryJobStore.getJobIdsByUser 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.
InMemoryJobStore.appendChunk (cyclomatic 24) packages/api/src/stream/implementations/InMemoryJobStore.ts:1757— InMemoryJobStore.appendChunk 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.
InMemoryJobStore.discardSteerLeftover (cyclomatic 24) packages/api/src/stream/implementations/InMemoryJobStore.ts:2535— InMemoryJobStore.discardSteerLeftover 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.
InMemoryJobStore.consumeParkedSteer (cyclomatic 24) packages/api/src/stream/implementations/InMemoryJobStore.ts:2795— InMemoryJobStore.consumeParkedSteer 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
tools.registerCodeExecutionTools (cyclomatic 24) packages/api/src/agents/tools.ts:1218— tools.registerCodeExecutionTools 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.
usage.recordCollectedUsage (cyclomatic 24) packages/api/src/agents/usage.ts:895— usage.recordCollectedUsage has cyclomatic complexity 24 (threshold 15). Of this number, 13 points are the body's own statements and 11 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.
modelBoundContent.collectModelBoundHistoricalFileIdState (cyclomatic 24) packages/api/src/middleware/modelBoundContent.ts:314— modelBoundContent.collectModelBoundHistoricalFileIdState has cyclomatic complexity 24 (threshold 15). Of this number, 16 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.
initialize.assertResolvedSkillContentAllowed (cyclomatic 24) packages/api/src/agents/initialize.ts:227— initialize.assertResolvedSkillContentAllowed 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, 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.
handlers.sniffImageMime (cyclomatic 24) packages/api/src/agents/handlers.ts:1968— handlers.sniffImageMime 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.
edges.resolveReachableGraph (cyclomatic 24) packages/api/src/agents/edges.ts:143— edges.resolveReachableGraph has cyclomatic complexity 24 (threshold 15). Of this number, 19 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.
inspection.getResumeStoredBranch (cyclomatic 24) packages/api/src/agents/hitl/inspection.ts:263— inspection.getResumeStoredBranch 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.
SubagentThreadTaskStore.claimDurableTaskResult (cyclomatic 24) packages/api/src/agents/subagentThreads.ts:2088— SubagentThreadTaskStore.claimDurableTaskResult 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.
email.createEmailChangeService.confirmEmailChange (cyclomatic 24) packages/api/src/auth/email.ts:598— email.createEmailChangeService.confirmEmailChange 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.
config.mergeAccessibleCodeEnvironments (cyclomatic 24) packages/api/src/code/config.ts:127— config.mergeAccessibleCodeEnvironments 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 9 function literals inside it that branch (lines 222, 182, 239, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
http.createCodeEnvironmentHttpHandlers.register (cyclomatic 24) packages/api/src/code/http.ts:575— http.createCodeEnvironmentHttpHandlers.register 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.
FlowStateManager.monitorFlow (cyclomatic 24) packages/api/src/flow/manager.ts:707— FlowStateManager.monitorFlow 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 4 function literals inside it that branch (lines 759, 721, 713, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
authorization.createImageAuthorizationMiddleware (cyclomatic 24) packages/api/src/images/authorization.ts:448— authorization.createImageAuthorizationMiddleware has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 3 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 456, 523). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
openid.resolveDirectOpenIDBearerConfig (cyclomatic 24) packages/api/src/mcp/openid.ts:126— openid.resolveDirectOpenIDBearerConfig 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.
zod.convertToZodUnion (cyclomatic 24) packages/api/src/mcp/zod.ts:66— zod.convertToZodUnion 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 one function literal inside it that branches (line 76). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
admission.createPrivateTextInitialAdmissionCallback (cyclomatic 24) packages/api/src/protection/private/admission.ts:30— admission.createPrivateTextInitialAdmissionCallback 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 6 function items inside it that branch (admitModel, a function literal at line 128, findRoot, …). 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.
handlers.createSkillsHandlers.downloadFile (cyclomatic 24) packages/api/src/skills/handlers.ts:655— handlers.createSkillsHandlers.downloadFile 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.
events.isOAuthStepEvent (cyclomatic 24) packages/chat/src/core/resumable/events.ts:15— events.isOAuthStepEvent 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.
send.useQueuedSend (cyclomatic 24) packages/chat/src/react/steering/send.ts:22— send.useQueuedSend 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 4 function literals inside it that branch (lines 82, 186, 130, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
generate.generateDynamicSchema (cyclomatic 24) packages/data-provider/src/generate.ts:133— generate.generateDynamicSchema 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.
actions.validateAndParseOpenAPISpec (cyclomatic 24) packages/data-provider/src/actions.ts:834— actions.validateAndParseOpenAPISpec 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.
resolve-llm-delivery-path.resolveDefaultLLMDeliveryPath (cyclomatic 24) packages/data-provider/src/resolve-llm-delivery-path.ts:150— resolve-llm-delivery-path.resolveDefaultLLMDeliveryPath 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.
design.chosenByDisabled (cyclomatic 24) scripts/eslint/design.mjs:322— design.chosenByDisabled 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.
sort-imports.sortFileImports (cyclomatic 24) scripts/sort-imports.mts:107— sort-imports.sortFileImports 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, 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.
mergeEditedContent (cyclomatic 24) api/app/clients/BaseClient.js:1641— mergeEditedContent 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
healMcpToolNames (cyclomatic 24) api/server/services/MCP.js:280— healMcpToolNames 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
processMessages (cyclomatic 24) api/server/services/Threads/manage.js:623— processMessages 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 7 function literals inside it that branch (lines 668, 738, 753, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cyclomatic 24) REDACTED:630— (anonymous) 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.
auth.router.post("/oauth/refresh") (cyclomatic 23) REDACTED:630— auth.router.post("/oauth/refresh") has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
convos.router.delete("/") (cyclomatic 23) REDACTED:509— convos.router.delete("/") 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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.buildPreLoginPayload (cyclomatic 23) api/server/routes/config.js:76— config.buildPreLoginPayload 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.
files.router.delete("/") (cyclomatic 23) REDACTED:189— files.router.delete("/") 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.
AssistantService.createInProgressHandler::in_progress (cyclomatic 23) api/server/services/AssistantService.js:150— AssistantService.createInProgressHandler::in_progress 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.
MCP.getServerConnectionStatus (cyclomatic 23) api/server/services/MCP.js:1764— MCP.getServerConnectionStatus 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.
useAttachmentPreviewSync.useAttachmentPreviewSync (cyclomatic 23) client/src/hooks/Files/useAttachmentPreviewSync.ts:63— useAttachmentPreviewSync.useAttachmentPreviewSync 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 4 function literals inside it that branch (lines 158, 123, 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.
useFileHandling.useFileHandlingCore.startUpload (cyclomatic 23) client/src/hooks/Files/useFileHandling.ts:551— useFileHandling.useFileHandlingCore.startUpload 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.
useSharePointPicker.useSharePointPicker.portMessageHandler (cyclomatic 23) client/src/hooks/Files/useSharePointPicker.ts:60— useSharePointPicker.useSharePointPicker.portMessageHandler has cyclomatic complexity 23 (threshold 15). Of this number, 14 points are the body's own statements and 9 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.
DescriptionWords.DescriptionWords (cyclomatic 23) client/src/components/Agents/DescriptionWords.tsx:53— DescriptionWords.DescriptionWords 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 4 function literals inside it that branch (lines 59, 61, 92, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TwoFactorSetupScreen.TwoFactorSetupScreen (cyclomatic 23) client/src/components/Auth/TwoFactorSetupScreen.tsx:56— TwoFactorSetupScreen.TwoFactorSetupScreen 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 11 function literals inside it that branch (lines 155, 208, 93, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Reasoning.Reasoning (cyclomatic 23) client/src/components/Chat/Messages/Content/Parts/Reasoning.tsx:169— Reasoning.Reasoning has cyclomatic complexity 23 (threshold 15). Of this number, 18 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.
rail.useFoldPath (cyclomatic 23) client/src/components/Chat/Messages/Content/rail.tsx:522— rail.useFoldPath 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 6 function literals inside it that branch (lines 587, 523, 533, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CodeWorkspaceMenu.GitContext (cyclomatic 23) client/src/components/Chat/Input/CodeWorkspaceMenu.tsx:288— CodeWorkspaceMenu.GitContext 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.
model.flattenRows (cyclomatic 23) client/src/components/Chat/Trace/model.ts:945— model.flattenRows 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 6 function items inside it that branch (pushRecords, a function literal at line 1005, a function literal at line 1023, …). 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.
utils.filterItems (cyclomatic 23) client/src/components/Chat/Menus/Endpoints/utils.ts:17— utils.filterItems 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 2 function literals inside it that branch (lines 39, 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.
running.groupConversationsByStatus (cyclomatic 23) client/src/components/Conversations/running.ts:64— running.groupConversationsByStatus 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
face.drawMouth (cyclomatic 23) client/src/components/Lia/engine/face.ts:305— face.drawMouth has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
LiaEngine.updateMotion (cyclomatic 23) client/src/components/Lia/engine/engine.ts:539— LiaEngine.updateMotion 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.
LiaEngine.render (cyclomatic 23) client/src/components/Lia/engine/engine.ts:649— LiaEngine.render 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.
PluginAuthForm.PluginAuthForm (cyclomatic 23) client/src/components/Plugins/Store/PluginAuthForm.tsx:87— PluginAuthForm.PluginAuthForm 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 2 function literals inside it that branch (lines 119, 131). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ActionsInput.ActionsInput (cyclomatic 23) client/src/components/SidePanel/Builder/ActionsInput.tsx:33— ActionsInput.ActionsInput 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 6 function items inside it that branch (a function literal at line 111, a function literal at line 73, submitContext, …). 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.
useWakeLock.useWakeLock (cyclomatic 23) client/src/hooks/useWakeLock.ts:55— useWakeLock.useWakeLock 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 5 function literals inside it that branch (lines 109, 145, 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.
useRum.useRum (cyclomatic 23) client/src/lib/rum/useRum.ts:159— useRum.useRum has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 3 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 195, 175, 268, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
approval.resolveAskUserQuestionPart (cyclomatic 23) client/src/utils/approval.ts:192— approval.resolveAskUserQuestionPart 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.
drafts.registerComposerDraft (cyclomatic 23) client/src/utils/drafts.ts:373— drafts.registerComposerDraft has cyclomatic complexity 23 (threshold 15). 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
groups.createAdminGroupsHandlers.updateGroup (cyclomatic 23) packages/api/src/admin/groups.ts:296— groups.createAdminGroupsHandlers.updateGroup 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.
wiring.createActivityLabelWiring (cyclomatic 23) packages/api/src/agents/activityLabels/wiring.ts:218— wiring.createActivityLabelWiring 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 257, 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.
InMemoryJobStore.createJob::assertOwnerCompatible (cyclomatic 23) packages/api/src/stream/implementations/InMemoryJobStore.ts:324— InMemoryJobStore.createJob::assertOwnerCompatible 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. This shape REPEATS in the file: one other method here (InMemoryJobStore.createJob) 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.
GenerationJobManagerClass.recordProviderExecutionDrain (cyclomatic 23) packages/api/src/stream/GenerationJobManager.ts:8286— GenerationJobManagerClass.recordProviderExecutionDrain 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.
tools.buildRunToolSet (cyclomatic 23) packages/api/src/agents/tools.ts:323— tools.buildRunToolSet 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.
memory.processMemory (cyclomatic 23) packages/api/src/agents/memory.ts:756— memory.processMemory 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.
bridge.createCodeBridgeStatusPoller (cyclomatic 23) packages/api/src/code/bridge.ts:102— bridge.createCodeBridgeStatusPoller 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 6 function items inside it that branch (a function literal at line 183, remember, observe, …). 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.
modes.createAgentToolApprovalSession.validateTransport (cyclomatic 23) packages/api/src/agents/hitl/modes.ts:564— modes.createAgentToolApprovalSession.validateTransport 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.
handlers.handleEditFileCall (cyclomatic 23) packages/api/src/agents/handlers.ts:4488— handlers.handleEditFileCall 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.
admission.createUnresolvedReviewMatcher (cyclomatic 23) packages/api/src/agents/hitl/admission.ts:222— admission.createUnresolvedReviewMatcher 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 6 function items inside it that branch (visitParts, a function literal at line 297, a function literal at line 285, …). 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.
deletion.createCheckpointDeletionReclaimer (cyclomatic 23) packages/api/src/agents/checkpoints/deletion.ts:226— deletion.createCheckpointDeletionReclaimer 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 5 function literals inside it that branch (lines 230, 292, 245, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
outcome.createAgentEventActionRecorder.observeToolEnd (cyclomatic 23) packages/api/src/agents/triggers/outcome.ts:226— outcome.createAgentEventActionRecorder.observeToolEnd 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.
view.publicThreadTurns (cyclomatic 23) packages/api/src/agents/view.ts:322— view.publicThreadTurns 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 350). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
share.createOptionalShareFileAuth (cyclomatic 23) packages/api/src/auth/share.ts:42— share.createOptionalShareFileAuth 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 4 function items inside it that branch (a function literal at line 95, verifySignedUser, getOpenIdUser, …). 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.
cloudfront-cookies.setCloudFrontCookies (cyclomatic 23) packages/api/src/cdn/cloudfront-cookies.ts:410— cloudfront-cookies.setCloudFrontCookies 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 branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
http.createCodeEnvironmentHttpHandlers.moveConversationDecision (cyclomatic 23) packages/api/src/code/http.ts:401— http.createCodeEnvironmentHttpHandlers.moveConversationDecision 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.
lane.createLaneGitRecorder (cyclomatic 23) packages/api/src/code/lane.ts:79— lane.createLaneGitRecorder 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 5 function items inside it that branch (write, a function literal at line 180, reserve, …). 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.
initialize.initializeGoogle (cyclomatic 23) packages/api/src/endpoints/google/initialize.ts:28— initialize.initializeGoogle 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.
process.processCodeOutput (cyclomatic 23) packages/api/src/files/code/process.ts:118— process.processCodeOutput 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 (process.processCodeOutput::writeOutput) 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.
MCPOAuthHandler.assertStoredClientBinding (cyclomatic 23) packages/api/src/mcp/oauth/handler.ts:511— MCPOAuthHandler.assertStoredClientBinding 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.
remoteAgentAuth.createRemoteAgentAuth::handler (cyclomatic 23) packages/api/src/middleware/remoteAgentAuth.ts:390— remoteAgentAuth.createRemoteAgentAuth::handler 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.
mcp.createScheduleMCPPreflight::runPreflight (cyclomatic 23) packages/api/src/schedules/mcp.ts:202— mcp.createScheduleMCPPreflight::runPreflight 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.
RedisEventTransport.syncReorderBuffer (cyclomatic 23) packages/api/src/stream/implementations/RedisEventTransport.ts:801— RedisEventTransport.syncReorderBuffer has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
config.getRumConfig (cyclomatic 23) packages/api/src/rum/config.ts:34— config.getRumConfig 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.
branch.sumBranch (cyclomatic 23) packages/chat/src/core/usage/branch.ts:14— branch.sumBranch 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.
Radio.Radio (cyclomatic 23) packages/client/src/components/Radio.tsx:38— Radio.Radio 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 5 function items inside it that branch (a function literal at line 187, handleKeyDown, 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.
file-config.getEndpointFileConfig (cyclomatic 23) packages/data-provider/src/file-config.ts:1127— file-config.getEndpointFileConfig 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.
compaction.isValidCompactionSemanticIndexEntry (cyclomatic 23) packages/data-schemas/src/types/compaction.ts:54— compaction.isValidCompactionSemanticIndexEntry 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.
transaction.createTransactionMethods.reserveBalance (cyclomatic 23) packages/data-schemas/src/methods/transaction.ts:482— transaction.createTransactionMethods.reserveBalance 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.
triggerDelivery.createAgentTriggerDeliveryMethods.expediteAgentTriggerDeliveries (cyclomatic 23) packages/data-schemas/src/methods/triggerDelivery.ts:2606— triggerDelivery.createAgentTriggerDeliveryMethods.expediteAgentTriggerDeliveries 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.
triggerDelivery.createAgentTriggerDeliveryMethods.reserveAgentEventActorDetachedAction (cyclomatic 23) packages/data-schemas/src/methods/triggerDelivery.ts:3837— triggerDelivery.createAgentTriggerDeliveryMethods.reserveAgentEventActorDetachedAction 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.
mcpAuthority.createMCPAuthorityMethods.compareProofs (cyclomatic 23) packages/data-schemas/src/methods/mcpAuthority.ts:1732— mcpAuthority.createMCPAuthorityMethods.compareProofs 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.
filterAuthorizedTools (cyclomatic 23) REDACTED:549— filterAuthorizedTools 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.
getListAgentsHandler (cyclomatic 23) REDACTED:1752— getListAgentsHandler has cyclomatic complexity 23 (threshold 15). Of this number, 18 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.
(anonymous) (cyclomatic 23) REDACTED:135— (anonymous) 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.
chatV1::handleError (cyclomatic 23) api/server/controllers/assistants/chatV1.js:139— chatV1::handleError 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.
importLibreChatConvo (cyclomatic 23) api/server/utils/import/importers.js:297— importLibreChatConvo has cyclomatic complexity 23 (threshold 15). Of this number, 16 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.
createErrorHandler (cyclomatic 23) api/server/controllers/assistants/errors.js:37— createErrorHandler 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 3 function literals inside it that branch (lines 45, 103, 118). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
formatMessages.formatMessage (cyclomatic 22) api/app/clients/prompts/formatMessages.js:50— formatMessages.formatMessage 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.
share.streamSharedFile (cyclomatic 22) REDACTED:249— share.streamSharedFile 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.
tools.loadAndFormatTools (cyclomatic 22) api/server/services/start/tools.js:32— tools.loadAndFormatTools 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.
useUnseenConversations.observeArrivalQuery (cyclomatic 22) client/src/hooks/Conversations/useUnseenConversations.ts:161— useUnseenConversations.observeArrivalQuery 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.
useQueryParams.useQueryParams.newQueryConvo (cyclomatic 22) client/src/hooks/Input/useQueryParams.ts:320— useQueryParams.useQueryParams.newQueryConvo 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.
AgentPanelContext.AgentPanelProvider (cyclomatic 22) client/src/Providers/AgentPanelContext.tsx:36— AgentPanelContext.AgentPanelProvider 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ErrorDisplay.ErrorDisplay (cyclomatic 22) client/src/components/Agents/ErrorDisplay.tsx:89— ErrorDisplay.ErrorDisplay 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 3 function items inside it that branch (getErrorInfo, getNotFoundMessage, getContextualTitle). 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.
Marketplace.AgentMarketplace (cyclomatic 22) client/src/components/Agents/Marketplace.tsx:21— Marketplace.AgentMarketplace 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 6 function items inside it that branch (handleMineChange, handleTabChange, a function literal at line 29, …). 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.
ProgressText.ProgressText::getText (cyclomatic 22) client/src/components/Chat/Messages/Content/Parts/OpenAIImageGen/ProgressText.tsx:25— ProgressText.ProgressText::getText 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.
useLazyHighlight.useLazyHighlight (cyclomatic 22) client/src/components/Chat/Messages/Content/Parts/useLazyHighlight.ts:87— useLazyHighlight.useLazyHighlight 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 6 function literals inside it that branch (lines 106, 94, 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.
RetrievalCall.RetrievalCall (cyclomatic 22) client/src/components/Chat/Messages/Content/RetrievalCall.tsx:334— RetrievalCall.RetrievalCall has cyclomatic complexity 22 (threshold 15). Of this number, 12 points are the body's own statements and 10 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.
FileRow.FileRow (cyclomatic 22) client/src/components/Chat/Input/Files/FileRow.tsx:21— FileRow.FileRow 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 literals inside it that branch (lines 127, 89, 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.
preview.buildActivityIndex (cyclomatic 22) client/src/components/Chat/Trace/preview.ts:422— preview.buildActivityIndex 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.
state.foldLegacyInvocations (cyclomatic 22) client/src/components/Chat/Subagents/state.ts:1295— state.foldLegacyInvocations 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.
Review.PendingToolApprovalPanel (cyclomatic 22) client/src/components/Chat/approval/Review.tsx:56— Review.PendingToolApprovalPanel has cyclomatic complexity 22 (threshold 15). Of this number, 12 points are the body's own statements and 10 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.
LiaEngine.chooseLife (cyclomatic 22) client/src/components/Lia/engine/engine.ts:363— LiaEngine.chooseLife 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.
UserKeyError.UserKeyError (cyclomatic 22) client/src/components/Messages/Content/Error/UserKeyError.tsx:32— UserKeyError.UserKeyError has cyclomatic complexity 22 (threshold 15). Of this number, 17 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.
RunCode.RunCode (cyclomatic 22) client/src/components/Messages/Content/RunCode.tsx:24— RunCode.RunCode has cyclomatic complexity 22 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AutoRefillSettings.AutoRefillSettings (cyclomatic 22) client/src/components/Nav/SettingsTabs/Balance/AutoRefillSettings.tsx:28— AutoRefillSettings.AutoRefillSettings 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 one function item inside it that branches (getLocalizedIntervalUnit). 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.
ProjectsView.ProjectsView (cyclomatic 22) client/src/components/Projects/ProjectsView.tsx:181— ProjectsView.ProjectsView has cyclomatic complexity 22 (threshold 15). Of this number, 14 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.
AgentPanel.composeAgentUpdatePayload (cyclomatic 22) client/src/components/SidePanel/Agents/AgentPanel.tsx:138— AgentPanel.composeAgentUpdatePayload 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.
useMCPServerForm.useMCPServerForm.defaultValues (cyclomatic 22) client/src/components/SidePanel/MCPBuilder/MCPServerDialog/hooks/useMCPServerForm.ts:82— useMCPServerForm.useMCPServerForm.defaultValues 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.
useMCPServerForm.useMCPServerForm.onSubmit (cyclomatic 22) client/src/components/SidePanel/MCPBuilder/MCPServerDialog/hooks/useMCPServerForm.ts:185— useMCPServerForm.useMCPServerForm.onSubmit 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.
private.useOwnerMessageTexts (cyclomatic 22) client/src/data-provider/Messages/private.ts:32— private.useOwnerMessageTexts 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 literals inside it that branch (lines 105, 75, 143, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
mermaid.fixSubgraphTitleContrast (cyclomatic 22) client/src/utils/mermaid.ts:253— mermaid.fixSubgraphTitleContrast 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.
nested.isContentTraversalProtected (cyclomatic 22) packages/api/src/protection/adapters/nested.ts:315— nested.isContentTraversalProtected 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.
submissions.extractModelParameterContent::visit (cyclomatic 22) packages/api/src/protection/adapters/submissions.ts:463— submissions.extractModelParameterContent::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.
secrets.redactConfigSecrets (cyclomatic 22) packages/api/src/admin/secrets.ts:1916— secrets.redactConfigSecrets 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.
catalog.createAdminConfigCatalogHandlers.getConfigCatalog (cyclomatic 22) packages/api/src/admin/catalog.ts:482— catalog.createAdminConfigCatalogHandlers.getConfigCatalog 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.
roles.createAdminRolesHandlers.addRoleMember (cyclomatic 22) packages/api/src/admin/roles.ts:1090— roles.createAdminRolesHandlers.addRoleMember 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.
attachments.collectAgentAttachmentStats (cyclomatic 22) packages/api/src/agents/attachments.ts:241— attachments.collectAgentAttachmentStats 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.
instructions.createRepositoryInstructionLoader (cyclomatic 22) packages/api/src/code/instructions.ts:47— instructions.createRepositoryInstructionLoader 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 49). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
provenance.isEffectiveUserSubmittedPath (cyclomatic 22) packages/api/src/protection/provenance.ts:154— provenance.isEffectiveUserSubmittedPath 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.
handlers.handleSkillToolCall (cyclomatic 22) packages/api/src/agents/handlers.ts:5195— handlers.handleSkillToolCall 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.
SubagentThreadTaskStore.controlInvocation (cyclomatic 22) packages/api/src/agents/subagentThreads.ts:2375— SubagentThreadTaskStore.controlInvocation 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.
subagentThreads.serializeTranscript (cyclomatic 22) packages/api/src/agents/subagentThreads.ts:479— subagentThreads.serializeTranscript 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.
executor.normalizeOutput (cyclomatic 22) packages/api/src/agents/hooks/executor.ts:521— executor.normalizeOutput 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.
runtime.synthesizeReasoningLabelGapEvents (cyclomatic 22) packages/api/src/agents/reasoningLabels/runtime.ts:192— runtime.synthesizeReasoningLabelGapEvents 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.
targets.createSubagentCodeRouting.attach (cyclomatic 22) packages/api/src/code/targets.ts:847— targets.createSubagentCodeRouting.attach has cyclomatic complexity 22 (threshold 15). Of this number, 14 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.
MCPConnection.readToolsSnapshot (cyclomatic 22) packages/api/src/mcp/connection.ts:2858— MCPConnection.readToolsSnapshot 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, separate the cases: extract each independent 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: MCPConnection.setupTransportErrorHandlers (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.
MCPManager.getServerToolFunctionsSnapshot (cyclomatic 22) packages/api/src/mcp/MCPManager.ts:816— MCPManager.getServerToolFunctionsSnapshot 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.createMCPCatalogStore.getCachedTools (cyclomatic 22) packages/api/src/mcp/catalog/store.ts:534— store.createMCPCatalogStore.getCachedTools has cyclomatic complexity 22 (threshold 15). Of this number, 11 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.
config.buildLangfuseConfig (cyclomatic 22) packages/api/src/langfuse/config.ts:249— config.buildLangfuseConfig 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.
outcomes.resolvePredecessorMismatch (cyclomatic 22) packages/chat/src/core/resumable/outcomes.ts:17— outcomes.resolvePredecessorMismatch 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.
useSteering.useSteering (cyclomatic 22) packages/chat/src/react/steering/useSteering.ts:130— useSteering.useSteering 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, name the conditions: bind each compound test to a 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.isCodeWorkspaceEnvironment (cyclomatic 22) packages/data-provider/src/code/workspace.ts:124— workspace.isCodeWorkspaceEnvironment 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.
config.isPrivateIPv4Literal (cyclomatic 22) packages/data-provider/src/config.ts:276— config.isPrivateIPv4Literal 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.
actions.openapiToFunction (cyclomatic 22) packages/data-provider/src/actions.ts:484— actions.openapiToFunction 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.
actions.validateActionDomain (cyclomatic 22) packages/data-provider/src/actions.ts:713— actions.validateActionDomain 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.
resolution.findShapeIssues (cyclomatic 22) packages/data-schemas/src/app/resolution.ts:1061— resolution.findShapeIssues 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.
resolution.resolveLayerAzureGroups (cyclomatic 22) packages/data-schemas/src/app/resolution.ts:1829— resolution.resolveLayerAzureGroups 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
stripUIResourceMarkers.collectCitationTokens (cyclomatic 22) packages/data-schemas/src/utils/stripUIResourceMarkers.ts:45— stripUIResourceMarkers.collectCitationTokens 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.
message.findOneAndMergeMessageProvenance (cyclomatic 22) packages/data-schemas/src/methods/message.ts:337— message.findOneAndMergeMessageProvenance 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.
message.createMessageMethods.bulkSaveMessages (cyclomatic 22) packages/data-schemas/src/methods/message.ts:1386— message.createMessageMethods.bulkSaveMessages 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 1393, 1453, 1506). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
message.createMessageMethods.getSubagentTaskControlReplay (cyclomatic 22) packages/data-schemas/src/methods/message.ts:2708— message.createMessageMethods.getSubagentTaskControlReplay 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.
message.createMessageMethods.listSubagentTasksForThreads (cyclomatic 22) packages/data-schemas/src/methods/message.ts:3837— message.createMessageMethods.listSubagentTasksForThreads has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 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.
share.getMessagesUpToTarget (cyclomatic 22) packages/data-schemas/src/methods/share.ts:826— share.getMessagesUpToTarget 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.
share.createShareMethods.createSharedLink (cyclomatic 22) packages/data-schemas/src/methods/share.ts:1260— share.createShareMethods.createSharedLink 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.
conversation.createConversationMethods.bulkSaveConvos (cyclomatic 22) packages/data-schemas/src/methods/conversation.ts:3382— conversation.createConversationMethods.bulkSaveConvos 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. This is NOT this file's highest cyclomatic complexity: conversation.validateAgentEventActorSuspension (cyclomatic 27) 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.
triggerDelivery.createAgentTriggerDeliveryMethods.publishStagedDelivery (cyclomatic 22) packages/data-schemas/src/methods/triggerDelivery.ts:1029— triggerDelivery.createAgentTriggerDeliveryMethods.publishStagedDelivery has cyclomatic complexity 22 (threshold 15). Of this number, 16 points are the body's own statements and 6 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.
setMessageOptions (cyclomatic 22) api/app/clients/BaseClient.js:452— setMessageOptions 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.
startServer (cyclomatic 22) REDACTED:445— startServer has cyclomatic complexity 22 (threshold 15). Of this number, 16 points are the body's own statements and 6 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.
AgentClient.useMemory (cyclomatic 21) api/server/controllers/agents/client.js:3305— AgentClient.useMemory 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.
socialLogins.configureSocialLogins (cyclomatic 21) REDACTED:83— socialLogins.configureSocialLogins 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.
messages.router.put("/:conversationId/:messageId") (cyclomatic 21) REDACTED:643— messages.router.put("/:conversationId/:messageId") 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.
index.router.get("/chat/status/:conversationId") (cyclomatic 21) api/server/routes/agents/index.js:475— index.router.get("/chat/status/:conversationId") 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.
useTokenUsage.useTokenUsage (cyclomatic 21) client/src/hooks/Chat/useTokenUsage.ts:47— useTokenUsage.useTokenUsage 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 6 function literals inside it that branch (lines 153, 133, 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.
useSpeechSettingsInit.useSpeechSettingsInit (cyclomatic 21) client/src/hooks/Config/useSpeechSettingsInit.ts:14— useSpeechSettingsInit.useSpeechSettingsInit 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 3 function literals inside it that branch (lines 39, 61, 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.
AgentHandoff.AgentHandoff (cyclomatic 21) client/src/components/Chat/Messages/Content/AgentHandoff.tsx:110— AgentHandoff.AgentHandoff has cyclomatic complexity 21 (threshold 15). 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Viewer.Viewer::renderBody (cyclomatic 21) client/src/components/Chat/Trace/Viewer.tsx:369— Viewer.Viewer::renderBody 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.
PinnedSection.DraggablePinnedRow (cyclomatic 21) client/src/components/Conversations/PinnedSection.tsx:99— PinnedSection.DraggablePinnedRow has cyclomatic complexity 21 (threshold 15). Of this number, 11 points are the body's own statements and 10 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.
catalog.buildCatalog (cyclomatic 21) client/src/components/SidePanel/Agents/Tools/items/catalog.ts:121— catalog.buildCatalog 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.
SkillsDialog.SkillsDialog (cyclomatic 21) client/src/components/SidePanel/Agents/Tools/SkillsDialog.tsx:47— SkillsDialog.SkillsDialog 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 4 function literals inside it that branch (lines 116, 74, 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.
AssistantAvatar.Avatar (cyclomatic 21) client/src/components/SidePanel/Builder/AssistantAvatar.tsx:29— AssistantAvatar.Avatar 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 5 function items inside it that branch (a function literal at line 127, handleFileChange, a function literal at line 64, …). 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.
MemoryPanel.MemoryPanel (cyclomatic 21) client/src/components/SidePanel/Memories/MemoryPanel.tsx:33— MemoryPanel.MemoryPanel 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
drafts.captureComposerDraft (cyclomatic 21) client/src/utils/drafts.ts:548— drafts.captureComposerDraft 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 4 function literals inside it that branch (lines 556, 589, 575, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
submissions.getModelParameterWrapperFields (cyclomatic 21) packages/api/src/protection/adapters/submissions.ts:389— submissions.getModelParameterWrapperFields 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.
InMemoryJobStore.enqueueSteerWithReceipt (cyclomatic 21) packages/api/src/stream/implementations/InMemoryJobStore.ts:1937— InMemoryJobStore.enqueueSteerWithReceipt 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.
GenerationJobManager.isOAuthReplayEvent (cyclomatic 21) packages/api/src/stream/GenerationJobManager.ts:573— GenerationJobManager.isOAuthReplayEvent 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.
inference.customSchema (cyclomatic 21) packages/api/src/agents/inference.ts:365— inference.customSchema 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.
provenance.visitSemanticUserSubmittedPaths (cyclomatic 21) packages/api/src/protection/provenance.ts:226— provenance.visitSemanticUserSubmittedPaths 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
manifest.createRunFileManifest.publish (cyclomatic 21) packages/api/src/agents/files/manifest.ts:327— manifest.createRunFileManifest.publish has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 358, 361). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
reservation.reserveSkillBlob (cyclomatic 21) packages/api/src/skills/reservation.ts:118— reservation.reserveSkillBlob 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.
service.convertInputToMessages (cyclomatic 21) packages/api/src/agents/responses/service.ts:298— service.convertInputToMessages has cyclomatic complexity 21 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
host.parseSteerResult (cyclomatic 21) packages/api/src/agents/triggers/host.ts:910— host.parseSteerResult 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.
legacy.mergeAgentOcrConversion (cyclomatic 21) packages/api/src/agents/legacy.ts:59— legacy.mergeAgentOcrConversion 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.
service.createAgentTriggerService.recoverPurges (cyclomatic 21) packages/api/src/agents/triggers/service.ts:456— service.createAgentTriggerService.recoverPurges 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 items inside it that branch (a function literal at line 486, isolated, a function literal at line 567). 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.
view.createParentSubagentIndexHandler (cyclomatic 21) packages/api/src/agents/view.ts:490— view.createParentSubagentIndexHandler 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 3 function literals inside it that branch (lines 491, 538, 520). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
metrics.createMetrics.metricsMiddleware (cyclomatic 21) REDACTED:948— metrics.createMetrics.metricsMiddleware 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 4 function items inside it that branch (complete, markSSEStream, a function literal at line 976, …). 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.
ip.isPrivateIPv4 (cyclomatic 21) packages/api/src/auth/ip.ts:20— ip.isPrivateIPv4 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.
openidRoleSync.selectOpenIdRole (cyclomatic 21) packages/api/src/auth/openidRoleSync.ts:250— openidRoleSync.selectOpenIdRole 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.
session.createOpenIDSessionRefreshService.rollbackSessionPublication (cyclomatic 21) packages/api/src/auth/openid/session.ts:1320— session.createOpenIDSessionRefreshService.rollbackSessionPublication 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 branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
auth.getUserMCPAuthMap (cyclomatic 21) packages/api/src/mcp/auth.ts:16— auth.getUserMCPAuthMap 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.
oidc.processOpenIDPlaceholders (cyclomatic 21) REDACTED:269— oidc.processOpenIDPlaceholders has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
MCPConnection.fetchOrderedToolsSnapshot (cyclomatic 21) packages/api/src/mcp/connection.ts:3013— MCPConnection.fetchOrderedToolsSnapshot 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: MCPConnection.setupTransportErrorHandlers (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.
MCPManager.discoverServerTools (cyclomatic 21) packages/api/src/mcp/MCPManager.ts:605— MCPManager.discoverServerTools 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
key.loadServiceKey (cyclomatic 21) packages/api/src/utils/key.ts:26— key.loadServiceKey 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.
error.ErrorController (cyclomatic 21) packages/api/src/middleware/error.ts:61— error.ErrorController 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.createScheduleMCPConsentService.view (cyclomatic 21) packages/api/src/schedules/authorization/service.ts:129— service.createScheduleMCPConsentService.view 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.
handlers.createSkillsHandlers.patch (cyclomatic 21) packages/api/src/skills/handlers.ts:538— handlers.createSkillsHandlers.patch 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.
classification.buildToolClassification (cyclomatic 21) packages/api/src/tools/classification.ts:396— classification.buildToolClassification 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.
reader.createLangfuseTraceReader.getRecord (cyclomatic 21) packages/api/src/langfuse/reader.ts:1148— reader.createLangfuseTraceReader.getRecord 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.
RedisJobStore.parseResolvedAskUserQuestions (cyclomatic 21) packages/api/src/stream/implementations/RedisJobStore.ts:5944— RedisJobStore.parseResolvedAskUserQuestions 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 one function literal inside it that branches (line 5957). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
Summary.Summary (cyclomatic 21) packages/chat/src/components/Summary.tsx:202— Summary.Summary 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 5 function literals inside it that branch (lines 241, 254, 214, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
failure.handleServedError (cyclomatic 21) packages/chat/src/core/resumable/failure.ts:19— failure.handleServedError 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.
Composer.Composer (cyclomatic 21) packages/client/src/components/Composer.tsx:103— Composer.Composer has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to 2 function items inside it that branch (handleKeyDown, handleKeyDown::defaultVerdict). 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.
InputWithDropDown.InputWithDropdown (cyclomatic 21) packages/client/src/components/InputWithDropDown.tsx:16— InputWithDropDown.InputWithDropdown 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 8 function items inside it that branch (handleKeyDown, handleSelect, a function literal at line 72, …). 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.
MultiSelect.MultiSelect (cyclomatic 21) packages/client/src/components/MultiSelect.tsx:84— MultiSelect.MultiSelect 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
parts.toUIPart (cyclomatic 21) packages/data-provider/src/parts.ts:550— parts.toUIPart 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.
codeEnvironment.createCodeEnvironmentMethods.createCodeEnvironmentWithinOwnerLimit (cyclomatic 21) packages/data-schemas/src/methods/codeEnvironment.ts:565— codeEnvironment.createCodeEnvironmentMethods.createCodeEnvironmentWithinOwnerLimit 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.
userGroup.collectMemberIdsFromGroupUpdate (cyclomatic 21) packages/data-schemas/src/methods/userGroup.ts:111— userGroup.collectMemberIdsFromGroupUpdate has cyclomatic complexity 21 (threshold 15). Of this number, 14 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.
share.anonymizeMessages.messages (cyclomatic 21) packages/data-schemas/src/methods/share.ts:628— share.anonymizeMessages.messages 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.
skill.extractAlwaysApplyFromBody (cyclomatic 21) packages/data-schemas/src/methods/skill.ts:869— skill.extractAlwaysApplyFromBody 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.
triggerDelivery.createAgentTriggerDeliveryMethods.claimNextAgentTriggerDelivery (cyclomatic 21) packages/data-schemas/src/methods/triggerDelivery.ts:1501— triggerDelivery.createAgentTriggerDeliveryMethods.claimNextAgentTriggerDelivery 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.
triggerDelivery.createAgentTriggerDeliveryMethods.claimAgentBackgroundToolResults (cyclomatic 21) packages/data-schemas/src/methods/triggerDelivery.ts:2819— triggerDelivery.createAgentTriggerDeliveryMethods.claimAgentBackgroundToolResults 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.
processFileUpload (cyclomatic 21) api/server/services/Files/process.js:629— processFileUpload has cyclomatic complexity 21 (threshold 15). Of this number, 16 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.
indexSync.ensureFilterableAttributes (cyclomatic 20) api/db/indexSync.js:89— indexSync.ensureFilterableAttributes has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
PermissionsController.getResourcePermissions (cyclomatic 20) api/server/controllers/PermissionsController.js:244— PermissionsController.getResourcePermissions 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.
memories.router.patch("/:key") (cyclomatic 20) api/server/routes/memories.js:316— memories.router.patch("/:key") 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.
canAccessResource.canAccessResource (cyclomatic 20) api/server/middleware/accessResources/canAccessResource.js:35— canAccessResource.canAccessResource 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 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.
files.router.get("/download/:userId/:file_id") (cyclomatic 20) REDACTED:635— files.router.get("/download/:userId/:file_id") 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.
importers.processConversation (cyclomatic 20) api/server/utils/import/importers.js:444— importers.processConversation 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.
socialLogin.socialLogin (cyclomatic 20) api/strategies/socialLogin.js:15— socialLogin.socialLogin 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 2 function literals inside it that branch (lines 16, 52). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
reasoning.resolveSubmittedReasoning (cyclomatic 20) client/src/hooks/Chat/ask/reasoning.ts:40— reasoning.resolveSubmittedReasoning 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.
abort.useAbortHandlers.abortConversation (cyclomatic 20) client/src/hooks/SSE/abort.ts:119— abort.useAbortHandlers.abortConversation 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.
announcements.useResumeAnnouncements (cyclomatic 20) client/src/hooks/SSE/announcements.ts:22— announcements.useResumeAnnouncements 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 81, 155). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AuthLayout.AuthLayout (cyclomatic 20) client/src/components/Auth/AuthLayout.tsx:13— AuthLayout.AuthLayout 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.
TwoFactorScreen.TwoFactorScreen (cyclomatic 20) client/src/components/Auth/TwoFactorScreen.tsx:31— TwoFactorScreen.TwoFactorScreen 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 4 function literals inside it that branch (lines 69, 47, 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.
Button.BackgroundTasksButton::jumpToTool (cyclomatic 20) client/src/components/Chat/BackgroundTasks/Button.tsx:92— Button.BackgroundTasksButton::jumpToTool 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: one other method here (Button.BackgroundTasksButton) 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.
ActivityPhaseGroup.LivePhaseHeader (cyclomatic 20) client/src/components/Chat/Messages/Content/ActivityPhaseGroup.tsx:278— ActivityPhaseGroup.LivePhaseHeader 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RetrievalCall.extractFileSources (cyclomatic 20) client/src/components/Chat/Messages/Content/RetrievalCall.tsx:30— RetrievalCall.extractFileSources 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.
PresetItems.PresetItems (cyclomatic 20) client/src/components/Chat/Menus/Presets/PresetItems.tsx:48— PresetItems.PresetItems has cyclomatic complexity 20 (threshold 15). Of this number, 12 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.
HeaderMenu.HeaderMenu (cyclomatic 20) client/src/components/Chat/Menus/HeaderMenu.tsx:25— HeaderMenu.HeaderMenu 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.
SearchResults.SearchResults (cyclomatic 20) client/src/components/Chat/Menus/Endpoints/components/SearchResults.tsx:175— SearchResults.SearchResults 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 2 function literals inside it that branch (lines 213, 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.
EventSubagentActivityGroup.EventSubagentRows (cyclomatic 20) client/src/components/Chat/Subagents/EventSubagentActivityGroup.tsx:85— EventSubagentActivityGroup.EventSubagentRows 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 5 function literals inside it that branch (lines 179, 122, 131, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ShareButton.ShareButton (cyclomatic 20) client/src/components/Conversations/ConvoOptions/ShareButton.tsx:33— ShareButton.ShareButton has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 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.
LimitError.LimitError (cyclomatic 20) client/src/components/Messages/Content/Error/LimitError.tsx:107— LimitError.LimitError 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.
PasskeyItem.PasskeyItem (cyclomatic 20) client/src/components/Nav/SettingsTabs/Account/Passkeys/PasskeyItem.tsx:62— PasskeyItem.PasskeyItem has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 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.
ApprovalOption.ApprovalOption (cyclomatic 20) client/src/components/SidePanel/Agents/ApprovalOption.tsx:28— ApprovalOption.ApprovalOption has cyclomatic complexity 20 (threshold 15). Of this number, 14 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.
MemoryCreateDialog.MemoryCreateDialog (cyclomatic 20) client/src/components/SidePanel/Memories/MemoryCreateDialog.tsx:25— MemoryCreateDialog.MemoryCreateDialog has cyclomatic complexity 20 (threshold 15). 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CreateSkillForm.CreateSkillForm (cyclomatic 20) client/src/components/Skills/forms/CreateSkillForm.tsx:63— CreateSkillForm.CreateSkillForm 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 5 function items inside it that branch (a function literal at line 166, a function literal at line 85, onSubmit, …). 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.
AdminSettingsDialog.AdminSettingsDialog (cyclomatic 20) client/src/components/ui/AdminSettingsDialog.tsx:112— AdminSettingsDialog.AdminSettingsDialog has cyclomatic complexity 20 (threshold 15). Of this number, 10 points are the body's own statements and 10 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.
useAttachExisting.useAttachExisting (cyclomatic 20) client/src/hooks/Files/useAttachExisting.ts:50— useAttachExisting.useAttachExisting 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 74). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
useAttachItems.useAttachItems.entries::build (cyclomatic 20) client/src/hooks/Input/useAttachItems.tsx:226— useAttachItems.useAttachItems.entries::build 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.
useMentions.useMentions.options (cyclomatic 20) client/src/hooks/Input/useMentions.ts:174— useMentions.useMentions.options 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
latex.tokenizeMathSpan (cyclomatic 20) client/src/utils/latex.ts:37— latex.tokenizeMathSpan 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 4 function items inside it that branch (content, open, escape, …). 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.
audit.runAuditedPermissionUpdate (cyclomatic 20) packages/api/src/acl/audit.ts:220— audit.runAuditedPermissionUpdate 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 3 function items inside it that branch (a function literal at line 275, recordFailures, flushDeferred). 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.
config.readRenames (cyclomatic 20) packages/api/src/admin/config.ts:1563— config.readRenames 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.createActivityPhaseWiring.partitionAt (cyclomatic 20) packages/api/src/agents/activityPhases/runtime.ts:1171— runtime.createActivityPhaseWiring.partitionAt has cyclomatic complexity 20 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InMemoryEventTransport.subscribe (cyclomatic 20) packages/api/src/stream/implementations/InMemoryEventTransport.ts:65— InMemoryEventTransport.subscribe 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 6 function items inside it that branch (deliver, a function literal at line 109, a function literal at line 156, …). 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.
view.parseDigestRequest (cyclomatic 20) packages/api/src/agents/digest/view.ts:92— view.parseDigestRequest 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.
memory.createMemoryTool (cyclomatic 20) packages/api/src/agents/memory.ts:134— memory.createMemoryTool 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 one function literal inside it that branches (line 171). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
BackgroundTaskRegistryClass.create (cyclomatic 20) packages/api/src/agents/background.ts:1328— BackgroundTaskRegistryClass.create 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.
handlers.createOpenAIToolCallStream.onRunStep (cyclomatic 20) packages/api/src/agents/openai/handlers.ts:500— handlers.createOpenAIToolCallStream.onRunStep 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.
workspace.readBoundedJson (cyclomatic 20) packages/api/src/code/workspace.ts:773— workspace.readBoundedJson 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.
modelBoundContent.projectProviderMessage (cyclomatic 20) packages/api/src/middleware/modelBoundContent.ts:1964— modelBoundContent.projectProviderMessage 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.buildSubagentConfigs (cyclomatic 20) packages/api/src/agents/run.ts:1911— run.buildSubagentConfigs 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.
processing.createHostEditProcessor.apply (cyclomatic 20) packages/api/src/agents/files/processing.ts:59— processing.createHostEditProcessor.apply 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 103, 153, 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.
handlers.handleCreateFileCall (cyclomatic 20) packages/api/src/agents/handlers.ts:4371— handlers.handleCreateFileCall 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.
host.steer (cyclomatic 20) packages/api/src/agents/triggers/host.ts:957— host.steer 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.
discovery.resolveSubagentGraphs (cyclomatic 20) packages/api/src/agents/discovery.ts:301— discovery.resolveSubagentGraphs has cyclomatic complexity 20 (threshold 15). Of this number, 14 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.
compatibility.planPluginHooks (cyclomatic 20) REDACTED:552— compatibility.planPluginHooks 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.registerPluginHooks (cyclomatic 20) packages/api/src/agents/hooks/runtime.ts:343— runtime.registerPluginHooks 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 (runtime.registerPluginHooks::hook) 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. This is NOT this file's highest cyclomatic complexity: runtime.createPluginHookPayload (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.
email.createEmailChangeService.requestEmailChange (cyclomatic 20) packages/api/src/auth/email.ts:413— email.createEmailChangeService.requestEmailChange 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.
handlers.createPasskeyHandlers.authenticatePasskey (cyclomatic 20) packages/api/src/auth/passkey/handlers.ts:602— handlers.createPasskeyHandlers.authenticatePasskey 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.
attachments.primeAgentAttachments (cyclomatic 20) packages/api/src/code/attachments.ts:1029— attachments.primeAgentAttachments has cyclomatic complexity 20 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
credentials.bootstrapCredentials (cyclomatic 20) packages/api/src/credentials.ts:276— credentials.bootstrapCredentials 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.
oauth.parseStored (cyclomatic 20) packages/api/src/pulls/oauth.ts:214— oauth.parseStored 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.
MCPTokenStorage.adoptRotatedTokens (cyclomatic 20) packages/api/src/mcp/oauth/tokens.ts:1509— MCPTokenStorage.adoptRotatedTokens 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.
previews.previewToolCall (cyclomatic 20) packages/api/src/messages/previews.ts:717— previews.previewToolCall 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.
protection.assertSkillFileContentAllowed (cyclomatic 20) packages/api/src/skills/protection.ts:20— protection.assertSkillFileContentAllowed 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.syncSource::syncPreparedSkill (cyclomatic 20) packages/api/src/skills/sync/github.ts:1898— github.syncSource::syncPreparedSkill 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 (github.syncSource) 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.
conformance.helper.verifyAuthorizationFixture (cyclomatic 20) packages/api/src/schedules/authorization/conformance.helper.ts:13— conformance.helper.verifyAuthorizationFixture 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.
resume.mergeResumeMessages (cyclomatic 20) packages/chat/src/core/resumable/resume.ts:175— resume.mergeResumeMessages 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.
recovery.useQueuedRecovery (cyclomatic 20) packages/chat/src/react/steering/recovery.ts:18— recovery.useQueuedRecovery 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 3 function literals inside it that branch (lines 46, 156, 136). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Avatar.Avatar (cyclomatic 20) packages/client/src/components/Avatar.tsx:16— Avatar.Avatar 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 33, 37, 28). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RequestExecutor.execute (cyclomatic 20) packages/data-provider/src/actions.ts:306— RequestExecutor.execute 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
azure.mapModelToAzureConfig (cyclomatic 20) packages/data-provider/src/azure.ts:138— azure.mapModelToAzureConfig 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.
parameterSettings.resolveReasoningSettingForTarget (cyclomatic 20) packages/data-provider/src/parameterSettings.ts:1447— parameterSettings.resolveReasoningSettingForTarget has cyclomatic complexity 20 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
parameterSettings.applyModelFamilyDefaults (cyclomatic 20) packages/data-provider/src/parameterSettings.ts:1711— parameterSettings.applyModelFamilyDefaults has cyclomatic complexity 20 (threshold 15). Of this number, 11 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.
object-traverse.isObject (cyclomatic 20) packages/data-schemas/src/utils/object-traverse.ts:48— object-traverse.isObject 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.
userGroup.createUserGroupMethods.getMemberGroupIds (cyclomatic 20) packages/data-schemas/src/methods/userGroup.ts:326— userGroup.createUserGroupMethods.getMemberGroupIds has cyclomatic complexity 20 (threshold 15). 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 353). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
auditLog.buildFilter (cyclomatic 20) packages/data-schemas/src/methods/auditLog.ts:246— auditLog.buildFilter 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.
message.retainSubagentControlReceipts (cyclomatic 20) packages/data-schemas/src/methods/message.ts:117— message.retainSubagentControlReceipts has cyclomatic complexity 20 (threshold 15). Of this number, 16 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.
queuedTurn.createAgentQueuedTurnMethods.getEffectiveAgentQueuedTurnPredecessor (cyclomatic 20) packages/data-schemas/src/methods/queuedTurn.ts:2577— queuedTurn.createAgentQueuedTurnMethods.getEffectiveAgentQueuedTurnPredecessor 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.
triggerDelivery.createAgentTriggerDeliveryMethods.settleAgentEventActorReceipt (cyclomatic 20) packages/data-schemas/src/methods/triggerDelivery.ts:3560— triggerDelivery.createAgentTriggerDeliveryMethods.settleAgentEventActorReceipt 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.
insights.createInsightsMethods.getInsights (cyclomatic 20) packages/data-schemas/src/methods/insights.ts:288— insights.createInsightsMethods.getInsights 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
design.disabledExpressions (cyclomatic 20) scripts/eslint/design.mjs:730— design.disabledExpressions 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.
generateActivityLabelViaRun (cyclomatic 20) api/server/controllers/agents/client.js:1304— generateActivityLabelViaRun has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 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.
getEventActorContext (cyclomatic 20) api/server/controllers/agents/client.js:2237— getEventActorContext 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.
blockFilteredActionContent (cyclomatic 20) REDACTED:117— blockFilteredActionContent 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 2 function literals inside it that branch (lines 128, 163). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cyclomatic 20) api/server/routes/memories.js:316— (anonymous) 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.
v1.blockFilteredAgentContent (cyclomatic 19) REDACTED:179— v1.blockFilteredAgentContent 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.
images.router.post("/") (cyclomatic 19) api/server/routes/files/images.js:44— images.router.post("/") 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
fork.getMessagesUpToTargetLevel (cyclomatic 19) api/server/utils/import/fork.js:185— fork.getMessagesUpToTargetLevel 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.
usePresets.usePresets (cyclomatic 19) client/src/hooks/Conversations/usePresets.ts:31— usePresets.usePresets 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 3 function literals inside it that branch (lines 52, 119, 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.
usePastedTextEdit.usePastedTextEdit.saveEdit (cyclomatic 19) client/src/hooks/Files/usePastedTextEdit.ts:295— usePastedTextEdit.usePastedTextEdit.saveEdit has cyclomatic complexity 19 (threshold 15). Of this number, 11 points are the body's own statements and 8 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.
useToolToggle.useToolToggle (cyclomatic 19) client/src/hooks/Plugins/useToolToggle.ts:29— useToolToggle.useToolToggle 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 8 function literals inside it that branch (lines 128, 114, 51, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SocialLoginRender.SocialLoginRender (cyclomatic 19) client/src/components/Auth/SocialLoginRender.tsx:16— SocialLoginRender.SocialLoginRender 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.
LoginForm.LoginForm (cyclomatic 19) client/src/components/Auth/LoginForm.tsx:26— LoginForm.LoginForm has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 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.
Registration.Registration (cyclomatic 19) client/src/components/Auth/Registration.tsx:22— Registration.Registration 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Attachment.AttachmentGroup (cyclomatic 19) client/src/components/Chat/Messages/Content/Parts/Attachment.tsx:504— Attachment.AttachmentGroup has cyclomatic complexity 19 (threshold 15). Of this number, 10 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.
handle.parseSubagentBackgroundHandle (cyclomatic 19) client/src/components/Chat/Messages/Content/Parts/handle.ts:115— handle.parseSubagentBackgroundHandle 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.
rail.traceTo (cyclomatic 19) client/src/components/Chat/Messages/Content/rail.tsx:408— rail.traceTo 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MessagesView.MessagesViewContent (cyclomatic 19) client/src/components/Chat/Messages/MessagesView.tsx:28— MessagesView.MessagesViewContent has cyclomatic complexity 19 (threshold 15). 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Queue.Queue (cyclomatic 19) client/src/components/Chat/Input/Composer/Queue.tsx:722— Queue.Queue has cyclomatic complexity 19 (threshold 15). Of this number, 14 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.
Reasoning.ReasoningControl (cyclomatic 19) client/src/components/Chat/Input/Reasoning.tsx:48— Reasoning.ReasoningControl has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 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.
Thinking.ThinkingControl (cyclomatic 19) client/src/components/Chat/Input/Composer/Thinking.tsx:22— Thinking.ThinkingControl 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Files.FileGrid (cyclomatic 19) client/src/components/Chat/Input/Composer/Files.tsx:204— Files.FileGrid has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 268, a function literal at line 228, a function literal at line 262, …). 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.
ParentSubagentsProvider.ParentSubagentsProvider (cyclomatic 19) client/src/components/Chat/Subagents/ParentSubagentsProvider.tsx:34— ParentSubagentsProvider.ParentSubagentsProvider has cyclomatic complexity 19 (threshold 15). Of this number, 14 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.
recovery.recoverTaskContent (cyclomatic 19) client/src/components/Chat/Subagents/recovery.ts:245— recovery.recoverTaskContent 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.
preview.buildApprovalPreview (cyclomatic 19) client/src/components/Chat/approval/preview.ts:110— preview.buildApprovalPreview 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.
mcpServerUtils.shouldShowActionButton (cyclomatic 19) client/src/components/MCP/mcpServerUtils.ts:192— mcpServerUtils.shouldShowActionButton 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.
SharedLinks.SharedLinks (cyclomatic 19) client/src/components/Nav/SettingsTabs/Data/SharedLinks.tsx:41— SharedLinks.SharedLinks 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 8 function literals inside it that branch (lines 98, 137, 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.
AgentConfig.AgentConfig (cyclomatic 19) client/src/components/SidePanel/Agents/AgentConfig.tsx:21— AgentConfig.AgentConfig 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 3 function literals inside it that branch (lines 192, 225, 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.
Panel.Parameters (cyclomatic 19) client/src/components/SidePanel/Parameters/Panel.tsx:27— Panel.Parameters 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 9 function literals inside it that branch (lines 102, 53, 93, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SkillTextEditor.SkillTextEditor (cyclomatic 19) client/src/components/Skills/display/SkillTextEditor.tsx:17— SkillTextEditor.SkillTextEditor 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 3 function items inside it that branch (save, a function literal at line 82, 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.
plugin.processTree (cyclomatic 19) client/src/components/Web/plugin.ts:99— plugin.processTree 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 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.
mutations.useUploadFileMutation (cyclomatic 19) client/src/data-provider/Files/mutations.ts:17— mutations.useUploadFileMutation 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 5 function literals inside it that branch (lines 47, 31, 120, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useAskAnswerMode.useAskAnswerMode.handleComposerKeyDown (cyclomatic 19) client/src/hooks/Input/useAskAnswerMode.ts:522— useAskAnswerMode.useAskAnswerMode.handleComposerKeyDown 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.
bootstrap.installRumBootstrap (cyclomatic 19) client/src/lib/rum/bootstrap.js:24— bootstrap.installRumBootstrap 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 items inside it that branch (enqueueRumEvent, persistRumQueue, 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.
approval.parseAskUserQuestionsArgs (cyclomatic 19) client/src/utils/approval.ts:87— approval.parseAskUserQuestionsArgs 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.
artifacts.getArtifactDownloadFilename (cyclomatic 19) client/src/utils/artifacts.ts:129— artifacts.getArtifactDownloadFilename 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.
files.isProviderAttachType (cyclomatic 19) client/src/utils/files.ts:532— files.isProviderAttachType 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.
messages.preserveStreamedContentIdentity (cyclomatic 19) client/src/utils/messages.ts:297— messages.preserveStreamedContentIdentity 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: messages.areMessageFieldsEqual (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.
pattern.readCustomPattern (cyclomatic 19) packages/api/src/protection/detectors/pattern.ts:189— pattern.readCustomPattern 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.
secrets.preserveConfigSecrets (cyclomatic 19) packages/api/src/admin/secrets.ts:1766— secrets.preserveConfigSecrets 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.
InMemoryJobStore.drainSteers (cyclomatic 19) packages/api/src/stream/implementations/InMemoryJobStore.ts:2045— InMemoryJobStore.drainSteers 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.
InMemoryJobStore.isValidParkedSteer (cyclomatic 19) packages/api/src/stream/implementations/InMemoryJobStore.ts:84— InMemoryJobStore.isValidParkedSteer 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.
ApprovalLifecycle.pause (cyclomatic 19) packages/api/src/stream/ApprovalLifecycle.ts:105— ApprovalLifecycle.pause 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.
GenerationJobManagerClass.finishFencedRuntimeRetirement (cyclomatic 19) packages/api/src/stream/GenerationJobManager.ts:7437— GenerationJobManagerClass.finishFencedRuntimeRetirement 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.
ActivityRecorder.record (cyclomatic 19) packages/api/src/agents/digest/recorder.ts:127— ActivityRecorder.record 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.
background.serializeSubagentSnapshot (cyclomatic 19) packages/api/src/agents/background.ts:2372— background.serializeSubagentSnapshot 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.
skills.injectSkillCatalog (cyclomatic 19) packages/api/src/agents/skills.ts:670— skills.injectSkillCatalog 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.
provenance.getUserSubmittedMessageFieldPathState (cyclomatic 19) packages/api/src/protection/provenance.ts:426— provenance.getUserSubmittedMessageFieldPathState 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.
handlers.handleWorkspaceFileRead (cyclomatic 19) packages/api/src/agents/handlers.ts:2358— handlers.handleWorkspaceFileRead 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.
handlers.loadSkillFileTextForAuthoring (cyclomatic 19) packages/api/src/agents/handlers.ts:3380— handlers.loadSkillFileTextForAuthoring 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.
SubagentThreadTaskStore.controlResultFromReceipt (cyclomatic 19) packages/api/src/agents/subagentThreads.ts:881— SubagentThreadTaskStore.controlResultFromReceipt 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.
request.handleSteerArmInternal (cyclomatic 19) packages/api/src/agents/steering/request.ts:1036— request.handleSteerArmInternal 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.
host.generateReasoningLabelRevision (cyclomatic 19) packages/api/src/agents/reasoningLabels/host.ts:257— host.generateReasoningLabelRevision has cyclomatic complexity 19 (threshold 15). 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
domain.isDomainAllowedCore (cyclomatic 19) packages/api/src/auth/domain.ts:298— domain.isDomainAllowedCore 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.
openid.findOpenIDUser (cyclomatic 19) packages/api/src/auth/openid.ts:227— openid.findOpenIDUser 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.
rename.createRenameConversationHandler (cyclomatic 19) packages/api/src/conversations/rename.ts:40— rename.createRenameConversationHandler 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 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.
delete.createCodeFileDeleter (cyclomatic 19) packages/api/src/files/code/delete.ts:16— delete.createCodeFileDeleter 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 47). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
image.readWindowedSandboxImage (cyclomatic 19) packages/api/src/files/code/image.ts:269— image.readWindowedSandboxImage 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.
service.createProvisionService.checkSessionsAlive (cyclomatic 19) packages/api/src/files/provision/service.ts:490— service.createProvisionService.checkSessionsAlive 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
priming.selectCodeFiles (cyclomatic 19) packages/api/src/files/code/priming.ts:102— priming.selectCodeFiles 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 literals inside it that branch (lines 143, 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.
mime.sniffImageMimeType (cyclomatic 19) packages/api/src/files/mime.ts:60— mime.sniffImageMimeType 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.
speech.createSpeechChunkProcessor (cyclomatic 19) packages/api/src/files/speech.ts:33— speech.createSpeechChunkProcessor 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 57). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
zod.dropSchemaFields (cyclomatic 19) packages/api/src/mcp/zod.ts:14— zod.dropSchemaFields 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.
balance.buildBalanceUpdateFields (cyclomatic 19) packages/api/src/middleware/balance.ts:66— balance.buildBalanceUpdateFields 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.
protection.decodeEncodedText (cyclomatic 19) packages/api/src/shared-links/protection.ts:1070— protection.decodeEncodedText 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.
handlers.createMemoryManagementHandlers.updateById (cyclomatic 19) packages/api/src/memory/handlers.ts:72— handlers.createMemoryManagementHandlers.updateById 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.
service.createSchedulesService.isScheduleLive (cyclomatic 19) packages/api/src/schedules/service.ts:1735— service.createSchedulesService.isScheduleLive 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.
service.createSchedulesService.claimScheduleResume (cyclomatic 19) packages/api/src/schedules/service.ts:1836— service.createSchedulesService.claimScheduleResume 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 2 function literals inside it that branch (lines 1859, 1890). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.syncSkillFiles (cyclomatic 19) packages/api/src/skills/sync/github.ts:1438— github.syncSkillFiles 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
deletionService.createSkillDeletionService.deleteWithClaim (cyclomatic 19) packages/api/src/skills/deletionService.ts:130— deletionService.createSkillDeletionService.deleteWithClaim has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 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.
crud.parseS3KeyParts (cyclomatic 19) packages/api/src/storage/s3/crud.ts:194— crud.parseS3KeyParts 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.
theme.collectModeIssues (cyclomatic 19) packages/data-provider/src/theme.ts:772— theme.collectModeIssues has cyclomatic complexity 19 (threshold 15). Of this number, 10 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.
resolution.getConfigOverrideIssues (cyclomatic 19) packages/data-schemas/src/app/resolution.ts:1144— resolution.getConfigOverrideIssues has cyclomatic complexity 19 (threshold 15). Of this number, 13 points are the body's own statements and 6 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.
resolution.withHiddenAzureGroups (cyclomatic 19) packages/data-schemas/src/app/resolution.ts:2006— resolution.withHiddenAzureGroups 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.
conformance.describeConfigStoreConformance (cyclomatic 19) packages/data-schemas/src/app/conformance.ts:115— conformance.describeConfigStoreConformance 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 13 function literals inside it that branch (lines 817, 839, 864, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
message.createMessageMethods.parseBackgroundToolResults (cyclomatic 19) packages/data-schemas/src/methods/message.ts:1985— message.createMessageMethods.parseBackgroundToolResults 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.
message.createMessageMethods.getMessagesForSubagentThreadView (cyclomatic 19) packages/data-schemas/src/methods/message.ts:2985— message.createMessageMethods.getMessagesForSubagentThreadView has cyclomatic complexity 19 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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.validateSkillFrontmatter (cyclomatic 19) packages/data-schemas/src/methods/skill.ts:432— skill.validateSkillFrontmatter 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.
triggerDelivery.createAgentTriggerDeliveryMethods.releaseAgentBackgroundToolResultClaims (cyclomatic 19) packages/data-schemas/src/methods/triggerDelivery.ts:2893— triggerDelivery.createAgentTriggerDeliveryMethods.releaseAgentBackgroundToolResultClaims 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
triggerDelivery.createAgentTriggerDeliveryMethods.deadLetterAgentTriggerDelivery (cyclomatic 19) packages/data-schemas/src/methods/triggerDelivery.ts:4469— triggerDelivery.createAgentTriggerDeliveryMethods.deadLetterAgentTriggerDelivery has cyclomatic complexity 19 (threshold 15). Of this number, 15 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.
design.disabledSense (cyclomatic 19) scripts/eslint/design.mjs:229— design.disabledSense 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.
static-checks.suppressionProblems (cyclomatic 19) scripts/static-checks.mts:1169— static-checks.suppressionProblems 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.
createAgentHandler (cyclomatic 19) REDACTED:723— createAgentHandler has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs 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.
filterFile (cyclomatic 19) api/server/services/Files/process.js:1780— filterFile 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.
callTool (cyclomatic 19) api/server/controllers/tools.js:110— callTool 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.
(anonymous) (cyclomatic 19) api/server/routes/files/images.js:44— (anonymous) has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs 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.
GeminiImageGen.convertImagesToInlineData (cyclomatic 18) api/app/clients/tools/structured/GeminiImageGen.js:132— GeminiImageGen.convertImagesToInlineData 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.
process.retrieveAndProcessFile (cyclomatic 18) api/server/services/Files/process.js:1578— process.retrieveAndProcessFile 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.
requireJwtAuth.requireJwtAuth (cyclomatic 18) api/server/middleware/requireJwtAuth.js:98— requireJwtAuth.requireJwtAuth 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 items inside it that branch (a function literal at line 176, logAuthenticationFailure, logFallbackSuccess, …). 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.
files.router.get("/code/download/:session_id/:fileId") (cyclomatic 18) REDACTED:355— files.router.get("/code/download/:session_id/:fileId") 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.
files.handleFileUpload (cyclomatic 18) REDACTED:793— files.handleFileUpload 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.
StreamRunManager.createToolCallStream::deltaHandler (cyclomatic 18) api/server/services/Runs/StreamRunManager.js:293— StreamRunManager.createToolCallStream::deltaHandler 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.
useUnseenBadge.useUnseenBadge (cyclomatic 18) client/src/hooks/Conversations/useUnseenBadge.ts:71— useUnseenBadge.useUnseenBadge 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 7 function literals inside it that branch (lines 84, 106, 138, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useUnseenConversations.useUnseenConversations (cyclomatic 18) client/src/hooks/Conversations/useUnseenConversations.ts:289— useUnseenConversations.useUnseenConversations 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 318, 300, 297). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useProgressiveRowMount.useProgressiveRowMount (cyclomatic 18) client/src/hooks/Messages/useProgressiveRowMount.tsx:83— useProgressiveRowMount.useProgressiveRowMount 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 6 function literals inside it that branch (lines 128, 153, 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.
finished.settleFinishedRun (cyclomatic 18) client/src/hooks/SSE/finished.ts:22— finished.settleFinishedRun 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CopyLink.CopyLink (cyclomatic 18) client/src/components/Agents/CopyLink.tsx:21— CopyLink.CopyLink has cyclomatic complexity 18 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useTasks.useBackgroundTasks (cyclomatic 18) client/src/components/Chat/BackgroundTasks/useTasks.ts:61— useTasks.useBackgroundTasks 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 5 function literals inside it that branch (lines 110, 108, 137, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ToolArtifactCard.ToolArtifactCard (cyclomatic 18) client/src/components/Chat/Messages/Content/Parts/ToolArtifactCard.tsx:60— ToolArtifactCard.ToolArtifactCard has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 99, a function literal at line 119, a function literal at line 95, …). 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.
background.parseDigestNode (cyclomatic 18) client/src/components/Chat/Messages/Content/Parts/background.ts:157— background.parseDigestNode 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.
hydration.PreviewedToolCallPart (cyclomatic 18) client/src/components/Chat/Messages/Content/hydration.tsx:65— hydration.PreviewedToolCallPart 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.
PendingTurn.PendingTurn (cyclomatic 18) client/src/components/Chat/Messages/PendingTurn.tsx:36— PendingTurn.PendingTurn has cyclomatic complexity 18 (threshold 15). Of this number, 9 points are the body's own statements and 9 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.
AskUserQuestionPopover.AskUserQuestionPopoverPanel (cyclomatic 18) client/src/components/Chat/Input/AskUserQuestionPopover.tsx:131— AskUserQuestionPopover.AskUserQuestionPopoverPanel 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, name the conditions: bind each compound test to a 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.TokenUsageIndicator (cyclomatic 18) client/src/components/Chat/Input/TokenUsage/index.tsx:84— index.TokenUsageIndicator has cyclomatic complexity 18 (threshold 15). Of this number, 14 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.
utils.getDisplayValue (cyclomatic 18) client/src/components/Chat/Menus/Endpoints/utils.ts:197— utils.getDisplayValue 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.
VirtualizedModelList.VirtualizedModelList (cyclomatic 18) client/src/components/Chat/Menus/Endpoints/components/VirtualizedModelList.tsx:41— VirtualizedModelList.VirtualizedModelList 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 4 function literals inside it that branch (lines 76, 70, 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.
EndpointItem.EndpointMenuContent (cyclomatic 18) client/src/components/Chat/Menus/Endpoints/components/EndpointItem.tsx:91— EndpointItem.EndpointMenuContent has cyclomatic complexity 18 (threshold 15). 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.
SubagentActivity.SubagentActivityContent (cyclomatic 18) client/src/components/Chat/Subagents/SubagentActivity.tsx:455— SubagentActivity.SubagentActivityContent 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SubagentConversation.ChildMessage (cyclomatic 18) client/src/components/Chat/Subagents/SubagentConversation.tsx:220— SubagentConversation.ChildMessage has cyclomatic complexity 18 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
body.drawFeet (cyclomatic 18) client/src/components/Lia/engine/body.ts:61— body.drawFeet 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.
SearchBar.SearchBar (cyclomatic 18) client/src/components/Nav/SearchBar.tsx:18— SearchBar.SearchBar 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 6 function items inside it that branch (a function literal at line 113, a function literal at line 154, a function literal at line 42, …). 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.
InstructionsPromptFields.InstructionsPromptFields (cyclomatic 18) client/src/components/SidePanel/Agents/InstructionsPromptFields.tsx:119— InstructionsPromptFields.InstructionsPromptFields 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 literals inside it that branch (lines 145, 135, 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.
SchedulePanel.SchedulePanel (cyclomatic 18) client/src/components/SidePanel/Schedules/SchedulePanel.tsx:15— SchedulePanel.SchedulePanel 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.
queries.useTitleGeneration (cyclomatic 18) client/src/data-provider/SSE/queries.ts:90— queries.useTitleGeneration 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 5 function literals inside it that branch (lines 158, 113, 133, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
privacy.sanitizeReplayEvent (cyclomatic 18) client/src/lib/rum/privacy.ts:108— privacy.sanitizeReplayEvent 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.
timestamps.cleanupTimestampedStorage (cyclomatic 18) client/src/utils/timestamps.ts:70— timestamps.cleanupTimestampedStorage has cyclomatic complexity 18 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AccessControlService.grantPermission (cyclomatic 18) packages/api/src/acl/accessControlService.ts:129— AccessControlService.grantPermission 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.
contentFilter.createContentFilter (cyclomatic 18) packages/api/src/middleware/contentFilter.ts:112— contentFilter.createContentFilter 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 113). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into 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.preserveArraySecrets (cyclomatic 18) packages/api/src/admin/secrets.ts:941— secrets.preserveArraySecrets 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.
wiring.captureActivityBlockContext (cyclomatic 18) packages/api/src/agents/activityLabels/wiring.ts:46— wiring.captureActivityBlockContext 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.
runtime.createActivityPhaseWiring (cyclomatic 18) packages/api/src/agents/activityPhases/runtime.ts:822— runtime.createActivityPhaseWiring 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 4 function literals inside it that branch (lines 898, 849, 834, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
GenerationJobManagerClass.takeoverGeneration (cyclomatic 18) packages/api/src/stream/GenerationJobManager.ts:3700— GenerationJobManagerClass.takeoverGeneration 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.
GenerationJobManagerClass.continueEarlyEventBootstrap (cyclomatic 18) packages/api/src/stream/GenerationJobManager.ts:5981— GenerationJobManagerClass.continueEarlyEventBootstrap 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 5994). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
settled.waitForGenerationSettled (cyclomatic 18) packages/api/src/stream/settled.ts:28— settled.waitForGenerationSettled 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 4 function literals inside it that branch (lines 60, 41, 51, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.isCodeExecutionApprovalBinding (cyclomatic 18) packages/api/src/agents/execution.ts:168— execution.isCodeExecutionApprovalBinding 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.
view.expandNodes (cyclomatic 18) packages/api/src/agents/digest/view.ts:524— view.expandNodes 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.
tools.buildHistoricalToolNames (cyclomatic 18) packages/api/src/agents/tools.ts:152— tools.buildHistoricalToolNames 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.
tools.registerFileAuthoringTools (cyclomatic 18) packages/api/src/agents/tools.ts:1327— tools.registerFileAuthoringTools 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.
skills.resolveAlwaysApplySkills (cyclomatic 18) packages/api/src/agents/skills.ts:1230— skills.resolveAlwaysApplySkills 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.
edits.parseEditConflict (cyclomatic 18) packages/api/src/code/edits.ts:239— edits.parseEditConflict 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.
messages.classifyProviderPart (cyclomatic 18) packages/api/src/protection/adapters/messages.ts:685— messages.classifyProviderPart 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
modelBoundContent.getStoredProviderContributionState (cyclomatic 18) packages/api/src/middleware/modelBoundContent.ts:2392— modelBoundContent.getStoredProviderContributionState 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.
handlers.detectToolInputSchemaKind (cyclomatic 18) packages/api/src/agents/handlers.ts:956— handlers.detectToolInputSchemaKind 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.
handlers.formatReadFileText (cyclomatic 18) packages/api/src/agents/handlers.ts:1094— handlers.formatReadFileText 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.
handlers.writeSandboxTextForAuthoring (cyclomatic 18) packages/api/src/agents/handlers.ts:2874— handlers.writeSandboxTextForAuthoring 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.
resume.resolveAskUserQuestionResume (cyclomatic 18) packages/api/src/agents/hitl/resume.ts:148— resume.resolveAskUserQuestionResume 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.
hookLoader.loadToolApprovalHooks (cyclomatic 18) REDACTED:67— hookLoader.loadToolApprovalHooks 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.
service.validateInputToolExchanges (cyclomatic 18) packages/api/src/agents/responses/service.ts:187— service.validateInputToolExchanges 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.
envelope.parseAgentTriggerEnvelope (cyclomatic 18) packages/api/src/agents/triggers/envelope.ts:332— envelope.parseAgentTriggerEnvelope 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.
delivery.prepareAgentTriggerDelivery (cyclomatic 18) packages/api/src/agents/triggers/delivery.ts:157— delivery.prepareAgentTriggerDelivery 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.
SubagentThreadTaskStore.controlResultReceipt (cyclomatic 18) packages/api/src/agents/subagentThreads.ts:962— SubagentThreadTaskStore.controlResultReceipt 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.
SubagentThreadTaskStore.destroyTaskControlTransport (cyclomatic 18) packages/api/src/agents/subagentThreads.ts:1246— SubagentThreadTaskStore.destroyTaskControlTransport 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.
SubagentThreadTaskStore.dropDeletedControlReceiptWork (cyclomatic 18) packages/api/src/agents/subagentThreads.ts:2887— SubagentThreadTaskStore.dropDeletedControlReceiptWork has cyclomatic complexity 18 (threshold 15). Of this number, 10 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.
AgentExecutionEnrollment.settleInternal (cyclomatic 18) packages/api/src/agents/remote/lifecycle.ts:121— AgentExecutionEnrollment.settleInternal 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.
protection.assertThreadMessagePage (cyclomatic 18) packages/api/src/assistants/protection.ts:144— protection.assertThreadMessagePage 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.
flight.createOpenIDRefreshFlightService.withOpenIDRefreshFlightLease (cyclomatic 18) packages/api/src/auth/openid/flight.ts:422— flight.createOpenIDRefreshFlightService.withOpenIDRefreshFlightLease 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
delivery.createOpenIDResponseDelivery (cyclomatic 18) packages/api/src/auth/openid/delivery.ts:48— delivery.createOpenIDResponseDelivery 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 63, 102, 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.
session.createOpenIDSessionRefreshService.publishResolvedSessionTokens (cyclomatic 18) packages/api/src/auth/openid/session.ts:1221— session.createOpenIDSessionRefreshService.publishResolvedSessionTokens 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.
environments.createCodeEnvironmentRegistry.listAccessibleConfigurations (cyclomatic 18) packages/api/src/code/environments.ts:505— environments.createCodeEnvironmentRegistry.listAccessibleConfigurations 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 4 function literals inside it that branch (lines 537, 590, 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.
decision.resolveConversationCodeEnvironmentDecision (cyclomatic 18) packages/api/src/code/decision.ts:78— decision.resolveConversationCodeEnvironmentDecision 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.
audio.encodeAndFormatAudios (cyclomatic 18) packages/api/src/files/encode/audio.ts:25— audio.encodeAndFormatAudios 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.
oauth.createPullRequestOAuth.refresh (cyclomatic 18) packages/api/src/pulls/oauth.ts:665— oauth.createPullRequestOAuth.refresh 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.
ServerConfigsDB.update (cyclomatic 18) packages/api/src/mcp/registry/db/ServerConfigsDB.ts:260— ServerConfigsDB.update 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.
MCPTokenStorage.hasStoredAuthorization (cyclomatic 18) packages/api/src/mcp/oauth/tokens.ts:417— MCPTokenStorage.hasStoredAuthorization 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.
utils.normalizeAgentToolKeys (cyclomatic 18) packages/api/src/mcp/utils.ts:109— utils.normalizeAgentToolKeys has cyclomatic complexity 18 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
zod.resolveJsonSchemaRefs (cyclomatic 18) packages/api/src/mcp/zod.ts:238— zod.resolveJsonSchemaRefs 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.
axios.logAxiosError (cyclomatic 18) packages/api/src/utils/axios.ts:44— axios.logAxiosError 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.
submission.saveAbortedUserMessage (cyclomatic 18) packages/api/src/protection/private/submission.ts:554— submission.saveAbortedUserMessage 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.discoverSkills (cyclomatic 18) packages/api/src/skills/sync/github.ts:672— github.discoverSkills has cyclomatic complexity 18 (threshold 15). 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 literals inside it that branch (lines 697, 699). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.createSkillManagementHandlers.wrap (cyclomatic 18) packages/api/src/skills/management.ts:262— management.createSkillManagementHandlers.wrap 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 267). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
web.isCredentialUsable (cyclomatic 18) packages/api/src/web/web.ts:224— web.isCredentialUsable 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.
RedisJobStore.cleanup (cyclomatic 18) packages/api/src/stream/implementations/RedisJobStore.ts:3679— RedisJobStore.cleanup 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 3696). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
timing.applyRunStepDelta (cyclomatic 18) packages/chat/src/core/stream/timing.ts:65— timing.applyRunStepDelta 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.
frames.handleFinal (cyclomatic 18) packages/chat/src/core/resumable/frames.ts:39— frames.handleFinal 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
settled.settleStart (cyclomatic 18) packages/chat/src/core/resumable/settled.ts:12— settled.settleStart 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.
OriginalDialog.DialogContent (cyclomatic 18) packages/client/src/components/OriginalDialog.tsx:224— OriginalDialog.DialogContent 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 5 function literals inside it that branch (lines 283, 243, 320, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RetryableError.RetryableError (cyclomatic 18) packages/client/src/components/RetryableError.tsx:51— RetryableError.RetryableError 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.
file-config.buildMimeAccept (cyclomatic 18) packages/data-provider/src/file-config.ts:929— file-config.buildMimeAccept 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.
bedrock.bedrockOutputParser (cyclomatic 18) packages/data-provider/src/bedrock.ts:972— bedrock.bedrockOutputParser 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.
azure.validateAzureGroups (cyclomatic 18) packages/data-provider/src/azure.ts:13— azure.validateAzureGroups 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.
resolve-llm-delivery-path.resolveUploadDestination (cyclomatic 18) packages/data-provider/src/resolve-llm-delivery-path.ts:507— resolve-llm-delivery-path.resolveUploadDestination 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tenantIsolation.applyTenantIsolation (cyclomatic 18) packages/data-schemas/src/models/plugins/tenantIsolation.ts:124— tenantIsolation.applyTenantIsolation 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 6 function items inside it that branch (a function literal at line 194, updateGuard, replaceGuard, …). 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.createFileMethods.publishRunArtifactFile (cyclomatic 18) packages/data-schemas/src/methods/file.ts:551— file.createFileMethods.publishRunArtifactFile 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.
appSnapshots.fitBoundAppSnapshots (cyclomatic 18) packages/data-schemas/src/methods/appSnapshots.ts:63— appSnapshots.fitBoundAppSnapshots 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.
share.advanceTargetToBranchTail (cyclomatic 18) packages/data-schemas/src/methods/share.ts:737— share.advanceTargetToBranchTail has cyclomatic complexity 18 (threshold 15). Of this number, 9 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.
chatProject.createChatProjectMethods.addChatProjectFile (cyclomatic 18) packages/data-schemas/src/methods/chatProject.ts:546— chatProject.createChatProjectMethods.addChatProjectFile 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.
queuedTurn.createAgentQueuedTurnMethods.enqueueAgentQueuedTurn (cyclomatic 18) packages/data-schemas/src/methods/queuedTurn.ts:1105— queuedTurn.createAgentQueuedTurnMethods.enqueueAgentQueuedTurn has cyclomatic complexity 18 (threshold 15). 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 1126). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
queuedTurn.createAgentQueuedTurnMethods.ensureEffectiveAdmissionBoundary (cyclomatic 18) packages/data-schemas/src/methods/queuedTurn.ts:1227— queuedTurn.createAgentQueuedTurnMethods.ensureEffectiveAdmissionBoundary 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.
triggerDelivery.createAgentTriggerDeliveryMethods.enqueueAgentTriggerDelivery (cyclomatic 18) packages/data-schemas/src/methods/triggerDelivery.ts:1181— triggerDelivery.createAgentTriggerDeliveryMethods.enqueueAgentTriggerDelivery 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.
gateway.handleMediaCreate (cyclomatic 18) otel/langfuse-fanout/cmd/langfuse-fanout/main.go:321— gateway.handleMediaCreate 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.
publishStagedApproval (cyclomatic 18) api/server/controllers/agents/client.js:4216— publishStagedApproval 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.
createSamlCallback (cyclomatic 18) api/strategies/samlStrategy.js:191— createSamlCallback 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 192). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
processAddedConvo (cyclomatic 18) api/server/services/Endpoints/agents/addedConvo.js:77— processAddedConvo 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.
memories.router.post("/") (cyclomatic 17) api/server/routes/memories.js:180— memories.router.post("/") 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.
initialize.initializeClient (cyclomatic 17) api/server/services/Endpoints/azureAssistants/initialize.js:50— initialize.initializeClient 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.
GraphApiService.getEntraGroupDetailsBatch (cyclomatic 17) api/server/services/GraphApiService.js:295— GraphApiService.getEntraGroupDetailsBatch 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 one function item inside it that branches (processBatch). 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.
PermissionService.grantPermission (cyclomatic 17) api/server/services/PermissionService.js:63— PermissionService.grantPermission 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.
getFileStrategy.getFileStrategy (cyclomatic 17) api/server/utils/getFileStrategy.js:27— getFileStrategy.getFileStrategy 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.
REDACTED.findDocumentInjectionPoint (cyclomatic 17) REDACTED:358— REDACTED.findDocumentInjectionPoint 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.
useCodeApprovalMode.resolveReachableCodeWorkspaceInheritance (cyclomatic 17) client/src/hooks/Agents/useCodeApprovalMode.ts:306— useCodeApprovalMode.resolveReachableCodeWorkspaceInheritance 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.
useCodeWorkspace.useCodeWorkspace.workspaceMetadata (cyclomatic 17) client/src/hooks/Agents/useCodeWorkspace.ts:241— useCodeWorkspace.useCodeWorkspace.workspaceMetadata 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.
useAddedResponse.useAddedResponse (cyclomatic 17) client/src/hooks/Conversations/useAddedResponse.ts:26— useAddedResponse.useAddedResponse 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 38, 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.
useTextarea.useTextarea.handleKeyDown (cyclomatic 17) client/src/hooks/Input/useTextarea.ts:251— useTextarea.useTextarea.handleKeyDown 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.
BookmarkForm.BookmarkForm (cyclomatic 17) client/src/components/Bookmarks/BookmarkForm.tsx:19— BookmarkForm.BookmarkForm 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 3 function items inside it that branch (a function literal at line 103, onSubmit, isTagTaken). 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.
useTasks.useBackgroundTasks.stopRows (cyclomatic 17) client/src/components/Chat/BackgroundTasks/useTasks.ts:193— useTasks.useBackgroundTasks.stopRows has cyclomatic complexity 17 (threshold 15). Of this number, 9 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.
SiblingHeader.SiblingHeader (cyclomatic 17) client/src/components/Chat/Messages/Content/SiblingHeader.tsx:30— SiblingHeader.SiblingHeader 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 (a function literal at line 63, handleBranch). 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.
StackedToolIcons.StackedToolIcons (cyclomatic 17) client/src/components/Chat/Messages/Content/ToolOutput/StackedToolIcons.tsx:30— StackedToolIcons.StackedToolIcons 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 2 function literals inside it that branch (lines 39, 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.
ActivityPhaseGroup.PhaseLabel (cyclomatic 17) client/src/components/Chat/Messages/Content/ActivityPhaseGroup.tsx:132— ActivityPhaseGroup.PhaseLabel 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DataTable.DataTable (cyclomatic 17) client/src/components/Chat/Input/Files/Table/DataTable.tsx:60— DataTable.DataTable has cyclomatic complexity 17 (threshold 15). 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SearchContent.SearchContent (cyclomatic 17) client/src/components/Chat/Messages/Content/SearchContent.tsx:30— SearchContent.SearchContent 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 one function literal inside it that branches (line 57). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
dispatch.findSubagentDispatch (cyclomatic 17) client/src/components/Chat/Subagents/dispatch.ts:16— dispatch.findSubagentDispatch 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.
SubagentConversation.RecoveredChildMessage (cyclomatic 17) client/src/components/Chat/Subagents/SubagentConversation.tsx:353— SubagentConversation.RecoveredChildMessage has cyclomatic complexity 17 (threshold 15). Of this number, 10 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.
EndpointIcon.EndpointIcon (cyclomatic 17) client/src/components/Endpoints/EndpointIcon.tsx:17— EndpointIcon.EndpointIcon 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.
MCPConfigDialog.MCPConfigDialog (cyclomatic 17) client/src/components/MCP/MCPConfigDialog.tsx:30— MCPConfigDialog.MCPConfigDialog 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 2 function items inside it that branch (a function literal at line 49, renderStatusBadge). 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.
CodeBlock.CodeBlock (cyclomatic 17) client/src/components/Messages/Content/CodeBlock.tsx:20— CodeBlock.CodeBlock has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 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.
recovery.RecoveryActions (cyclomatic 17) client/src/components/Messages/Content/Error/recovery.tsx:75— recovery.RecoveryActions 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 5 function items inside it that branch (a function literal at line 102, a function literal at line 125, 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.
Export.MermaidExport (cyclomatic 17) client/src/components/Messages/Content/Mermaid/Export.tsx:56— Export.MermaidExport 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 8 function literals inside it that branch (lines 190, 100, 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.
Dialog.SettingsDialog (cyclomatic 17) client/src/components/Nav/Settings/Dialog.tsx:22— Dialog.SettingsDialog 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Message.Message (cyclomatic 17) client/src/components/Share/Message.tsx:22— Message.Message 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.
SelectedPrincipalsList.SelectedPrincipalsList (cyclomatic 17) client/src/components/Sharing/PeoplePicker/SelectedPrincipalsList.tsx:22— SelectedPrincipalsList.SelectedPrincipalsList 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 (a function literal at line 57, getPrincipalDisplayInfo). 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.
selectors.matchesMcpServer (cyclomatic 17) client/src/components/SidePanel/Agents/Tools/items/selectors.ts:107— selectors.matchesMcpServer 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.
plugin.findNextMatch (cyclomatic 17) client/src/components/Web/plugin.ts:41— plugin.findNextMatch 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.
convos.findManualConvoTitleInAllQueries (cyclomatic 17) client/src/utils/convos.ts:1472— convos.findManualConvoTitleInAllQueries has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 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.
thread.indexMessages (cyclomatic 17) client/src/utils/thread.ts:73— thread.indexMessages has cyclomatic complexity 17 (threshold 15). Of this number, 11 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.
migrate-agent-permissions.migrateAgentPermissionsEnhanced (cyclomatic 17) config/migrate-agent-permissions.js:23— migrate-agent-permissions.migrateAgentPermissionsEnhanced has cyclomatic complexity 17 (threshold 15). Of this number, 12 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.
config.prepareEntryChange (cyclomatic 17) packages/api/src/admin/config.ts:2071— config.prepareEntryChange 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.
langfuse.createAdminLangfuseHandlers.testConnection (cyclomatic 17) packages/api/src/admin/langfuse.ts:687— langfuse.createAdminLangfuseHandlers.testConnection 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.
roles.createAdminRolesHandlers.removeRoleMember (cyclomatic 17) packages/api/src/admin/roles.ts:1182— roles.createAdminRolesHandlers.removeRoleMember 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.
aggregation.feedSubagentAggregator (cyclomatic 17) packages/api/src/agents/aggregation.ts:32— aggregation.feedSubagentAggregator 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.
InMemoryJobStore.restoreClaimedSteers (cyclomatic 17) packages/api/src/stream/implementations/InMemoryJobStore.ts:2094— InMemoryJobStore.restoreClaimedSteers 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: InMemoryJobStore.queuedReceiptForMutation (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.
InMemoryJobStore.removeSteer (cyclomatic 17) packages/api/src/stream/implementations/InMemoryJobStore.ts:2247— InMemoryJobStore.removeSteer 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: InMemoryJobStore.queuedReceiptForMutation (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.
InMemoryJobStore.parkLeftovers (cyclomatic 17) packages/api/src/stream/implementations/InMemoryJobStore.ts:2598— InMemoryJobStore.parkLeftovers 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: InMemoryJobStore.queuedReceiptForMutation (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.
GenerationJobManagerClass.getOrCreateRuntimeState (cyclomatic 17) packages/api/src/stream/GenerationJobManager.ts:3213— GenerationJobManagerClass.getOrCreateRuntimeState 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.
GenerationJobManagerClass.resumeClaimedGeneration (cyclomatic 17) packages/api/src/stream/GenerationJobManager.ts:3846— GenerationJobManagerClass.resumeClaimedGeneration has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
GenerationJobManagerClass.overflowEarlyEventBuffer (cyclomatic 17) packages/api/src/stream/GenerationJobManager.ts:5861— GenerationJobManagerClass.overflowEarlyEventBuffer 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.
GenerationJobManager.getPublishedProvenance (cyclomatic 17) packages/api/src/stream/GenerationJobManager.ts:396— GenerationJobManager.getPublishedProvenance has cyclomatic complexity 17 (threshold 15). Of this number, 12 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.
GenerationJobManager.getReplayStepId (cyclomatic 17) packages/api/src/stream/GenerationJobManager.ts:522— GenerationJobManager.getReplayStepId 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.
harvest.createBackgroundCodeResultHandler (cyclomatic 17) packages/api/src/agents/harvest.ts:306— harvest.createBackgroundCodeResultHandler 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 317). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
tree.boundLeaf (cyclomatic 17) packages/api/src/agents/digest/tree.ts:306— tree.boundLeaf 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.
linked.createLinkedInstructionsResolver (cyclomatic 17) packages/api/src/agents/instructions/linked.ts:315— linked.createLinkedInstructionsResolver 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 items inside it that branch (resolve, resolve::checkPromptBlocked). 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.
run.resolveSummarizationProvider (cyclomatic 17) packages/api/src/agents/run.ts:1174— run.resolveSummarizationProvider 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.
matching.applyTextEdits (cyclomatic 17) REDACTED:385— matching.applyTextEdits 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.
resume.buildResolvedAskUserQuestion (cyclomatic 17) packages/api/src/agents/hitl/resume.ts:194— resume.buildResolvedAskUserQuestion 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.
clientTools.validateClientTools (cyclomatic 17) packages/api/src/agents/responses/clientTools.ts:120— clientTools.validateClientTools 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.
SubagentThreadTaskStore.persistResult (cyclomatic 17) packages/api/src/agents/subagentThreads.ts:3660— SubagentThreadTaskStore.persistResult 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.
backgroundClaims.claimBackgroundToolResult (cyclomatic 17) packages/api/src/agents/backgroundClaims.ts:6— backgroundClaims.claimBackgroundToolResult has cyclomatic complexity 17 (threshold 15). Of this number, 13 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.
discovery.discoverConnectedAgents (cyclomatic 17) packages/api/src/agents/discovery.ts:427— discovery.discoverConnectedAgents has cyclomatic complexity 17 (threshold 15). Of this number, 13 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.
tracker.createModelErrorTracker::getUpstreamModelError (cyclomatic 17) packages/api/src/agents/failures/tracker.ts:55— tracker.createModelErrorTracker::getUpstreamModelError 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.
runtime.drainAndBuildInjections (cyclomatic 17) packages/api/src/agents/steering/runtime.ts:102— runtime.drainAndBuildInjections has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
outcome.toolEvidence (cyclomatic 17) packages/api/src/agents/triggers/outcome.ts:79— outcome.toolEvidence 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 86). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
localRefresh.createLocalRefreshHandler (cyclomatic 17) packages/api/src/auth/localRefresh.ts:87— localRefresh.createLocalRefreshHandler 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 112). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
limiter.createTwoFactorLimiter (cyclomatic 17) packages/api/src/auth/limiter.ts:37— limiter.createTwoFactorLimiter 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 (a function literal at line 79, getUserLimiterKey, getTempTokenUserId, …). 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.
cloudfront.initializeCloudFront (cyclomatic 17) packages/api/src/cdn/cloudfront.ts:12— cloudfront.initializeCloudFront 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.
responses.getResponsesApiRouting (cyclomatic 17) packages/api/src/endpoints/config/responses.ts:17— responses.getResponsesApiRouting 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.
video.encodeAndFormatVideos (cyclomatic 17) packages/api/src/files/encode/video.ts:24— video.encodeAndFormatVideos 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.
FlowStateManager.acquireLease (cyclomatic 17) packages/api/src/flow/manager.ts:270— FlowStateManager.acquireLease 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.
oidc.extractOpenIDTokenInfo (cyclomatic 17) REDACTED:176— oidc.extractOpenIDTokenInfo 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.
MCPConnectionFactory.createConnection (cyclomatic 17) packages/api/src/mcp/MCPConnectionFactory.ts:809— MCPConnectionFactory.createConnection 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.
loading.loadMCPTools (cyclomatic 17) packages/api/src/mcp/loading.ts:47— loading.loadMCPTools 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
protection.extractLocatorAliasFragments (cyclomatic 17) packages/api/src/shared-links/protection.ts:1420— protection.extractLocatorAliasFragments 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.
protection.sanitizeInspectableEncodedValues (cyclomatic 17) packages/api/src/shared-links/protection.ts:1520— protection.sanitizeInspectableEncodedValues 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.
trigger.readScheduleFireContext (cyclomatic 17) packages/api/src/schedules/trigger.ts:30— trigger.readScheduleFireContext 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.
bearer.prepareScheduledMCPBearer (cyclomatic 17) packages/api/src/schedules/bearer.ts:490— bearer.prepareScheduledMCPBearer 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.
erasure.settleStrandedRuns (cyclomatic 17) packages/api/src/schedules/erasure.ts:303— erasure.settleStrandedRuns 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.
deployment.createDeploymentSkillMethods (cyclomatic 17) packages/api/src/skills/deployment.ts:492— deployment.createDeploymentSkillMethods 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 8 function literals inside it that branch (lines 590, 497, 504, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
deletionService.createSkillDeletionService.startSkillDeletionSweep.sweepAbandonedIntents (cyclomatic 17) packages/api/src/skills/deletionService.ts:267— deletionService.createSkillDeletionService.startSkillDeletionSweep.sweepAbandonedIntents 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 2 function literals inside it that branch (lines 278, 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.
access.createSharedLinkAccessMiddleware (cyclomatic 17) REDACTED:44— access.createSharedLinkAccessMiddleware 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 literals inside it that branch (lines 113, 55, 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.
admission.getPredecessorMismatchState (cyclomatic 17) packages/api/src/stream/admission.ts:32— admission.getPredecessorMismatchState 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.
RedisJobStore.hasScheduleCleanupObligation (cyclomatic 17) packages/api/src/stream/implementations/RedisJobStore.ts:3403— RedisJobStore.hasScheduleCleanupObligation 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.
proxy.proxyRumRequest (cyclomatic 17) packages/api/src/rum/proxy.ts:220— proxy.proxyRumRequest 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.
CollapsibleText.CollapsibleText (cyclomatic 17) packages/chat/src/components/CollapsibleText.tsx:29— CollapsibleText.CollapsibleText has cyclomatic complexity 17 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
resume.getResumeMessageIndexes (cyclomatic 17) packages/chat/src/core/resumable/resume.ts:127— resume.getResumeMessageIndexes 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.resolveCodeEnvironmentSelection (cyclomatic 17) packages/data-provider/src/code/workspace.ts:270— workspace.resolveCodeEnvironmentSelection 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: workspace.isCodeWorkspaceSelection (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.
parsers.redactErrorValue (cyclomatic 17) packages/data-schemas/src/config/parsers.ts:231— parsers.redactErrorValue 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 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.
stripUIResourceMarkers.sanitizeUIResourceContent (cyclomatic 17) packages/data-schemas/src/utils/stripUIResourceMarkers.ts:519— stripUIResourceMarkers.sanitizeUIResourceContent 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.
subagentContent.createSubagentContentMethods.streamSubagentContentBatches (cyclomatic 17) packages/data-schemas/src/methods/subagentContent.ts:235— subagentContent.createSubagentContentMethods.streamSubagentContentBatches 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.
file.normalizeProjectFileRecord (cyclomatic 17) packages/data-schemas/src/methods/file.ts:189— file.normalizeProjectFileRecord 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.
auditLog.createAuditLogMethods.verifyAuditChain (cyclomatic 17) packages/data-schemas/src/methods/auditLog.ts:531— auditLog.createAuditLogMethods.verifyAuditChain 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.
message.createMessageMethods.readBackgroundToolHandle (cyclomatic 17) packages/data-schemas/src/methods/message.ts:2043— message.createMessageMethods.readBackgroundToolHandle 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.
mcpAuthority.createMCPAuthorityConfigSourceRevision (cyclomatic 17) packages/data-schemas/src/methods/mcpAuthority.ts:293— mcpAuthority.createMCPAuthorityConfigSourceRevision 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 2 function literals inside it that branch (lines 305, 314). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
browserSetup.createBrowserSetupStore.claimNonce (cyclomatic 17) packages/data-schemas/src/methods/browserSetup.ts:381— browserSetup.createBrowserSetupStore.claimNonce 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.
checks.checkLabel (cyclomatic 17) scripts/activity-labels/checks.mts:112— checks.checkLabel 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.
report.markdownReport (cyclomatic 17) scripts/activity-labels/report.mts:104— report.markdownReport 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.
static-checks.inlineDirectives (cyclomatic 17) scripts/static-checks.mts:995— static-checks.inlineDirectives 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 3 function items inside it that branch (count, a function literal at line 997, a function literal at line 1041). 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.
static-checks.introducedWithinAllowance (cyclomatic 17) scripts/static-checks.mts:1405— static-checks.introducedWithinAllowance 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 branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
extractResponseRequestContent (cyclomatic 17) api/server/controllers/agents/responses.js:260— extractResponseRequestContent 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.
getPreparedCodeOutputBuffer (cyclomatic 17) api/server/services/Files/Code/process.js:157— getPreparedCodeOutputBuffer 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.
writeSandboxFile (cyclomatic 17) api/server/services/Files/Code/process.js:1604— writeSandboxFile 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.
confirmAgentGenerationsDrained (cyclomatic 17) REDACTED:368— confirmAgentGenerationsDrained 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 2 function literals inside it that branch (lines 391, 424). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
resolveShareFile (cyclomatic 17) REDACTED:187— resolveShareFile 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.
migrateSharedLinkPermissions::(anonymous)::processBatch (cyclomatic 17) config/migrate-shared-link-permissions.js:153— migrateSharedLinkPermissions::(anonymous)::processBatch 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.
client.normalizeEventActorContextMeta (cyclomatic 16) api/server/controllers/agents/client.js:267— client.normalizeEventActorContextMeta 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.router.post("/artifact/:messageId") (cyclomatic 16) REDACTED:432— messages.router.post("/artifact/:messageId") 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.
share.router.patch("/:shareId") (cyclomatic 16) REDACTED:709— share.router.patch("/:shareId") 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.
importers.importClaudeConvo (cyclomatic 16) api/server/utils/import/importers.js:205— importers.importClaudeConvo 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.
openidStrategy.hasOpenIdAdminRole (cyclomatic 16) api/strategies/openidStrategy.js:560— openidStrategy.hasOpenIdAdminRole 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.
useUnseenConversations.readReplyState (cyclomatic 16) client/src/hooks/Conversations/useUnseenConversations.ts:41— useUnseenConversations.readReplyState 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.
useTextarea.useTextarea.routeClipboardFiles (cyclomatic 16) client/src/hooks/Input/useTextarea.ts:327— useTextarea.useTextarea.routeClipboardFiles has cyclomatic complexity 16 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useContentHandler.useContentHandler.contentHandler (cyclomatic 16) client/src/hooks/SSE/useContentHandler.ts:37— useContentHandler.useContentHandler.contentHandler 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.
DeploymentTheme.useThemeCache (cyclomatic 16) client/src/Providers/DeploymentTheme.tsx:139— DeploymentTheme.useThemeCache 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 4 function literals inside it that branch (lines 167, 184, 145, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Login.Login (cyclomatic 16) client/src/components/Auth/Login.tsx:25— Login.Login has cyclomatic complexity 16 (threshold 15). Of this number, 8 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.
ApprovalContext.ApprovalStateProvider (cyclomatic 16) client/src/components/Chat/Messages/Content/ApprovalContext.tsx:170— ApprovalContext.ApprovalStateProvider 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 8 function literals inside it that branch (lines 232, 320, 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.
FilePreviewDialog.getDisplayType (cyclomatic 16) client/src/components/Chat/Messages/Content/FilePreviewDialog.tsx:61— FilePreviewDialog.getDisplayType 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.
Image.Image (cyclomatic 16) client/src/components/Chat/Messages/Content/Image.tsx:27— Image.Image has cyclomatic complexity 16 (threshold 15). Of this number, 9 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.
background.parseBackgroundTaskOutput (cyclomatic 16) client/src/components/Chat/Messages/Content/Parts/background.ts:264— background.parseBackgroundTaskOutput 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.
CodeWorkspaceMenu.EnvironmentWorkspaces (cyclomatic 16) client/src/components/Chat/Input/CodeWorkspaceMenu.tsx:162— CodeWorkspaceMenu.EnvironmentWorkspaces 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 4 function literals inside it that branch (lines 209, 187, 245, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Inspector.RecordContent (cyclomatic 16) client/src/components/Chat/Trace/Inspector.tsx:69— Inspector.RecordContent 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.
CustomMenu.CustomMenu (cyclomatic 16) client/src/components/Chat/Menus/Endpoints/CustomMenu.tsx:18— CustomMenu.CustomMenu 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.
EndpointItem.EndpointItem (cyclomatic 16) client/src/components/Chat/Menus/Endpoints/components/EndpointItem.tsx:254— EndpointItem.EndpointItem 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SearchResults.prepareSearchResults (cyclomatic 16) client/src/components/Chat/Menus/Endpoints/components/SearchResults.tsx:35— SearchResults.prepareSearchResults 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 42, 63). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SortFilterHeader.SortFilterHeader (cyclomatic 16) client/src/components/Chat/Input/Files/Table/SortFilterHeader.tsx:19— SortFilterHeader.SortFilterHeader has cyclomatic complexity 16 (threshold 15). Of this number, 9 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.
Wakeup.Wakeup (cyclomatic 16) client/src/components/Chat/Messages/Content/Wakeup.tsx:101— Wakeup.Wakeup 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 141, 122, 204). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Google.GoogleSettings (cyclomatic 16) client/src/components/Endpoints/Settings/Google.tsx:14— Google.GoogleSettings 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 3 function items inside it that branch (a function literal at line 57, renderComponent, a function literal at line 22). 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.
Mermaid.Mermaid (cyclomatic 16) client/src/components/Messages/Content/Mermaid/Mermaid.tsx:55— Mermaid.Mermaid 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 6 function literals inside it that branch (lines 107, 159, 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.
ProjectInstructionsDialog.ProjectInstructionsDialog (cyclomatic 16) client/src/components/Projects/ProjectInstructionsDialog.tsx:40— ProjectInstructionsDialog.ProjectInstructionsDialog 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 8 function items inside it that branch (a function literal at line 62, handleOpenChange, onSubmit, …). 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.
CategorySelector.CategorySelector (cyclomatic 16) client/src/components/Prompts/fields/CategorySelector.tsx:23— CategorySelector.CategorySelector 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 5 function literals inside it that branch (lines 52, 70, 63, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MCPCardActions.MCPCardActions (cyclomatic 16) client/src/components/SidePanel/MCPBuilder/MCPCardActions.tsx:40— MCPCardActions.MCPCardActions 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.
ScheduleDialog.ScheduleDialog::onSubmit (cyclomatic 16) client/src/components/SidePanel/Schedules/ScheduleDialog.tsx:384— ScheduleDialog.ScheduleDialog::onSubmit 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 (ScheduleDialog.ScheduleDialog) 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.
UploadSkillDialog.UploadSkillDialog (cyclomatic 16) client/src/components/Skills/dialogs/UploadSkillDialog.tsx:88— UploadSkillDialog.UploadSkillDialog 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 7 function literals inside it that branch (lines 129, 156, 120, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Citation.Citation (cyclomatic 16) client/src/components/Web/Citation.tsx:302— Citation.Citation has cyclomatic complexity 16 (threshold 15). Of this number, 9 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.
queries.useMarketplaceAgentsInfiniteQuery (cyclomatic 16) client/src/data-provider/Agents/queries.ts:237— queries.useMarketplaceAgentsInfiniteQuery 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 items inside it that branch (a function literal at line 299, onError, a function literal at line 277). 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.
mutations.useConversationTagMutation (cyclomatic 16) client/src/data-provider/mutations.ts:1181— mutations.useConversationTagMutation 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 4 function items inside it that branch (onMutationSuccess, a function literal at line 1194, a function literal at line 1236, …). 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.
mutations.useDeleteConversationMutation (cyclomatic 16) client/src/data-provider/mutations.ts:1365— mutations.useDeleteConversationMutation 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 1388, 1452). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
files.validateFiles (cyclomatic 16) client/src/utils/files.ts:430— files.validateFiles 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.
drafts.removeTabAttachmentPresence (cyclomatic 16) client/src/utils/drafts.ts:1030— drafts.removeTabAttachmentPresence 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.
endpoints.getDefaultModelSpec (cyclomatic 16) client/src/utils/endpoints.ts:418— endpoints.getDefaultModelSpec 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.
convos.groupConversations (cyclomatic 16) client/src/utils/convos.ts:136— convos.groupConversations 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 4 function literals inside it that branch (lines 154, 191, 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.
convos.conversationInsertVerdict (cyclomatic 16) client/src/utils/convos.ts:389— convos.conversationInsertVerdict 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.
convos.trackConvoQueryAuthority (cyclomatic 16) client/src/utils/convos.ts:739— convos.trackConvoQueryAuthority 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 758). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
groupToolCalls.groupSequentialToolCalls (cyclomatic 16) client/src/utils/groupToolCalls.ts:142— groupToolCalls.groupSequentialToolCalls 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.
presets.getPresetTitle (cyclomatic 16) client/src/utils/presets.ts:6— presets.getPresetTitle 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.
memory.handleMemoryArtifact (cyclomatic 16) client/src/utils/memory.ts:83— memory.handleMemoryArtifact 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.
secrets.encryptConfigSecretFields (cyclomatic 16) packages/api/src/admin/secrets.ts:1645— secrets.encryptConfigSecretFields 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.
secrets.encryptConfigSecrets (cyclomatic 16) packages/api/src/admin/secrets.ts:1715— secrets.encryptConfigSecrets 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.createAdminConfigHandlers.toggleConfig (cyclomatic 16) packages/api/src/admin/config.ts:5028— config.createAdminConfigHandlers.toggleConfig 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.
SubagentActivityStream.subscribe (cyclomatic 16) packages/api/src/agents/subagentActivity.ts:287— SubagentActivityStream.subscribe 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 6 function items inside it that branch (a function literal at line 354, a function literal at line 365, a function literal at line 295, …). 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.
InMemoryEventTransport.retainReplay (cyclomatic 16) packages/api/src/stream/implementations/InMemoryEventTransport.ts:189— InMemoryEventTransport.retainReplay 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.
GenerationJobManagerClass.emitChunk (cyclomatic 16) packages/api/src/stream/GenerationJobManager.ts:6928— GenerationJobManagerClass.emitChunk 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.
execution.resolveCodeExecutionContext (cyclomatic 16) packages/api/src/agents/execution.ts:376— execution.resolveCodeExecutionContext 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.
view.renderDigest (cyclomatic 16) packages/api/src/agents/digest/view.ts:656— view.renderDigest 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.
RedisSubagentTaskControlTransport.cancelScope (cyclomatic 16) packages/api/src/agents/subagentTaskRouting.ts:897— RedisSubagentTaskControlTransport.cancelScope 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.
handlers.createOpenAIToolCallStream.finish (cyclomatic 16) packages/api/src/agents/openai/handlers.ts:440— handlers.createOpenAIToolCallStream.finish 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.
modelBoundContent.isLegacyArtifactProjectionHuman (cyclomatic 16) packages/api/src/middleware/modelBoundContent.ts:1329— modelBoundContent.isLegacyArtifactProjectionHuman 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.
modelBoundContent.snapshotModelBoundPartProperty (cyclomatic 16) packages/api/src/middleware/modelBoundContent.ts:1726— modelBoundContent.snapshotModelBoundPartProperty 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, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
modelBoundContent.getSelectedRawStoredMessageFileIds (cyclomatic 16) packages/api/src/middleware/modelBoundContent.ts:2453— modelBoundContent.getSelectedRawStoredMessageFileIds 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.
session.createRunFileSession.prepare (cyclomatic 16) packages/api/src/agents/files/session.ts:275— session.createRunFileSession.prepare 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.
handlers.normalizeSkillMdContent (cyclomatic 16) packages/api/src/agents/handlers.ts:1614— handlers.normalizeSkillMdContent 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.
handlers.mergeSandboxSessionArtifact (cyclomatic 16) packages/api/src/agents/handlers.ts:2699— handlers.mergeSandboxSessionArtifact 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.
storage.ownedCheckpointReferences (cyclomatic 16) packages/api/src/agents/checkpoints/storage.ts:48— storage.ownedCheckpointReferences 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.
checkpointer.deleteAgentCheckpoint (cyclomatic 16) packages/api/src/agents/checkpointer.ts:1075— checkpointer.deleteAgentCheckpoint 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.
answers.applyRetainedAnswers (cyclomatic 16) packages/api/src/agents/hitl/answers.ts:581— answers.applyRetainedAnswers 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 branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
subagentCompletionWakeup.candidateFromMessage (cyclomatic 16) packages/api/src/agents/subagentCompletionWakeup.ts:189— subagentCompletionWakeup.candidateFromMessage 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.
guard.isBoundEventContinuation (cyclomatic 16) packages/api/src/agents/guard.ts:72— guard.isBoundEventContinuation 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.
mcpIdentity.stampMcpServerIdentities (cyclomatic 16) packages/api/src/agents/mcpIdentity.ts:42— mcpIdentity.stampMcpServerIdentities has cyclomatic complexity 16 (threshold 15). Of this number, 9 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.
service.createAgentTriggerService (cyclomatic 16) packages/api/src/agents/triggers/service.ts:340— service.createAgentTriggerService 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.
view.publicStatus (cyclomatic 16) packages/api/src/agents/view.ts:204— view.publicStatus 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.
queuedTurnHttp.resolveFiles (cyclomatic 16) packages/api/src/agents/queuedTurnHttp.ts:212— queuedTurnHttp.resolveFiles 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.
report.getEndpointOverrideReport (cyclomatic 16) packages/api/src/app/report.ts:122— report.getEndpointOverrideReport 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ip.hasPrivateEmbeddedIPv4 (cyclomatic 16) packages/api/src/auth/ip.ts:69— ip.hasPrivateEmbeddedIPv4 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.
handlers.createPasskeyHandlers.registerPasskeyVerify (cyclomatic 16) packages/api/src/auth/passkey/handlers.ts:401— handlers.createPasskeyHandlers.registerPasskeyVerify 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.
openidRoleSync.getOpenIdRolesForOpenIdSync (cyclomatic 16) packages/api/src/auth/openidRoleSync.ts:117— openidRoleSync.getOpenIdRolesForOpenIdSync 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.
session.createOpenIDSessionRefreshService.canBindLegacyOpenIDSession (cyclomatic 16) packages/api/src/auth/openid/session.ts:408— session.createOpenIDSessionRefreshService.canBindLegacyOpenIDSession 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.
attachments.importOne (cyclomatic 16) packages/api/src/code/attachments.ts:482— attachments.importOne 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.
capabilities.readAuthorizedAttachedWorkerStatus (cyclomatic 16) packages/api/src/code/capabilities.ts:55— capabilities.readAuthorizedAttachedWorkerStatus 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
reasoning.readCatalog (cyclomatic 16) packages/api/src/endpoints/reasoning.ts:165— reasoning.readCatalog 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.
process.processCodeOutput::writeOutput (cyclomatic 16) packages/api/src/files/code/process.ts:312— process.processCodeOutput::writeOutput 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 (process.processCodeOutput) 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.
search.executeFileSearchQuery (cyclomatic 16) packages/api/src/files/rag/search.ts:50— search.executeFileSearchQuery has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 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.
MCPServersRegistry.deepEqual (cyclomatic 16) packages/api/src/mcp/registry/MCPServersRegistry.ts:156— MCPServersRegistry.deepEqual 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.
obo.resolveOboToken (cyclomatic 16) packages/api/src/mcp/oauth/obo.ts:293— obo.resolveOboToken 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.
MCPOAuthHandler.createOAuthFetch (cyclomatic 16) packages/api/src/mcp/oauth/handler.ts:73— MCPOAuthHandler.createOAuthFetch 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 82). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
MCPConnection.isConnected (cyclomatic 16) packages/api/src/mcp/connection.ts:3154— MCPConnection.isConnected 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: MCPConnection.setupTransportErrorHandlers (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.
defer.shouldDeferMCPOAuthSignIn (cyclomatic 16) packages/api/src/mcp/defer.ts:77— defer.shouldDeferMCPOAuthSignIn 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.
tools.createMCPToolCacheService.updateMCPServerTools (cyclomatic 16) packages/api/src/mcp/tools.ts:309— tools.createMCPToolCacheService.updateMCPServerTools 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.
transform.createPiiTextTransformer.createSession.transform (cyclomatic 16) packages/api/src/protection/transform.ts:115— transform.createPiiTextTransformer.createSession.transform has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
handlers.createProjectHandlers.updateProject (cyclomatic 16) packages/api/src/projects/handlers.ts:238— handlers.createProjectHandlers.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.
handlers.createSchedulesHandlers.runScheduleNow (cyclomatic 16) packages/api/src/schedules/handlers.ts:1166— handlers.createSchedulesHandlers.runScheduleNow 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.
mcp.readStdioServer (cyclomatic 16) packages/api/src/plugins/mcp.ts:213— mcp.readStdioServer 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.
crud.extractKeyFromS3Url (cyclomatic 16) packages/api/src/storage/s3/crud.ts:669— crud.extractKeyFromS3Url 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.
feedback.sendFeedbackScore (cyclomatic 16) packages/api/src/langfuse/feedback.ts:125— feedback.sendFeedbackScore 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 3 function literals inside it that branch (lines 160, 143, 154). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RedisEventTransport.subscribe (cyclomatic 16) packages/api/src/stream/implementations/RedisEventTransport.ts:1366— RedisEventTransport.subscribe 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 1426, 1442, 1411). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
timing.applyToolPreparation (cyclomatic 16) packages/chat/src/core/stream/timing.ts:18— timing.applyToolPreparation 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.
terminal.authorizeTerminalTeardown (cyclomatic 16) packages/chat/src/core/resumable/terminal.ts:197— terminal.authorizeTerminalTeardown 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.
outcomes.handoffStartToReplacement (cyclomatic 16) packages/chat/src/core/resumable/outcomes.ts:143— outcomes.handoffStartToReplacement 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.
chips.useSteerChips (cyclomatic 16) packages/chat/src/react/steering/chips.ts:88— chips.useSteerChips 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 9 function literals inside it that branch (lines 217, 164, 207, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useSteerEscalate.useSteerEscalate (cyclomatic 16) packages/chat/src/react/steering/useSteerEscalate.ts:47— useSteerEscalate.useSteerEscalate 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 4 function literals inside it that branch (lines 88, 71, 96, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useSteerRecovery.useSteerRecovery.retry (cyclomatic 16) packages/chat/src/react/steering/useSteerRecovery.ts:154— useSteerRecovery.useSteerRecovery.retry 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 258, 189, 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.
ThemeProvider.syncControlledTheme (cyclomatic 16) packages/client/src/theme/context/ThemeProvider.tsx:361— ThemeProvider.syncControlledTheme 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.
parsers.parseTextParts (cyclomatic 16) packages/data-provider/src/parsers.ts:377— parsers.parseTextParts has cyclomatic complexity 16 (threshold 15). 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, separate the cases: extract each independent 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.attributeIssue (cyclomatic 16) packages/data-schemas/src/app/resolution.ts:726— resolution.attributeIssue 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: resolution.getConfigIssueParams (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 method is counted neither in this dimension's figures nor in its score.
resolution.filterMCPServerOverrides (cyclomatic 16) packages/data-schemas/src/app/resolution.ts:1536— resolution.filterMCPServerOverrides 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: resolution.getConfigIssueParams (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 method is counted neither in this dimension's figures nor in its score.
changes.getConfigChangeWrittenPaths (cyclomatic 16) packages/data-schemas/src/app/changes.ts:546— changes.getConfigChangeWrittenPaths 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.
role.createRoleMethods.initializeRoles (cyclomatic 16) packages/data-schemas/src/methods/role.ts:79— role.createRoleMethods.initializeRoles 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.
auditLog.createAuditLogMethods.recordAuditEntry (cyclomatic 16) packages/data-schemas/src/methods/auditLog.ts:337— auditLog.createAuditLogMethods.recordAuditEntry 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.
share.createShareMethods.getSharedLinks (cyclomatic 16) packages/data-schemas/src/methods/share.ts:1101— share.createShareMethods.getSharedLinks has cyclomatic complexity 16 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
chatProject.createChatProjectMethods.updateChatProject (cyclomatic 16) packages/data-schemas/src/methods/chatProject.ts:480— chatProject.createChatProjectMethods.updateChatProject has cyclomatic complexity 16 (threshold 15). 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, separate the cases: extract each independent 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.createConversationMethods.archiveAllConvos (cyclomatic 16) packages/data-schemas/src/methods/conversation.ts:4240— conversation.createConversationMethods.archiveAllConvos 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: conversation.validateAgentEventActorSuspension (cyclomatic 27) 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.
gateway.handle (cyclomatic 16) otel/langfuse-fanout/cmd/langfuse-fanout/main.go:240— gateway.handle 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, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
prepareEventActorContext (cyclomatic 16) api/server/controllers/agents/client.js:2164— prepareEventActorContext 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.
getMessagesForConversation (cyclomatic 16) api/app/clients/BaseClient.js:1496— getMessagesForConversation 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.
getDefaultHandlers::handle (cyclomatic 16) api/server/controllers/agents/callbacks.js:689— getDefaultHandlers::handle has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
abortMessage (cyclomatic 16) api/server/middleware/abortMiddleware.js:25— abortMessage 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.
handlers.createToolExecuteHandler.handle (cognitive 547) packages/api/src/agents/handlers.ts:5670— handlers.createToolExecuteHandler.handle has cognitive complexity 547 (threshold 15). Drivers by points: if/else 145 (280 pts), ternaries 52 (118 pts), boolean chains 85, error handling 22 (53 pts), loops 5 (11 pts) (nesting depth added 238). Most of this is not in the body itself: 12 of the 547 points are its own statements and the rest belongs to 29 function items inside it that branch (a function literal at line 7247, a function literal at line 6955, a function literal at line 5931, …). 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.
background.runCheckBackgroundTask (cognitive 375) packages/api/src/agents/background.ts:2518— background.runCheckBackgroundTask has cognitive complexity 375 (threshold 15). Drivers by points: if/else 64 (244 pts), ternaries 20 (67 pts), error handling 9 (33 pts), boolean chains 31 (nesting depth added 251). Of this number, 371 points are the body's own statements and 4 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.
ResumeAgentController (cognitive 368) api/server/controllers/agents/resume.js:772— ResumeAgentController has cognitive complexity 368 (threshold 15). Drivers by points: if/else 92 (157 pts), error handling 37 (89 pts), boolean chains 54, ternaries 20 (44 pts), other 24 (nesting depth added 141). Of this number, 335 points are the body's own statements and 33 belong to 37 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.
ResumableAgentController (cognitive 348) api/server/controllers/agents/request.js:769— ResumableAgentController has cognitive complexity 348 (threshold 15). Drivers by points: if/else 175 (318 pts), boolean chains 153, ternaries 58 (91 pts), error handling 38 (90 pts), other 35 (nesting depth added 228). To reduce it, split the body into named stages: move each independent 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.extractMessageContent (cognitive 294) packages/api/src/protection/adapters/messages.ts:781— messages.extractMessageContent has cognitive complexity 294 (threshold 15). Drivers by points: if/else 71 (219 pts), ternaries 10 (26 pts), loops 7 (19 pts), boolean chains 18, error handling 5 (12 pts) (nesting depth added 183). Of this number, 251 points are the body's own statements and 43 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.
outcome.createAgentEventTerminalHandler (cognitive 290) packages/api/src/agents/triggers/outcome.ts:292— outcome.createAgentEventTerminalHandler has cognitive complexity 290 (threshold 15). Drivers by points: if/else 82 (168 pts), ternaries 30 (75 pts), boolean chains 47 (nesting depth added 131). None of this is in the body itself: all 290 points belong to 2 function literals inside it that branch (lines 323, 346). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SubagentThreadPanel.SubagentThreadPanel (cognitive 287) client/src/components/Chat/Subagents/SubagentThreadPanel.tsx:127— SubagentThreadPanel.SubagentThreadPanel has cognitive complexity 287 (threshold 15). Drivers by points: boolean chains 109, if/else 89 (99 pts), ternaries 60 (77 pts), error handling 2 (nesting depth added 27). Of this number, 89 points are the body's own statements and 198 belong to 50 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.
initialize.initializeAgent (cognitive 267) packages/api/src/agents/initialize.ts:1221— initialize.initializeAgent has cognitive complexity 267 (threshold 15). Drivers by points: if/else 91 (126 pts), boolean chains 67, ternaries 43 (63 pts), loops 5 (9 pts), error handling 2 (nesting depth added 59). Of this number, 249 points are the body's own statements and 18 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.
MessageNav.MessageNav (cognitive 263) client/src/components/Chat/Messages/MessageNav.tsx:370— MessageNav.MessageNav has cognitive complexity 263 (threshold 15). Drivers by points: if/else 141 (187 pts), boolean chains 33, loops 21 (27 pts), ternaries 15 (16 pts) (nesting depth added 53). Most of this is not in the body itself: 13 of the 263 points are its own statements and the rest belongs to 62 function literals inside it that branch (lines 1146, 1255, 1439, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MCPManager.callTool (cognitive 262) packages/api/src/mcp/MCPManager.ts:1486— MCPManager.callTool has cognitive complexity 262 (threshold 15). Drivers by points: if/else 61 (173 pts), boolean chains 43, error handling 8 (22 pts), ternaries 10 (21 pts), loops 2 (3 pts) (nesting depth added 138). Of this number, 212 points are the body's own statements and 50 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.
llm.getOpenAILLMConfig (cognitive 250) packages/api/src/endpoints/openai/llm.ts:601— llm.getOpenAILLMConfig has cognitive complexity 250 (threshold 15). Drivers by points: if/else 83 (182 pts), boolean chains 58, loops 4 (8 pts), ternaries 1 (2 pts) (nesting depth added 104). Of this number, 246 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.
ResumableAgentController::startGeneration (cognitive 234) api/server/controllers/agents/request.js:2261— ResumableAgentController::startGeneration has cognitive complexity 234 (threshold 15). Drivers by points: if/else 63 (117 pts), error handling 15 (41 pts), boolean chains 34, ternaries 20 (29 pts), other 13 (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.
modelBoundContent.inspectModelBoundContent (cognitive 209) packages/api/src/middleware/modelBoundContent.ts:3507— modelBoundContent.inspectModelBoundContent has cognitive complexity 209 (threshold 15). Drivers by points: if/else 45 (137 pts), boolean chains 31, loops 14 (28 pts), ternaries 6 (8 pts), error handling 3 (5 pts) (nesting depth added 110). Of this number, 177 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.
resolution.foldConfigLayers (cognitive 206) packages/data-schemas/src/app/resolution.ts:2273— resolution.foldConfigLayers has cognitive complexity 206 (threshold 15). Drivers by points: if/else 37 (127 pts), loops 11 (46 pts), boolean chains 20, ternaries 3 (13 pts) (nesting depth added 135). 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.
actor.executeAgentEventActor (cognitive 200) packages/api/src/agents/triggers/actor.ts:226— actor.executeAgentEventActor has cognitive complexity 200 (threshold 15). Drivers by points: ternaries 47 (86 pts), if/else 53 (83 pts), boolean chains 26, error handling 4 (5 pts) (nesting depth added 70). Of this number, 198 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.
permissions.updateInterfacePermissions (cognitive 193) packages/api/src/app/permissions.ts:104— permissions.updateInterfacePermissions has cognitive complexity 193 (threshold 15). Drivers by points: ternaries 41 (86 pts), boolean chains 53, if/else 23 (45 pts), loops 4 (8 pts), error handling 1 (nesting depth added 71). Of this number, 161 points are the body's own statements and 32 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.
initializeClientWithProvider (cognitive 193) api/server/services/Endpoints/agents/initialize.js:223— initializeClientWithProvider has cognitive complexity 193 (threshold 15). Drivers by points: if/else 67 (78 pts), boolean chains 36, other 30, ternaries 27 (29 pts), loops 9 (11 pts), error handling 6 (9 pts) (nesting depth added 18). Of this number, 70 points are the body's own statements and 123 belong to 96 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.
GenerationJobManagerClass.subscribeWithResume (cognitive 185) packages/api/src/stream/GenerationJobManager.ts:6168— GenerationJobManagerClass.subscribeWithResume has cognitive complexity 185 (threshold 15). Drivers by points: if/else 72 (135 pts), boolean chains 29, loops 4 (11 pts), ternaries 6 (9 pts), error handling 1 (nesting depth added 73). Of this number, 162 points are the body's own statements and 23 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.
SubagentPublicRecorder.recordEvent (cognitive 173) packages/api/src/agents/activity.ts:710— SubagentPublicRecorder.recordEvent has cognitive complexity 173 (threshold 15). Drivers by points: if/else 40 (98 pts), ternaries 19 (44 pts), boolean chains 19, loops 5 (12 pts) (nesting depth added 90). To reduce it, split the body into named stages: move each independent 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.validateSettingDefinitions (cognitive 170) packages/data-provider/src/generate.ts:256— generate.validateSettingDefinitions has cognitive complexity 170 (threshold 15). Drivers by points: if/else 50 (124 pts), boolean chains 38, loops 4 (7 pts), ternaries 1 (nesting depth added 77). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Palette.Palette (cognitive 164) client/src/components/Chat/Input/Composer/Palette.tsx:197— Palette.Palette has cognitive complexity 164 (threshold 15). Drivers by points: if/else 56 (71 pts), boolean chains 48, ternaries 23 (30 pts), loops 9 (15 pts) (nesting depth added 28). Of this number, 29 points are the body's own statements and 135 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.
sendReservedMessage (cognitive 163) api/app/clients/BaseClient.js:772— sendReservedMessage has cognitive complexity 163 (threshold 15). Drivers by points: if/else 55 (104 pts), boolean chains 29, other 9, error handling 4 (8 pts), ternaries 6 (7 pts), loops 2 (6 pts) (nesting depth added 58). Of this number, 146 points are the body's own statements and 17 belong to 18 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.router.post("/chat/abort") (cognitive 147) api/server/routes/agents/index.js:602— index.router.post("/chat/abort") has cognitive complexity 147 (threshold 15). Drivers by points: if/else 34 (75 pts), boolean chains 39, ternaries 10 (19 pts), error handling 4 (11 pts), loops 2 (3 pts) (nesting depth added 58). Of this number, 96 points are the body's own statements and 51 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.
subagentContent.foldSubagentEvent (cognitive 138) client/src/utils/subagentContent.ts:219— subagentContent.foldSubagentEvent has cognitive complexity 138 (threshold 15). Drivers by points: if/else 30 (59 pts), ternaries 21 (56 pts), boolean chains 19, loops 2 (4 pts) (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.
messages.snapshotExternalMessages (cognitive 136) packages/api/src/protection/adapters/messages.ts:417— messages.snapshotExternalMessages has cognitive complexity 136 (threshold 15). Drivers by points: if/else 25 (77 pts), ternaries 6 (23 pts), error handling 6 (16 pts), boolean chains 11, loops 3 (9 pts) (nesting depth added 85). Of this number, 130 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.
updateAgentHandler (cognitive 131) REDACTED:1056— updateAgentHandler has cognitive complexity 131 (threshold 15). Drivers by points: if/else 42 (80 pts), boolean chains 20, other 14, loops 2 (8 pts), ternaries 5 (8 pts), error handling 1 (nesting depth added 47). Of this number, 128 points are the body's own statements and 3 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.
workspace.executeWorkspaceTool (cognitive 128) packages/api/src/code/workspace.ts:1310— workspace.executeWorkspaceTool has cognitive complexity 128 (threshold 15). Drivers by points: if/else 30 (68 pts), boolean chains 29, ternaries 14 (27 pts), error handling 2 (3 pts), loops 1 (nesting depth added 52). Of this number, 117 points are the body's own statements and 11 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.
protection.extractNestedSerializedPayloadFragments (cognitive 128) packages/api/src/shared-links/protection.ts:1207— protection.extractNestedSerializedPayloadFragments has cognitive complexity 128 (threshold 15). Drivers by points: if/else 20 (62 pts), loops 15 (55 pts), boolean chains 8, ternaries 1 (3 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.
engine.startScheduleEngine (cognitive 127) packages/api/src/schedules/engine.ts:44— engine.startScheduleEngine has cognitive complexity 127 (threshold 15). Drivers by points: if/else 34 (74 pts), ternaries 8 (17 pts), error handling 8 (16 pts), boolean chains 13, loops 6 (7 pts) (nesting depth added 58). None of this is in the body itself: all 127 points belong to 16 function items inside it that branch (a function literal at line 69, a function literal at line 500, a function literal at line 334, …). 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.
AccessControlService.bulkUpdateResourcePermissions (cognitive 126) packages/api/src/acl/accessControlService.ts:472— AccessControlService.bulkUpdateResourcePermissions has cognitive complexity 126 (threshold 15). Drivers by points: if/else 42 (62 pts), boolean chains 24, ternaries 12 (23 pts), error handling 5 (10 pts), loops 6 (7 pts) (nesting depth added 37). Of this number, 111 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.
llm.getGoogleConfig (cognitive 123) packages/api/src/endpoints/google/llm.ts:491— llm.getGoogleConfig has cognitive complexity 123 (threshold 15). Drivers by points: if/else 47 (87 pts), boolean chains 25, ternaries 3 (5 pts), loops 2 (4 pts), error handling 1 (2 pts) (nesting depth added 45). Of this number, 115 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.
RedisJobStore.deserializeJob (cognitive 122) packages/api/src/stream/implementations/RedisJobStore.ts:5620— RedisJobStore.deserializeJob has cognitive complexity 122 (threshold 15). Drivers by points: boolean chains 47, ternaries 41 (43 pts), if/else 14 (27 pts), error handling 2 (3 pts), loops 1 (2 pts) (nesting depth added 17). Of this number, 118 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
loadTools (cognitive 121) api/app/clients/tools/util/handleTools.js:136— loadTools has cognitive complexity 121 (threshold 15). Drivers by points: if/else 30 (71 pts), boolean chains 18, other 12, ternaries 5 (11 pts), error handling 2 (7 pts), loops 2 (nesting depth added 52). Of this number, 95 points are the body's own statements and 26 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.
RedisJobStore.getContentParts (cognitive 120) packages/api/src/stream/implementations/RedisJobStore.ts:4354— RedisJobStore.getContentParts has cognitive complexity 120 (threshold 15). Drivers by points: if/else 38 (85 pts), ternaries 7 (18 pts), boolean chains 14, loops 3 (nesting depth added 58). To reduce it, split the body into named stages: move each independent 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.createConversationMethods.saveConvo (cognitive 119) packages/data-schemas/src/methods/conversation.ts:2405— conversation.createConversationMethods.saveConvo has cognitive complexity 119 (threshold 15). Drivers by points: if/else 45 (68 pts), boolean chains 27, error handling 7 (15 pts), ternaries 5 (7 pts), loops 1 (2 pts) (nesting depth added 34). Of this number, 110 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.
ContentParts.ContentPartsBody (cognitive 117) client/src/components/Chat/Messages/Content/ContentParts.tsx:465— ContentParts.ContentPartsBody has cognitive complexity 117 (threshold 15). Drivers by points: if/else 28 (44 pts), boolean chains 36, ternaries 18 (22 pts), loops 10 (15 pts) (nesting depth added 25). Of this number, 46 points are the body's own statements and 71 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.
llm.getLLMConfig (cognitive 117) packages/api/src/endpoints/anthropic/llm.ts:136— llm.getLLMConfig has cognitive complexity 117 (threshold 15). Drivers by points: if/else 49 (84 pts), boolean chains 27, loops 2 (4 pts), ternaries 2 (nesting depth added 37). Of this number, 110 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.
process.processAgentFileUpload (cognitive 115) api/server/services/Files/process.js:809— process.processAgentFileUpload has cognitive complexity 115 (threshold 15). Drivers by points: if/else 36 (63 pts), boolean chains 20, ternaries 12 (18 pts), error handling 5 (14 pts) (nesting depth added 42). Of this number, 82 points are the body's own statements and 33 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.
GenerationJobManagerClass.createJob (cognitive 114) packages/api/src/stream/GenerationJobManager.ts:2542— GenerationJobManagerClass.createJob has cognitive complexity 114 (threshold 15). Drivers by points: if/else 39 (63 pts), boolean chains 29, error handling 8 (16 pts), ternaries 4 (5 pts), loops 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
modelBoundContent.projectModelBoundProviderContent (cognitive 114) packages/api/src/middleware/modelBoundContent.ts:2778— modelBoundContent.projectModelBoundProviderContent has cognitive complexity 114 (threshold 15). Drivers by points: if/else 27 (75 pts), boolean chains 15, loops 7 (15 pts), ternaries 2 (8 pts), error handling 1 (nesting depth added 62). Of this number, 111 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.
resumeCompletion (cognitive 113) api/server/controllers/agents/client.js:5423— resumeCompletion has cognitive complexity 113 (threshold 15). Drivers by points: if/else 23 (37 pts), other 27, ternaries 14 (17 pts), loops 8 (16 pts), boolean chains 12, error handling 3 (4 pts) (nesting depth added 26). Of this number, 68 points are the body's own statements and 45 belong to 18 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.
backgroundCompletionWakeup.createBackgroundToolCompletionWakeupResolver::resolve (cognitive 112) packages/api/src/agents/backgroundCompletionWakeup.ts:294— backgroundCompletionWakeup.createBackgroundToolCompletionWakeupResolver::resolve has cognitive complexity 112 (threshold 15). Drivers by points: if/else 36 (75 pts), boolean chains 23, ternaries 6 (9 pts), loops 1 (3 pts), error handling 2 (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.
service.createSchedulesService.recordScheduleOutcome (cognitive 112) packages/api/src/schedules/service.ts:1428— service.createSchedulesService.recordScheduleOutcome has cognitive complexity 112 (threshold 15). Drivers by points: if/else 27 (48 pts), boolean chains 29, error handling 8 (18 pts), ternaries 10 (16 pts), loops 1 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
buildMessages (cognitive 110) api/server/controllers/agents/client.js:2366— buildMessages has cognitive complexity 110 (threshold 15). Drivers by points: if/else 50 (85 pts), loops 24 (53 pts), other 41, boolean chains 33, ternaries 20 (29 pts), error handling 3 (nesting depth added 73). To reduce it, split the body into named stages: move each independent 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.handleSteerRequestInternal (cognitive 109) packages/api/src/agents/steering/request.ts:401— request.handleSteerRequestInternal has cognitive complexity 109 (threshold 15). Drivers by points: if/else 49 (73 pts), boolean chains 31, ternaries 3 (5 pts) (nesting depth added 26). Of this number, 107 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.
refreshController (cognitive 109) REDACTED:240— refreshController has cognitive complexity 109 (threshold 15). Drivers by points: if/else 20 (58 pts), ternaries 8 (22 pts), error handling 5 (18 pts), boolean chains 9, other 2 (nesting depth added 65). Of this number, 64 points are the body's own statements and 45 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.
cleanup.disposeClient (cognitive 108) api/server/cleanup.js:58— cleanup.disposeClient has cognitive complexity 108 (threshold 15). Drivers by points: if/else 87 (107 pts), error handling 1 (nesting depth added 20). Of this number, 100 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
zod.convertJsonSchemaToZod (cognitive 108) packages/api/src/mcp/zod.ts:830— zod.convertJsonSchemaToZod has cognitive complexity 108 (threshold 15). Drivers by points: if/else 34 (82 pts), boolean chains 21, ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 51). Of this number, 104 points are the body's own statements and 4 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.
openai.executeOpenAIChatCompletion (cognitive 107) api/server/controllers/agents/openai.js:288— openai.executeOpenAIChatCompletion has cognitive complexity 107 (threshold 15). Drivers by points: if/else 37 (50 pts), boolean chains 19, loops 10 (17 pts), ternaries 12 (16 pts), error handling 3 (5 pts) (nesting depth added 26). Of this number, 16 points are the body's own statements and 91 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.
CodeWorkspaceMenu.CodeWorkspaceMenu (cognitive 105) client/src/components/Chat/Input/CodeWorkspaceMenu.tsx:449— CodeWorkspaceMenu.CodeWorkspaceMenu has cognitive complexity 105 (threshold 15). Drivers by points: boolean chains 56, ternaries 26 (31 pts), if/else 17 (18 pts) (nesting depth added 6). Of this number, 74 points are the body's own statements and 31 belong to 17 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.
GenerationJobManagerClass.emitChunkNow (cognitive 105) packages/api/src/stream/GenerationJobManager.ts:7013— GenerationJobManagerClass.emitChunkNow has cognitive complexity 105 (threshold 15). Drivers by points: if/else 36 (74 pts), boolean chains 14, ternaries 4 (9 pts), error handling 2 (6 pts), loops 1 (2 pts) (nesting depth added 48). Of this number, 88 points are the body's own statements and 17 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.
message.createMessageMethods.claimBackgroundToolResults (cognitive 105) packages/data-schemas/src/methods/message.ts:2091— message.createMessageMethods.claimBackgroundToolResults has cognitive complexity 105 (threshold 15). Drivers by points: if/else 24 (44 pts), boolean chains 32, ternaries 17 (28 pts), loops 1 (nesting depth added 31). Of this number, 99 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.
agent.createAgentMethods.getListAgentsByAccess (cognitive 103) packages/data-schemas/src/methods/agent.ts:2018— agent.createAgentMethods.getListAgentsByAccess has cognitive complexity 103 (threshold 15). Drivers by points: if/else 27 (44 pts), ternaries 18 (32 pts), boolean chains 19, loops 4 (8 pts) (nesting depth added 35). Of this number, 82 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.
(anonymous) (cognitive 103) api/server/routes/agents/index.js:602— (anonymous) has cognitive complexity 103 (threshold 15). Drivers by points: if/else 34 (75 pts), boolean chains 44, ternaries 10 (18 pts), error handling 4 (11 pts), other 5, loops 2 (3 pts) (nesting depth added 57). 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.
handlers.handleReadFileCall (cognitive 102) packages/api/src/agents/handlers.ts:4635— handlers.handleReadFileCall has cognitive complexity 102 (threshold 15). Drivers by points: if/else 50 (76 pts), boolean chains 17, ternaries 4 (5 pts), loops 2 (3 pts), error handling 1 (nesting depth added 28). Of this number, 101 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.
fire.fireSchedule (cognitive 102) packages/api/src/schedules/fire.ts:126— fire.fireSchedule has cognitive complexity 102 (threshold 15). Drivers by points: if/else 44 (60 pts), ternaries 14 (22 pts), boolean chains 10, error handling 7 (10 pts) (nesting depth added 27). Most of this is not in the body itself: 2 of the 102 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 249, a function literal at line 516, advance, …). 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.
responses.executeResponse (cognitive 101) api/server/controllers/agents/responses.js:526— responses.executeResponse has cognitive complexity 101 (threshold 15). Drivers by points: if/else 30 (46 pts), ternaries 13 (19 pts), boolean chains 18, error handling 5 (11 pts), loops 5 (7 pts) (nesting depth added 30). Of this number, 17 points are the body's own statements and 84 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.
Artifacts.Artifacts (cognitive 101) client/src/components/Artifacts/Artifacts.tsx:45— Artifacts.Artifacts has cognitive complexity 101 (threshold 15). Drivers by points: if/else 40 (41 pts), boolean chains 33, ternaries 20 (24 pts), error handling 2 (3 pts) (nesting depth added 6). Of this number, 51 points are the body's own statements and 50 belong to 17 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.
requests.executeDurableWorkspaceRequest (cognitive 101) packages/api/src/code/requests.ts:83— requests.executeDurableWorkspaceRequest has cognitive complexity 101 (threshold 15). Drivers by points: if/else 33 (79 pts), boolean chains 11, ternaries 5 (6 pts), error handling 2 (4 pts), loops 1 (nesting depth added 49). Of this number, 88 points are the body's own statements and 13 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.
web.loadWebSearchAuth::checkAuth (cognitive 100) packages/api/src/web/web.ts:628— web.loadWebSearchAuth::checkAuth has cognitive complexity 100 (threshold 15). Drivers by points: if/else 36 (65 pts), boolean chains 23, loops 4 (7 pts), ternaries 2 (3 pts), error handling 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.
conversation.createConversationMethods.getConvosByCursor (cognitive 99) packages/data-schemas/src/methods/conversation.ts:3615— conversation.createConversationMethods.getConvosByCursor has cognitive complexity 99 (threshold 15). Drivers by points: if/else 33 (53 pts), ternaries 14 (25 pts), boolean chains 9, loops 4 (7 pts), error handling 3 (5 pts) (nesting depth added 36). Of this number, 96 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.
reducer.reduceStep (cognitive 98) packages/chat/src/core/reducer.ts:50— reducer.reduceStep has cognitive complexity 98 (threshold 15). Drivers by points: if/else 37 (62 pts), ternaries 7 (18 pts), boolean chains 15, loops 1 (3 pts) (nesting depth added 38). Of this number, 95 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.
useMCPServerManager.useMCPServerManager (cognitive 97) client/src/hooks/MCP/useMCPServerManager.ts:79— useMCPServerManager.useMCPServerManager has cognitive complexity 97 (threshold 15). Drivers by points: if/else 44 (57 pts), boolean chains 26, ternaries 5 (7 pts), error handling 3 (4 pts), loops 2 (3 pts) (nesting depth added 17). Most of this is not in the body itself: 3 of the 97 points are its own statements and the rest belongs to 22 function literals inside it that branch (lines 338, 133, 511, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RedisJobStore.createJob (cognitive 96) packages/api/src/stream/implementations/RedisJobStore.ts:2053— RedisJobStore.createJob has cognitive complexity 96 (threshold 15). Drivers by points: boolean chains 46, if/else 24 (26 pts), ternaries 19 (22 pts), match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
useAutoSave.useAutoSave (cognitive 95) client/src/hooks/Input/useAutoSave.ts:44— useAutoSave.useAutoSave has cognitive complexity 95 (threshold 15). Drivers by points: if/else 37 (51 pts), boolean chains 34, ternaries 5 (8 pts), error handling 1, loops 1 (nesting depth added 17). Most of this is not in the body itself: 2 of the 95 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 401, 616, 104, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chatCompletion (cognitive 95) api/server/controllers/agents/client.js:4544— chatCompletion has cognitive complexity 95 (threshold 15). Drivers by points: if/else 34 (42 pts), other 28, ternaries 26 (28 pts), boolean chains 20, loops 4 (6 pts), error handling 2 (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
useFileHandling.useFileHandlingCore.processFiles (cognitive 94) client/src/hooks/Files/useFileHandling.ts:683— useFileHandling.useFileHandlingCore.processFiles has cognitive complexity 94 (threshold 15). Drivers by points: if/else 27 (53 pts), boolean chains 18, ternaries 7 (10 pts), error handling 4 (7 pts), loops 6 (nesting depth added 32). Of this number, 83 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.
resources.primeResources (cognitive 94) packages/api/src/agents/resources.ts:764— resources.primeResources has cognitive complexity 94 (threshold 15). Drivers by points: if/else 23 (52 pts), loops 9 (18 pts), boolean chains 11, ternaries 6 (9 pts), error handling 2 (4 pts) (nesting depth added 43). Of this number, 93 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.
activity.projectSubagentActivity (cognitive 93) packages/api/src/agents/activity.ts:405— activity.projectSubagentActivity has cognitive complexity 93 (threshold 15). Drivers by points: if/else 18 (39 pts), ternaries 12 (39 pts), boolean chains 11, loops 2 (3 pts), error handling 1 (nesting depth added 49). Of this number, 90 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.
recovery.createOpenIDRefreshRecoveryService.sendOpenIDAuthResponse (cognitive 93) packages/api/src/auth/openid/recovery.ts:674— recovery.createOpenIDRefreshRecoveryService.sendOpenIDAuthResponse has cognitive complexity 93 (threshold 15). Drivers by points: if/else 27 (46 pts), boolean chains 19, error handling 7 (19 pts), ternaries 4 (9 pts) (nesting depth added 36). Of this number, 66 points are the body's own statements and 27 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.
message.createMessageMethods.settleToolCallResult (cognitive 93) packages/data-schemas/src/methods/message.ts:1626— message.createMessageMethods.settleToolCallResult has cognitive complexity 93 (threshold 15). Drivers by points: if/else 26 (50 pts), ternaries 14 (22 pts), boolean chains 19, error handling 1, loops 1 (nesting depth added 32). Of this number, 55 points are the body's own statements and 38 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.
executeResponse::execute (cognitive 92) api/server/controllers/agents/responses.js:684— executeResponse::execute has cognitive complexity 92 (threshold 15). Drivers by points: if/else 20 (32 pts), error handling 7 (17 pts), boolean chains 16, ternaries 10 (14 pts), other 7, loops 4 (6 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.
modelBoundContent.projectStoredMessageForProvider (cognitive 91) packages/api/src/middleware/modelBoundContent.ts:2030— modelBoundContent.projectStoredMessageForProvider has cognitive complexity 91 (threshold 15). Drivers by points: if/else 29 (59 pts), boolean chains 16, loops 4 (8 pts), error handling 4 (7 pts), ternaries 1 (nesting depth added 37). Of this number, 84 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.
skillFiles.primeInvokedSkills (cognitive 91) packages/api/src/agents/skillFiles.ts:749— skillFiles.primeInvokedSkills has cognitive complexity 91 (threshold 15). Drivers by points: if/else 17 (43 pts), loops 7 (19 pts), ternaries 4 (14 pts), boolean chains 11, error handling 1 (4 pts) (nesting depth added 51). Of this number, 76 points are the body's own statements and 15 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.
(anonymous) (cognitive 91) REDACTED:279— (anonymous) has cognitive complexity 91 (threshold 15). Drivers by points: if/else 31 (53 pts), error handling 7 (14 pts), boolean chains 13, ternaries 4 (7 pts), other 3, loops 1 (nesting depth added 32). Of this number, 49 points are the body's own statements and 42 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.
usePaletteEntries.usePaletteEntries (cognitive 89) client/src/hooks/Input/usePaletteEntries.tsx:147— usePaletteEntries.usePaletteEntries has cognitive complexity 89 (threshold 15). Drivers by points: if/else 23 (41 pts), boolean chains 24, ternaries 9 (16 pts), loops 4 (8 pts) (nesting depth added 29). Most of this is not in the body itself: 3 of the 89 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 266, 221, 521, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MCPConnectionFactory.handleOAuthEvents::handleOAuthEvent (cognitive 89) packages/api/src/mcp/MCPConnectionFactory.ts:1850— MCPConnectionFactory.handleOAuthEvents::handleOAuthEvent has cognitive complexity 89 (threshold 15). Drivers by points: if/else 29 (62 pts), boolean chains 10, ternaries 4 (9 pts), error handling 4 (8 pts) (nesting depth added 42). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Queue.QueueRow (cognitive 88) client/src/components/Chat/Input/Composer/Queue.tsx:121— Queue.QueueRow has cognitive complexity 88 (threshold 15). Drivers by points: boolean chains 46, if/else 24 (28 pts), ternaries 13, loops 1 (nesting depth added 4). Of this number, 59 points are the body's own statements and 29 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.
submissions.extractStoredMessageContentWithBudget (cognitive 88) packages/api/src/protection/adapters/submissions.ts:1202— submissions.extractStoredMessageContentWithBudget has cognitive complexity 88 (threshold 15). Drivers by points: if/else 37 (57 pts), boolean chains 10, ternaries 9 (10 pts), loops 6, error handling 4 (5 pts) (nesting depth added 22). Of this number, 28 points are the body's own statements and 60 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.
definitions.loadToolDefinitions (cognitive 88) packages/api/src/tools/definitions.ts:126— definitions.loadToolDefinitions has cognitive complexity 88 (threshold 15). Drivers by points: if/else 25 (62 pts), boolean chains 11, loops 5 (10 pts), ternaries 3 (5 pts) (nesting depth added 44). Of this number, 80 points are the body's own statements and 8 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.
sync.handleSync (cognitive 88) packages/chat/src/core/resumable/sync.ts:32— sync.handleSync has cognitive complexity 88 (threshold 15). Drivers by points: if/else 36 (58 pts), ternaries 6 (16 pts), boolean chains 7, loops 4 (7 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
activityLabels.groupActivityPhases (cognitive 87) client/src/utils/activityLabels.ts:496— activityLabels.groupActivityPhases has cognitive complexity 87 (threshold 15). Drivers by points: if/else 26 (57 pts), loops 7 (18 pts), boolean chains 8, ternaries 3 (4 pts) (nesting depth added 43). Of this number, 83 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.
SetKeyDialog.SetKeyDialog (cognitive 86) client/src/components/Input/SetKeyDialog/SetKeyDialog.tsx:151— SetKeyDialog.SetKeyDialog has cognitive complexity 86 (threshold 15). Drivers by points: ternaries 12 (36 pts), if/else 19 (32 pts), boolean chains 17, error handling 1 (nesting depth added 37). Most of this is not in the body itself: 3 of the 86 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 231, a function literal at line 242, 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.
Stage.Stage (cognitive 86) client/src/components/Lia/Stage.tsx:81— Stage.Stage has cognitive complexity 86 (threshold 15). Drivers by points: if/else 50 (57 pts), boolean chains 19, ternaries 6 (8 pts), loops 2 (nesting depth added 9). Most of this is not in the body itself: 1 of the 86 points is its own statement and the rest belongs to 24 function literals inside it that branch (lines 281, 124, 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.
files.getCanonicalFileReferenceIds (cognitive 86) packages/api/src/protection/files.ts:800— files.getCanonicalFileReferenceIds has cognitive complexity 86 (threshold 15). Drivers by points: if/else 15 (43 pts), error handling 3 (15 pts), boolean chains 12, loops 5 (12 pts), ternaries 1 (4 pts) (nesting depth added 50). Of this number, 85 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.
subagentContent.readSubagentContent (cognitive 86) packages/api/src/agents/subagentContent.ts:405— subagentContent.readSubagentContent has cognitive complexity 86 (threshold 15). Drivers by points: if/else 19 (55 pts), boolean chains 14, ternaries 4 (14 pts), loops 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.
McpSection.McpSection (cognitive 84) client/src/components/SidePanel/Agents/Tools/ItemDialog/sections/McpSection.tsx:68— McpSection.McpSection has cognitive complexity 84 (threshold 15). Drivers by points: boolean chains 43, if/else 20 (24 pts), ternaries 14, loops 2, error handling 1 (nesting depth added 4). Of this number, 41 points are the body's own statements and 43 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.
useDrawerSwipe.useDrawerSwipe (cognitive 84) client/src/hooks/Nav/useDrawerSwipe.ts:289— useDrawerSwipe.useDrawerSwipe has cognitive complexity 84 (threshold 15). Drivers by points: if/else 38 (49 pts), boolean chains 20, ternaries 8 (15 pts) (nesting depth added 18). None of this is in the body itself: all 84 points belong to 12 function literals inside it that branch (lines 510, 306, 577, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
skillFiles.executePrimeSkillFiles (cognitive 84) packages/api/src/agents/skillFiles.ts:409— skillFiles.executePrimeSkillFiles has cognitive complexity 84 (threshold 15). Drivers by points: if/else 20 (50 pts), loops 4 (11 pts), error handling 4 (10 pts), ternaries 4 (10 pts), boolean chains 3 (nesting depth added 49). Of this number, 78 points are the body's own statements and 6 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.
mongoMeili.createMeiliMongooseModel (cognitive 84) packages/data-schemas/src/models/plugins/mongoMeili.ts:299— mongoMeili.createMeiliMongooseModel has cognitive complexity 84 (threshold 15). Drivers by points: if/else 33 (56 pts), boolean chains 8, error handling 7 (8 pts), ternaries 5 (8 pts), loops 4 (nesting depth added 27). Of this number, 55 points are the body's own statements and 29 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.
models.createLoadConfigModels (cognitive 83) packages/api/src/endpoints/config/models.ts:88— models.createLoadConfigModels has cognitive complexity 83 (threshold 15). Drivers by points: if/else 20 (42 pts), ternaries 5 (15 pts), boolean chains 14, loops 7 (12 pts) (nesting depth added 37). None of this is in the body itself: all 83 points belong to 4 function literals inside it that branch (lines 91, 299, 242, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
launch.startGeneration (cognitive 83) packages/chat/src/core/resumable/launch.ts:37— launch.startGeneration has cognitive complexity 83 (threshold 15). Drivers by points: if/else 21 (49 pts), ternaries 4 (16 pts), boolean chains 12, error handling 2 (5 pts), loops 1 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataTable.DataTable (cognitive 83) packages/client/src/components/DataTable/DataTable.tsx:36— DataTable.DataTable has cognitive complexity 83 (threshold 15). Drivers by points: if/else 39 (40 pts), boolean chains 34, ternaries 9 (nesting depth added 1). Of this number, 22 points are the body's own statements and 61 belong to 27 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.
ToolCall.ToolCall (cognitive 82) client/src/components/Chat/Messages/Content/ToolCall.tsx:35— ToolCall.ToolCall has cognitive complexity 82 (threshold 15). Drivers by points: boolean chains 34, if/else 31 (34 pts), ternaries 9 (12 pts), error handling 2 (nesting depth added 6). Of this number, 22 points are the body's own statements and 60 belong to 16 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.
WebSearch.WebSearch (cognitive 82) client/src/components/Chat/Messages/Content/WebSearch.tsx:63— WebSearch.WebSearch has cognitive complexity 82 (threshold 15). Drivers by points: boolean chains 35, ternaries 12 (24 pts), if/else 15 (19 pts), loops 3 (4 pts) (nesting depth added 17). Of this number, 47 points are the body's own statements and 35 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.
ChatForm.ChatForm (cognitive 82) client/src/components/Chat/Input/ChatForm.tsx:151— ChatForm.ChatForm has cognitive complexity 82 (threshold 15). Drivers by points: boolean chains 50, if/else 16 (17 pts), ternaries 14, loops 1 (nesting depth added 1). Of this number, 43 points are the body's own statements and 39 belong to 18 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.
actor.resumeAgentEventActor (cognitive 82) packages/api/src/agents/triggers/actor.ts:905— actor.resumeAgentEventActor has cognitive complexity 82 (threshold 15). Drivers by points: ternaries 24 (38 pts), if/else 28 (33 pts), boolean chains 8, error handling 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.
MCPTokenStorage.storeTokensUnderLease (cognitive 82) packages/api/src/mcp/oauth/tokens.ts:580— MCPTokenStorage.storeTokensUnderLease has cognitive complexity 82 (threshold 15). Drivers by points: if/else 29 (38 pts), ternaries 12 (17 pts), boolean chains 16, error handling 3 (6 pts), loops 3 (5 pts) (nesting depth added 19). Of this number, 78 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.
zod.sanitizeGeminiSchema (cognitive 82) packages/api/src/mcp/zod.ts:673— zod.sanitizeGeminiSchema has cognitive complexity 82 (threshold 15). Drivers by points: if/else 27 (56 pts), boolean chains 17, ternaries 2 (5 pts), loops 2 (4 pts) (nesting depth added 34). Of this number, 78 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.
triggerDelivery.createAgentTriggerDeliveryMethods.claimAgentBackgroundToolResultBatch (cognitive 82) packages/data-schemas/src/methods/triggerDelivery.ts:3026— triggerDelivery.createAgentTriggerDeliveryMethods.claimAgentBackgroundToolResultBatch has cognitive complexity 82 (threshold 15). Drivers by points: if/else 30 (49 pts), boolean chains 16, ternaries 7 (15 pts), loops 1 (2 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.
reinitMCPServer (cognitive 82) api/server/services/Tools/mcp.js:144— reinitMCPServer has cognitive complexity 82 (threshold 15). Drivers by points: if/else 28 (42 pts), boolean chains 16, error handling 5 (11 pts), other 7, ternaries 4 (6 pts) (nesting depth added 22). Of this number, 74 points are the body's own statements and 8 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.
GenerationJobManagerClass.attachSubscription (cognitive 81) packages/api/src/stream/GenerationJobManager.ts:5132— GenerationJobManagerClass.attachSubscription has cognitive complexity 81 (threshold 15). Drivers by points: if/else 75 (99 pts), boolean chains 38, loops 4 (13 pts), error handling 4 (6 pts), ternaries 2 (nesting depth added 35). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and 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 (GenerationJobManagerClass.attachSubscription::deliverStoredTerminal) 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.
run.createRun (cognitive 81) packages/api/src/agents/run.ts:2130— run.createRun has cognitive complexity 81 (threshold 15). Drivers by points: if/else 42 (65 pts), boolean chains 35, loops 11 (21 pts), ternaries 11 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (run.createRun::buildAgentInput) 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.
Breakdown.Breakdown (cognitive 80) client/src/components/Chat/Input/TokenUsage/Breakdown.tsx:112— Breakdown.Breakdown has cognitive complexity 80 (threshold 15). Drivers by points: boolean chains 35, ternaries 26 (31 pts), if/else 10 (12 pts), loops 2 (nesting depth added 7). Of this number, 59 points are the body's own statements and 21 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.
ArtifactCodeEditor.ArtifactCodeEditor (cognitive 78) client/src/components/Artifacts/ArtifactCodeEditor.tsx:236— ArtifactCodeEditor.ArtifactCodeEditor has cognitive complexity 78 (threshold 15). Drivers by points: if/else 43 (49 pts), boolean chains 18, ternaries 11 (nesting depth added 6). Most of this is not in the body itself: 5 of the 78 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 509, 384, 589, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentPanel.AgentPanel (cognitive 78) client/src/components/SidePanel/Agents/AgentPanel.tsx:465— AgentPanel.AgentPanel has cognitive complexity 78 (threshold 15). Drivers by points: boolean chains 33, if/else 27 (30 pts), ternaries 8 (9 pts), error handling 4 (6 pts) (nesting depth added 6). Of this number, 21 points are the body's own statements and 57 belong to 15 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.
executeOpenAIChatCompletion::execute (cognitive 78) api/server/controllers/agents/openai.js:441— executeOpenAIChatCompletion::execute has cognitive complexity 78 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 14, loops 7 (12 pts), ternaries 10 (12 pts), other 9, error handling 3 (7 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.
service.createSchedulesService.deleteScheduleForOwner (cognitive 77) packages/api/src/schedules/service.ts:2083— service.createSchedulesService.deleteScheduleForOwner has cognitive complexity 77 (threshold 15). Drivers by points: if/else 16 (34 pts), ternaries 8 (19 pts), boolean chains 14, loops 4 (10 pts) (nesting depth added 35). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useCopyToClipboard.createCitationProcessor.process (cognitive 76) client/src/hooks/Messages/useCopyToClipboard.ts:310— useCopyToClipboard.createCitationProcessor.process has cognitive complexity 76 (threshold 15). Drivers by points: if/else 14 (49 pts), loops 7 (16 pts), boolean chains 11 (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.
model.groupSteps (cognitive 76) client/src/components/Chat/Trace/model.ts:409— model.groupSteps has cognitive complexity 76 (threshold 15). Drivers by points: if/else 15 (36 pts), loops 10 (18 pts), ternaries 5 (12 pts), boolean chains 10 (nesting depth added 36). Of this number, 29 points are the body's own statements and 47 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.
UserConnectionManager.getUserConnectionForTarget (cognitive 76) packages/api/src/mcp/UserConnectionManager.ts:473— UserConnectionManager.getUserConnectionForTarget has cognitive complexity 76 (threshold 15). Drivers by points: if/else 21 (50 pts), ternaries 6 (10 pts), boolean chains 7, error handling 2 (5 pts), loops 1 (4 pts) (nesting depth added 39). Of this number, 70 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.
design.recipeReader (cognitive 76) scripts/eslint/design.mjs:453— design.recipeReader has cognitive complexity 76 (threshold 15). Drivers by points: boolean chains 36, if/else 21 (29 pts), ternaries 6 (7 pts), loops 2, match/switch 2 (nesting depth added 9). None of this is in the body itself: all 76 points belong to 19 function items inside it that branch (always, alongside, companions, …). 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.
final.useFinalHandler (cognitive 75) client/src/hooks/SSE/final.ts:34— final.useFinalHandler has cognitive complexity 75 (threshold 15). Drivers by points: if/else 26 (41 pts), boolean chains 22, ternaries 4 (10 pts), loops 1 (2 pts) (nesting depth added 22). None of this is in the body itself: all 75 points belong to 3 function literals inside it that branch (lines 57, 270, 301). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
GenerationJobManagerClass.finishTerminalJobInternal (cognitive 75) packages/api/src/stream/GenerationJobManager.ts:4378— GenerationJobManagerClass.finishTerminalJobInternal has cognitive complexity 75 (threshold 15). Drivers by points: if/else 23 (39 pts), boolean chains 14, error handling 3 (9 pts), ternaries 5 (8 pts), loops 1 (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.
GenerationJobManagerClass.abortJob (cognitive 75) packages/api/src/stream/GenerationJobManager.ts:4673— GenerationJobManagerClass.abortJob has cognitive complexity 75 (threshold 15). Drivers by points: if/else 21 (31 pts), boolean chains 25, ternaries 9 (13 pts), error handling 4 (5 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.
UserConnectionManager.createUserConnectionInternal (cognitive 75) packages/api/src/mcp/UserConnectionManager.ts:743— UserConnectionManager.createUserConnectionInternal has cognitive complexity 75 (threshold 15). Drivers by points: if/else 30 (45 pts), boolean chains 17, ternaries 7, error handling 2 (3 pts), loops 1 (3 pts) (nesting depth added 18). Of this number, 69 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.
recovery.applyRecoveredContent (cognitive 74) client/src/components/Chat/Subagents/recovery.ts:43— recovery.applyRecoveredContent has cognitive complexity 74 (threshold 15). Drivers by points: if/else 21 (49 pts), boolean chains 12, loops 3 (7 pts), ternaries 3 (6 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
files.getOpaqueFields (cognitive 74) packages/api/src/protection/files.ts:496— files.getOpaqueFields has cognitive complexity 74 (threshold 15). Drivers by points: if/else 27 (42 pts), boolean chains 25, error handling 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.
admission.canAgentGraphPause (cognitive 74) packages/api/src/agents/hitl/admission.ts:370— admission.canAgentGraphPause has cognitive complexity 74 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 22, ternaries 6 (13 pts), loops 7 (12 pts) (nesting depth added 24). Of this number, 45 points are the body's own statements and 29 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.
MCPOAuthHandler.initiateOAuthFlow (cognitive 74) packages/api/src/mcp/oauth/handler.ts:800— MCPOAuthHandler.initiateOAuthFlow has cognitive complexity 74 (threshold 15). Drivers by points: if/else 27 (38 pts), boolean chains 19, ternaries 4 (11 pts), error handling 4 (6 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.
conversation.createConversationMethods.commitAgentEventActorState (cognitive 74) packages/data-schemas/src/methods/conversation.ts:1213— conversation.createConversationMethods.commitAgentEventActorState has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 24 (38 pts), if/else 15 (22 pts), boolean chains 14 (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.
loadAgentTools (cognitive 74) api/server/services/ToolService.js:1686— loadAgentTools has cognitive complexity 74 (threshold 15). Drivers by points: if/else 32 (46 pts), boolean chains 17, ternaries 3 (4 pts), loops 3, error handling 1 (2 pts), other 2 (nesting depth added 16). Of this number, 59 points are the body's own statements and 15 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.
useCodeWorkspace.useCodeWorkspace (cognitive 73) client/src/hooks/Agents/useCodeWorkspace.ts:172— useCodeWorkspace.useCodeWorkspace has cognitive complexity 73 (threshold 15). Drivers by points: boolean chains 42, if/else 14 (21 pts), ternaries 6 (10 pts) (nesting depth added 11). Of this number, 62 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.
loadToolsForExecution (cognitive 73) api/server/services/ToolService.js:2169— loadToolsForExecution has cognitive complexity 73 (threshold 15). Drivers by points: boolean chains 24, if/else 17 (20 pts), ternaries 8 (11 pts), other 9, loops 3 (5 pts), error handling 2 (4 pts) (nesting depth added 10). Of this number, 65 points are the body's own statements and 8 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.
SubagentCall.SubagentCall (cognitive 72) client/src/components/Chat/Messages/Content/Parts/SubagentCall.tsx:174— SubagentCall.SubagentCall has cognitive complexity 72 (threshold 15). Drivers by points: boolean chains 31, ternaries 25 (29 pts), if/else 12 (nesting depth added 4). Of this number, 36 points are the body's own statements and 36 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.
LangfuseConnection.LangfuseConnection (cognitive 72) client/src/components/Nav/SettingsTabs/Integrations/LangfuseConnection.tsx:107— LangfuseConnection.LangfuseConnection has cognitive complexity 72 (threshold 15). Drivers by points: boolean chains 40, if/else 20, ternaries 11 (12 pts) (nesting depth added 1). Of this number, 38 points are the body's own statements and 34 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.
host.startRun (cognitive 71) packages/api/src/agents/triggers/host.ts:575— host.startRun has cognitive complexity 71 (threshold 15). Drivers by points: boolean chains 31, ternaries 11 (21 pts), if/else 9 (11 pts), error handling 5 (8 pts) (nesting depth added 15). Of this number, 69 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.
AgentGrid.AgentGrid (cognitive 70) client/src/components/Agents/AgentGrid.tsx:27— AgentGrid.AgentGrid has cognitive complexity 70 (threshold 15). Drivers by points: if/else 27 (31 pts), boolean chains 29, ternaries 5 (7 pts), loops 2 (3 pts) (nesting depth added 7). Of this number, 27 points are the body's own statements and 43 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.
MCPOAuthHandler.refreshOAuthTokens (cognitive 70) packages/api/src/mcp/oauth/handler.ts:1826— MCPOAuthHandler.refreshOAuthTokens has cognitive complexity 70 (threshold 15). Drivers by points: if/else 37 (59 pts), boolean chains 7, ternaries 1 (3 pts), error handling 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.
previews.nestedAttachmentCalls (cognitive 70) packages/api/src/messages/previews.ts:255— previews.nestedAttachmentCalls has cognitive complexity 70 (threshold 15). Drivers by points: if/else 12 (42 pts), ternaries 4 (18 pts), loops 5 (7 pts), boolean chains 3 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agent.isDuplicateVersion (cognitive 70) packages/data-schemas/src/methods/agent.ts:856— agent.isDuplicateVersion has cognitive complexity 70 (threshold 15). Drivers by points: if/else 24 (52 pts), boolean chains 11, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatRoute.ChatRoute (cognitive 69) client/src/routes/ChatRoute.tsx:50— ChatRoute.ChatRoute has cognitive complexity 69 (threshold 15). Drivers by points: boolean chains 33, if/else 21, ternaries 12 (15 pts) (nesting depth added 3). Of this number, 25 points are the body's own statements and 44 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.
activity.projectPersistedMessageActivity (cognitive 69) packages/api/src/agents/activity.ts:168— activity.projectPersistedMessageActivity has cognitive complexity 69 (threshold 15). Drivers by points: ternaries 27 (44 pts), if/else 12 (15 pts), boolean chains 10 (nesting depth added 20). Most of this is not in the body itself: 1 of the 69 points is its own statement and the rest belongs to one function literal inside it that branches (line 174). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
initialize.initializeBedrock (cognitive 69) packages/api/src/endpoints/bedrock/initialize.ts:108— initialize.initializeBedrock has cognitive complexity 69 (threshold 15). Drivers by points: if/else 22 (33 pts), ternaries 11 (19 pts), boolean chains 15, error handling 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parsers.formatToolContent (cognitive 69) packages/api/src/mcp/parsers.ts:328— parsers.formatToolContent has cognitive complexity 69 (threshold 15). Drivers by points: if/else 30 (40 pts), boolean chains 22, ternaries 4 (6 pts), loops 1 (nesting depth added 12). Of this number, 30 points are the body's own statements and 39 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.
model.buildTraceModel (cognitive 68) client/src/components/Chat/Trace/model.ts:671— model.buildTraceModel has cognitive complexity 68 (threshold 15). Drivers by points: if/else 22 (43 pts), loops 8 (13 pts), boolean chains 6, ternaries 2 (6 pts) (nesting depth added 30). 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.
BadgeRowContext.BadgeRowProvider (cognitive 67) client/src/Providers/BadgeRowContext.tsx:43— BadgeRowContext.BadgeRowProvider has cognitive complexity 67 (threshold 15). Drivers by points: if/else 17 (35 pts), error handling 7 (21 pts), boolean chains 6, ternaries 2 (3 pts), loops 1 (2 pts) (nesting depth added 34). Most of this is not in the body itself: 2 of the 67 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 85, 182, 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.
VirtualizedAgentGrid.VirtualizedAgentGrid (cognitive 67) client/src/components/Agents/VirtualizedAgentGrid.tsx:69— VirtualizedAgentGrid.VirtualizedAgentGrid has cognitive complexity 67 (threshold 15). Drivers by points: if/else 28 (31 pts), boolean chains 22, ternaries 12, loops 2 (nesting depth added 3). Of this number, 19 points are the body's own statements and 48 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
import.handleZip (cognitive 67) packages/api/src/skills/import.ts:1004— import.handleZip has cognitive complexity 67 (threshold 15). Drivers by points: if/else 31 (51 pts), boolean chains 11, loops 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 21). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MCPTokenStorage.executeTokenRefresh (cognitive 67) packages/api/src/mcp/oauth/tokens.ts:1611— MCPTokenStorage.executeTokenRefresh has cognitive complexity 67 (threshold 15). Drivers by points: if/else 23 (48 pts), boolean chains 7, error handling 4, loops 1 (4 pts), ternaries 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.
MCPManager.runAppOperation (cognitive 67) packages/api/src/mcp/MCPManager.ts:2325— MCPManager.runAppOperation has cognitive complexity 67 (threshold 15). Drivers by points: if/else 19 (47 pts), boolean chains 9, error handling 3 (6 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 33). Of this number, 42 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.
mcpAuthority.createMCPAuthorityMethods.loadCurrentProof (cognitive 67) packages/data-schemas/src/methods/mcpAuthority.ts:1098— mcpAuthority.createMCPAuthorityMethods.loadCurrentProof has cognitive complexity 67 (threshold 15). Drivers by points: if/else 25 (32 pts), boolean chains 14, ternaries 9 (11 pts), loops 8 (10 pts) (nesting depth added 11). Of this number, 48 points are the body's own statements and 19 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.
processRequiredActions (cognitive 67) api/server/services/ToolService.js:433— processRequiredActions has cognitive complexity 67 (threshold 15). Drivers by points: if/else 17 (45 pts), loops 4 (8 pts), boolean chains 6, error handling 2 (4 pts), other 4 (nesting depth added 34). Of this number, 50 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.
logoutController (cognitive 67) api/server/controllers/auth/LogoutController.js:31— logoutController has cognitive complexity 67 (threshold 15). Drivers by points: if/else 19 (47 pts), boolean chains 8, other 5, error handling 2 (3 pts), ternaries 3, loops 1 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GenerationJobManagerClass.getResumeState (cognitive 66) packages/api/src/stream/GenerationJobManager.ts:8831— GenerationJobManagerClass.getResumeState has cognitive complexity 66 (threshold 15). Drivers by points: if/else 20 (29 pts), boolean chains 14, ternaries 10 (14 pts), error handling 4 (8 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.
MCPConnection.constructTransport (cognitive 66) packages/api/src/mcp/connection.ts:1718— MCPConnection.constructTransport has cognitive complexity 66 (threshold 15). Drivers by points: if/else 19 (35 pts), ternaries 8 (17 pts), boolean chains 9, loops 1 (3 pts), error handling 1, match/switch 1 (nesting depth added 27). Of this number, 27 points are the body's own statements and 39 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.
ToolApproval.ToolApproval (cognitive 65) client/src/components/Chat/Messages/Content/ToolApproval.tsx:97— ToolApproval.ToolApproval has cognitive complexity 65 (threshold 15). Drivers by points: boolean chains 32, if/else 20, ternaries 8 (10 pts), error handling 2 (3 pts) (nesting depth added 3). Of this number, 25 points are the body's own statements and 40 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.
Convo.Conversation (cognitive 65) client/src/components/Conversations/Convo.tsx:54— Convo.Conversation has cognitive complexity 65 (threshold 15). Drivers by points: boolean chains 32, if/else 21 (23 pts), ternaries 9, error handling 1 (nesting depth added 2). Of this number, 35 points are the body's own statements and 30 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.
nested.visitNestedStrings (cognitive 65) packages/api/src/protection/adapters/nested.ts:426— nested.visitNestedStrings has cognitive complexity 65 (threshold 15). Drivers by points: if/else 17 (40 pts), loops 4 (9 pts), boolean chains 8, error handling 3 (8 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transform.transformToOpenAIConfig (cognitive 65) packages/api/src/endpoints/openai/transform.ts:30— transform.transformToOpenAIConfig has cognitive complexity 65 (threshold 15). Drivers by points: if/else 26 (40 pts), boolean chains 19, loops 3 (5 pts), ternaries 1 (nesting depth added 16). Of this number, 50 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.
missing.recoverMissingStream (cognitive 65) packages/chat/src/core/resumable/missing.ts:20— missing.recoverMissingStream has cognitive complexity 65 (threshold 15). Drivers by points: if/else 24 (43 pts), boolean chains 13, error handling 3 (5 pts), loops 1 (2 pts), ternaries 2 (nesting depth added 22). Of this number, 61 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.
stripUIResourceMarkers.applyCitationTextBoundaries (cognitive 65) packages/data-schemas/src/utils/stripUIResourceMarkers.ts:131— stripUIResourceMarkers.applyCitationTextBoundaries has cognitive complexity 65 (threshold 15). Drivers by points: if/else 19 (33 pts), loops 9 (14 pts), boolean chains 10, ternaries 3 (8 pts) (nesting depth added 24). Of this number, 34 points are the body's own statements and 31 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.
message.createMessageMethods.saveMessage (cognitive 65) packages/data-schemas/src/methods/message.ts:1137— message.createMessageMethods.saveMessage has cognitive complexity 65 (threshold 15). Drivers by points: if/else 24 (33 pts), boolean chains 15, error handling 6 (14 pts), ternaries 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.
loadToolDefinitionsWrapper (cognitive 65) api/server/services/ToolService.js:836— loadToolDefinitionsWrapper has cognitive complexity 65 (threshold 15). Drivers by points: if/else 64 (95 pts), boolean chains 28, ternaries 5 (10 pts), error handling 4 (7 pts), other 6, loops 3 (4 pts) (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.
callbacks.getDefaultHandlers (cognitive 64) api/server/controllers/agents/callbacks.js:341— callbacks.getDefaultHandlers has cognitive complexity 64 (threshold 15). Drivers by points: if/else 32 (40 pts), boolean chains 13, ternaries 5 (8 pts), error handling 1 (2 pts), loops 1 (nesting depth added 12). Most of this is not in the body itself: 13 of the 64 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 592, a function literal at line 480, a function literal at line 533, …). 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.
turn.buildTurn (cognitive 64) client/src/hooks/Chat/ask/turn.ts:109— turn.buildTurn has cognitive complexity 64 (threshold 15). Drivers by points: if/else 17 (23 pts), ternaries 19 (20 pts), boolean chains 17, loops 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ProjectResources.ProjectResources (cognitive 64) client/src/components/Projects/ProjectResources.tsx:94— ProjectResources.ProjectResources has cognitive complexity 64 (threshold 15). Drivers by points: boolean chains 24, if/else 18 (21 pts), ternaries 8 (14 pts), error handling 3, loops 2 (nesting depth added 9). Of this number, 31 points are the body's own statements and 33 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.
InMemoryJobStore.cleanup (cognitive 64) packages/api/src/stream/implementations/InMemoryJobStore.ts:1202— InMemoryJobStore.cleanup has cognitive complexity 64 (threshold 15). Drivers by points: if/else 20 (46 pts), loops 7 (8 pts), boolean chains 7, ternaries 1 (3 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
matching.findLineWindowMatch (cognitive 64) REDACTED:171— matching.findLineWindowMatch has cognitive complexity 64 (threshold 15). Drivers by points: if/else 17 (40 pts), loops 8 (19 pts), boolean chains 4, ternaries 1 (nesting depth added 34). Of this number, 61 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.
ThemeProvider.ThemeProvider (cognitive 64) packages/client/src/theme/context/ThemeProvider.tsx:468— ThemeProvider.ThemeProvider has cognitive complexity 64 (threshold 15). Drivers by points: if/else 28 (31 pts), boolean chains 17, ternaries 12 (15 pts), error handling 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 48 belong to 12 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.
PromptForm.PromptForm (cognitive 63) client/src/components/Prompts/forms/PromptForm.tsx:271— PromptForm.PromptForm has cognitive complexity 63 (threshold 15). Drivers by points: boolean chains 25, if/else 19 (22 pts), ternaries 14 (16 pts) (nesting depth added 5). Of this number, 39 points are the body's own statements and 24 belong to 12 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.
added.loadAddedAgent (cognitive 63) packages/api/src/agents/added.ts:90— added.loadAddedAgent has cognitive complexity 63 (threshold 15). Drivers by points: if/else 23 (31 pts), boolean chains 17, ternaries 3 (6 pts), error handling 2 (5 pts), loops 3 (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.
inference.resolveAgentInferenceParameters (cognitive 63) packages/api/src/agents/inference.ts:437— inference.resolveAgentInferenceParameters has cognitive complexity 63 (threshold 15). Drivers by points: if/else 19 (36 pts), boolean chains 22, ternaries 2 (4 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.
host.createRunFileHost (cognitive 63) packages/api/src/agents/files/host.ts:77— host.createRunFileHost has cognitive complexity 63 (threshold 15). Drivers by points: if/else 20 (34 pts), loops 10 (20 pts), boolean chains 4, error handling 3, ternaries 2 (nesting depth added 24). Most of this is not in the body itself: 1 of the 63 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 186, 360, 393, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
engine.createAgentTriggerDeliveryEngine.processDelivery (cognitive 63) packages/api/src/agents/triggers/engine.ts:388— engine.createAgentTriggerDeliveryEngine.processDelivery has cognitive complexity 63 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 12, ternaries 5 (12 pts), error handling 4 (7 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.
useQueueDrain.useQueueDrain (cognitive 63) packages/chat/src/react/steering/useQueueDrain.ts:57— useQueueDrain.useQueueDrain has cognitive complexity 63 (threshold 15). Drivers by points: if/else 28 (33 pts), boolean chains 20, ternaries 6 (7 pts), loops 2 (3 pts) (nesting depth added 7). Most of this is not in the body itself: 2 of the 63 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 169, 345, 226, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.createAdminConfigHandlers.upsertConfigOverrides (cognitive 62) packages/api/src/admin/config.ts:3397— config.createAdminConfigHandlers.upsertConfigOverrides has cognitive complexity 62 (threshold 15). Drivers by points: if/else 29 (39 pts), boolean chains 11, ternaries 7 (8 pts), error handling 2, loops 2 (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
resources.computeProvisionState (cognitive 62) packages/api/src/agents/resources.ts:443— resources.computeProvisionState has cognitive complexity 62 (threshold 15). Drivers by points: if/else 18 (28 pts), boolean chains 21, ternaries 7 (9 pts), error handling 1 (2 pts), loops 2 (nesting depth added 13). Of this number, 50 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.
view.createSubagentThreadViewHandler (cognitive 62) packages/api/src/agents/view.ts:598— view.createSubagentThreadViewHandler has cognitive complexity 62 (threshold 15). Drivers by points: if/else 13 (21 pts), ternaries 21, boolean chains 16, loops 3, error handling 1 (nesting depth added 8). None of this is in the body itself: all 62 points belong to 4 function literals inside it that branch (lines 599, 679, 732, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useConversationSeen.useConversationSeen (cognitive 61) client/src/hooks/Conversations/useConversationSeen.ts:32— useConversationSeen.useConversationSeen has cognitive complexity 61 (threshold 15). Drivers by points: if/else 30 (36 pts), boolean chains 23, ternaries 1 (2 pts) (nesting depth added 7). None of this is in the body itself: all 61 points belong to 10 function literals inside it that branch (lines 132, 277, 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.
ToolCallGroup.ToolCallGroup (cognitive 61) client/src/components/Chat/Messages/Content/ToolCallGroup.tsx:84— ToolCallGroup.ToolCallGroup has cognitive complexity 61 (threshold 15). Drivers by points: boolean chains 64, if/else 46 (64 pts), ternaries 24 (42 pts), loops 1 (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. This shape REPEATS in the file: one other method here (ToolCallGroup.ToolCallGroup::resolveGroupLabel) 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.
EditContentParts.EditContentParts (cognitive 61) client/src/components/Chat/Messages/Content/EditContentParts.tsx:38— EditContentParts.EditContentParts has cognitive complexity 61 (threshold 15). Drivers by points: if/else 26 (29 pts), boolean chains 21, ternaries 7 (9 pts), error handling 1, loops 1 (nesting depth added 5). Most of this is not in the body itself: 8 of the 61 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 209, a function literal at line 331, a function literal at line 378, …). 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.
InMemoryJobStore.createJob (cognitive 61) packages/api/src/stream/implementations/InMemoryJobStore.ts:277— InMemoryJobStore.createJob has cognitive complexity 61 (threshold 15). Drivers by points: if/else 41 (50 pts), boolean chains 37, ternaries 8 (11 pts), error handling 2 (3 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. This shape REPEATS in the file: one other method here (InMemoryJobStore.createJob::assertOwnerCompatible) 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.
service.createAgentChatCompletion (cognitive 61) packages/api/src/agents/openai/service.ts:640— service.createAgentChatCompletion has cognitive complexity 61 (threshold 15). Drivers by points: ternaries 18 (29 pts), if/else 13 (16 pts), boolean chains 14, error handling 1, loops 1 (nesting depth added 14). Of this number, 55 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.
callback.createProvisionFilesCallback (cognitive 61) packages/api/src/files/provision/callback.ts:78— callback.createProvisionFilesCallback has cognitive complexity 61 (threshold 15). Drivers by points: if/else 26 (38 pts), ternaries 8 (11 pts), boolean chains 10, loops 1 (2 pts) (nesting depth added 16). None of this is in the body itself: all 61 points belong to 13 function items inside it that branch (a function literal at line 120, a function literal at line 197, a function literal at line 258, …). 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.
mongoMeili.mongoMeili (cognitive 61) packages/data-schemas/src/models/plugins/mongoMeili.ts:952— mongoMeili.mongoMeili has cognitive complexity 61 (threshold 15). Drivers by points: if/else 30 (42 pts), boolean chains 10, error handling 4 (6 pts), ternaries 3 (nesting depth added 14). Most of this is not in the body itself: 7 of the 61 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 1049, 1268, 1211, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
finalizeResumedTurn (cognitive 61) api/server/controllers/agents/resume.js:416— finalizeResumedTurn has cognitive complexity 61 (threshold 15). Drivers by points: other 15, boolean chains 14, if/else 12 (14 pts), ternaries 10 (12 pts), error handling 3 (6 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.
(anonymous) (cognitive 61) api/server/routes/agents/index.js:192— (anonymous) has cognitive complexity 61 (threshold 15). Drivers by points: if/else 24 (32 pts), boolean chains 17, loops 1 (4 pts), ternaries 2 (4 pts), error handling 1 (2 pts), other 2 (nesting depth added 14). Of this number, 48 points are the body's own statements and 13 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.
createOpenAIImageTools (cognitive 61) api/app/clients/tools/structured/OpenAIImageTools.js:63— createOpenAIImageTools has cognitive complexity 61 (threshold 15). Drivers by points: if/else 29 (35 pts), boolean chains 15, loops 3 (4 pts), other 4, error handling 2, ternaries 1 (nesting depth added 7). Most of this is not in the body itself: 11 of the 61 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 234, a function literal at line 115, getApiKey, …). 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.
AuthContext.AuthContextProvider (cognitive 60) client/src/hooks/AuthContext.tsx:87— AuthContext.AuthContextProvider has cognitive complexity 60 (threshold 15). Drivers by points: if/else 31 (35 pts), boolean chains 16, ternaries 6 (9 pts) (nesting depth added 7). Most of this is not in the body itself: 4 of the 60 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 323, 397, 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.
ToolCallGroup.ToolCallGroup::resolveGroupLabel (cognitive 60) client/src/components/Chat/Messages/Content/ToolCallGroup.tsx:469— ToolCallGroup.ToolCallGroup::resolveGroupLabel has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 13 (30 pts), if/else 15 (25 pts), boolean chains 5 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ToolCallGroup.ToolCallGroup) 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.
state.reduceSubagentProgress (cognitive 60) client/src/components/Chat/Subagents/state.ts:904— state.reduceSubagentProgress has cognitive complexity 60 (threshold 15). Drivers by points: if/else 18 (37 pts), ternaries 9 (11 pts), boolean chains 9, loops 3 (nesting depth added 21). Of this number, 52 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.
workspace.isValidResult (cognitive 60) packages/api/src/code/workspace.ts:928— workspace.isValidResult has cognitive complexity 60 (threshold 15). Drivers by points: boolean chains 29, if/else 12 (17 pts), ternaries 6 (12 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
modelBoundContent.getProviderMessageProvenanceState (cognitive 60) packages/api/src/middleware/modelBoundContent.ts:1090— modelBoundContent.getProviderMessageProvenanceState has cognitive complexity 60 (threshold 15). Drivers by points: if/else 19 (41 pts), boolean chains 9, loops 3 (6 pts), error handling 2 (4 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
chat.extractChatContent (cognitive 60) packages/api/src/protection/adapters/chat.ts:95— chat.extractChatContent has cognitive complexity 60 (threshold 15). Drivers by points: if/else 30 (33 pts), boolean chains 20, ternaries 3, error handling 2, loops 1 (2 pts) (nesting depth added 4). Of this number, 44 points are the body's own statements and 16 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.
successor.useOwedSuccessor (cognitive 59) client/src/hooks/SSE/successor.ts:34— successor.useOwedSuccessor has cognitive complexity 59 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 18, ternaries 8, loops 4 (6 pts) (nesting depth added 12). Most of this is not in the body itself: 10 of the 59 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 314, 265, 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.
Mermaid.MermaidRenderer (cognitive 59) client/src/components/Messages/Content/Mermaid/Mermaid.tsx:198— Mermaid.MermaidRenderer has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 16 (29 pts), boolean chains 18, if/else 10 (12 pts) (nesting depth added 15). Of this number, 51 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.
config.createAdminConfigHandlers.patchConfigField (cognitive 59) packages/api/src/admin/config.ts:3730— config.createAdminConfigHandlers.patchConfigField has cognitive complexity 59 (threshold 15). Drivers by points: if/else 27 (40 pts), ternaries 4 (7 pts), boolean chains 6, loops 4, error handling 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.
validation.validateGraphSubagentTopology (cognitive 59) packages/api/src/agents/validation.ts:206— validation.validateGraphSubagentTopology has cognitive complexity 59 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 12, loops 7 (12 pts), ternaries 2 (4 pts) (nesting depth added 22). Of this number, 57 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.
lifecycle.reconcileCodeEnvironmentLifecycle (cognitive 59) packages/api/src/code/lifecycle.ts:24— lifecycle.reconcileCodeEnvironmentLifecycle has cognitive complexity 59 (threshold 15). Drivers by points: if/else 14 (26 pts), ternaries 7 (13 pts), boolean chains 8, error handling 3 (7 pts), loops 5 (nesting depth added 22). None of this is in the body itself: all 59 points belong to 2 function literals inside it that branch (lines 35, 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.
registry.resolveTheme (cognitive 59) packages/data-provider/src/themes/registry.ts:678— registry.resolveTheme has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 35, boolean chains 23, if/else 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.
createActionTool._call (cognitive 59) api/server/services/ActionService.js:205— createActionTool._call has cognitive complexity 59 (threshold 15). Drivers by points: if/else 18 (43 pts), error handling 4 (10 pts), boolean chains 4, other 2 (nesting depth added 31). Of this number, 39 points are the body's own statements and 20 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.
index.router.get("/chat/stream/:streamId") (cognitive 58) api/server/routes/agents/index.js:192— index.router.get("/chat/stream/:streamId") has cognitive complexity 58 (threshold 15). Drivers by points: if/else 24 (32 pts), boolean chains 16, loops 1 (4 pts), ternaries 2 (4 pts), error handling 1 (2 pts) (nesting depth added 14). Of this number, 46 points are the body's own statements and 12 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.
modes.createAgentToolApprovalSession.validateExecution (cognitive 58) packages/api/src/agents/hitl/modes.ts:397— modes.createAgentToolApprovalSession.validateExecution has cognitive complexity 58 (threshold 15). Drivers by points: boolean chains 30, if/else 21 (26 pts), ternaries 2 (nesting depth added 5). Of this number, 56 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.
ActionService.createActionTool._call (cognitive 57) api/server/services/ActionService.js:205— ActionService.createActionTool._call has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (43 pts), error handling 4 (10 pts), boolean chains 4 (nesting depth added 31). Of this number, 38 points are the body's own statements and 19 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.
useNewConvo.useNewConvo.newConversation (cognitive 57) client/src/hooks/useNewConvo.ts:325— useNewConvo.useNewConvo.newConversation has cognitive complexity 57 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 17, ternaries 6 (11 pts), loops 1 (4 pts) (nesting depth added 21). Of this number, 33 points are the body's own statements and 24 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.
files.getBlockedOpaqueFileField (cognitive 57) packages/api/src/protection/files.ts:675— files.getBlockedOpaqueFileField has cognitive complexity 57 (threshold 15). Drivers by points: if/else 16 (38 pts), error handling 3 (8 pts), loops 3 (6 pts), boolean chains 5 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
protection.loadThreadUserMessages (cognitive 57) packages/api/src/assistants/protection.ts:184— protection.loadThreadUserMessages has cognitive complexity 57 (threshold 15). Drivers by points: if/else 17 (41 pts), boolean chains 10, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
models.fetchModels (cognitive 57) packages/api/src/endpoints/models.ts:154— models.fetchModels has cognitive complexity 57 (threshold 15). Drivers by points: if/else 20 (31 pts), boolean chains 16, ternaries 6 (7 pts), error handling 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.
AskUserQuestions.AskUserQuestions (cognitive 56) client/src/components/Chat/Messages/Content/AskUserQuestions.tsx:22— AskUserQuestions.AskUserQuestions has cognitive complexity 56 (threshold 15). Drivers by points: boolean chains 25, if/else 20 (23 pts), ternaries 6 (7 pts), loops 1 (nesting depth added 4). 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, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PinnedSection.PinnedSection (cognitive 56) client/src/components/Conversations/PinnedSection.tsx:310— PinnedSection.PinnedSection has cognitive complexity 56 (threshold 15). Drivers by points: if/else 25 (31 pts), boolean chains 16, ternaries 4 (5 pts), loops 4 (nesting depth added 7). Most of this is not in the body itself: 10 of the 56 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 394, 426, 556, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MCPConnectionFactory.handleOAuthRequired (cognitive 56) packages/api/src/mcp/MCPConnectionFactory.ts:2348— MCPConnectionFactory.handleOAuthRequired has cognitive complexity 56 (threshold 15). Drivers by points: if/else 17 (41 pts), ternaries 3 (7 pts), boolean chains 5, error handling 2 (3 pts) (nesting depth added 29). Of this number, 55 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.
PixelCard.PixelCard (cognitive 56) packages/client/src/components/PixelCard.tsx:192— PixelCard.PixelCard has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 10, ternaries 8 (10 pts), loops 4 (7 pts) (nesting depth added 13). Most of this is not in the body itself: 9 of the 56 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 235, a function literal at line 293, 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.
generate.generateDynamicSchema (cognitive 56) packages/data-provider/src/generate.ts:133— generate.generateDynamicSchema has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (50 pts), boolean chains 5, loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parsers.redactFormat (cognitive 56) packages/data-schemas/src/config/parsers.ts:603— parsers.redactFormat has cognitive complexity 56 (threshold 15). Drivers by points: if/else 18 (35 pts), boolean chains 8, error handling 5 (8 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 22). Of this number, 55 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.
config.createAdminConfigHandlers.applyConfigChanges (cognitive 55) packages/api/src/admin/config.ts:4386— config.createAdminConfigHandlers.applyConfigChanges has cognitive complexity 55 (threshold 15). Drivers by points: if/else 36 (50 pts), boolean chains 16, loops 8 (13 pts), ternaries 9 (11 pts), error handling 3 (4 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. This shape REPEATS in the file: one other method here (config.createAdminConfigHandlers.applyConfigChanges::plan) 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.
RedisJobStore.overlayHostSteerParts (cognitive 55) packages/api/src/stream/implementations/RedisJobStore.ts:4111— RedisJobStore.overlayHostSteerParts has cognitive complexity 55 (threshold 15). Drivers by points: if/else 18 (39 pts), boolean chains 9, ternaries 1 (4 pts), loops 3 (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.
agent.createAgentMethods.updateAgent (cognitive 55) packages/data-schemas/src/methods/agent.ts:1455— agent.createAgentMethods.updateAgent has cognitive complexity 55 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 12, ternaries 4 (6 pts), error handling 1 (4 pts), loops 2 (4 pts) (nesting depth added 21). Of this number, 51 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.
updateUserPluginsController (cognitive 55) api/server/controllers/UserController.js:188— updateUserPluginsController has cognitive complexity 55 (threshold 15). Drivers by points: if/else 16 (32 pts), ternaries 4 (7 pts), boolean chains 5, error handling 3 (5 pts), loops 2 (5 pts), other 1 (nesting depth added 24). Of this number, 53 points are the body's own statements and 2 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.
AgentClient.rebaseActivityPhaseBounds (cognitive 54) api/server/controllers/agents/client.js:4089— AgentClient.rebaseActivityPhaseBounds has cognitive complexity 54 (threshold 15). Drivers by points: if/else 15 (35 pts), boolean chains 9, loops 5 (8 pts), 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.
useAppBridge.useAppBridge (cognitive 54) client/src/hooks/MCP/useAppBridge.ts:154— useAppBridge.useAppBridge has cognitive complexity 54 (threshold 15). Drivers by points: if/else 31 (34 pts), boolean chains 18, error handling 1, ternaries 1 (nesting depth added 3). None of this is in the body itself: all 54 points belong to 20 function literals inside it that branch (lines 201, 530, 627, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
client.estimateDocumentBlockTokens (cognitive 54) packages/api/src/agents/client.ts:238— client.estimateDocumentBlockTokens has cognitive complexity 54 (threshold 15). Drivers by points: if/else 13 (30 pts), ternaries 5 (13 pts), boolean chains 8, loops 1 (3 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
image.encodeAndFormatImages (cognitive 54) packages/api/src/files/encode/image.ts:89— image.encodeAndFormatImages has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (39 pts), error handling 2 (6 pts), boolean chains 5, loops 2, ternaries 1 (2 pts) (nesting depth added 25). 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, split the body into named stages: move each independent 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.createGitHubPullRequestSource.find (cognitive 54) packages/api/src/pulls/github.ts:322— github.createGitHubPullRequestSource.find has cognitive complexity 54 (threshold 15). Drivers by points: if/else 25 (31 pts), boolean chains 15, ternaries 4 (6 pts), loops 2 (nesting depth added 8). Of this number, 22 points are the body's own statements and 32 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.
bitbucket.createBitbucketPullRequestSource.find (cognitive 54) packages/api/src/pulls/bitbucket.ts:250— bitbucket.createBitbucketPullRequestSource.find has cognitive complexity 54 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 13, ternaries 4 (6 pts), loops 5 (nesting depth added 11). Of this number, 21 points are the body's own statements and 33 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.
createResponsesToolEndCallback (cognitive 54) api/server/controllers/agents/callbacks.js:1289— createResponsesToolEndCallback has cognitive complexity 54 (threshold 15). Drivers by points: if/else 21 (34 pts), error handling 5 (11 pts), boolean chains 5, loops 1 (2 pts), other 1, ternaries 1 (nesting depth added 20). None of this is in the body itself: all 54 points belong to 13 function items inside it that branch (a function literal at line 1293, a function literal at line 1305, a function literal at line 1404, …). 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.
useNewConvo.useNewConvo.switchToConversation (cognitive 53) client/src/hooks/useNewConvo.ts:115— useNewConvo.useNewConvo.switchToConversation has cognitive complexity 53 (threshold 15). Drivers by points: if/else 21 (31 pts), boolean chains 20, ternaries 2 (nesting depth added 10). None of this is in the body itself: all 53 points belong to 3 function literals inside it that branch (lines 116, 278, 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.
Effort.Effort (cognitive 53) client/src/components/Chat/Input/Composer/Effort.tsx:114— Effort.Effort has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 20, boolean chains 19, if/else 12, error handling 2. Of this number, 35 points are the body's own statements and 18 belong to 14 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.
Conversations.Conversations (cognitive 53) client/src/components/Conversations/Conversations.tsx:225— Conversations.Conversations has cognitive complexity 53 (threshold 15). Drivers by points: if/else 27 (28 pts), boolean chains 18, ternaries 5 (7 pts) (nesting depth added 3). Of this number, 18 points are the body's own statements and 35 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.
DynamicSlider.DynamicSlider (cognitive 53) client/src/components/SidePanel/Parameters/DynamicSlider.tsx:11— DynamicSlider.DynamicSlider has cognitive complexity 53 (threshold 15). Drivers by points: if/else 19 (26 pts), ternaries 11 (14 pts), boolean chains 13 (nesting depth added 10). Of this number, 20 points are the body's own statements and 33 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.
convos.updateConvoInAllQueries (cognitive 53) client/src/utils/convos.ts:1610— convos.updateConvoInAllQueries has cognitive complexity 53 (threshold 15). Drivers by points: if/else 13 (24 pts), ternaries 8 (17 pts), boolean chains 9, loops 2 (3 pts) (nesting depth added 21). Most of this is not in the body itself: 13 of the 53 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 1660, 1722, 1641, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.createResponsesEventHandlers (cognitive 53) packages/api/src/agents/responses/service.ts:614— service.createResponsesEventHandlers has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (34 pts), loops 5 (9 pts), boolean chains 7, ternaries 1 (3 pts) (nesting depth added 24). None of this is in the body itself: all 53 points belong to 6 function literals inside it that branch (lines 820, 909, 861, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.resolveSubagentGraphs (cognitive 53) packages/api/src/agents/discovery.ts:301— discovery.resolveSubagentGraphs has cognitive complexity 53 (threshold 15). Drivers by points: if/else 10 (33 pts), loops 6 (13 pts), error handling 1 (3 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 34). Of this number, 36 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.
handlers.createSchedulesHandlers.updateSchedule (cognitive 53) packages/api/src/schedules/handlers.ts:904— handlers.createSchedulesHandlers.updateSchedule has cognitive complexity 53 (threshold 15). Drivers by points: if/else 27 (33 pts), boolean chains 19, ternaries 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
deletion.runSkillDeletion (cognitive 53) packages/api/src/skills/deletion.ts:55— deletion.runSkillDeletion has cognitive complexity 53 (threshold 15). Drivers by points: if/else 18 (31 pts), error handling 6 (14 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 22). Of this number, 29 points are the body's own statements and 24 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.
static-checks.unusedCapacity (cognitive 53) scripts/static-checks.mts:1231— static-checks.unusedCapacity has cognitive complexity 53 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 7 (10 pts), ternaries 5 (10 pts), boolean chains 9, error handling 1 (nesting depth added 20). Of this number, 50 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.
createToolEndCallback (cognitive 53) api/server/controllers/agents/callbacks.js:916— createToolEndCallback has cognitive complexity 53 (threshold 15). Drivers by points: if/else 20 (33 pts), error handling 5 (11 pts), boolean chains 5, loops 1 (2 pts), other 1, ternaries 1 (nesting depth added 20). None of this is in the body itself: all 53 points belong to 13 function items inside it that branch (a function literal at line 920, a function literal at line 932, a function literal at line 1038, …). 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.
(anonymous) (cognitive 53) config/delete-user.js:52— (anonymous) has cognitive complexity 53 (threshold 15). Drivers by points: if/else 21 (30 pts), error handling 7 (12 pts), ternaries 3 (6 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 19). Of this number, 52 points are the body's own statements and 1 belongs to 37 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.
openIdJwtLogin (cognitive 53) api/strategies/openIdJwtStrategy.js:128— openIdJwtLogin has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (29 pts), ternaries 9 (13 pts), boolean chains 10, error handling 1 (nesting depth added 17). Most of this is not in the body itself: 2 of the 53 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 214, 156, 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.
useComposerHint.composeHint (cognitive 52) client/src/hooks/Input/useComposerHint.ts:68— useComposerHint.composeHint has cognitive complexity 52 (threshold 15). Drivers by points: if/else 16 (23 pts), ternaries 9 (21 pts), boolean chains 8 (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.
toolTiming.createToolTimingTracker (cognitive 52) packages/api/src/agents/toolTiming.ts:192— toolTiming.createToolTimingTracker has cognitive complexity 52 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 14, ternaries 5 (8 pts), loops 3 (nesting depth added 12). Of this number, 43 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.
SubagentThreadTaskStore.prepareThread (cognitive 52) packages/api/src/agents/subagentThreads.ts:3302— SubagentThreadTaskStore.prepareThread has cognitive complexity 52 (threshold 15). Drivers by points: if/else 16 (24 pts), ternaries 10 (17 pts), boolean chains 9, error handling 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
queuedTurns.createAgentQueuedTurnResolver (cognitive 52) packages/api/src/agents/queuedTurns.ts:467— queuedTurns.createAgentQueuedTurnResolver has cognitive complexity 52 (threshold 15). Drivers by points: boolean chains 25, if/else 12, ternaries 5 (11 pts), error handling 3 (4 pts) (nesting depth added 7). None of this is in the body itself: all 52 points belong to 3 function literals inside it that branch (lines 473, 678, 660). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
storage.createDeleteFileWithSecondaryStorage (cognitive 52) packages/api/src/files/storage.ts:76— storage.createDeleteFileWithSecondaryStorage has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 21, error handling 3, ternaries 2, loops 1 (nesting depth added 5). None of this is in the body itself: all 52 points belong to 7 function literals inside it that branch (lines 117, 132, 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.
cleanup.cleanupMCPServerOAuthWithFenceHeld (cognitive 52) packages/api/src/mcp/oauth/cleanup.ts:308— cleanup.cleanupMCPServerOAuthWithFenceHeld has cognitive complexity 52 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 9, ternaries 6 (8 pts), error handling 3 (7 pts), loops 4 (nesting depth added 15). Of this number, 47 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.
saveErrorTurn (cognitive 52) api/server/controllers/agents/request.js:376— saveErrorTurn has cognitive complexity 52 (threshold 15). Drivers by points: boolean chains 22, if/else 11 (14 pts), ternaries 6 (9 pts), other 6, 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.
processOpenIDAuth (cognitive 52) api/strategies/openidStrategy.js:651— processOpenIDAuth has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (28 pts), ternaries 6 (12 pts), boolean chains 11, other 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.
createInProgressHandler::in_progress (cognitive 52) api/server/services/AssistantService.js:150— createInProgressHandler::in_progress has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (37 pts), loops 2 (6 pts), boolean chains 5, ternaries 1 (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.
PermissionService.ensureGroupPrincipalExists (cognitive 51) api/server/services/PermissionService.js:380— PermissionService.ensureGroupPrincipalExists has cognitive complexity 51 (threshold 15). Drivers by points: if/else 17 (38 pts), boolean chains 10, error handling 1 (3 pts) (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.
OpenAIImageGen.OpenAIImageGen (cognitive 51) client/src/components/Chat/Messages/Content/Parts/OpenAIImageGen/OpenAIImageGen.tsx:37— OpenAIImageGen.OpenAIImageGen has cognitive complexity 51 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 21, ternaries 3, error handling 2 (nesting depth added 5). Of this number, 30 points are the body's own statements and 21 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.
live.newestLine (cognitive 51) client/src/components/Chat/Messages/Content/live.ts:295— live.newestLine has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (29 pts), ternaries 5 (15 pts), boolean chains 6, loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
migrate-shared-link-permissions.migrateSharedLinkPermissions (cognitive 51) config/migrate-shared-link-permissions.js:21— migrate-shared-link-permissions.migrateSharedLinkPermissions has cognitive complexity 51 (threshold 15). Drivers by points: if/else 18 (31 pts), loops 4 (10 pts), boolean chains 8, error handling 1 (2 pts) (nesting depth added 20). None of this is in the body itself: all 51 points belong to 2 function literals inside it that branch (lines 153, 28). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MCPConnection.createFetchFunction::customFetch (cognitive 51) packages/api/src/mcp/connection.ts:1455— MCPConnection.createFetchFunction::customFetch has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 12, ternaries 4 (9 pts), loops 2 (5 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.
requirements.resolveScheduledMCPRequirements (cognitive 51) packages/api/src/schedules/requirements.ts:33— requirements.resolveScheduledMCPRequirements has cognitive complexity 51 (threshold 15). Drivers by points: if/else 37 (64 pts), loops 17 (25 pts), boolean chains 21, ternaries 2 (4 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (requirements.resolveScheduledMCPRequirements::visitDirectTree) 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.
handlers.createSchedulesHandlers.createSchedule (cognitive 51) packages/api/src/schedules/handlers.ts:628— handlers.createSchedulesHandlers.createSchedule has cognitive complexity 51 (threshold 15). Drivers by points: if/else 30 (41 pts), error handling 2 (5 pts), boolean chains 4, ternaries 1 (nesting depth added 14). Of this number, 40 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.
service.recordScheduledMCPToolAuthFailure (cognitive 51) packages/api/src/schedules/service.ts:336— service.recordScheduledMCPToolAuthFailure has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 9, error handling 3 (5 pts), ternaries 4 (5 pts), loops 1 (nesting depth added 19). Of this number, 16 points are the body's own statements and 35 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.
reader.createLangfuseTraceReader.listRecords (cognitive 51) packages/api/src/langfuse/reader.ts:637— reader.createLangfuseTraceReader.listRecords has cognitive complexity 51 (threshold 15). Drivers by points: if/else 46 (93 pts), ternaries 21 (33 pts), boolean chains 32, loops 15 (21 pts), error handling 5 (8 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: 3 other methods here (reader.createLangfuseTraceReader.listRecords::probe, reader.createLangfuseTraceReader.listRecords::segmentOf, reader.createLangfuseTraceReader.listRecords::nameToolRounds) 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.
reconcile.reconcileGenerationLifecycle (cognitive 51) packages/chat/src/core/resumable/reconcile.ts:25— reconcile.reconcileGenerationLifecycle has cognitive complexity 51 (threshold 15). Drivers by points: if/else 26 (35 pts), boolean chains 10, error handling 3, loops 1 (2 pts), 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.
run.createRun::buildAgentInput (cognitive 50) packages/api/src/agents/run.ts:2402— run.createRun::buildAgentInput has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 13, loops 3 (6 pts), ternaries 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. This shape REPEATS in the file: one other method here (run.createRun) 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.
connection.guardMCPStreamableHTTPResponse (cognitive 50) packages/api/src/mcp/connection.ts:366— connection.guardMCPStreamableHTTPResponse has cognitive complexity 50 (threshold 15). Drivers by points: if/else 21 (33 pts), boolean chains 10, ternaries 3, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 14). Of this number, 34 points are the body's own statements and 16 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.
processMessages (cognitive 50) api/server/services/Threads/manage.js:623— processMessages has cognitive complexity 50 (threshold 15). Drivers by points: if/else 10 (28 pts), error handling 2 (7 pts), loops 3 (6 pts), boolean chains 4, ternaries 2 (3 pts), other 2 (nesting depth added 27). Of this number, 20 points are the body's own statements and 30 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.
useQueryParams.useQueryParams (cognitive 49) client/src/hooks/Input/useQueryParams.ts:62— useQueryParams.useQueryParams has cognitive complexity 49 (threshold 15). Drivers by points: if/else 23 (26 pts), boolean chains 23 (nesting depth added 3). Most of this is not in the body itself: 3 of the 49 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 569, 236, 624, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
import.blockFilteredImportContent (cognitive 49) packages/api/src/skills/import.ts:183— import.blockFilteredImportContent has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 14 (33 pts), if/else 6 (9 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 24). Of this number, 43 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.
http.createCodeEnvironmentHttpHandlers.pair (cognitive 49) packages/api/src/code/http.ts:675— http.createCodeEnvironmentHttpHandlers.pair has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (22 pts), error handling 11 (15 pts), ternaries 6 (8 pts), boolean chains 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.
preflight.assertUploadContentAllowed (cognitive 49) packages/api/src/files/preflight.ts:40— preflight.assertUploadContentAllowed has cognitive complexity 49 (threshold 15). Drivers by points: if/else 16 (35 pts), boolean chains 9, ternaries 2 (5 pts) (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.
imports.inspectConversationImportContent (cognitive 49) packages/api/src/imports.ts:83— imports.inspectConversationImportContent has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 11, error handling 2 (4 pts), loops 1 (nesting depth added 21). Of this number, 46 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.
submit.useSubmitSteer (cognitive 49) packages/chat/src/react/steering/submit.ts:35— submit.useSubmitSteer has cognitive complexity 49 (threshold 15). Drivers by points: if/else 20 (26 pts), boolean chains 22, ternaries 1 (nesting depth added 6). None of this is in the body itself: all 49 points belong to 9 function literals inside it that branch (lines 243, 338, 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.
duplicateAgentHandler (cognitive 49) REDACTED:1431— duplicateAgentHandler has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 7, error handling 5 (6 pts), other 5, loops 2 (4 pts) (nesting depth added 13). Of this number, 45 points are the body's own statements and 4 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.
GenericGrantAccessDialog.GenericGrantAccessDialog (cognitive 48) client/src/components/Sharing/GenericGrantAccessDialog.tsx:39— GenericGrantAccessDialog.GenericGrantAccessDialog has cognitive complexity 48 (threshold 15). Drivers by points: boolean chains 26, ternaries 10 (11 pts), if/else 10, error handling 1 (nesting depth added 1). Of this number, 27 points are the body's own statements and 21 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.
GenerationJobManagerClass.cleanup (cognitive 48) packages/api/src/stream/GenerationJobManager.ts:9455— GenerationJobManagerClass.cleanup has cognitive complexity 48 (threshold 15). Drivers by points: if/else 15 (34 pts), boolean chains 7, loops 3 (4 pts), 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.
service.createAggregatorEventHandlers (cognitive 48) packages/api/src/agents/responses/service.ts:1150— service.createAggregatorEventHandlers has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 5 (9 pts), ternaries 2 (7 pts), boolean chains 6 (nesting depth added 22). None of this is in the body itself: all 48 points belong to 6 function literals inside it that branch (lines 1194, 1228, 1161, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
load.loadEphemeralAgent (cognitive 48) packages/api/src/agents/load.ts:74— load.loadEphemeralAgent has cognitive complexity 48 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 10, ternaries 3 (7 pts), loops 2 (4 pts), error handling 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.
session.createOpenIDSessionRefreshService.performIdpRefresh (cognitive 48) packages/api/src/auth/openid/session.ts:1523— session.createOpenIDSessionRefreshService.performIdpRefresh has cognitive complexity 48 (threshold 15). Drivers by points: if/else 15 (26 pts), error handling 6 (11 pts), ternaries 4 (7 pts), boolean chains 4 (nesting depth added 19). Most of this is not in the body itself: 10 of the 48 points are its own statements and the rest belongs to one function literal inside it that branches (line 1593). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into 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.createOpenIDSessionRefreshService.refreshOpenIDSession (cognitive 48) packages/api/src/auth/openid/session.ts:1914— session.createOpenIDSessionRefreshService.refreshOpenIDSession has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (39 pts), boolean chains 5, error handling 1 (2 pts), ternaries 2 (nesting depth added 23). 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, 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.
queued.planCodeFileUploads (cognitive 48) packages/api/src/files/code/queued.ts:47— queued.planCodeFileUploads has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (29 pts), loops 9 (13 pts), boolean chains 4, ternaries 2 (nesting depth added 17). Of this number, 35 points are the body's own statements and 13 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
retention.computeRetentionExpiry (cognitive 48) packages/api/src/files/retention.ts:113— retention.computeRetentionExpiry has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (29 pts), boolean chains 10, ternaries 2 (7 pts), error handling 1 (2 pts) (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.
actions.openapiToFunction (cognitive 48) packages/data-provider/src/actions.ts:484— actions.openapiToFunction has cognitive complexity 48 (threshold 15). Drivers by points: if/else 8 (31 pts), loops 4 (12 pts), boolean chains 5 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
performSync (cognitive 48) api/db/indexSync.js:193— performSync has cognitive complexity 48 (threshold 15). Drivers by points: if/else 19 (25 pts), boolean chains 10, ternaries 2 (6 pts), other 4, error handling 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.
AgentDetailContent.AgentDetailContent (cognitive 47) client/src/components/Agents/AgentDetailContent.tsx:64— AgentDetailContent.AgentDetailContent has cognitive complexity 47 (threshold 15). Drivers by points: boolean chains 23, ternaries 14 (15 pts), if/else 6 (8 pts), loops 1 (nesting depth added 3). Of this number, 36 points are the body's own statements and 11 belong to 7 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.
client.countFormattedMessageTokens::processValue (cognitive 47) packages/api/src/agents/client.ts:317— client.countFormattedMessageTokens::processValue has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (37 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
service.createSetupService.advance (cognitive 47) packages/api/src/code/setup/service.ts:319— service.createSetupService.advance has cognitive complexity 47 (threshold 15). Drivers by points: if/else 23 (33 pts), boolean chains 8, ternaries 2 (4 pts), error handling 2 (nesting depth added 12). Of this number, 39 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.
preflight.preflightCodeOutputBatch (cognitive 47) packages/api/src/files/code/preflight.ts:129— preflight.preflightCodeOutputBatch has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (32 pts), boolean chains 9, error handling 1 (2 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
content.updateContent (cognitive 47) packages/chat/src/core/steps/content.ts:171— content.updateContent has cognitive complexity 47 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 20, 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.
createMCPTool (cognitive 47) api/server/services/MCP.js:1057— createMCPTool has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (23 pts), ternaries 9 (10 pts), boolean chains 8, other 5, loops 1 (nesting depth added 10). Of this number, 41 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.
useReplyWatcher.mergeTimestamps (cognitive 46) client/src/hooks/Conversations/useReplyWatcher.ts:205— useReplyWatcher.mergeTimestamps has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 13, ternaries 5 (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.
FilePreviewDialog.FilePreviewDialog (cognitive 46) client/src/components/Chat/Messages/Content/FilePreviewDialog.tsx:96— FilePreviewDialog.FilePreviewDialog has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 22, if/else 16 (18 pts), ternaries 4, error handling 2 (nesting depth added 2). Of this number, 26 points are the body's own statements and 20 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.
useSubagentActivityStream.useSubagentActivityStream (cognitive 46) client/src/data-provider/Subagents/useSubagentActivityStream.ts:50— useSubagentActivityStream.useSubagentActivityStream has cognitive complexity 46 (threshold 15). Drivers by points: if/else 21 (24 pts), boolean chains 15, ternaries 3 (6 pts), error handling 1 (nesting depth added 6). None of this is in the body itself: all 46 points belong to 13 function literals inside it that branch (lines 161, 207, 117, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
files.omitResolvedFileLocators (cognitive 46) packages/api/src/protection/files.ts:1004— files.omitResolvedFileLocators has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 9, loops 3 (6 pts), ternaries 2 (3 pts), error handling 1 (nesting depth added 16). Of this number, 43 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.
loader.createCustomConfigLoader (cognitive 46) packages/api/src/app/loader.ts:122— loader.createCustomConfigLoader has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22 (32 pts), boolean chains 8, error handling 3 (5 pts), loops 1 (nesting depth added 12). None of this is in the body itself: all 46 points belong to 3 function literals inside it that branch (lines 133, 142, 237). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
initialize.initializeOpenAI (cognitive 46) packages/api/src/endpoints/openai/initialize.ts:48— initialize.initializeOpenAI has cognitive complexity 46 (threshold 15). Drivers by points: if/else 20 (27 pts), boolean chains 14, ternaries 5 (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.
RedisEventTransport.deliverMessage (cognitive 46) packages/api/src/stream/implementations/RedisEventTransport.ts:1117— RedisEventTransport.deliverMessage has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 6, error handling 2 (6 pts), loops 3 (5 pts), match/switch 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RedisJobStore.applyMembershipSnapshot (cognitive 46) packages/api/src/stream/implementations/RedisJobStore.ts:2756— RedisJobStore.applyMembershipSnapshot has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22 (30 pts), ternaries 7 (9 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.
file-config.buildMergedFileConfig (cognitive 46) packages/data-provider/src/file-config.ts:1251— file-config.buildMergedFileConfig has cognitive complexity 46 (threshold 15). Drivers by points: if/else 30 (42 pts), boolean chains 3, loops 1 (nesting depth added 12). Of this number, 44 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.
parsers.getResponseSender (cognitive 46) packages/data-provider/src/parsers.ts:222— parsers.getResponseSender has cognitive complexity 46 (threshold 15). Drivers by points: if/else 24 (27 pts), boolean chains 19 (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.
role.createRoleMethods.initializeRoles (cognitive 46) packages/data-schemas/src/methods/role.ts:79— role.createRoleMethods.initializeRoles has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (33 pts), loops 4 (11 pts), boolean chains 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
role.createRoleMethods.updateAccessPermissions (cognitive 46) packages/data-schemas/src/methods/role.ts:294— role.createRoleMethods.updateAccessPermissions has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (28 pts), boolean chains 7, loops 6 (7 pts), error handling 2 (4 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
browserSetup.createBrowserSetupStore.update (cognitive 46) packages/data-schemas/src/methods/browserSetup.ts:238— browserSetup.createBrowserSetupStore.update has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 22, if/else 16 (19 pts), ternaries 3, 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.
static-checks.main (cognitive 46) scripts/static-checks.mts:2252— static-checks.main has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 5 (19 pts), if/else 10 (17 pts), loops 3 (5 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 24). 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, 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.
useDictation.useDictation (cognitive 45) client/src/hooks/Input/useDictation.ts:40— useDictation.useDictation has cognitive complexity 45 (threshold 15). Drivers by points: if/else 25 (26 pts), boolean chains 17, ternaries 2 (nesting depth added 1). None of this is in the body itself: all 45 points belong to 10 function literals inside it that branch (lines 145, 106, 184, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
subagentContent.reconcileSubagentMessagePhases (cognitive 45) client/src/utils/subagentContent.ts:514— subagentContent.reconcileSubagentMessagePhases has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 7, loops 5, ternaries 4 (5 pts) (nesting depth added 14). Of this number, 43 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.
handlers.handleAttachedWorkspaceEditFileCall (cognitive 45) packages/api/src/agents/handlers.ts:4065— handlers.handleAttachedWorkspaceEditFileCall has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (29 pts), ternaries 5 (7 pts), boolean chains 6, error handling 2 (3 pts) (nesting depth added 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
lookup.createPullRequestLookup (cognitive 45) packages/api/src/pulls/lookup.ts:132— lookup.createPullRequestLookup has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (30 pts), boolean chains 6, ternaries 4 (5 pts), loops 3, error handling 1 (nesting depth added 12). None of this is in the body itself: all 45 points belong to 8 function items inside it that branch (a function literal at line 282, a function literal at line 221, partitionOf, …). 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.
azure.validateAzureGroups (cognitive 45) packages/data-provider/src/azure.ts:13— azure.validateAzureGroups has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (34 pts), boolean chains 6, loops 2 (5 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.
skill.createSkillMethods.upsertSkillFile (cognitive 45) packages/data-schemas/src/methods/skill.ts:1920— skill.createSkillMethods.upsertSkillFile has cognitive complexity 45 (threshold 15). Drivers by points: if/else 12 (23 pts), ternaries 5 (10 pts), boolean chains 7, error handling 2 (5 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.
useChatHelpers.useChatHelpers (cognitive 44) client/src/hooks/Chat/useChatHelpers.ts:39— useChatHelpers.useChatHelpers has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 12, ternaries 2 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 13). Most of this is not in the body itself: 1 of the 44 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 209, 71, 171, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ActivityPhaseGroup.ActivityPhaseGroup (cognitive 44) client/src/components/Chat/Messages/Content/ActivityPhaseGroup.tsx:540— ActivityPhaseGroup.ActivityPhaseGroup has cognitive complexity 44 (threshold 15). Drivers by points: boolean chains 21, ternaries 11 (16 pts), if/else 7 (nesting depth added 5). Of this number, 31 points are the body's own statements and 13 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.
preview.buildMessagePreview (cognitive 44) client/src/components/Chat/Trace/preview.ts:122— preview.buildMessagePreview has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 10, ternaries 3 (9 pts), loops 1 (nesting depth added 19). 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, split the body into named stages: move each independent 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.buildPreviewIndex (cognitive 44) client/src/components/Chat/Trace/preview.ts:305— preview.buildPreviewIndex has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 4 (7 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 22). 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, split the body into named stages: move each independent 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.useShortcutActions (cognitive 44) client/src/hooks/useKeyboardShortcuts.ts:497— useKeyboardShortcuts.useShortcutActions has cognitive complexity 44 (threshold 15). Drivers by points: if/else 30 (32 pts), boolean chains 10, loops 1, ternaries 1 (nesting depth added 2). None of this is in the body itself: all 44 points belong to 17 function literals inside it that branch (lines 709, 550, 760, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
protection.assertResumeRuntimeContentAllowed (cognitive 44) packages/api/src/agents/hitl/protection.ts:984— protection.assertResumeRuntimeContentAllowed has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 5 (10 pts), boolean chains 9, ternaries 5 (nesting depth added 15). Of this number, 38 points are the body's own statements and 6 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.
describe.describeThemeColors (cognitive 44) packages/data-provider/src/themes/describe.ts:37— describe.describeThemeColors has cognitive complexity 44 (threshold 15). Drivers by points: if/else 23, boolean chains 21. Of this number, 41 points are the body's own statements and 3 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.
triggerDelivery.createAgentTriggerDeliveryMethods.claimNextAgentTriggerDelivery (cognitive 44) packages/data-schemas/src/methods/triggerDelivery.ts:1501— triggerDelivery.createAgentTriggerDeliveryMethods.claimNextAgentTriggerDelivery has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 10 (28 pts), if/else 4 (9 pts), boolean chains 4, loops 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.
updateAssistant (cognitive 44) api/server/controllers/assistants/v2.js:146— updateAssistant has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (29 pts), ternaries 2 (5 pts), boolean chains 4, loops 2 (4 pts), other 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.
FavoritesController.updateFavoritesController (cognitive 43) api/server/controllers/FavoritesController.js:6— FavoritesController.updateFavoritesController has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 13, error handling 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.
useChatFunctions.useChatFunctions.ask (cognitive 43) client/src/hooks/Chat/useChatFunctions.ts:182— useChatFunctions.useChatFunctions.ask has cognitive complexity 43 (threshold 15). Drivers by points: if/else 22 (26 pts), boolean chains 14, ternaries 3 (nesting depth added 4). Of this number, 41 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.
ParallelContent.groupParallelContent (cognitive 43) client/src/components/Chat/Messages/Content/ParallelContent.tsx:36— ParallelContent.groupParallelContent has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 4 (9 pts), boolean chains 6, ternaries 2 (nesting depth added 18). Of this number, 22 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.
AskUserQuestion.AskUserQuestionSingle (cognitive 43) client/src/components/Chat/Messages/Content/AskUserQuestion.tsx:116— AskUserQuestion.AskUserQuestionSingle has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 19, if/else 17 (18 pts), ternaries 6 (nesting depth added 1). Of this number, 18 points are the body's own statements and 25 belong to 9 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.
SkillsCommand.SkillsCommandContent (cognitive 43) client/src/components/Chat/Input/SkillsCommand.tsx:80— SkillsCommand.SkillsCommandContent has cognitive complexity 43 (threshold 15). Drivers by points: if/else 23 (28 pts), boolean chains 10, loops 3 (4 pts), ternaries 1 (nesting depth added 6). Most of this is not in the body itself: 5 of the 43 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 295, 111, 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.
adapters.contentPartsToActivity (cognitive 43) client/src/components/Chat/Subagents/adapters.ts:103— adapters.contentPartsToActivity has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 20 (32 pts), if/else 7, boolean chains 4 (nesting depth added 12). None of this is in the body itself: all 43 points belong to one function literal inside it that branches (line 107). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
SubagentActivity.SubagentControlHistory (cognitive 43) client/src/components/Chat/Subagents/SubagentActivity.tsx:135— SubagentActivity.SubagentControlHistory has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 16, loops 2, ternaries 2 (nesting depth added 9). Of this number, 23 points are the body's own statements and 20 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.
metadata.sanitizeJobMetadata (cognitive 43) packages/api/src/stream/metadata.ts:9— metadata.sanitizeJobMetadata has cognitive complexity 43 (threshold 15). Drivers by points: if/else 40 (41 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.
edges.resolveReachableGraph (cognitive 43) packages/api/src/agents/edges.ts:143— edges.resolveReachableGraph has cognitive complexity 43 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 7 (11 pts), ternaries 5 (11 pts), boolean chains 5 (nesting depth added 20). Of this number, 38 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.
service.createSchedulesService (cognitive 43) packages/api/src/schedules/service.ts:574— service.createSchedulesService has cognitive complexity 43 (threshold 15). Drivers by points: if/else 24 (29 pts), boolean chains 11, ternaries 2, loops 1 (nesting depth added 5). Most of this is not in the body itself: 3 of the 43 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 703, 845, 814, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.createSkillMethods.updateSkill (cognitive 43) packages/data-schemas/src/methods/skill.ts:1499— skill.createSkillMethods.updateSkill has cognitive complexity 43 (threshold 15). Drivers by points: if/else 28 (32 pts), boolean chains 5, ternaries 4, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
(anonymous) (cognitive 43) api/server/routes/config.js:231— (anonymous) has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (19 pts), other 8, boolean chains 7, error handling 3 (5 pts), ternaries 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.
DialogImage.DialogImage (cognitive 42) client/src/components/Chat/Messages/Content/DialogImage.tsx:23— DialogImage.DialogImage has cognitive complexity 42 (threshold 15). Drivers by points: if/else 22 (23 pts), boolean chains 12, ternaries 6, error handling 1 (nesting depth added 1). Most of this is not in the body itself: 13 of the 42 points are its own statements and the rest belongs to 15 function items inside it that branch (a function literal at line 121, a function literal at line 201, a function literal at line 64, …). 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.
ContentParts.ContentParts (cognitive 42) client/src/components/Chat/Messages/Content/ContentParts.tsx:1353— ContentParts.ContentParts has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 18, if/else 10 (11 pts), loops 6 (9 pts), ternaries 2 (4 pts) (nesting depth added 6). Of this number, 21 points are the body's own statements and 21 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.
dispatch.findSubagentDispatch (cognitive 42) client/src/components/Chat/Subagents/dispatch.ts:16— dispatch.findSubagentDispatch has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (26 pts), ternaries 2 (8 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
recovery.createOpenIDRefreshRecoveryService.recoverOpenIDRefreshBridge (cognitive 42) packages/api/src/auth/openid/recovery.ts:451— recovery.createOpenIDRefreshRecoveryService.recoverOpenIDRefreshBridge has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (20 pts), error handling 7 (13 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 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 505, 604). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
document.encodeAndFormatDocuments (cognitive 42) packages/api/src/files/encode/document.ts:298— document.encodeAndFormatDocuments has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (34 pts), boolean chains 7, 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.
gitlab.createGitLabPullRequestSource.find (cognitive 42) packages/api/src/pulls/gitlab.ts:208— gitlab.createGitLabPullRequestSource.find has cognitive complexity 42 (threshold 15). Drivers by points: if/else 20 (26 pts), boolean chains 9, ternaries 3 (5 pts), loops 2 (nesting depth added 8). Of this number, 21 points are the body's own statements and 21 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.
erasure.settleAbandonedRuns (cognitive 42) packages/api/src/schedules/erasure.ts:88— erasure.settleAbandonedRuns has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 8, ternaries 4 (8 pts), 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.
revertAgentVersionHandler (cognitive 42) REDACTED:2043— revertAgentVersionHandler has cognitive complexity 42 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 7, other 5, ternaries 4, error handling 1 (nesting depth added 5). Of this number, 39 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.
state.foldLegacyInvocations (cognitive 41) client/src/components/Chat/Subagents/state.ts:1295— state.foldLegacyInvocations has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 7 (10 pts), ternaries 3 (5 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConnectedAccounts.ConnectedAccounts (cognitive 41) client/src/components/Nav/Settings/ConnectedAccounts.tsx:58— ConnectedAccounts.ConnectedAccounts has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (22 pts), boolean chains 15, ternaries 4 (nesting depth added 1). Of this number, 16 points are the body's own statements and 25 belong to 11 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.
GenerationJobManagerClass.claimTerminalJob (cognitive 41) packages/api/src/stream/GenerationJobManager.ts:4045— GenerationJobManagerClass.claimTerminalJob has cognitive complexity 41 (threshold 15). Drivers by points: boolean chains 21, if/else 11 (15 pts), ternaries 3, error handling 1 (2 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.
handlers.handleWorkspaceListCall (cognitive 41) packages/api/src/agents/handlers.ts:2549— handlers.handleWorkspaceListCall has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 12 (16 pts), if/else 9 (13 pts), boolean chains 9, loops 2, 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.
queuedTurns.createAgentQueuedTurnScheduler.recoverPass (cognitive 41) packages/api/src/agents/queuedTurns.ts:821— queuedTurns.createAgentQueuedTurnScheduler.recoverPass has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (20 pts), ternaries 4 (8 pts), boolean chains 7, error handling 2 (4 pts), loops 2 (nesting depth added 14). Most of this is not in the body itself: 1 of the 41 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 825, 863, 859, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.getOpenAIConfig (cognitive 41) packages/api/src/endpoints/openai/config.ts:93— config.getOpenAIConfig has cognitive complexity 41 (threshold 15). Drivers by points: if/else 22 (27 pts), boolean chains 13, ternaries 1 (nesting depth added 5). Of this number, 38 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.
MCPConnection.readToolsSnapshot (cognitive 41) packages/api/src/mcp/connection.ts:2858— MCPConnection.readToolsSnapshot has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (23 pts), error handling 2 (6 pts), boolean chains 5, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 20). Of this number, 40 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.createSchedulesService.recordMCPToolAuthFailure (cognitive 41) packages/api/src/schedules/service.ts:1126— service.createSchedulesService.recordMCPToolAuthFailure has cognitive complexity 41 (threshold 15). Drivers by points: boolean chains 22, if/else 9 (11 pts), ternaries 6 (8 pts) (nesting depth added 4). Of this number, 37 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.
ceiling.settleAfterRetryCeiling (cognitive 41) packages/chat/src/core/resumable/ceiling.ts:19— ceiling.settleAfterRetryCeiling has cognitive complexity 41 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 11, error handling 2, loops 1 (2 pts), ternaries 2 (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.
actions.validateAndParseOpenAPISpec (cognitive 41) packages/data-provider/src/actions.ts:834— actions.validateAndParseOpenAPISpec has cognitive complexity 41 (threshold 15). Drivers by points: if/else 7 (24 pts), boolean chains 8, loops 3 (7 pts), error handling 2 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
assistant.createAssistantMethods.updateAssistantAvatar (cognitive 41) packages/data-schemas/src/methods/assistant.ts:69— assistant.createAssistantMethods.updateAssistantAvatar has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 16, ternaries 3 (4 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.
primeFiles (cognitive 41) api/server/services/Files/Code/process.js:695— primeFiles has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 8 (14 pts), if/else 8 (13 pts), other 7, boolean chains 3, error handling 1 (2 pts), loops 2 (nesting depth added 12). Of this number, 22 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.
moderateText.moderateText (cognitive 40) api/server/middleware/moderateText.js:15— moderateText.moderateText has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 5, error handling 2 (5 pts), loops 2 (4 pts), ternaries 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.
useReplyWatcher.useReplyWatcher (cognitive 40) client/src/hooks/Conversations/useReplyWatcher.ts:407— useReplyWatcher.useReplyWatcher has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19 (30 pts), boolean chains 5, loops 4, error handling 1 (nesting depth added 11). None of this is in the body itself: all 40 points belong to 7 function literals inside it that branch (lines 514, 443, 478, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useNewChat.useNewChat (cognitive 40) client/src/hooks/Conversations/useNewChat.ts:117— useNewChat.useNewChat has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 8, loops 5 (7 pts), error handling 1 (2 pts), ternaries 1 (nesting depth added 12). None of this is in the body itself: all 40 points belong to 5 function literals inside it that branch (lines 188, 176, 205, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useResumeOnLoad.useResumeOnLoad (cognitive 40) client/src/hooks/SSE/useResumeOnLoad.ts:49— useResumeOnLoad.useResumeOnLoad has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19, boolean chains 18, ternaries 2, loops 1. Most of this is not in the body itself: 9 of the 40 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 169, 326, 96, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PromptsCommand.PromptsCommand (cognitive 40) client/src/components/Chat/Input/PromptsCommand.tsx:64— PromptsCommand.PromptsCommand has cognitive complexity 40 (threshold 15). Drivers by points: if/else 25 (30 pts), boolean chains 9, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 3 of the 40 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 116, 288, 199, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
state.prependSubagentReplay (cognitive 40) client/src/components/Chat/Subagents/state.ts:1027— state.prependSubagentReplay has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 9 (15 pts), loops 2 (5 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.
AgentSelect.AgentSelect (cognitive 40) client/src/components/SidePanel/Agents/AgentSelect.tsx:25— AgentSelect.AgentSelect has cognitive complexity 40 (threshold 15). Drivers by points: if/else 22, boolean chains 15, ternaries 3. None of this is in the body itself: all 40 points belong to 8 function literals inside it that branch (lines 144, 77, 240, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
mutations.useMarkConversationUnreadMutation (cognitive 40) client/src/data-provider/mutations.ts:741— mutations.useMarkConversationUnreadMutation has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 14, ternaries 7 (nesting depth added 3). None of this is in the body itself: all 40 points belong to 6 function literals inside it that branch (lines 801, 898, 787, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
submissions.toBoundedJsonValue (cognitive 40) packages/api/src/protection/adapters/submissions.ts:2039— submissions.toBoundedJsonValue has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 8, error handling 3 (6 pts), loops 2 (3 pts), ternaries 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.
runtime.stringifyBounded::walk (cognitive 40) packages/api/src/agents/activityLabels/runtime.ts:262— runtime.stringifyBounded::walk has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 6, ternaries 2 (5 pts), loops 2 (4 pts), error handling 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.
tools.buildRunToolSet (cognitive 40) packages/api/src/agents/tools.ts:323— tools.buildRunToolSet has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 7 (11 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pricing.buildTokenConfigMap (cognitive 40) packages/api/src/endpoints/pricing.ts:26— pricing.buildTokenConfigMap has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (33 pts), loops 2 (3 pts), boolean chains 2, ternaries 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.
zod.normalizeJsonSchema (cognitive 40) packages/api/src/mcp/zod.ts:396— zod.normalizeJsonSchema has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 10, ternaries 2 (6 pts), loops 2 (4 pts) (nesting depth added 14). Of this number, 37 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.
enrollment.createScheduleMCPEnrollmentResolver (cognitive 40) packages/api/src/schedules/authorization/enrollment.ts:40— enrollment.createScheduleMCPEnrollmentResolver has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 10, ternaries 4 (7 pts), loops 3 (nesting depth added 11). None of this is in the body itself: all 40 points belong 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.
github.syncSource (cognitive 40) packages/api/src/skills/sync/github.ts:1625— github.syncSource has cognitive complexity 40 (threshold 15). Drivers by points: if/else 30 (45 pts), ternaries 13 (21 pts), boolean chains 11, error handling 5 (8 pts), loops 6 (7 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (github.syncSource::syncPreparedSkill) 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.
triggerDelivery.createAgentTriggerDeliveryMethods.recoverLanePublisher (cognitive 40) packages/data-schemas/src/methods/triggerDelivery.ts:741— triggerDelivery.createAgentTriggerDeliveryMethods.recoverLanePublisher has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 12 (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.
agent.decodeAgentSortCursor (cognitive 40) packages/data-schemas/src/methods/agent.ts:296— agent.decodeAgentSortCursor has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19 (26 pts), boolean chains 11, ternaries 1 (2 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.
healMcpToolNames (cognitive 40) api/server/services/MCP.js:280— healMcpToolNames has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (26 pts), boolean chains 6, ternaries 1 (4 pts), error handling 1 (2 pts), loops 1, other 1 (nesting depth added 19). Of this number, 39 points are the body's own statements and 1 belongs 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.
syncMessages (cognitive 40) api/server/services/Threads/manage.js:257— syncMessages has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (21 pts), ternaries 3 (9 pts), boolean chains 6, other 3, loops 1 (nesting depth added 15). Of this number, 35 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.
getMCPTools (cognitive 40) REDACTED:135— getMCPTools has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 9, loops 3 (5 pts), error handling 2 (3 pts), other 2, ternaries 1 (2 pts) (nesting depth added 13). Of this number, 37 points are the body's own statements and 3 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.
flushRedisCache (cognitive 40) config/flush-cache.js:88— flushRedisCache has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 7, ternaries 3 (6 pts), loops 2 (5 pts), error handling 3 (4 pts) (nesting depth added 11). Of this number, 39 points are the body's own statements and 1 belongs 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.
buildEndpointOption (cognitive 40) REDACTED:61— buildEndpointOption has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 8, error handling 5 (8 pts), ternaries 4 (8 pts), other 2 (nesting depth added 11). Of this number, 39 points are the body's own statements and 1 belongs 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.
EditMessage.EditMessage (cognitive 39) client/src/components/Chat/Messages/Content/EditMessage.tsx:14— EditMessage.EditMessage has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 19, if/else 13, ternaries 4 (6 pts), error handling 1 (nesting depth added 2). Most of this is not in the body itself: 14 of the 39 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 192, getStatusMessage, updateMessage, …). 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.
BashCall.BashCall (cognitive 39) client/src/components/Chat/Messages/Content/Parts/BashCall.tsx:29— BashCall.BashCall has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 21, ternaries 8 (11 pts), if/else 7 (nesting depth added 3). Of this number, 24 points are the body's own statements and 15 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.
ChatView.ChatView (cognitive 39) client/src/components/Chat/ChatView.tsx:57— ChatView.ChatView has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 25, ternaries 9 (10 pts), if/else 4 (nesting depth added 1). 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Settings.CodeSettings (cognitive 39) client/src/components/SidePanel/Agents/Code/Settings.tsx:45— Settings.CodeSettings has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 29, if/else 6, ternaries 4. Of this number, 31 points are the body's own statements and 8 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.
UnifiedSidebar.UnifiedSidebar (cognitive 39) client/src/components/UnifiedSidebar/UnifiedSidebar.tsx:54— UnifiedSidebar.UnifiedSidebar has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 15 (27 pts), if/else 8, boolean chains 4 (nesting depth added 12). Of this number, 29 points are the body's own statements and 10 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.
useProjectMenuItem.useProjectMenuItem (cognitive 39) client/src/hooks/Chat/useProjectMenuItem.tsx:24— useProjectMenuItem.useProjectMenuItem has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 10, ternaries 4 (7 pts), loops 1 (2 pts) (nesting depth added 10). Of this number, 31 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.
convos.upsertConvoInAllQueries (cognitive 39) client/src/utils/convos.ts:582— convos.upsertConvoInAllQueries has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (25 pts), ternaries 3 (8 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 18). Most of this is not in the body itself: 7 of the 39 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 633, 697, 686, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
mermaid.fixSubgraphTitleContrast (cognitive 39) client/src/utils/mermaid.ts:253— mermaid.fixSubgraphTitleContrast has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (30 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
files.resolveCanonicalReferences (cognitive 39) packages/api/src/protection/files.ts:1216— files.resolveCanonicalReferences has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 6, loops 4 (6 pts), error handling 2 (4 pts) (nesting depth added 14). 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, split the body into named stages: move each independent 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.createAdminConfigHandlers.applyConfigChanges::plan (cognitive 39) packages/api/src/admin/config.ts:4549— config.createAdminConfigHandlers.applyConfigChanges::plan has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 4 (8 pts), boolean chains 7, 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. This shape REPEATS in the file: one other method here (config.createAdminConfigHandlers.applyConfigChanges) 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.
groups.createAdminGroupsHandlers.deleteGroup (cognitive 39) packages/api/src/admin/groups.ts:373— groups.createAdminGroupsHandlers.deleteGroup has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (29 pts), error handling 4 (5 pts), ternaries 3, boolean chains 1, loops 1 (nesting depth added 13). Of this number, 24 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.
langfuse.createAdminLangfuseHandlers.updateConnection (cognitive 39) packages/api/src/admin/langfuse.ts:510— langfuse.createAdminLangfuseHandlers.updateConnection has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (24 pts), ternaries 7, boolean chains 4, error handling 3 (4 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
InMemoryJobStore.transitionStatus (cognitive 39) packages/api/src/stream/implementations/InMemoryJobStore.ts:816— InMemoryJobStore.transitionStatus has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (20 pts), ternaries 4 (8 pts), loops 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.
GenerationJobManagerClass.expireStaleApprovals (cognitive 39) packages/api/src/stream/GenerationJobManager.ts:9306— GenerationJobManagerClass.expireStaleApprovals has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 4 (8 pts), loops 4 (7 pts), boolean chains 6 (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.isValidRequest (cognitive 39) packages/api/src/code/workspace.ts:829— workspace.isValidRequest has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 28, if/else 10 (11 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.
modelBoundContent.collectModelBoundHistoricalFileIdState (cognitive 39) packages/api/src/middleware/modelBoundContent.ts:314— modelBoundContent.collectModelBoundHistoricalFileIdState has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (30 pts), error handling 3 (4 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 16). Of this number, 30 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.
handlers.writeSkillMd (cognitive 39) packages/api/src/agents/handlers.ts:3562— handlers.writeSkillMd has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (25 pts), ternaries 6 (7 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 13). 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.
resume.attachAskUserQuestionAnswers (cognitive 39) packages/api/src/agents/hitl/resume.ts:684— resume.attachAskUserQuestionAnswers has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 8, ternaries 3 (6 pts), error handling 1 (3 pts), 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.
SubagentThreadTaskStore.controlInvocationAndPersist (cognitive 39) packages/api/src/agents/subagentThreads.ts:2467— SubagentThreadTaskStore.controlInvocationAndPersist has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 7, error handling 4 (7 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.
queuedTurnHttp.handleAgentQueuedTurnEnqueue (cognitive 39) packages/api/src/agents/queuedTurnHttp.ts:272— queuedTurnHttp.handleAgentQueuedTurnEnqueue has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 11, error handling 3 (4 pts), ternaries 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.
resume.projectPendingMCPOAuthPrompts (cognitive 39) packages/api/src/mcp/oauth/resume.ts:50— resume.projectPendingMCPOAuthPrompts has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 6 (12 pts), boolean chains 5, loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RedisEventTransport.syncReorderBuffer (cognitive 39) packages/api/src/stream/implementations/RedisEventTransport.ts:801— RedisEventTransport.syncReorderBuffer has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 3 (8 pts), boolean chains 4, ternaries 3, 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.
RedisJobStore.getIndexedTerminalHostActionJobs (cognitive 39) packages/api/src/stream/implementations/RedisJobStore.ts:3500— RedisJobStore.getIndexedTerminalHostActionJobs has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 5, error handling 1 (2 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
triggerDelivery.createAgentTriggerDeliveryMethods.recoverAgentTriggerLanePublications (cognitive 39) packages/data-schemas/src/methods/triggerDelivery.ts:1254— triggerDelivery.createAgentTriggerDeliveryMethods.recoverAgentTriggerLanePublications has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 8, ternaries 3 (6 pts), loops 3, error handling 1 (2 pts) (nesting depth added 12). Of this number, 36 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.
titleConvo (cognitive 39) api/server/controllers/agents/client.js:6121— titleConvo has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 11, error handling 3 (4 pts), other 3, ternaries 1 (nesting depth added 3). Of this number, 34 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.
(anonymous) (cognitive 39) REDACTED:278— (anonymous) has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 8, loops 3 (7 pts), ternaries 2, error handling 1, other 1 (nesting depth added 12). Of this number, 38 points are the body's own statements and 1 belongs 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.
messages.router.post("/branch") (cognitive 38) REDACTED:278— messages.router.post("/branch") has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 8, loops 3 (7 pts), ternaries 2, error handling 1 (nesting depth added 12). Of this number, 37 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.
useAutoSave.useAutoSave.restoreFiles (cognitive 38) client/src/hooks/Input/useAutoSave.ts:117— useAutoSave.useAutoSave.restoreFiles has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 7, loops 2 (4 pts), ternaries 2 (3 pts) (nesting depth added 14). Most of this is not in the body itself: 8 of the 38 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 154, 189). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SubagentActivity.toContentPart (cognitive 38) client/src/components/Chat/Subagents/SubagentActivity.tsx:331— SubagentActivity.toContentPart has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 19 (31 pts), if/else 5 (6 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InsightsView.InsightsView (cognitive 38) client/src/components/Insights/InsightsView.tsx:546— InsightsView.InsightsView has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 18, if/else 13, ternaries 4, loops 2 (3 pts) (nesting depth added 1). Of this number, 17 points are the body's own statements and 21 belong to 15 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.
LiaEngine.updateMotion (cognitive 38) client/src/components/Lia/engine/engine.ts:539— LiaEngine.updateMotion has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (26 pts), ternaries 4 (8 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.
runtime.createActivityPhaseWiring.hook (cognitive 38) packages/api/src/agents/activityPhases/runtime.ts:1424— runtime.createActivityPhaseWiring.hook has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 10, ternaries 4 (7 pts), loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
view.expandNodes (cognitive 38) packages/api/src/agents/digest/view.ts:524— view.expandNodes has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (24 pts), ternaries 3 (10 pts), boolean chains 3, 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.
service.validateInputToolExchanges (cognitive 38) packages/api/src/agents/responses/service.ts:187— service.validateInputToolExchanges has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (34 pts), loops 3, boolean chains 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.
MCPTokenStorage.forceRefreshTokens (cognitive 38) packages/api/src/mcp/oauth/tokens.ts:1044— MCPTokenStorage.forceRefreshTokens has cognitive complexity 38 (threshold 15). Drivers by points: if/else 21 (28 pts), boolean chains 4, ternaries 3 (4 pts), error handling 1 (2 pts) (nesting depth added 9). Most of this is not in the body itself: 10 of the 38 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1116, 1217, 1227, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MCPConnectionFactory.discoverToolsInternal (cognitive 38) packages/api/src/mcp/MCPConnectionFactory.ts:394— MCPConnectionFactory.discoverToolsInternal has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 7, error handling 3 (5 pts), ternaries 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
service.createSchedulesService.reconcileRetainedJobs (cognitive 38) packages/api/src/schedules/service.ts:1284— service.createSchedulesService.reconcileRetainedJobs has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (17 pts), error handling 3 (8 pts), ternaries 3 (8 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.
RedisJobStore.transitionStatusInternal (cognitive 38) packages/api/src/stream/implementations/RedisJobStore.ts:3004— RedisJobStore.transitionStatusInternal has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 11, ternaries 10 (11 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
frames.handleFrame (cognitive 38) packages/chat/src/core/resumable/frames.ts:189— frames.handleFrame has cognitive complexity 38 (threshold 15). Drivers by points: if/else 22 (28 pts), boolean chains 7, ternaries 1 (2 pts), error handling 1 (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.
conversation.createConversationMethods.deleteConvos (cognitive 38) packages/data-schemas/src/methods/conversation.ts:4013— conversation.createConversationMethods.deleteConvos has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (16 pts), error handling 7 (12 pts), loops 5 (7 pts), boolean chains 3 (nesting depth added 13). Of this number, 24 points are the body's own statements and 14 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.
BaseClient.addPreviousAttachments (cognitive 37) api/app/clients/BaseClient.js:1930— BaseClient.addPreviousAttachments has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 13, loops 7 (12 pts), 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. This shape REPEATS in the file: one other method here (BaseClient.addPreviousAttachments::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.
DynamicInput.DynamicInput (cognitive 37) client/src/components/SidePanel/Parameters/DynamicInput.tsx:11— DynamicInput.DynamicInput has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 17, if/else 11, ternaries 9. Most of this is not in the body itself: 14 of the 37 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 117, handleInputBlur, handleInputChange). 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.
subagentContent.foldSubagentEventIntoTicker (cognitive 37) client/src/utils/subagentContent.ts:825— subagentContent.foldSubagentEventIntoTicker has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 7 (14 pts), boolean chains 4 (nesting depth added 14). 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.
secrets.preserveArraySecrets (cognitive 37) packages/api/src/admin/secrets.ts:941— secrets.preserveArraySecrets has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (27 pts), boolean chains 5, 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.
bridge.getCodeBridgeWorkerStatus (cognitive 37) packages/api/src/code/bridge.ts:413— bridge.getCodeBridgeWorkerStatus has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 17, if/else 10 (14 pts), ternaries 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.
messages.snapshotNestedSubmittedValue (cognitive 37) packages/api/src/protection/adapters/messages.ts:255— messages.snapshotNestedSubmittedValue has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (23 pts), error handling 3 (6 pts), loops 3 (4 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.
provenance.getUserSubmittedPathState (cognitive 37) packages/api/src/protection/provenance.ts:307— provenance.getUserSubmittedPathState has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (28 pts), error handling 3 (4 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 16). Of this number, 27 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.
modelBoundContent.projectModelBoundSourceFiles (cognitive 37) packages/api/src/middleware/modelBoundContent.ts:432— modelBoundContent.projectModelBoundSourceFiles has cognitive complexity 37 (threshold 15). Drivers by points: if/else 42 (68 pts), loops 7 (12 pts), boolean chains 5, error handling 5 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (modelBoundContent.projectModelBoundSourceFiles::appendResolvedFiles) 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.
service.validateRequest (cognitive 37) packages/api/src/agents/openai/service.ts:515— service.validateRequest has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 10, 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.
compatibility.planPluginHooks (cognitive 37) REDACTED:552— compatibility.planPluginHooks has cognitive complexity 37 (threshold 15). Drivers by points: if/else 4 (14 pts), boolean chains 9, ternaries 2 (8 pts), loops 3 (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.
request.handleSteerCancelInternal (cognitive 37) packages/api/src/agents/steering/request.ts:831— request.handleSteerCancelInternal has cognitive complexity 37 (threshold 15). Drivers by points: if/else 23 (25 pts), boolean chains 10, ternaries 2 (nesting depth added 2). Of this number, 21 points are the body's own statements and 16 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.
auth.getUserMCPAuthMap (cognitive 37) packages/api/src/mcp/auth.ts:16— auth.getUserMCPAuthMap has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 3 (6 pts), boolean chains 4, ternaries 1 (2 pts), error handling 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.
service.createScheduleMCPConsentService (cognitive 37) packages/api/src/schedules/authorization/service.ts:113— service.createScheduleMCPConsentService has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 8, ternaries 2 (4 pts), error handling 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
handlers.createSkillsHandlers.downloadFile (cognitive 37) packages/api/src/skills/handlers.ts:655— handlers.createSkillsHandlers.downloadFile has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (28 pts), ternaries 2 (4 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 13). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
enqueue.useQueueEnqueue (cognitive 37) packages/chat/src/react/steering/enqueue.ts:47— enqueue.useQueueEnqueue has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 21, if/else 10 (12 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 3). None of this is in the body itself: all 37 points belong to 6 function literals inside it that branch (lines 101, 80, 160, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
object-traverse.forEach::walk (cognitive 37) packages/data-schemas/src/utils/object-traverse.ts:139— object-traverse.forEach::walk has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 2 (6 pts), boolean chains 5, ternaries 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.
userGroup.createUserGroupMethods.getMemberGroupIds (cognitive 37) packages/data-schemas/src/methods/userGroup.ts:326— userGroup.createUserGroupMethods.getMemberGroupIds has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (22 pts), error handling 4 (10 pts), loops 1 (3 pts), boolean chains 1, ternaries 1 (nesting depth added 18). Most of this is not in the body itself: 5 of the 37 points are its own statements and the rest belongs to one function literal inside it that branches (line 353). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
triggerDelivery.createAgentTriggerDeliveryMethods.settleBatchMembers (cognitive 37) packages/data-schemas/src/methods/triggerDelivery.ts:1807— triggerDelivery.createAgentTriggerDeliveryMethods.settleBatchMembers has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 7 (15 pts), if/else 6 (12 pts), boolean chains 10 (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.
mcpAuthority.assertProofIntegrity (cognitive 37) packages/data-schemas/src/methods/mcpAuthority.ts:578— mcpAuthority.assertProofIntegrity has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 15, 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.
report.markdownReport (cognitive 37) scripts/activity-labels/report.mts:104— report.markdownReport has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 5 (11 pts), ternaries 1 (6 pts), boolean chains 1 (nesting depth added 23). 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.
chatV1 (cognitive 37) api/server/controllers/assistants/chatV1.js:77— chatV1 has cognitive complexity 37 (threshold 15). Drivers by points: if/else 47 (62 pts), boolean chains 15, ternaries 10 (11 pts), error handling 8 (9 pts), other 9, loops 2 (4 pts) (nesting depth added 19). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
chatV2 (cognitive 37) REDACTED:70— chatV2 has cognitive complexity 37 (threshold 15). Drivers by points: if/else 29 (44 pts), other 9, boolean chains 8, error handling 4 (5 pts), ternaries 4, 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.
useTextarea.useTextarea.handlePaste (cognitive 36) client/src/hooks/Input/useTextarea.ts:409— useTextarea.useTextarea.handlePaste has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 8, error handling 2 (3 pts), loops 2 (3 pts), ternaries 2 (nesting depth added 4). Of this number, 16 points are the body's own statements and 20 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.
DescriptionWords.DescriptionWords (cognitive 36) client/src/components/Agents/DescriptionWords.tsx:53— DescriptionWords.DescriptionWords has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 5 (6 pts), ternaries 3, boolean chains 2 (nesting depth added 12). None of this is in the body itself: all 36 points belong to 4 function literals inside it that branch (lines 59, 61, 92, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
QuoteButton.QuoteButton (cognitive 36) client/src/components/Chat/Input/QuoteButton.tsx:321— QuoteButton.QuoteButton has cognitive complexity 36 (threshold 15). Drivers by points: if/else 23, boolean chains 11, error handling 1, ternaries 1. None of this is in the body itself: all 36 points belong to 14 function literals inside it that branch (lines 393, 454, 477, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Bar.Bar (cognitive 36) client/src/components/Chat/Input/Composer/Bar.tsx:217— Bar.Bar has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 19, boolean chains 14, if/else 3. Of this number, 29 points are the body's own statements and 7 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.
Landing.Landing (cognitive 36) client/src/components/Chat/Landing.tsx:39— Landing.Landing has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 15 (17 pts), boolean chains 12, if/else 7 (nesting depth added 2). Of this number, 25 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.
MemoryEditDialog.MemoryEditDialog (cognitive 36) client/src/components/SidePanel/Memories/MemoryEditDialog.tsx:40— MemoryEditDialog.MemoryEditDialog has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 20, if/else 7 (8 pts), ternaries 7 (8 pts) (nesting depth added 2). Of this number, 25 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.
ScheduleDialog.ScheduleDialog (cognitive 36) client/src/components/SidePanel/Schedules/ScheduleDialog.tsx:183— ScheduleDialog.ScheduleDialog has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 27 (43 pts), boolean chains 25, 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. This shape REPEATS in the file: one other method here (ScheduleDialog.ScheduleDialog::onSubmit) 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.
client.createMultiAgentMapper (cognitive 36) packages/api/src/agents/client.ts:558— client.createMultiAgentMapper has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 9, loops 4 (6 pts), ternaries 2 (3 pts), error handling 1 (nesting depth added 11). Most of this is not in the body itself: 9 of the 36 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 571, 577). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
modes.createAgentToolApprovalSession.hook (cognitive 36) packages/api/src/agents/hitl/modes.ts:662— modes.createAgentToolApprovalSession.hook has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 11, 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.
controller.createResetToolApprovalController (cognitive 36) REDACTED:43— controller.createResetToolApprovalController has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 6, loops 1 (4 pts), ternaries 2 (3 pts), error handling 2 (nesting depth added 15). None of this is in the body itself: all 36 points belong to one function literal inside it that branches (line 54). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
compatibility.planMatcher (cognitive 36) REDACTED:393— compatibility.planMatcher has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 8 (12 pts), boolean chains 9, error handling 1 (nesting depth added 7). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ControlCombobox.ControlCombobox (cognitive 36) packages/client/src/components/ControlCombobox.tsx:72— ControlCombobox.ControlCombobox has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 16, if/else 8 (11 pts), ternaries 9 (nesting depth added 3). Of this number, 18 points are the body's own statements and 18 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.
parts.toUIMessage (cognitive 36) packages/data-provider/src/parts.ts:911— parts.toUIMessage has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 18, if/else 9 (14 pts), loops 2 (3 pts), ternaries 1 (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.
handleRunInterrupt (cognitive 36) api/server/controllers/agents/client.js:4339— handleRunInterrupt has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 7, other 6, ternaries 3 (4 pts), error handling 2 (3 pts) (nesting depth added 6). Of this number, 35 points are the body's own statements and 1 belongs 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.
filterAuthorizedTools (cognitive 36) REDACTED:549— filterAuthorizedTools has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (20 pts), ternaries 4 (6 pts), boolean chains 4, error handling 1 (3 pts), other 2, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 36) REDACTED:123— (anonymous) has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 5 (7 pts), boolean chains 6, loops 3 (6 pts), error handling 1, other 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.
createToolCallStream::deltaHandler (cognitive 36) api/server/services/Runs/StreamRunManager.js:293— createToolCallStream::deltaHandler has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (8 pts), boolean chains 6 (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.
BaseClient.getTokenCountForMessage::processValue (cognitive 35) api/app/clients/BaseClient.js:1573— BaseClient.getTokenCountForMessage::processValue has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (25 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
config.router.get("/") (cognitive 35) api/server/routes/config.js:231— config.router.get("/") has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 7, error handling 3 (5 pts), ternaries 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.
state.foldReplaySegments (cognitive 35) client/src/components/Chat/Subagents/state.ts:1175— state.foldReplaySegments has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 5 (6 pts), boolean chains 5, ternaries 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.
adapters.mergePersistedAndLiveActivity (cognitive 35) client/src/components/Chat/Subagents/adapters.ts:226— adapters.mergePersistedAndLiveActivity has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 8, ternaries 1 (2 pts), loops 1 (nesting depth added 14). 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.
InMemoryEventTransport.subscribe (cognitive 35) packages/api/src/stream/implementations/InMemoryEventTransport.ts:65— InMemoryEventTransport.subscribe has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (29 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 14). Most of this is not in the body itself: 4 of the 35 points are its own statements and the rest belongs to 6 function items inside it that branch (deliver, a function literal at line 109, a function literal at line 156, …). 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.
GenerationJobManagerClass.recoverCommittedCreate (cognitive 35) packages/api/src/stream/GenerationJobManager.ts:2266— GenerationJobManagerClass.recoverCommittedCreate has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 5, error handling 2 (4 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 13). Of this number, 34 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.
inspection.getResumeAgentSnapshot (cognitive 35) packages/api/src/agents/hitl/inspection.ts:148— inspection.getResumeAgentSnapshot has cognitive complexity 35 (threshold 15). Drivers by points: if/else 5 (21 pts), loops 4 (7 pts), error handling 1 (5 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
env.processMCPEnv (cognitive 35) packages/api/src/utils/env.ts:385— env.processMCPEnv has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 10, loops 5 (10 pts), 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.
ConnectionsRepository.loadConnection (cognitive 35) packages/api/src/mcp/ConnectionsRepository.ts:131— ConnectionsRepository.loadConnection has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 6, 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.
loading.loadMCPTools (cognitive 35) packages/api/src/mcp/loading.ts:47— loading.loadMCPTools has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (19 pts), error handling 2 (7 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 18). Of this number, 33 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.
execution.createScheduleMCPExecution.resolve (cognitive 35) packages/api/src/schedules/authorization/execution.ts:83— execution.createScheduleMCPExecution.resolve has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 8, error handling 3 (4 pts), ternaries 1 (3 pts) (nesting depth added 5). Of this number, 30 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.
runtime.createScheduleMCPRuntimeHost.prepare (cognitive 35) packages/api/src/schedules/authorization/runtime.ts:129— runtime.createScheduleMCPRuntimeHost.prepare has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 11, ternaries 5 (8 pts) (nesting depth added 8). None of this is in the body itself: all 35 points belong to one function literal inside it that branches (line 130). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
useSteerConvert.useSteerConvert (cognitive 35) packages/chat/src/react/steering/useSteerConvert.ts:71— useSteerConvert.useSteerConvert has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 17, if/else 6 (8 pts), ternaries 7 (8 pts), loops 2 (nesting depth added 3). None of this is in the body itself: all 35 points belong to 11 function literals inside it that branch (lines 126, 164, 133, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
queuedTurn.createAgentQueuedTurnMethods.beginAgentQueuedTurnAdmission (cognitive 35) packages/data-schemas/src/methods/queuedTurn.ts:1954— queuedTurn.createAgentQueuedTurnMethods.beginAgentQueuedTurnAdmission has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 9, ternaries 5 (9 pts), error handling 1 (nesting depth added 9). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to 2 function items inside it that branch (a function literal at line 2001, retireObsoleteClaim). 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.
startServer (cognitive 35) REDACTED:185— startServer has cognitive complexity 35 (threshold 15). Drivers by points: if/else 20 (21 pts), ternaries 4 (6 pts), error handling 4, boolean chains 3, other 1 (nesting depth added 3). Of this number, 21 points are the body's own statements and 14 belong to 17 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.
deleteUserController (cognitive 35) api/server/controllers/UserController.js:366— deleteUserController has cognitive complexity 35 (threshold 15). Drivers by points: error handling 7 (14 pts), if/else 10 (13 pts), boolean chains 4, other 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.
migrateSharedLinkPermissions::(anonymous)::processBatch (cognitive 35) config/migrate-shared-link-permissions.js:153— migrateSharedLinkPermissions::(anonymous)::processBatch has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (9 pts), boolean chains 5, 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.
MultiMessage.MultiMessage (cognitive 34) client/src/components/Chat/Messages/MultiMessage.tsx:19— MultiMessage.MultiMessage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 12, ternaries 2 (3 pts) (nesting depth added 3). Of this number, 19 points are the body's own statements and 15 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.
Mention.MentionContent (cognitive 34) client/src/components/Chat/Input/Mention.tsx:28— Mention.MentionContent has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 9, ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 4 of the 34 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 192, handleSelect, handleSelect::defaultSelect, …). 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.foldAcceptedSubagentEvents (cognitive 34) client/src/components/Chat/Subagents/state.ts:746— state.foldAcceptedSubagentEvents has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 7 (11 pts), boolean chains 9, loops 2 (nesting depth added 9). 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.
catalog.buildCatalog (cognitive 34) client/src/components/SidePanel/Agents/Tools/items/catalog.ts:121— catalog.buildCatalog has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 4 (10 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AssistantPanel.AssistantPanel (cognitive 34) client/src/components/SidePanel/Builder/AssistantPanel.tsx:48— AssistantPanel.AssistantPanel has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 11, ternaries 8 (9 pts) (nesting depth added 2). Most of this is not in the body itself: 14 of the 34 points are its own statements and the rest belongs to 8 function items inside it that branch (onSubmit, a function literal at line 185, a function literal at line 93, …). 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.
Sources.FileItem (cognitive 34) client/src/components/Web/Sources.tsx:206— Sources.FileItem has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 13, ternaries 8 (11 pts), if/else 9, error handling 1 (nesting depth added 3). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Sources.SourcesComponent (cognitive 34) client/src/components/Web/Sources.tsx:569— Sources.SourcesComponent has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 9, loops 1 (nesting depth added 8). Most of this is not in the body itself: 1 of the 34 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 601, 574, 664, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
shortcuts.resolveComposerKeyDown (cognitive 34) client/src/utils/shortcuts.ts:266— shortcuts.resolveComposerKeyDown has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 10, 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.
subagentContent.reconcileSubagentToolTimings (cognitive 34) client/src/utils/subagentContent.ts:611— subagentContent.reconcileSubagentToolTimings has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 7, loops 3 (5 pts), ternaries 1 (2 pts) (nesting depth added 11). Of this number, 26 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.
secrets.redactConfigSecrets (cognitive 34) packages/api/src/admin/secrets.ts:1916— secrets.redactConfigSecrets has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 4 (5 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.
users.createAdminUsersHandlers.deleteUser (cognitive 34) packages/api/src/admin/users.ts:230— users.createAdminUsersHandlers.deleteUser has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (18 pts), error handling 5 (11 pts), boolean chains 3, loops 1, 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.
toolTiming.applySubagentToolTiming (cognitive 34) packages/api/src/agents/toolTiming.ts:107— toolTiming.applySubagentToolTiming has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 10, loops 1 (2 pts), ternaries 1 (nesting depth added 9). Of this number, 22 points are the body's own statements and 12 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.
subagentContent.createSubagentTaskContentHandler (cognitive 34) packages/api/src/agents/subagentContent.ts:569— subagentContent.createSubagentTaskContentHandler has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 12, ternaries 6, error handling 2 (3 pts) (nesting depth added 3). None of this is in the body itself: all 34 points belong to one function literal inside it that branches (line 575). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
subagentCompletionWakeup.createSubagentCompletionWakeupResolver (cognitive 34) packages/api/src/agents/subagentCompletionWakeup.ts:590— subagentCompletionWakeup.createSubagentCompletionWakeupResolver has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 8, ternaries 3 (5 pts), error handling 1 (nesting depth added 7). None of this is in the body itself: all 34 points belong to 2 function literals inside it that branch (lines 601, 678). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.createReasoningLabelWiring.schedule (cognitive 34) packages/api/src/agents/reasoningLabels/runtime.ts:382— runtime.createReasoningLabelWiring.schedule has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 9, error handling 4, ternaries 2 (nesting depth added 4). Of this number, 16 points are the body's own statements and 18 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.
initialize.initializeCustom (cognitive 34) packages/api/src/endpoints/custom/initialize.ts:187— initialize.initializeCustom has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 10, ternaries 5 (6 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
resume.mergeResumeMessages (cognitive 34) packages/chat/src/core/resumable/resume.ts:175— resume.mergeResumeMessages has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 3, 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.
receipts.reconcileServerQueuedTurns (cognitive 34) packages/chat/src/core/steer/receipts.ts:128— receipts.reconcileServerQueuedTurns has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 20, if/else 10, ternaries 3 (4 pts) (nesting depth added 1). None of this is in the body itself: all 34 points belong to 3 function literals inside it that branch (lines 141, 201, 136). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
messages.buildTree (cognitive 34) packages/data-provider/src/messages.ts:50— messages.buildTree has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (20 pts), loops 6 (7 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 9). Of this number, 29 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.
queuedTurn.createAgentQueuedTurnMethods.enqueueAgentQueuedTurn (cognitive 34) packages/data-schemas/src/methods/queuedTurn.ts:1105— queuedTurn.createAgentQueuedTurnMethods.enqueueAgentQueuedTurn has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 3 (8 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 17). Most of this is not in the body itself: 7 of the 34 points are its own statements and the rest belongs to one function literal inside it that branches (line 1126). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
_call (cognitive 34) api/app/clients/tools/structured/FluxAPI.js:195— _call has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 10, error handling 4 (6 pts), loops 1, other 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.
generateFinetunedImage (cognitive 34) api/app/clients/tools/structured/FluxAPI.js:429— generateFinetunedImage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 10, error handling 4 (6 pts), loops 1, other 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.
updateResourcePermissions (cognitive 34) api/server/controllers/PermissionsController.js:70— updateResourcePermissions has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (13 pts), error handling 4 (7 pts), boolean chains 6, ternaries 6, loops 1, other 1 (nesting depth added 4). Of this number, 33 points are the body's own statements and 1 belongs 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.
messages.router.get("/") (cognitive 33) REDACTED:123— messages.router.get("/") has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 6, loops 3 (6 pts), ternaries 4 (5 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.
useNewChat.useNewChat.startNewChat (cognitive 33) client/src/hooks/Conversations/useNewChat.ts:303— useNewChat.useNewChat.startNewChat has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (25 pts), loops 3 (4 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 12). Most of this is not in the body itself: 11 of the 33 points are its own statements and the rest belongs to 4 function items inside it that branch (collectDiscardWork, a function literal at line 381, a function literal at line 434, …). 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.
ProgressText.ProgressText::getText (cognitive 33) client/src/components/Chat/Messages/Content/Parts/OpenAIImageGen/ProgressText.tsx:25— ProgressText.ProgressText::getText has cognitive complexity 33 (threshold 15). Drivers by points: if/else 20 (32 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.
StreamAudio.StreamAudio (cognitive 33) client/src/components/Chat/Input/StreamAudio.tsx:33— StreamAudio.StreamAudio has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 6, ternaries 3, error handling 1, loops 1 (nesting depth added 7). 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 64, 59, 196). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.Review (cognitive 33) client/src/components/Code/Setup.tsx:48— Setup.Review has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 24, if/else 8, ternaries 1. Of this number, 30 points are the body's own statements and 3 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.
SkillsSection.SkillsSection (cognitive 33) client/src/components/SidePanel/Agents/Tools/SkillsSection.tsx:116— SkillsSection.SkillsSection has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 16, if/else 10 (12 pts), loops 2 (3 pts), ternaries 2 (nesting depth added 3). Most of this is not in the body itself: 15 of the 33 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 201, 162, 187, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useArtifacts.useArtifacts (cognitive 33) client/src/hooks/Artifacts/useArtifacts.ts:156— useArtifacts.useArtifacts has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (22 pts), boolean chains 9, loops 1, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 276, 259, 171, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.createActivityPhaseWiring.close (cognitive 33) packages/api/src/agents/activityPhases/runtime.ts:1284— runtime.createActivityPhaseWiring.close has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 9, loops 2 (4 pts), error handling 3, ternaries 1 (nesting depth added 8). Of this number, 24 points are the body's own statements and 9 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.
GenerationJobManagerClass.saveRunStepFromEvent (cognitive 33) packages/api/src/stream/GenerationJobManager.ts:7717— GenerationJobManagerClass.saveRunStepFromEvent has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 9 (17 pts), if/else 9 (11 pts), boolean chains 5 (nesting depth added 10). Of this number, 26 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.
tools.registerFileAuthoringTools (cognitive 33) packages/api/src/agents/tools.ts:1327— tools.registerFileAuthoringTools has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 3 (8 pts), boolean chains 3, 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.
bindings.createAgentEventBindingHandlers.register (cognitive 33) packages/api/src/agents/triggers/bindings.ts:207— bindings.createAgentEventBindingHandlers.register has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (16 pts), error handling 5 (7 pts), boolean chains 5, ternaries 4, loops 1 (nesting depth added 8). Of this number, 23 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.
session.createOpenIDSessionRefreshService.syncRefreshTokenCookie (cognitive 33) packages/api/src/auth/openid/session.ts:811— session.createOpenIDSessionRefreshService.syncRefreshTokenCookie has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 3 (11 pts), ternaries 1 (5 pts), boolean chains 1 (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.
protection.extractLocatorAliasFragments (cognitive 33) packages/api/src/shared-links/protection.ts:1420— protection.extractLocatorAliasFragments has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (24 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bearer.createScheduledMCPBearerHost.bind.resolve (cognitive 33) packages/api/src/schedules/bearer.ts:173— bearer.createScheduledMCPBearerHost.bind.resolve has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (23 pts), boolean chains 7, error handling 1, 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.
upload.createSkillUploadHandler (cognitive 33) packages/api/src/skills/upload.ts:48— upload.createSkillUploadHandler has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 8, error handling 1, ternaries 1 (nesting depth added 7). None of this is in the body itself: all 33 points belong to 3 function literals inside it that branch (lines 51, 140, 156). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
view.deriveTokenUsageView (cognitive 33) packages/chat/src/core/usage/view.ts:117— view.deriveTokenUsageView has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 13 (18 pts), boolean chains 8, if/else 5 (7 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
workspace.resolveCodeWorkspaceInheritance (cognitive 33) packages/data-provider/src/code/workspace.ts:363— workspace.resolveCodeWorkspaceInheritance has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 7 (9 pts), loops 4 (8 pts), boolean chains 5 (nesting depth added 12). Of this number, 20 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.
share.getMessagesUpToTarget (cognitive 33) packages/data-schemas/src/methods/share.ts:826— share.getMessagesUpToTarget has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 7, loops 4 (7 pts), ternaries 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.
schedule.createScheduleMethods.recordRunOutcome (cognitive 33) packages/data-schemas/src/methods/schedule.ts:1490— schedule.createScheduleMethods.recordRunOutcome has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 14 (18 pts), if/else 7 (9 pts), boolean chains 6 (nesting depth added 6). Of this number, 27 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
queuedTurn.createAgentQueuedTurnMethods.deadLetterAgentQueuedTurn (cognitive 33) packages/data-schemas/src/methods/queuedTurn.ts:2336— queuedTurn.createAgentQueuedTurnMethods.deadLetterAgentQueuedTurn has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 14, 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.
triggerDelivery.createAgentTriggerDeliveryMethods.publishStagedDelivery (cognitive 33) packages/data-schemas/src/methods/triggerDelivery.ts:1029— triggerDelivery.createAgentTriggerDeliveryMethods.publishStagedDelivery has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 14). 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 into named stages: move each independent 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)::beforePublish (cognitive 33) api/server/routes/agents/index.js:786— (anonymous)::beforePublish has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 7, error handling 3 (7 pts), ternaries 2 (4 pts), other 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.
(anonymous) (cognitive 33) REDACTED:635— (anonymous) has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 5, error handling 2 (4 pts), ternaries 2 (4 pts), other 1 (nesting depth added 12). Of this number, 28 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.
files.router.get("/download/:userId/:file_id") (cognitive 32) REDACTED:635— files.router.get("/download/:userId/:file_id") has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 5, error handling 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 12). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
importers.processConversation (cognitive 32) api/server/utils/import/importers.js:444— importers.processConversation has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (22 pts), ternaries 2 (4 pts), boolean chains 3, 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.
useUnseenConversations.observeArrivalQuery (cognitive 32) client/src/hooks/Conversations/useUnseenConversations.ts:161— useUnseenConversations.observeArrivalQuery has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 8, ternaries 3 (5 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
format.formatMessageContent (cognitive 32) client/src/hooks/Conversations/format.ts:111— format.formatMessageContent has cognitive complexity 32 (threshold 15). Drivers by points: if/else 23 (32 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.
useSelectorEffects.useSelectorEffects (cognitive 32) client/src/hooks/Endpoint/useSelectorEffects.ts:12— useSelectorEffects.useSelectorEffects has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 12 (nesting depth added 5). None of this is in the body itself: all 32 points belong to 6 function items inside it that branch (a function literal at line 87, a function literal at line 41, 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.
PendingSteers.PendingSteers (cognitive 32) client/src/components/Chat/Messages/Content/Parts/PendingSteers.tsx:39— PendingSteers.PendingSteers has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 14, if/else 13 (14 pts), ternaries 3 (4 pts) (nesting depth added 2). Most of this is not in the body itself: 1 of the 32 points is its own statement and the rest belongs to 7 function items inside it that branch (a function literal at line 144, resolvePaused, queueSteer, …). 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.
outcome.getToolMeta (cognitive 32) client/src/components/Chat/Messages/Content/outcome.ts:101— outcome.getToolMeta has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 18, ternaries 4 (8 pts), if/else 6 (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.
ProgressText.ProgressText (cognitive 32) client/src/components/Chat/Messages/Content/ProgressText.tsx:62— ProgressText.ProgressText has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 11 (14 pts), boolean chains 12, if/else 6 (nesting depth added 3). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Reasoning.useComposerReasoning (cognitive 32) client/src/components/Chat/Input/Reasoning.tsx:265— Reasoning.useComposerReasoning has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 18, if/else 7, ternaries 6 (7 pts) (nesting depth added 1). Of this number, 16 points are the body's own statements and 16 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.
ChatGroupItem.ChatGroupItem (cognitive 32) client/src/components/Prompts/lists/ChatGroupItem.tsx:35— ChatGroupItem.ChatGroupItem has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 11, ternaries 4, error handling 1 (nesting depth added 1). Most of this is not in the body itself: 13 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 105, a function literal at line 80, a function literal at line 180, …). 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.
pattern.createLinearInspector (cognitive 32) packages/api/src/protection/detectors/pattern.ts:416— pattern.createLinearInspector has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 6 (8 pts), boolean chains 4, ternaries 3, error handling 1 (2 pts) (nesting depth added 9). Most of this is not in the body itself: 8 of the 32 points are its own statements and the rest belongs to 3 function items inside it that branch (locate, inspectFragment, a function literal at line 467). 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.
config.prepareEntryChange (cognitive 32) packages/api/src/admin/config.ts:2071— config.prepareEntryChange has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
roles.createAdminRolesHandlers.deleteRole (cognitive 32) packages/api/src/admin/roles.ts:829— roles.createAdminRolesHandlers.deleteRole has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 7, ternaries 4, error handling 3, loops 1 (nesting depth added 5). Of this number, 23 points are the body's own statements and 9 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.
host.resolveActivityLabelModel (cognitive 32) packages/api/src/agents/activityLabels/host.ts:282— host.resolveActivityLabelModel has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 8, error handling 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
json.cloneJsonValue (cognitive 32) packages/api/src/agents/json.ts:8— json.cloneJsonValue has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (25 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.
handlers.createOpenAIToolCallStream.onRunStepDelta (cognitive 32) packages/api/src/agents/openai/handlers.ts:555— handlers.createOpenAIToolCallStream.onRunStepDelta has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 7, 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.
validationFeedback.toolValidationFeedback (cognitive 32) packages/api/src/agents/validationFeedback.ts:7— validationFeedback.toolValidationFeedback has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 9, loops 2 (5 pts), ternaries 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.
handlers.buildToolCallConfig (cognitive 32) packages/api/src/agents/handlers.ts:5465— handlers.buildToolCallConfig has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 5, ternaries 1 (4 pts), loops 1 (3 pts) (nesting depth added 17). 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.
protection.assertResumeToolContentAllowed (cognitive 32) packages/api/src/agents/hitl/protection.ts:393— protection.assertResumeToolContentAllowed has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 12, if/else 9 (12 pts), ternaries 3 (5 pts), loops 2, error handling 1 (nesting depth added 5). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
subagentThreads.serializeTranscript (cognitive 32) packages/api/src/agents/subagentThreads.ts:479— subagentThreads.serializeTranscript has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 5, loops 2 (4 pts), ternaries 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.
runtime.createReasoningLabelWiring.startStep (cognitive 32) packages/api/src/agents/reasoningLabels/runtime.ts:538— runtime.createReasoningLabelWiring.startStep has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 17, if/else 7 (8 pts), ternaries 7 (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.
delete.createCodeFileDeleter (cognitive 32) packages/api/src/files/code/delete.ts:16— delete.createCodeFileDeleter has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (18 pts), error handling 3 (7 pts), boolean chains 3, ternaries 2 (3 pts), loops 1 (nesting depth added 16). None of this is in the body itself: all 32 points belong to one function literal inside it that branches (line 47). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
handler.createConversationPullRequestsHandler (cognitive 32) packages/api/src/pulls/handler.ts:455— handler.createConversationPullRequestsHandler has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (16 pts), ternaries 6 (8 pts), boolean chains 5, loops 2, error handling 1 (nesting depth added 4). None of this is in the body itself: all 32 points belong to 5 function literals inside it that branch (lines 468, 489, 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.
service.createSchedulesService.quiesceUserSchedules (cognitive 32) packages/api/src/schedules/service.ts:2310— service.createSchedulesService.quiesceUserSchedules has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 10, ternaries 3 (7 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.
github.syncSource::syncPreparedSkill (cognitive 32) packages/api/src/skills/sync/github.ts:1898— github.syncSource::syncPreparedSkill has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 3 (6 pts), boolean chains 4, error handling 2 (3 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (github.syncSource) 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.
RedisEventTransport.subscribeReplayable (cognitive 32) packages/api/src/stream/implementations/RedisEventTransport.ts:1283— RedisEventTransport.subscribeReplayable has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 6, loops 4 (5 pts) (nesting depth added 4). None of this is in the body itself: all 32 points belong to 4 function items inside it that branch (a function literal at line 1329, deliver, unsubscribe, …). 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.
RedisJobStore.cleanup (cognitive 32) packages/api/src/stream/implementations/RedisJobStore.ts:3679— RedisJobStore.cleanup has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 4, loops 3 (4 pts), ternaries 1 (3 pts) (nesting depth added 14). Most of this is not in the body itself: 11 of the 32 points are its own statements and the rest belongs to one function literal inside it that branches (line 3696). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
RedisJobStore.getJobIdsByUser (cognitive 32) packages/api/src/stream/implementations/RedisJobStore.ts:3966— RedisJobStore.getJobIdsByUser has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 17, if/else 7 (14 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.
upload.readEventStream (cognitive 32) packages/data-provider/src/upload.ts:115— upload.readEventStream has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 2 (3 pts), boolean chains 1, 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.
skill.validateSkillFrontmatter (cognitive 32) packages/data-schemas/src/methods/skill.ts:432— skill.validateSkillFrontmatter has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (26 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.
skill.extractAlwaysApplyFromBody (cognitive 32) packages/data-schemas/src/methods/skill.ts:869— skill.extractAlwaysApplyFromBody has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 6, 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.
recordActivityLabelUsage (cognitive 32) api/server/controllers/agents/client.js:1135— recordActivityLabelUsage has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 5 (8 pts), boolean chains 7, error handling 3 (6 pts), if/else 4 (5 pts), other 5, loops 1 (nesting depth added 7). Of this number, 28 points are the body's own statements and 4 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.
extractResponseRequestContent (cognitive 32) api/server/controllers/agents/responses.js:260— extractResponseRequestContent has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 3 (6 pts), boolean chains 3, error handling 2 (3 pts), other 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.
importLibreChatConvo (cognitive 32) api/server/utils/import/importers.js:297— importLibreChatConvo has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 7, loops 2 (4 pts), other 2, error handling 1 (nesting depth added 10). Of this number, 18 points are the body's own statements and 14 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.
useAttachmentHandler.useAttachmentHandler (cognitive 31) client/src/hooks/SSE/useAttachmentHandler.ts:33— useAttachmentHandler.useAttachmentHandler has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 9 (nesting depth added 9). None of this is in the body itself: all 31 points belong to 5 function literals inside it that branch (lines 91, 36, 123, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
BackgroundTaskCall.BackgroundTaskCall (cognitive 31) client/src/components/Chat/Messages/Content/Parts/BackgroundTaskCall.tsx:21— BackgroundTaskCall.BackgroundTaskCall has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 21, if/else 7, ternaries 2, error handling 1. Of this number, 28 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.
preview.buildActivityIndex (cognitive 31) client/src/components/Chat/Trace/preview.ts:422— preview.buildActivityIndex has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 3 (6 pts), boolean chains 5, loops 4 (5 pts) (nesting depth added 12). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Timeline.Timeline (cognitive 31) client/src/components/Chat/Trace/Timeline.tsx:38— Timeline.Timeline has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13, boolean chains 11, ternaries 6 (7 pts) (nesting depth added 1). Most of this is not in the body itself: 2 of the 31 points are its own statements and the rest belongs to 11 function items inside it that branch (handleKeyDown, handlePointerMove, a function literal at line 81, …). 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.
ProjectEditor.ProjectEditor (cognitive 31) client/src/components/Projects/ProjectEditor.tsx:35— ProjectEditor.ProjectEditor has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 16, if/else 8 (9 pts), boolean chains 6 (nesting depth added 1). 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: 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.
ModelPanel.ModelPanel (cognitive 31) client/src/components/SidePanel/Agents/ModelPanel.tsx:35— ModelPanel.ModelPanel has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 16, ternaries 9, if/else 6. Most of this is not in the body itself: 10 of the 31 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 179, 248, 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.
AssistantSelect.AssistantSelect (cognitive 31) client/src/components/SidePanel/Builder/AssistantSelect.tsx:37— AssistantSelect.AssistantSelect has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 10, ternaries 3 (nesting depth added 1). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to 11 function literals inside it that branch (lines 67, 193, 138, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.MCPServerDialog (cognitive 31) client/src/components/SidePanel/MCPBuilder/MCPServerDialog/index.tsx:39— index.MCPServerDialog has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 13 (16 pts), boolean chains 9, if/else 6 (nesting depth added 3). Of this number, 25 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
retention.retainMessages (cognitive 31) client/src/data-provider/Messages/retention.ts:130— retention.retainMessages has cognitive complexity 31 (threshold 15). Drivers by points: if/else 19 (22 pts), boolean chains 9 (nesting depth added 3). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to 7 function items inside it that branch (a function literal at line 236, a function literal at line 202, a function literal at line 145, …). 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.
config.createAdminConfigHandlers.tombstoneConfigField (cognitive 31) packages/api/src/admin/config.ts:4084— config.createAdminConfigHandlers.tombstoneConfigField has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17, boolean chains 7, ternaries 5, error handling 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
roles.createAdminRolesHandlers.updateRole (cognitive 31) packages/api/src/admin/roles.ts:670— roles.createAdminRolesHandlers.updateRole has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 6, ternaries 2 (4 pts), 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.
runtime.restoreLegacyOverflowAnchors (cognitive 31) packages/api/src/agents/activityPhases/runtime.ts:691— runtime.restoreLegacyOverflowAnchors has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 11, if/else 8 (10 pts), ternaries 7 (8 pts), loops 2 (nesting depth added 3). Of this number, 20 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.
attachments.collectAgentAttachmentStats (cognitive 31) packages/api/src/agents/attachments.ts:241— attachments.collectAgentAttachmentStats has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 10, ternaries 3 (6 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.
InMemoryJobStore.appendChunk (cognitive 31) packages/api/src/stream/implementations/InMemoryJobStore.ts:1757— InMemoryJobStore.appendChunk has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 8 (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.
context.resolveChatProjectContext (cognitive 31) packages/api/src/projects/context.ts:178— context.resolveChatProjectContext has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 13, if/else 9 (11 pts), ternaries 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.
bridge.createCodeBridgeStatusPoller (cognitive 31) packages/api/src/code/bridge.ts:102— bridge.createCodeBridgeStatusPoller has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 2, error handling 2, loops 1 (2 pts), ternaries 1 (nesting depth added 9). None of this is in the body itself: all 31 points belong to 6 function items inside it that branch (a function literal at line 183, remember, observe, …). 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.
modelBoundContent.getSelectedRawStoredMessageFileIds (cognitive 31) packages/api/src/middleware/modelBoundContent.ts:2453— modelBoundContent.getSelectedRawStoredMessageFileIds has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 2 (4 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
service.convertInputToMessages (cognitive 31) packages/api/src/agents/responses/service.ts:298— service.convertInputToMessages has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (28 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.
MCPOAuthHandler.createOAuthFetch (cognitive 31) packages/api/src/mcp/oauth/handler.ts:73— MCPOAuthHandler.createOAuthFetch has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (28 pts), boolean chains 2, loops 1 (nesting depth added 16). None of this is in the body itself: all 31 points belong to one function literal inside it that branches (line 82). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
zod.dropSchemaFields (cognitive 31) packages/api/src/mcp/zod.ts:14— zod.dropSchemaFields has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 5, loops 2 (5 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.
timing.applyRunStepDelta (cognitive 31) packages/chat/src/core/stream/timing.ts:65— timing.applyRunStepDelta has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 2 (8 pts), boolean chains 5, 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.
rows.useQueueRows (cognitive 31) packages/chat/src/react/steering/rows.ts:35— rows.useQueueRows has cognitive complexity 31 (threshold 15). Drivers by points: if/else 20 (22 pts), boolean chains 3, loops 3, ternaries 3 (nesting depth added 2). Most of this is not in the body itself: 2 of the 31 points are its own statements and the rest belongs to 16 function literals inside it that branch (lines 60, 210, 233, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
parsers.debugTraverse (cognitive 31) packages/data-schemas/src/config/parsers.ts:777— parsers.debugTraverse has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14, boolean chains 8, ternaries 5 (7 pts), error handling 2 (nesting depth added 2). Of this number, 17 points are the body's own statements and 14 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.
auditLog.createAuditLogMethods.verifyAuditChain (cognitive 31) packages/data-schemas/src/methods/auditLog.ts:531— auditLog.createAuditLogMethods.verifyAuditChain has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 4 (11 pts), boolean chains 2, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
createToolInstance::_call (cognitive 31) api/server/services/MCP.js:1331— createToolInstance::_call has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 10, other 5, ternaries 3 (4 pts), 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.
useReplyAlerts.useReplyAlerts (cognitive 30) client/src/hooks/Conversations/useReplyAlerts.ts:213— useReplyAlerts.useReplyAlerts has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 8, loops 3 (5 pts), error handling 1 (2 pts), ternaries 1 (nesting depth added 4). None of this is in the body itself: all 30 points belong to 7 function literals inside it that branch (lines 281, 262, 321, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useDebouncedMermaid.useDebouncedMermaid (cognitive 30) client/src/hooks/Mermaid/useDebouncedMermaid.ts:88— useDebouncedMermaid.useDebouncedMermaid has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 9, ternaries 5 (7 pts) (nesting depth added 5). Most of this is not in the body itself: 10 of the 30 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 131, 185, 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.
SharedLinkButton.SharedLinkButton (cognitive 30) client/src/components/Conversations/ConvoOptions/SharedLinkButton.tsx:75— SharedLinkButton.SharedLinkButton has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 16, if/else 7 (8 pts), error handling 4, ternaries 2 (nesting depth added 1). Of this number, 16 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.
BackupCodesItem.BackupCodesItem (cognitive 30) client/src/components/Nav/SettingsTabs/Account/BackupCodesItem.tsx:33— BackupCodesItem.BackupCodesItem has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 10 (20 pts), boolean chains 8, if/else 2 (nesting depth added 10). Most of this is not in the body itself: 11 of the 30 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 123, fetchBackupCodes, a function literal at line 54). 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.
PromptName.PromptName (cognitive 30) client/src/components/Prompts/fields/PromptName.tsx:17— PromptName.PromptName has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 10, ternaries 4 (5 pts) (nesting depth added 4). Most of this is not in the body itself: 7 of the 30 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 82, 58, 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.
messages.preserveStreamedContentIdentity (cognitive 30) client/src/utils/messages.ts:297— messages.preserveStreamedContentIdentity has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
memory.processMemory (cognitive 30) packages/api/src/agents/memory.ts:756— memory.processMemory has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 3 (7 pts), boolean chains 6, 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.
skills.resolveAlwaysApplySkills (cognitive 30) packages/api/src/agents/skills.ts:1230— skills.resolveAlwaysApplySkills has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 4, loops 2 (3 pts), 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.
workspace.toLinkedWorktreeRequest (cognitive 30) packages/api/src/code/workspace.ts:1193— workspace.toLinkedWorktreeRequest has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 5 (10 pts), boolean chains 4, 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.
matching.applyTextEdits (cognitive 30) REDACTED:385— matching.applyTextEdits has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (23 pts), ternaries 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
handlers.handleSandboxFileFallback (cognitive 30) packages/api/src/agents/handlers.ts:2224— handlers.handleSandboxFileFallback has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 6, ternaries 4 (6 pts), 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.
handlers.handleWorkspaceSearchCall (cognitive 30) packages/api/src/agents/handlers.ts:2454— handlers.handleWorkspaceSearchCall has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 10 (12 pts), if/else 7 (10 pts), boolean chains 6, error handling 1, 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.
SubagentThreadTaskStore.destroyTaskControlTransport (cognitive 30) packages/api/src/agents/subagentThreads.ts:1246— SubagentThreadTaskStore.destroyTaskControlTransport has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 4 (7 pts), boolean chains 3, 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.
runtime.drainAndBuildInjections (cognitive 30) packages/api/src/agents/steering/runtime.ts:102— runtime.drainAndBuildInjections has cognitive complexity 30 (threshold 15). Drivers by points: error handling 5 (12 pts), if/else 6 (9 pts), loops 4 (6 pts), ternaries 1 (2 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.
service.createAppConfigService.getAppConfig (cognitive 30) packages/api/src/app/service.ts:969— service.createAppConfigService.getAppConfig has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 9, error handling 2, ternaries 2 (nesting depth added 4). Of this number, 25 points are the body's own statements and 5 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.
credentials.writeCredentialFile (cognitive 30) packages/api/src/credentials.ts:168— credentials.writeCredentialFile has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 6 (12 pts), ternaries 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reasoning.readCatalog (cognitive 30) packages/api/src/endpoints/reasoning.ts:165— reasoning.readCatalog has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 3 (5 pts), ternaries 1 (3 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.
image.readWindowedSandboxImage (cognitive 30) packages/api/src/files/code/image.ts:269— image.readWindowedSandboxImage has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 4, 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.
mcp.createScheduleMCPPreflight::runPreflight (cognitive 30) packages/api/src/schedules/mcp.ts:202— mcp.createScheduleMCPPreflight::runPreflight has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 3 (6 pts), boolean chains 3, loops 2, 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.
handlers.createTraceHandlers (cognitive 30) packages/api/src/traces/handlers.ts:128— handlers.createTraceHandlers has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 9, error handling 3, ternaries 2 (nesting depth added 1). None of this is in the body itself: all 30 points belong to 7 function items inside it that branch (handleFailure, record, prepareScope, …). 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.
RedisJobStore.cleanupRequiresActionIndex (cognitive 30) packages/api/src/stream/implementations/RedisJobStore.ts:3771— RedisJobStore.cleanupRequiresActionIndex has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 15). Most of this is not in the body itself: 7 of the 30 points are its own statements and the rest belongs to one function literal inside it that branches (line 3780). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
branch.sumBranch (cognitive 30) packages/chat/src/core/usage/branch.ts:14— branch.sumBranch has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 7, ternaries 4 (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.
receipts.useQueuedTurnReceipts (cognitive 30) packages/chat/src/react/steering/receipts.ts:30— receipts.useQueuedTurnReceipts has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 14, if/else 10 (11 pts), ternaries 4, loops 1 (nesting depth added 1). None of this is in the body itself: all 30 points belong to 10 function literals inside it that branch (lines 103, 62, 69, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
DataTable.DataTable (cognitive 30) packages/client/src/components/DataTable.tsx:224— DataTable.DataTable has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 14, ternaries 8, if/else 6, error handling 1 (2 pts) (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 8 function literals inside it that branch (lines 332, 360, 254, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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-config.buildMimeAccept (cognitive 30) packages/data-provider/src/file-config.ts:929— file-config.buildMimeAccept has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 4 (5 pts), ternaries 2, boolean chains 1 (nesting depth added 13). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
share.createShareMethods.updateSharedLink (cognitive 30) packages/data-schemas/src/methods/share.ts:1438— share.createShareMethods.updateSharedLink has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 8 (12 pts), if/else 7 (9 pts), boolean chains 7, error handling 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.
triggerDelivery.toRecord (cognitive 30) packages/data-schemas/src/methods/triggerDelivery.ts:593— triggerDelivery.toRecord has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 26, 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.
handle (cognitive 30) api/server/controllers/agents/callbacks.js:132— handle has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 6, error handling 2 (3 pts), loops 1 (2 pts), other 2, ternaries 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.
OpenWeather._call (cognitive 29) api/app/clients/tools/structured/OpenWeather.js:167— OpenWeather._call has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 5, error handling 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tools.loadAndFormatTools (cognitive 29) api/server/services/start/tools.js:32— tools.loadAndFormatTools has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 8, error handling 2 (4 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.
fork.getMessagesUpToTargetLevel (cognitive 29) api/server/utils/import/fork.js:185— fork.getMessagesUpToTargetLevel has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (7 pts), boolean chains 5, ternaries 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.
REDACTED.findDocumentInjectionPoint (cognitive 29) REDACTED:358— REDACTED.findDocumentInjectionPoint has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useMCPSelect.useMCPSelect (cognitive 29) client/src/hooks/MCP/useMCPSelect.ts:15— useMCPSelect.useMCPSelect has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 9, ternaries 2 (3 pts) (nesting depth added 5). Most of this is not in the body itself: 3 of the 29 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 142, 95, 123, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useMessageScrolling.useMessageScrolling (cognitive 29) client/src/hooks/Messages/useMessageScrolling.ts:28— useMessageScrolling.useMessageScrolling has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (19 pts), boolean chains 10 (nesting depth added 1). None of this is in the body itself: all 29 points belong to 8 function literals inside it that branch (lines 372, 432, 290, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
abort.useAbortHandlers.abortConversation (cognitive 29) client/src/hooks/SSE/abort.ts:119— abort.useAbortHandlers.abortConversation has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, error handling 2 (3 pts), loops 1 (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.
LogContent.LogContent (cognitive 29) client/src/components/Chat/Messages/Content/Parts/LogContent.tsx:40— LogContent.LogContent has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 13, if/else 10 (12 pts), ternaries 4 (nesting depth added 2). Most of this is not in the body itself: 7 of the 29 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 67, renderAttachment, a function literal at line 44, …). 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.
BackgroundTaskCard.BackgroundTaskCard (cognitive 29) client/src/components/Chat/Messages/Content/BackgroundTaskCard.tsx:33— BackgroundTaskCard.BackgroundTaskCard has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 19, ternaries 6, if/else 4. Of this number, 27 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.
recovery.recoverTaskContent (cognitive 29) client/src/components/Chat/Subagents/recovery.ts:245— recovery.recoverTaskContent has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (nesting depth added 12). Of this number, 25 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.
ShareView.SharedView (cognitive 29) client/src/components/Share/ShareView.tsx:49— ShareView.SharedView has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 12, if/else 12, ternaries 5. 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, 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.
ConversationsSection.ConversationsSection (cognitive 29) client/src/components/UnifiedSidebar/ConversationsSection.tsx:40— ConversationsSection.ConversationsSection has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 18, ternaries 6, if/else 5. Of this number, 20 points are the body's own statements and 9 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.
Citation.CompositeCitation (cognitive 29) client/src/components/Web/Citation.tsx:61— Citation.CompositeCitation has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 21, if/else 5, ternaries 3. Of this number, 19 points are the body's own statements and 10 belong to 7 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.
submissions.getModelParameterWrapperFields (cognitive 29) packages/api/src/protection/adapters/submissions.ts:389— submissions.getModelParameterWrapperFields has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 5, loops 2 (3 pts), ternaries 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.
GenerationJobManagerClass.publishTerminalClaim (cognitive 29) packages/api/src/stream/GenerationJobManager.ts:4197— GenerationJobManagerClass.publishTerminalClaim has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 7, error handling 3 (5 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
GenerationJobManagerClass.attachSubscription::deliverStoredTerminal (cognitive 29) packages/api/src/stream/GenerationJobManager.ts:5678— GenerationJobManagerClass.attachSubscription::deliverStoredTerminal has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 6, 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. This shape REPEATS in the file: one other method here (GenerationJobManagerClass.attachSubscription) 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.
tools.registerCodeExecutionTools (cognitive 29) packages/api/src/agents/tools.ts:1218— tools.registerCodeExecutionTools has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 8, 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.
skills.injectSkillCatalog (cognitive 29) packages/api/src/agents/skills.ts:670— skills.injectSkillCatalog has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (6 pts), ternaries 2 (5 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.
initialize.assertResolvedSkillContentAllowed (cognitive 29) packages/api/src/agents/initialize.ts:227— initialize.assertResolvedSkillContentAllowed has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 13, if/else 7 (12 pts), error handling 1 (2 pts), loops 1, ternaries 1 (nesting depth added 6). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
encode.createRunFileMessageEncoder.encode (cognitive 29) packages/api/src/agents/files/encode.ts:138— encode.createRunFileMessageEncoder.encode has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 8, ternaries 2, loops 1 (nesting depth added 6). 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, split the body into named stages: move each independent 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.shapeSummarizationConfig (cognitive 29) packages/api/src/agents/run.ts:1349— run.shapeSummarizationConfig has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 17, ternaries 10 (11 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.
handlers.formatReadFileText (cognitive 29) packages/api/src/agents/handlers.ts:1094— handlers.formatReadFileText has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
handlers.handleSkillToolCall (cognitive 29) packages/api/src/agents/handlers.ts:5195— handlers.handleSkillToolCall has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 4 (9 pts), error handling 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.
inspection.getResumeStoredBranch (cognitive 29) packages/api/src/agents/hitl/inspection.ts:263— inspection.getResumeStoredBranch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 7, ternaries 2 (3 pts), loops 2, 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.
SubagentThreadTaskStore.start (cognitive 29) packages/api/src/agents/subagentThreads.ts:1591— SubagentThreadTaskStore.start has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 12, error handling 1, ternaries 1 (nesting depth added 5). Of this number, 26 points are the body's own statements and 3 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.
discovery.discoverConnectedAgents (cognitive 29) packages/api/src/agents/discovery.ts:427— discovery.discoverConnectedAgents has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (18 pts), error handling 2 (5 pts), loops 3 (4 pts), boolean chains 1, ternaries 1 (nesting depth added 13). Of this number, 25 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.
executor.normalizeOutput (cognitive 29) packages/api/src/agents/hooks/executor.ts:521— executor.normalizeOutput has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 7, 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.
bindingResolver.createAgentEventContinueResolver (cognitive 29) packages/api/src/agents/triggers/bindingResolver.ts:41— bindingResolver.createAgentEventContinueResolver has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 5 (11 pts), boolean chains 7, if/else 5 (6 pts), error handling 4 (5 pts) (nesting depth added 8). None of this is in the body itself: all 29 points belong to one function literal inside it that branches (line 45). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
domain.isDomainAllowedCore (cognitive 29) packages/api/src/auth/domain.ts:298— domain.isDomainAllowedCore has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (23 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.
credentials.bootstrapCredentials (cognitive 29) packages/api/src/credentials.ts:276— credentials.bootstrapCredentials has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 3, ternaries 1 (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.
audio.encodeAndFormatAudios (cognitive 29) packages/api/src/files/encode/audio.ts:25— audio.encodeAndFormatAudios has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (23 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.
zod.convertToZodUnion (cognitive 29) packages/api/src/mcp/zod.ts:66— zod.convertToZodUnion has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 9 (nesting depth added 6). Most of this is not in the body itself: 5 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 76). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
key.loadServiceKey (cognitive 29) packages/api/src/utils/key.ts:26— key.loadServiceKey has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 5 (10 pts), boolean chains 4, ternaries 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.syncSkillFiles (cognitive 29) packages/api/src/skills/sync/github.ts:1438— github.syncSkillFiles has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 5, ternaries 2 (4 pts), loops 2 (nesting depth added 11). Of this number, 22 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.
useQueuedTurnReveal.useQueuedTurnReveal (cognitive 29) packages/chat/src/react/steering/useQueuedTurnReveal.ts:53— useQueuedTurnReveal.useQueuedTurnReveal has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 17, if/else 9 (11 pts), loops 1 (nesting depth added 2). None of this is in the body itself: all 29 points belong to 4 function literals inside it that branch (lines 64, 111, 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.
Dropdown.Dropdown (cognitive 29) packages/client/src/components/Dropdown.tsx:65— Dropdown.Dropdown has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 13, ternaries 8 (9 pts), if/else 5 (7 pts) (nesting depth added 3). Of this number, 16 points are the body's own statements and 13 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.
actions.validateActionDomain (cognitive 29) packages/data-provider/src/actions.ts:713— actions.validateActionDomain has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 6, ternaries 3 (6 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.
stripUIResourceMarkers.sanitizeUIResourceContent (cognitive 29) packages/data-schemas/src/utils/stripUIResourceMarkers.ts:519— stripUIResourceMarkers.sanitizeUIResourceContent has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 4, loops 1 (nesting depth added 13). Of this number, 23 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.
conversation.createConversationMethods.bulkSaveConvos (cognitive 29) packages/data-schemas/src/methods/conversation.ts:3382— conversation.createConversationMethods.bulkSaveConvos has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 7, loops 3 (5 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 8). Most of this is not in the body itself: 14 of the 29 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 3448, 3430). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
queuedTurn.toRecord (cognitive 29) packages/data-schemas/src/methods/queuedTurn.ts:607— queuedTurn.toRecord has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 28, 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.
design.disabledExpressions (cognitive 29) scripts/eslint/design.mjs:730— design.disabledExpressions has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 3 (7 pts), boolean chains 6, loops 1 (nesting depth added 12). 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.
processAttachments (cognitive 29) api/app/clients/BaseClient.js:1829— processAttachments has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 5, ternaries 4, loops 2, other 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.
REDACTED.window.addEventListener("message") (cognitive 28) REDACTED:162— REDACTED.window.addEventListener("message") has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 7, 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.
RetrievalCall.extractFileSources (cognitive 28) client/src/components/Chat/Messages/Content/RetrievalCall.tsx:30— RetrievalCall.extractFileSources has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 11, 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.
adapters.standardContent (cognitive 28) client/src/components/Chat/Subagents/adapters.ts:314— adapters.standardContent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 2, loops 1 (nesting depth added 14). 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.
ActionsInput.ActionsInput (cognitive 28) client/src/components/SidePanel/Agents/ActionsInput.tsx:46— ActionsInput.ActionsInput has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15, boolean chains 12, ternaries 1. Most of this is not in the body itself: 10 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 131, getButtonContent, a function literal at line 89, …). 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.processTree (cognitive 28) client/src/components/Web/plugin.ts:99— plugin.processTree has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 13). None of this is in the body itself: all 28 points belong 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.
createChatSearchParams.createChatSearchParams (cognitive 28) client/src/utils/createChatSearchParams.ts:64— createChatSearchParams.createChatSearchParams has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 8, ternaries 1 (3 pts) (nesting depth added 4). Of this number, 14 points are the body's own statements and 14 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.
groups.createAdminGroupsHandlers.createGroup (cognitive 28) packages/api/src/admin/groups.ts:200— groups.createAdminGroupsHandlers.createGroup has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 9, loops 2 (3 pts), ternaries 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.
runtime.createActivityPhaseWiring.partitionAt (cognitive 28) packages/api/src/agents/activityPhases/runtime.ts:1171— runtime.createActivityPhaseWiring.partitionAt has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 4 (8 pts), boolean chains 5, loops 3 (nesting depth added 10). Of this number, 21 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.
GenerationJobManagerClass.takeoverGeneration (cognitive 28) packages/api/src/stream/GenerationJobManager.ts:3700— GenerationJobManagerClass.takeoverGeneration has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 5 (9 pts), error handling 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.
modelBoundContent.getLegacyProviderLineage (cognitive 28) packages/api/src/middleware/modelBoundContent.ts:1242— modelBoundContent.getLegacyProviderLineage has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 1 (4 pts), error handling 1 (3 pts) (nesting depth added 16). 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, 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.
modelBoundContent.createInitialModelBoundAdmissionCallback (cognitive 28) packages/api/src/middleware/modelBoundContent.ts:3356— modelBoundContent.createInitialModelBoundAdmissionCallback has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 9, loops 2, ternaries 1 (nesting depth added 2). None of this is in the body itself: all 28 points belong to 8 function items inside it that branch (a function literal at line 3450, a function literal at line 3419, findAgentNodeRun, …). 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.
storage.ownedCheckpointReferences (cognitive 28) packages/api/src/agents/checkpoints/storage.ts:48— storage.ownedCheckpointReferences has cognitive complexity 28 (threshold 15). Drivers by points: loops 5 (11 pts), ternaries 3 (8 pts), if/else 3 (6 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.
service.validateResponseRequest (cognitive 28) packages/api/src/agents/responses/service.ts:85— service.validateResponseRequest has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 10 (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.
deletion.createCheckpointDeletionReclaimer (cognitive 28) packages/api/src/agents/checkpoints/deletion.ts:226— deletion.createCheckpointDeletionReclaimer has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 6 (10 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 8). None of this is in the body itself: all 28 points belong to 5 function literals inside it that branch (lines 292, 230, 245, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.mergeAgentOcrConversion (cognitive 28) packages/api/src/agents/legacy.ts:59— legacy.mergeAgentOcrConversion has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 9 (nesting depth added 8). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
domain.isOAuthUrlAllowed (cognitive 28) packages/api/src/auth/domain.ts:462— domain.isOAuthUrlAllowed has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 3, 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.
capabilities.resolveCodeExecutionWorkspaceContext (cognitive 28) packages/api/src/code/capabilities.ts:103— capabilities.resolveCodeExecutionWorkspaceContext has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 8 (9 pts), boolean chains 7, 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.
FlowStateManager.acquireLease (cognitive 28) packages/api/src/flow/manager.ts:270— FlowStateManager.acquireLease has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 13). Of this number, 22 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.
MCPOAuthHandler.completeOAuthFlow (cognitive 28) packages/api/src/mcp/oauth/handler.ts:1261— MCPOAuthHandler.completeOAuthFlow has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 5 (7 pts), boolean chains 6, error handling 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.
MCPServerCatalogRecoveryTracker.run (cognitive 28) packages/api/src/mcp/catalog/recovery.ts:530— MCPServerCatalogRecoveryTracker.run has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 10, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 12 of the 28 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 613, trackPublication, a function literal at line 652). 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.
recovery.recoverMCPServerCatalogsWithState (cognitive 28) packages/api/src/mcp/catalog/recovery.ts:857— recovery.recoverMCPServerCatalogsWithState has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 10, loops 2, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 13 of the 28 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 943, 875, 892). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
submission.getPrivateTextInspectionTokens (cognitive 28) packages/api/src/protection/private/submission.ts:297— submission.getPrivateTextInspectionTokens has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (21 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.
erasure.settleStrandedRuns (cognitive 28) packages/api/src/schedules/erasure.ts:303— erasure.settleStrandedRuns has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 4, 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.
github.discoverSkills (cognitive 28) packages/api/src/skills/sync/github.ts:672— github.discoverSkills has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (4 pts), ternaries 3 (4 pts), boolean chains 2 (nesting depth added 11). Most of this is not in the body itself: 10 of the 28 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 697, 699). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RedisEventTransport.handleMessage (cognitive 28) packages/api/src/stream/implementations/RedisEventTransport.ts:895— RedisEventTransport.handleMessage has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 7, error handling 2 (4 pts), 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
outcomes.resolvePredecessorMismatch (cognitive 28) packages/chat/src/core/resumable/outcomes.ts:17— outcomes.resolvePredecessorMismatch has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (23 pts), error handling 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.
send.useQueuedSend (cognitive 28) packages/chat/src/react/steering/send.ts:22— send.useQueuedSend has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 7, error handling 1 (2 pts) (nesting depth added 5). None of this is in the body itself: all 28 points belong to 4 function literals inside it that branch (lines 82, 186, 130, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
resolution.getConfigOverrideIssues (cognitive 28) packages/data-schemas/src/app/resolution.ts:1144— resolution.getConfigOverrideIssues has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (6 pts), boolean chains 4, ternaries 2 (3 pts) (nesting depth added 10). Of this number, 22 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.
stripUIResourceMarkers.collectCitationTokens (cognitive 28) packages/data-schemas/src/utils/stripUIResourceMarkers.ts:45— stripUIResourceMarkers.collectCitationTokens has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (22 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.
message.findOneAndMergeMessageProvenance (cognitive 28) packages/data-schemas/src/methods/message.ts:337— message.findOneAndMergeMessageProvenance has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 10, ternaries 4 (8 pts), if/else 3 (7 pts), 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.
message.createMessageMethods.bulkSaveMessages (cognitive 28) packages/data-schemas/src/methods/message.ts:1386— message.createMessageMethods.bulkSaveMessages has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (15 pts), loops 3 (5 pts), boolean chains 4, error handling 2 (3 pts), ternaries 1 (nesting depth added 6). Of this number, 14 points are the body's own statements and 14 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.
transaction.createTransactionMethods.reserveBalance (cognitive 28) packages/data-schemas/src/methods/transaction.ts:482— transaction.createTransactionMethods.reserveBalance has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 8, 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.
mcpAuthority.prepareTargets (cognitive 28) packages/data-schemas/src/methods/mcpAuthority.ts:474— mcpAuthority.prepareTargets has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 12 (nesting depth added 1). 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 486). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
GeminiImageGen.convertImagesToInlineData (cognitive 27) api/app/clients/tools/structured/GeminiImageGen.js:132— GeminiImageGen.convertImagesToInlineData has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (6 pts), boolean chains 4, 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.
auth.router.post("/oauth/refresh") (cognitive 27) REDACTED:630— auth.router.post("/oauth/refresh") has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 7, error handling 5 (6 pts), ternaries 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.
index.router.get("/chat/status/:conversationId") (cognitive 27) api/server/routes/agents/index.js:475— index.router.get("/chat/status/:conversationId") has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 8, 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.
files.router.delete("/") (cognitive 27) REDACTED:189— files.router.delete("/") has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 5, error handling 1, loops 1 (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.
importers.importClaudeConvo (cognitive 27) api/server/utils/import/importers.js:205— importers.importClaudeConvo has cognitive complexity 27 (threshold 15). Drivers by points: if/else 3 (9 pts), ternaries 3 (8 pts), boolean chains 6, 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.
useFileHandling.useFileHandlingCore (cognitive 27) client/src/hooks/Files/useFileHandling.ts:199— useFileHandling.useFileHandlingCore has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (17 pts), ternaries 4, boolean chains 3, loops 2 (3 pts) (nesting depth added 4). Most of this is not in the body itself: 9 of the 27 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 422, 235, 354, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useFileHandling.useFileHandlingCore.startUpload (cognitive 27) client/src/hooks/Files/useFileHandling.ts:551— useFileHandling.useFileHandlingCore.startUpload has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Search.Search (cognitive 27) client/src/routes/Search.tsx:84— Search.Search has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 12, ternaries 1 (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 9 function literals inside it that branch (lines 222, 278, 193, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
FileAuthoringCall.FileAuthoringCall (cognitive 27) client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx:103— FileAuthoringCall.FileAuthoringCall has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 17, if/else 5, ternaries 5. 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
model.flattenRows (cognitive 27) client/src/components/Chat/Trace/model.ts:945— model.flattenRows has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (10 pts), if/else 6 (8 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 5). Most of this is not in the body itself: 3 of the 27 points are its own statements and the rest belongs to 6 function items inside it that branch (pushRecords, a function literal at line 1005, a function literal at line 1023, …). 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.
ServerInitializationSection.ServerInitializationSection (cognitive 27) client/src/components/MCP/ServerInitializationSection.tsx:17— ServerInitializationSection.ServerInitializationSection has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 13, if/else 7 (8 pts), ternaries 4 (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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ToolCard.ToolCardImpl (cognitive 27) client/src/components/SidePanel/Agents/Tools/ToolCard.tsx:85— ToolCard.ToolCardImpl has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 19, ternaries 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.
CreateSkillDialog.CreateSkillDialog (cognitive 27) client/src/components/Skills/dialogs/CreateSkillDialog.tsx:52— CreateSkillDialog.CreateSkillDialog has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 12, if/else 11, ternaries 4. Most of this is not in the body itself: 7 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 94, a function literal at line 85, 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.
mutations.useDeleteConversationMutation (cognitive 27) client/src/data-provider/mutations.ts:1365— mutations.useDeleteConversationMutation has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 4 (8 pts), boolean chains 2, ternaries 1 (nesting depth added 12). None of this is in the body itself: all 27 points belong to 2 function literals inside it that branch (lines 1388, 1452). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useAskAnswerMode.useAskAnswerMode (cognitive 27) client/src/hooks/Input/useAskAnswerMode.ts:43— useAskAnswerMode.useAskAnswerMode has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 16, ternaries 7, if/else 4. Of this number, 16 points are the body's own statements and 11 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.
timestamps.cleanupTimestampedStorage (cognitive 27) client/src/utils/timestamps.ts:70— timestamps.cleanupTimestampedStorage has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 4, error handling 2 (4 pts), loops 1 (nesting depth added 12). 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.
audit.runAuditedPermissionUpdate (cognitive 27) packages/api/src/acl/audit.ts:220— audit.runAuditedPermissionUpdate has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 5 (8 pts), boolean chains 3, loops 3, ternaries 3 (nesting depth added 9). Most of this is not in the body itself: 4 of the 27 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 275, recordFailures, flushDeferred). 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.
submissions.extractModelParameterContent::visit (cognitive 27) packages/api/src/protection/adapters/submissions.ts:463— submissions.extractModelParameterContent::visit has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 6, 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.
roles.createAdminRolesHandlers.addRoleMember (cognitive 27) packages/api/src/admin/roles.ts:1090— roles.createAdminRolesHandlers.addRoleMember has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 4, error handling 2 (4 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
workspace.readBoundedJson (cognitive 27) packages/api/src/code/workspace.ts:773— workspace.readBoundedJson has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 8, error handling 1, loops 1 (nesting depth added 8). Of this number, 22 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.
run.buildSubagentConfigs (cognitive 27) packages/api/src/agents/run.ts:1911— run.buildSubagentConfigs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, ternaries 2 (5 pts), loops 3 (nesting depth added 9). Of this number, 25 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.
intent.withSkillUploadIntent (cognitive 27) packages/api/src/skills/intent.ts:39— intent.withSkillUploadIntent has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 4 (9 pts), ternaries 1 (4 pts), loops 1 (2 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.
handlers.writeBundledSkillFile (cognitive 27) packages/api/src/agents/handlers.ts:3743— handlers.writeBundledSkillFile has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, ternaries 5 (7 pts), 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.
session.createOpenIDSessionRefreshService.rollbackSessionPublication (cognitive 27) packages/api/src/auth/openid/session.ts:1320— session.createOpenIDSessionRefreshService.rollbackSessionPublication has cognitive complexity 27 (threshold 15). Drivers by points: error handling 5 (10 pts), if/else 6, boolean chains 5, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 8). Of this number, 23 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.
service.createProvisionService.checkSessionsAlive (cognitive 27) packages/api/src/files/provision/service.ts:490— service.createProvisionService.checkSessionsAlive has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (5 pts), ternaries 2 (4 pts), boolean chains 2, error handling 2 (nesting depth added 9). Of this number, 16 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.
zod.resolveJsonSchemaRefs (cognitive 27) packages/api/src/mcp/zod.ts:238— zod.resolveJsonSchemaRefs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 7, 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.
messageFilterPii.createMessageFilterPii (cognitive 27) packages/api/src/middleware/messageFilterPii.ts:124— messageFilterPii.createMessageFilterPii has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 6, error handling 2 (3 pts), loops 1, ternaries 1 (nesting depth added 5). None of this is in the body itself: all 27 points belong to 3 function literals inside it that branch (lines 125, 179, 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.
file-config.getEndpointFileConfig (cognitive 27) packages/data-provider/src/file-config.ts:1127— file-config.getEndpointFileConfig has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 9, loops 1 (2 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parameterSettings.applyModelFamilyDefaults (cognitive 27) packages/data-provider/src/parameterSettings.ts:1711— parameterSettings.applyModelFamilyDefaults has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 3 (5 pts), boolean chains 4 (nesting depth added 8). 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 literals inside it that branch (lines 1785, 1738, 1721, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
static-checks.directiveComments (cognitive 27) scripts/static-checks.mts:1082— static-checks.directiveComments has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 4 (10 pts), error handling 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.
chatV1::handleError (cognitive 27) api/server/controllers/assistants/chatV1.js:139— chatV1::handleError has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 5, error handling 3, loops 1 (2 pts), ternaries 1 (2 pts), other 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.
streamAudio (cognitive 27) api/server/services/Files/Audio/TTSService.js:383— streamAudio has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), error handling 2 (4 pts), loops 2 (3 pts), other 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.
createErrorHandler (cognitive 27) api/server/controllers/assistants/errors.js:37— createErrorHandler has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 5, error handling 3, loops 1 (2 pts), ternaries 1 (2 pts), other 1 (nesting depth added 4). None of this is in the body itself: all 27 points belong to 3 function literals inside it that branch (lines 45, 103, 118). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
getCustomConfigSpeech.getCustomConfigSpeech (cognitive 26) api/server/services/Files/Audio/getCustomConfigSpeech.js:31— getCustomConfigSpeech.getCustomConfigSpeech has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2 (6 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.
MCP.getServerConnectionStatus (cognitive 26) api/server/services/MCP.js:1764— MCP.getServerConnectionStatus has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 10, ternaries 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.
useCodeApprovalMode.resolveReachableCodeWorkspaceInheritance (cognitive 26) client/src/hooks/Agents/useCodeApprovalMode.ts:306— useCodeApprovalMode.resolveReachableCodeWorkspaceInheritance has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 4 (8 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 10). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useCodeWorkspace.useCodeWorkspace.workspaceMetadata (cognitive 26) client/src/hooks/Agents/useCodeWorkspace.ts:241— useCodeWorkspace.useCodeWorkspace.workspaceMetadata has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 5, loops 3 (4 pts), 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.
AskUserQuestionCall.AskUserQuestionCall (cognitive 26) client/src/components/Chat/Messages/Content/AskUserQuestionCall.tsx:30— AskUserQuestionCall.AskUserQuestionCall has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 9, if/else 4, error handling 1 (nesting depth added 2). Of this number, 15 points are the body's own statements and 11 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.
CreatePromptForm.CreatePromptForm (cognitive 26) client/src/components/Prompts/forms/CreatePromptForm.tsx:37— CreatePromptForm.CreatePromptForm has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 12, if/else 7, ternaries 7. Of this number, 13 points are the body's own statements and 13 belong to 6 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.
SkillFileViewer.SkillFileViewer (cognitive 26) client/src/components/Skills/display/SkillFileViewer.tsx:23— SkillFileViewer.SkillFileViewer has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 20, if/else 3, ternaries 2, error handling 1. Of this number, 19 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.
signIn.watchPullRequestSignIn (cognitive 26) client/src/data-provider/PullRequest/signIn.ts:71— signIn.watchPullRequestSignIn has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 9, error handling 1, ternaries 1 (nesting depth added 2). Most of this is not in the body itself: 2 of the 26 points are its own statements and the rest belongs to 5 function items inside it that branch (check, onSettled, resume, …). 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.
useChatOptions.useChatOptions (cognitive 26) client/src/hooks/Sharing/useChatOptions.tsx:46— useChatOptions.useChatOptions has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 12, boolean chains 11, if/else 3. Of this number, 13 points are the body's own statements and 13 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.
useRum.useRum (cognitive 26) client/src/lib/rum/useRum.ts:159— useRum.useRum has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 4, ternaries 2 (nesting depth added 6). Most of this is not in the body itself: 2 of the 26 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 195, 268, 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.
drafts.setFilesDraft (cognitive 26) client/src/utils/drafts.ts:1220— drafts.setFilesDraft has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 11 (16 pts), boolean chains 6, if/else 3 (4 pts) (nesting depth added 6). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
memory.handleMemoryArtifact (cognitive 26) client/src/utils/memory.ts:83— memory.handleMemoryArtifact has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 4 (8 pts), boolean chains 4 (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.
thread.indexMessages (cognitive 26) client/src/utils/thread.ts:73— thread.indexMessages has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 6 (8 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 10). 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, split the body into named stages: move each independent 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-agent-permissions.migrateAgentPermissionsEnhanced (cognitive 26) config/migrate-agent-permissions.js:23— migrate-agent-permissions.migrateAgentPermissionsEnhanced has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3, error handling 1 (3 pts), loops 2 (3 pts), ternaries 1 (nesting depth added 9). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
contentFilter.createContentFilter (cognitive 26) packages/api/src/middleware/contentFilter.ts:112— contentFilter.createContentFilter has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (4 pts), error handling 2 (3 pts), boolean chains 2, ternaries 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 113). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
config.prepareChange (cognitive 26) packages/api/src/admin/config.ts:2203— config.prepareChange has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 6, 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.
wiring.captureActivityBlockContext (cognitive 26) packages/api/src/agents/activityLabels/wiring.ts:46— wiring.captureActivityBlockContext has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 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.
modelBoundContent.snapshotModelBoundPartObject (cognitive 26) packages/api/src/middleware/modelBoundContent.ts:1627— modelBoundContent.snapshotModelBoundPartObject has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), error handling 2 (3 pts), loops 2 (3 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.
admission.createUnresolvedReviewMatcher (cognitive 26) packages/api/src/agents/hitl/admission.ts:222— admission.createUnresolvedReviewMatcher has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 7, loops 3, ternaries 1 (nesting depth added 5). Most of this is not in the body itself: 7 of the 26 points are its own statements and the rest belongs to 6 function items inside it that branch (visitParts, a function literal at line 297, a function literal at line 285, …). 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.
SubagentThreadTaskStore.replayDurableControl (cognitive 26) packages/api/src/agents/subagentThreads.ts:1016— SubagentThreadTaskStore.replayDurableControl has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 8 (14 pts), if/else 7, boolean chains 5 (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.
backgroundCompletionWakeup.createBackgroundToolDeadClaimRecovery (cognitive 26) packages/api/src/agents/backgroundCompletionWakeup.ts:1078— backgroundCompletionWakeup.createBackgroundToolDeadClaimRecovery has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 9 (nesting depth added 2). None of this is in the body itself: all 26 points belong to 3 function literals inside it that branch (lines 1094, 1139, 1155). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
control.createSubagentControlHandler (cognitive 26) packages/api/src/agents/control.ts:154— control.createSubagentControlHandler has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 7 (8 pts), boolean chains 7, error handling 1 (nesting depth added 3). None of this is in the body itself: all 26 points belong to one function literal inside it that branches (line 155). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
tracker.createModelErrorTracker::getUpstreamModelError (cognitive 26) packages/api/src/agents/failures/tracker.ts:55— tracker.createModelErrorTracker::getUpstreamModelError has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 6, loops 2 (4 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.
view.publicThreadTurns (cognitive 26) packages/api/src/agents/view.ts:322— view.publicThreadTurns has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 9 (10 pts), boolean chains 4, loops 1 (nesting depth added 5). Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to one function literal inside it that branches (line 350). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
rebinding.findRecordDrops (cognitive 26) packages/api/src/app/rebinding.ts:835— rebinding.findRecordDrops has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 3 (9 pts), loops 2 (3 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.
session.createOpenIDSessionRefreshService.performIdpRefreshGrant (cognitive 26) packages/api/src/auth/openid/session.ts:1027— session.createOpenIDSessionRefreshService.performIdpRefreshGrant has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 8, error handling 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.
title.publishConversationTitle (cognitive 26) packages/api/src/conversations/title.ts:24— title.publishConversationTitle has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 11 (nesting depth added 4). 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, split the body into named stages: move each independent 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.createEndpointsConfigService.getEndpointsConfig (cognitive 26) packages/api/src/endpoints/config/endpoints.ts:39— endpoints.createEndpointsConfigService.getEndpointsConfig has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 7, ternaries 2 (5 pts), loops 1 (nesting depth added 5). 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.
video.encodeAndFormatVideos (cognitive 26) packages/api/src/files/encode/video.ts:24— video.encodeAndFormatVideos has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 5, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
message.getThreadData (cognitive 26) packages/api/src/utils/message.ts:220— message.getThreadData has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (8 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.
remoteAgentAuth.createRemoteAgentAuth::handler (cognitive 26) packages/api/src/middleware/remoteAgentAuth.ts:390— remoteAgentAuth.createRemoteAgentAuth::handler has cognitive complexity 26 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 2, error handling 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.
protection.decodeEncodedText (cognitive 26) packages/api/src/shared-links/protection.ts:1070— protection.decodeEncodedText has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 6, ternaries 2 (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.
previews.mayFitJson (cognitive 26) packages/api/src/messages/previews.ts:487— previews.mayFitJson has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (7 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.
service.createScheduleMCPConsentService.view (cognitive 26) packages/api/src/schedules/authorization/service.ts:129— service.createScheduleMCPConsentService.view has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 4, ternaries 2 (4 pts), 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.
service.autoMigrateLegacyLink (cognitive 26) packages/api/src/shared-links/service.ts:32— service.autoMigrateLegacyLink has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 2 (8 pts), error handling 2 (6 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.
RedisJobStore.updateJob (cognitive 26) packages/api/src/stream/implementations/RedisJobStore.ts:2415— RedisJobStore.updateJob has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (13 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
steer.collectQuotelessAppliedSteerIds (cognitive 26) packages/chat/src/core/steer/steer.ts:71— steer.collectQuotelessAppliedSteerIds has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 3, loops 2 (3 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.
SelectDropDown.SelectDropDown (cognitive 26) packages/client/src/components/SelectDropDown.tsx:76— SelectDropDown.SelectDropDown has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 9, ternaries 9, if/else 8. Most of this is not in the body itself: 6 of the 26 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 237, 129, 133, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
resolve-llm-delivery-path.resolveDefaultLLMDeliveryPath (cognitive 26) packages/data-provider/src/resolve-llm-delivery-path.ts:150— resolve-llm-delivery-path.resolveDefaultLLMDeliveryPath has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 7, ternaries 3 (4 pts) (nesting depth added 5). 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, split the body into named stages: move each independent 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.resolveLayerAzureGroups (cognitive 26) packages/data-schemas/src/app/resolution.ts:1829— resolution.resolveLayerAzureGroups has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 5 (7 pts), loops 4, boolean chains 3 (nesting depth added 7). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
share.createShareMethods.getSharedMessages (cognitive 26) packages/data-schemas/src/methods/share.ts:954— share.createShareMethods.getSharedMessages has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 8 (10 pts), if/else 7 (8 pts), boolean chains 6, error handling 2 (nesting depth added 3). Of this number, 22 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.
conversation.createConversationMethods.archiveAllConvos (cognitive 26) packages/data-schemas/src/methods/conversation.ts:4240— conversation.createConversationMethods.archiveAllConvos has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (8 pts), error handling 3 (5 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.
queuedTurn.createAgentQueuedTurnMethods.claimNextAgentQueuedTurn (cognitive 26) packages/data-schemas/src/methods/queuedTurn.ts:1706— queuedTurn.createAgentQueuedTurnMethods.claimNextAgentQueuedTurn has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5, ternaries 3 (5 pts) (nesting depth added 6). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sort-imports.sortFileImports (cognitive 26) scripts/sort-imports.mts:107— sort-imports.sortFileImports has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 5 (9 pts), boolean chains 6 (nesting depth added 7). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
static-checks.suppressionProblems (cognitive 26) scripts/static-checks.mts:1169— static-checks.suppressionProblems has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 3 (7 pts), boolean chains 4, loops 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.
main.protobufTraceTenantID (cognitive 26) otel/langfuse-fanout/cmd/langfuse-fanout/main.go:826— main.protobufTraceTenantID has cognitive complexity 26 (threshold 15). Drivers by points: if/else 3 (16 pts), loops 4 (10 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 (main.jsonTraceTenantID) 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.
main.jsonTraceTenantID (cognitive 26) otel/langfuse-fanout/cmd/langfuse-fanout/main.go:857— main.jsonTraceTenantID has cognitive complexity 26 (threshold 15). Drivers by points: if/else 3 (16 pts), loops 4 (10 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 (main.protobufTraceTenantID) 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.
(anonymous) (cognitive 26) REDACTED:509— (anonymous) has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11, boolean chains 6, other 4, error handling 2 (3 pts), ternaries 2 (nesting depth added 1). Of this number, 25 points are the body's own statements and 1 belongs to 7 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.
createGeminiImageTool (cognitive 26) api/app/clients/tools/structured/GeminiImageGen.js:312— createGeminiImageTool has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, error handling 3, other 2, ternaries 2 (nesting depth added 2). 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 324, (anonymous)::abortHandler, a function literal at line 410, …). 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.
share.streamSharedFile (cognitive 25) REDACTED:249— share.streamSharedFile has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 8, ternaries 4 (6 pts), error handling 1 (2 pts) (nesting depth added 5). 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.
streamAudio.splitTextIntoChunks (cognitive 25) api/server/services/Files/Audio/streamAudio.js:68— streamAudio.splitTextIntoChunks has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useSharePointPicker.useSharePointPicker.portMessageHandler (cognitive 25) client/src/hooks/Files/useSharePointPicker.ts:60— useSharePointPicker.useSharePointPicker.portMessageHandler has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 9, match/switch 2 (3 pts), error handling 1 (nesting depth added 8). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Presentation.Presentation (cognitive 25) client/src/components/Chat/Presentation.tsx:28— Presentation.Presentation has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 12, if/else 7 (8 pts), ternaries 2 (3 pts), error handling 1, loops 1 (nesting depth added 2). 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 76, 160, 63, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
QuoteButton.visibleAnchor (cognitive 25) client/src/components/Chat/Input/QuoteButton.tsx:204— QuoteButton.visibleAnchor has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7, ternaries 5 (6 pts), loops 1 (nesting depth added 4). Of this number, 14 points are the body's own statements and 11 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.
state.reduceSubagentReplay (cognitive 25) client/src/components/Chat/Subagents/state.ts:1446— state.reduceSubagentReplay has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 7, ternaries 2 (nesting depth added 6). Of this number, 21 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.
running.groupConversationsByStatus (cognitive 25) client/src/components/Conversations/running.ts:64— running.groupConversationsByStatus has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, ternaries 3 (4 pts), loops 2 (3 pts) (nesting depth added 6). 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.
ProjectWorkspace.ProjectWorkspace (cognitive 25) client/src/components/Projects/ProjectWorkspace.tsx:69— ProjectWorkspace.ProjectWorkspace has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 14 (16 pts), if/else 5, boolean chains 4 (nesting depth added 2). Of this number, 20 points are the body's own statements and 5 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.
ToolsMarketplaceDialog.ToolsMarketplaceDialog (cognitive 25) client/src/components/SidePanel/Agents/Tools/ToolsMarketplaceDialog.tsx:46— ToolsMarketplaceDialog.ToolsMarketplaceDialog has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 9, ternaries 1 (2 pts), match/switch 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 4 function literals inside it that branch (lines 120, 199, 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.
VersionItem.VersionItem (cognitive 25) client/src/components/SidePanel/Agents/Version/VersionItem.tsx:41— VersionItem.VersionItem has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 12 (14 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.
useMCPServerForm.useMCPServerForm.defaultValues (cognitive 25) client/src/components/SidePanel/MCPBuilder/MCPServerDialog/hooks/useMCPServerForm.ts:82— useMCPServerForm.useMCPServerForm.defaultValues has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 14, ternaries 3 (6 pts), if/else 4 (5 pts) (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.
SkillForm.SkillForm (cognitive 25) client/src/components/Skills/forms/SkillForm.tsx:56— SkillForm.SkillForm has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 12, ternaries 8, if/else 5. Most of this is not in the body itself: 10 of the 25 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 192, onSubmit, 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.
private.useOwnerMessageTexts (cognitive 25) client/src/data-provider/Messages/private.ts:32— private.useOwnerMessageTexts has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 6, loops 4 (6 pts), error handling 1 (2 pts) (nesting depth added 8). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 105, 75, 143, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useAttachItems.useAttachItems.entries::build (cognitive 25) client/src/hooks/Input/useAttachItems.tsx:226— useAttachItems.useAttachItems.entries::build has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 6, ternaries 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.
groupToolCalls.groupSequentialToolCalls (cognitive 25) client/src/utils/groupToolCalls.ts:142— groupToolCalls.groupSequentialToolCalls has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 10). Of this number, 16 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.
reasoningLabels.applyReasoningLabel (cognitive 25) client/src/utils/reasoningLabels.ts:24— reasoningLabels.applyReasoningLabel has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 11, 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.
secrets.encryptConfigSecretFields (cognitive 25) packages/api/src/admin/secrets.ts:1645— secrets.encryptConfigSecretFields has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 3, 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.
secrets.preserveConfigSecrets (cognitive 25) packages/api/src/admin/secrets.ts:1766— secrets.preserveConfigSecrets has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, ternaries 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.
config.createAdminConfigHandlers.deleteConfigField (cognitive 25) packages/api/src/admin/config.ts:4246— config.createAdminConfigHandlers.deleteConfigField has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 5, ternaries 3, error handling 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.
auth.getPluginAuthMap (cognitive 25) packages/api/src/agents/auth.ts:18— auth.getPluginAuthMap has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (6 pts), error handling 2 (4 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 12). Of this number, 14 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.
BackgroundTaskRegistryClass.create (cognitive 25) packages/api/src/agents/background.ts:1328— BackgroundTaskRegistryClass.create has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 3, 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.
handlers.createOpenAIToolCallStream.onRunStep (cognitive 25) packages/api/src/agents/openai/handlers.ts:500— handlers.createOpenAIToolCallStream.onRunStep has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, error handling 1 (3 pts), 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.
modes.createAgentToolApprovalSession.validateTransport (cognitive 25) packages/api/src/agents/hitl/modes.ts:564— modes.createAgentToolApprovalSession.validateTransport has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 8 (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.extractInvokedSkillsFromPayload (cognitive 25) packages/api/src/agents/run.ts:272— run.extractInvokedSkillsFromPayload has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 1 (4 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 14). 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.
SubagentThreadTaskStore.flushControlReceipts (cognitive 25) packages/api/src/agents/subagentThreads.ts:1126— SubagentThreadTaskStore.flushControlReceipts has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 11). None of this is in the body itself: all 25 points belong to 4 function literals inside it that branch (lines 1131, 1138, 1172, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
openid.findOpenIDUser (cognitive 25) packages/api/src/auth/openid.ts:227— openid.findOpenIDUser has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, ternaries 2 (3 pts), error handling 1 (nesting depth added 8). 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.
flight.createOpenIDRefreshFlightService.withOpenIDRefreshFlightLease (cognitive 25) packages/api/src/auth/openid/flight.ts:422— flight.createOpenIDRefreshFlightService.withOpenIDRefreshFlightLease has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (16 pts), error handling 3 (6 pts), boolean chains 3 (nesting depth added 8). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
delivery.createOpenIDResponseDelivery (cognitive 25) packages/api/src/auth/openid/delivery.ts:48— delivery.createOpenIDResponseDelivery has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, ternaries 1 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 8). None of this is in the body itself: all 25 points belong to 3 function literals inside it that branch (lines 63, 102, 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.
http.createCodeEnvironmentHttpHandlers.register (cognitive 25) packages/api/src/code/http.ts:575— http.createCodeEnvironmentHttpHandlers.register has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 5 (7 pts), error handling 5, 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.
helpers.configureReasoning (cognitive 25) packages/api/src/endpoints/anthropic/helpers.ts:75— helpers.configureReasoning has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts), ternaries 4 (7 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.
authorization.createImageAuthorizationMiddleware (cognitive 25) packages/api/src/images/authorization.ts:448— authorization.createImageAuthorizationMiddleware has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 3, ternaries 3, error handling 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 2 function literals inside it that branch (lines 456, 523). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.createPullRequestOAuth.refresh (cognitive 25) packages/api/src/pulls/oauth.ts:665— oauth.createPullRequestOAuth.refresh has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 4 (8 pts), boolean chains 4, 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.
tools.createMCPToolCacheService.updateMCPServerTools (cognitive 25) packages/api/src/mcp/tools.ts:309— tools.createMCPToolCacheService.updateMCPServerTools has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, ternaries 2 (3 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.
admission.createPrivateTextInitialAdmissionCallback (cognitive 25) packages/api/src/protection/private/admission.ts:30— admission.createPrivateTextInitialAdmissionCallback has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 7, loops 2 (nesting depth added 3). 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 (admitModel, a function literal at line 128, findRoot, …). 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.createSchedulesService.isScheduleLive (cognitive 25) packages/api/src/schedules/service.ts:1735— service.createSchedulesService.isScheduleLive has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, ternaries 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.
config.getRumConfig (cognitive 25) packages/api/src/rum/config.ts:34— config.getRumConfig has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 6, ternaries 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
theme.collectModeIssues (cognitive 25) packages/data-provider/src/theme.ts:772— theme.collectModeIssues has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 7, ternaries 1 (2 pts) (nesting depth added 5). Of this number, 13 points are the body's own statements and 12 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.
queuedTurn.createAgentQueuedTurnMethods.getEffectiveAgentQueuedTurnPredecessor (cognitive 25) packages/data-schemas/src/methods/queuedTurn.ts:2577— queuedTurn.createAgentQueuedTurnMethods.getEffectiveAgentQueuedTurnPredecessor has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 5, loops 2, ternaries 1 (nesting depth added 6). Of this number, 22 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.
mcpAuthority.createMCPAuthorityMethods.compareProofs (cognitive 25) packages/data-schemas/src/methods/mcpAuthority.ts:1732— mcpAuthority.createMCPAuthorityMethods.compareProofs has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (22 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.
searchTokens.backfillSearchTokens (cognitive 25) packages/data-schemas/src/migrations/searchTokens.ts:57— searchTokens.backfillSearchTokens has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (10 pts) (nesting depth added 15). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
design.disabledSense (cognitive 25) scripts/eslint/design.mjs:229— design.disabledSense has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 7 (9 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.
memories.router.patch("/:key") (cognitive 24) api/server/routes/memories.js:316— memories.router.patch("/:key") has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 5, 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
checkBan.checkBan (cognitive 24) api/server/middleware/checkBan.js:82— checkBan.checkBan has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 5, ternaries 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.
files.handleFileUpload (cognitive 24) REDACTED:793— files.handleFileUpload has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (15 pts), error handling 3 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 6). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
useUnseenConversations.readReplyState (cognitive 24) client/src/hooks/Conversations/useUnseenConversations.ts:41— useUnseenConversations.readReplyState has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 6 (10 pts), boolean chains 2 (nesting depth added 9). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StackedToolIcons.StackedToolIcons (cognitive 24) client/src/components/Chat/Messages/Content/ToolOutput/StackedToolIcons.tsx:30— StackedToolIcons.StackedToolIcons has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 3 (5 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 9). Most of this is not in the body itself: 5 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 39, 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.
Inspector.Inspector (cognitive 24) client/src/components/Chat/Trace/Inspector.tsx:269— Inspector.Inspector has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 17, if/else 3 (4 pts), ternaries 3 (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.
ModelSelectorContext.ModelSelectorProvider (cognitive 24) client/src/components/Chat/Menus/Endpoints/ModelSelectorContext.tsx:62— ModelSelectorContext.ModelSelectorProvider has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 7, ternaries 1 (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 9 function literals inside it that branch (lines 147, 224, 240, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ShareArtifacts.ShareArtifactsContainer (cognitive 24) client/src/components/Share/ShareArtifacts.tsx:58— ShareArtifacts.ShareArtifactsContainer has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, ternaries 9, if/else 3. 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.
SkillsDialog.SkillsDialog (cognitive 24) client/src/components/SidePanel/Agents/Tools/SkillsDialog.tsx:47— SkillsDialog.SkillsDialog has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, loops 3 (4 pts), ternaries 4 (nesting depth added 5). Most of this is not in the body itself: 8 of the 24 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 99, 116, 74, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useSideNavLinks.useSideNavLinks (cognitive 24) client/src/hooks/Nav/useSideNavLinks.ts:39— useSideNavLinks.useSideNavLinks has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 14, if/else 10. None of this is in the body itself: all 24 points belong to one function literal inside it that branches (line 101). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
useKeyboardShortcuts.useKeyboardShortcuts (cognitive 24) client/src/hooks/useKeyboardShortcuts.ts:1070— useKeyboardShortcuts.useKeyboardShortcuts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 9, loops 1 (nesting depth added 2). None of this is in the body itself: all 24 points belong to 2 function literals inside it that branch (lines 1092, 1080). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
privacy.sanitizeReplayEvent (cognitive 24) client/src/lib/rum/privacy.ts:108— privacy.sanitizeReplayEvent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 4 (8 pts), boolean chains 3, 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.
approval.resolveAskUserQuestionPart (cognitive 24) client/src/utils/approval.ts:192— approval.resolveAskUserQuestionPart has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 9, loops 2, ternaries 2 (nesting depth added 4). 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.
convos.conversationInsertVerdict (cognitive 24) client/src/utils/convos.ts:389— convos.conversationInsertVerdict has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 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.
GenerationJobManagerClass.emitChunk (cognitive 24) packages/api/src/stream/GenerationJobManager.ts:6928— GenerationJobManagerClass.emitChunk has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 2 (nesting depth added 10). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ActivityRecorder.evictOldest (cognitive 24) packages/api/src/agents/digest/recorder.ts:463— ActivityRecorder.evictOldest has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 6 (9 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.
provenance.visitSemanticUserSubmittedPaths (cognitive 24) packages/api/src/protection/provenance.ts:226— provenance.visitSemanticUserSubmittedPaths has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 3 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). Of this number, 18 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.
modelBoundContent.projectProviderMessage (cognitive 24) packages/api/src/middleware/modelBoundContent.ts:1964— modelBoundContent.projectProviderMessage has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 8, loops 1 (2 pts), 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.
delivery.resolveScopedTurnAttachments (cognitive 24) packages/api/src/agents/files/delivery.ts:102— delivery.resolveScopedTurnAttachments has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 3 (7 pts), loops 4 (5 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.
run.resolveAzureSummarization (cognitive 24) packages/api/src/agents/run.ts:1040— run.resolveAzureSummarization has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 12 (13 pts), boolean chains 9, if/else 2 (nesting depth added 1). 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: 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.
tools.interruptToolHandler.handle (cognitive 24) packages/api/src/agents/steering/tools.ts:46— tools.interruptToolHandler.handle has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11, boolean chains 7, ternaries 3 (4 pts), error handling 2 (nesting depth added 1). Most of this is not in the body itself: 3 of the 24 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 59, 70, 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.
import.scanArchiveFiles (cognitive 24) packages/api/src/skills/import.ts:596— import.scanArchiveFiles has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 2, error handling 1 (2 pts), ternaries 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.
ptc.instrumentPtcToolMap (cognitive 24) packages/api/src/agents/ptc.ts:117— ptc.instrumentPtcToolMap has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (16 pts), if/else 2 (4 pts), error handling 2 (3 pts), loops 1 (nesting depth added 13). Most of this is not in the body itself: 5 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 150, safeEmit). 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.
handlers.loadSkillFileTextForAuthoring (cognitive 24) packages/api/src/agents/handlers.ts:3380— handlers.loadSkillFileTextForAuthoring has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (19 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.
clientTools.validateClientTools (cognitive 24) packages/api/src/agents/responses/clientTools.ts:120— clientTools.validateClientTools has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 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.
host.steer (cognitive 24) packages/api/src/agents/triggers/host.ts:957— host.steer has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 6 (7 pts), boolean chains 4, error handling 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.
runtime.registerPluginHooks::hook (cognitive 24) packages/api/src/agents/hooks/runtime.ts:415— runtime.registerPluginHooks::hook has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 7, 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. This shape REPEATS in the file: one other method here (runtime.registerPluginHooks) 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.
runtime.registerPluginHooks (cognitive 24) packages/api/src/agents/hooks/runtime.ts:343— runtime.registerPluginHooks has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17 (34 pts), ternaries 10 (22 pts), boolean chains 14, error handling 1 (3 pts), loops 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (runtime.registerPluginHooks::hook) 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.
ownerContact.attachAgentOwnerContacts (cognitive 24) packages/api/src/agents/ownerContact.ts:54— ownerContact.attachAgentOwnerContacts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 2 (4 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.
lease.createEventChildGenerationLeaseAcquirer (cognitive 24) packages/api/src/agents/triggers/lease.ts:41— lease.createEventChildGenerationLeaseAcquirer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 7, ternaries 3, error handling 1 (2 pts) (nesting depth added 2). None of this is in the body itself: all 24 points belong to 7 function literals inside it that branch (lines 45, 125, 164, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
command.createAttachedWorkspaceBashTool (cognitive 24) packages/api/src/code/command.ts:458— command.createAttachedWorkspaceBashTool has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 10, if/else 7 (8 pts), boolean chains 6 (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 one function literal inside it that branches (line 526). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
http.createCodeEnvironmentHttpHandlers.moveConversationDecision (cognitive 24) packages/api/src/code/http.ts:401— http.createCodeEnvironmentHttpHandlers.moveConversationDecision has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 7, error handling 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.
operations.isDefinitiveFileStorageFailure (cognitive 24) packages/api/src/files/operations.ts:88— operations.isDefinitiveFileStorageFailure has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 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.
cleanup.cleanupDeletedMCPServerOAuthUsers (cognitive 24) packages/api/src/mcp/oauth/cleanup.ts:72— cleanup.cleanupDeletedMCPServerOAuthUsers has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (6 pts), error handling 2 (4 pts), boolean chains 2 (nesting depth added 11). Of this number, 16 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.
MCPConnectionFactory.createConnection (cognitive 24) packages/api/src/mcp/MCPConnectionFactory.ts:809— MCPConnectionFactory.createConnection has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 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.
protection.assertSkillFileContentAllowed (cognitive 24) packages/api/src/skills/protection.ts:20— protection.assertSkillFileContentAllowed has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (13 pts), boolean chains 6, if/else 4 (5 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
classification.buildToolClassification (cognitive 24) packages/api/src/tools/classification.ts:396— classification.buildToolClassification has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, loops 1 (2 pts), 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.
reader.createLangfuseTraceReader.getRecord (cognitive 24) packages/api/src/langfuse/reader.ts:1148— reader.createLangfuseTraceReader.getRecord has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 9, error handling 1 (2 pts), boolean chains 1, 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.
RedisJobStore.hasScheduleCleanupObligation (cognitive 24) packages/api/src/stream/implementations/RedisJobStore.ts:3403— RedisJobStore.hasScheduleCleanupObligation has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (14 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.
events.isOAuthStepEvent (cognitive 24) packages/chat/src/core/resumable/events.ts:15— events.isOAuthStepEvent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 8, ternaries 4 (7 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.useQueuedRecovery (cognitive 24) packages/chat/src/react/steering/recovery.ts:18— recovery.useQueuedRecovery has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 4, error handling 2 (3 pts), ternaries 1 (nesting depth added 5). None of this is in the body itself: all 24 points belong to 3 function literals inside it that branch (lines 46, 156, 136). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
bedrock.bedrockOutputParser (cognitive 24) packages/data-provider/src/bedrock.ts:972— bedrock.bedrockOutputParser has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 6, loops 1 (3 pts) (nesting depth added 6). Of this number, 15 points are the body's own statements and 9 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.
resolution.withHiddenAzureGroups (cognitive 24) packages/data-schemas/src/app/resolution.ts:2006— resolution.withHiddenAzureGroups has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, loops 2 (3 pts), 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.
auditLog.createAuditLogMethods.recordAuditEntry (cognitive 24) packages/data-schemas/src/methods/auditLog.ts:337— auditLog.createAuditLogMethods.recordAuditEntry has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 2 (6 pts), boolean chains 5, 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.
share.createShareMethods.createSharedLink (cognitive 24) packages/data-schemas/src/methods/share.ts:1260— share.createShareMethods.createSharedLink has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 8, ternaries 3 (4 pts), 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.
triggerDelivery.createAgentTriggerDeliveryMethods.releaseAgentBackgroundToolResultClaims (cognitive 24) packages/data-schemas/src/methods/triggerDelivery.ts:2893— triggerDelivery.createAgentTriggerDeliveryMethods.releaseAgentBackgroundToolResultClaims has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 6 (9 pts), boolean chains 5 (nesting depth added 6). Of this number, 19 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.
chatCompletion::runAgents (cognitive 24) api/server/controllers/agents/client.js:4939— chatCompletion::runAgents has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10, boolean chains 6, other 4, ternaries 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
getListAgentsHandler (cognitive 24) REDACTED:1752— getListAgentsHandler has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, ternaries 3, error handling 2, other 2 (nesting depth added 2). Of this number, 19 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.
(anonymous) (cognitive 24) api/server/routes/memories.js:316— (anonymous) has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 5, 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
indexSync.ensureFilterableAttributes (cognitive 23) api/db/indexSync.js:89— indexSync.ensureFilterableAttributes has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 7 (9 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.
resize.resizeImageBuffer (cognitive 23) api/server/services/Files/images/resize.js:19— resize.resizeImageBuffer has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 2, 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.
useCodeWorkspace.useCodeWorkspace.resolveSelections (cognitive 23) client/src/hooks/Agents/useCodeWorkspace.ts:493— useCodeWorkspace.useCodeWorkspace.resolveSelections has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (7 pts), ternaries 3 (7 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.
useSpeechSettingsInit.useSpeechSettingsInit (cognitive 23) client/src/hooks/Config/useSpeechSettingsInit.ts:14— useSpeechSettingsInit.useSpeechSettingsInit has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, ternaries 2 (nesting depth added 3). None of this is in the body itself: all 23 points belong to 3 function literals inside it that branch (lines 39, 61, 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.
Marketplace.AgentMarketplace (cognitive 23) client/src/components/Agents/Marketplace.tsx:21— Marketplace.AgentMarketplace has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12, boolean chains 7, ternaries 4. Most of this is not in the body itself: 8 of the 23 points are its own statements and the rest belongs to 6 function items inside it that branch (handleMineChange, handleTabChange, handleSearch, …). 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.
rows.findToolCallArgs (cognitive 23) client/src/components/Chat/BackgroundTasks/rows.ts:63— rows.findToolCallArgs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FilePreviewDialog.getDisplayType (cognitive 23) client/src/components/Chat/Messages/Content/FilePreviewDialog.tsx:61— FilePreviewDialog.getDisplayType has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, ternaries 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.
ToolIcon.getToolIconType (cognitive 23) client/src/components/Chat/Messages/Content/ToolOutput/ToolIcon.tsx:66— ToolIcon.getToolIconType has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17, boolean chains 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.
verticals.collectSearchVerticals (cognitive 23) client/src/components/Chat/Messages/Content/verticals.tsx:61— verticals.collectSearchVerticals has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (7 pts), boolean chains 3, ternaries 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.
HeaderMenu.HeaderMenu (cognitive 23) client/src/components/Chat/Menus/HeaderMenu.tsx:25— HeaderMenu.HeaderMenu has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 8, boolean chains 6 (nesting depth added 4). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
outcome.hasTerminalOutcome (cognitive 23) client/src/components/Chat/Subagents/outcome.ts:10— outcome.hasTerminalOutcome has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 10, loops 5 (8 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. This shape REPEATS in the file: one other method here (outcome.hasTerminalOutcome::matches) 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.
LiaEngine.chooseLife (cognitive 23) client/src/components/Lia/engine/engine.ts:363— LiaEngine.chooseLife has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 6, loops 2, ternaries 1 (nesting depth added 6). 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.
AuthSection.AuthSection (cognitive 23) client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/AuthSection.tsx:27— AuthSection.AuthSection has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, ternaries 10, if/else 1. Of this number, 20 points are the body's own statements and 3 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.
MCPServerCard.MCPServerCard (cognitive 23) client/src/components/SidePanel/MCPBuilder/MCPServerCard.tsx:28— MCPServerCard.MCPServerCard has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11, boolean chains 9, ternaries 2 (3 pts) (nesting depth added 1). Most of this is not in the body itself: 8 of the 23 points are its own statements and the rest belongs to 4 function items inside it that branch (getStatusText, handleInitialize, a function literal at line 57, …). 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.
ScheduleDialog.ScheduleDialog::onSubmit (cognitive 23) client/src/components/SidePanel/Schedules/ScheduleDialog.tsx:384— ScheduleDialog.ScheduleDialog::onSubmit has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 8 (15 pts), boolean chains 4, if/else 3 (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. This shape REPEATS in the file: one other method here (ScheduleDialog.ScheduleDialog) 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.
LocalizedDateRangePicker.LocalizedDateRangePicker (cognitive 23) client/src/components/ui/LocalizedDateRangePicker.tsx:68— LocalizedDateRangePicker.LocalizedDateRangePicker has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 13, if/else 5, ternaries 5. 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.
queries.useTitleGeneration (cognitive 23) client/src/data-provider/SSE/queries.ts:90— queries.useTitleGeneration has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5, ternaries 2 (3 pts), loops 1 (nesting depth added 5). None of this is in the body itself: all 23 points belong to 5 function literals inside it that branch (lines 158, 113, 133, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.applyModelSpecEphemeralAgent (cognitive 23) client/src/utils/endpoints.ts:336— endpoints.applyModelSpecEphemeralAgent has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 2 (7 pts), boolean chains 3, loops 1 (2 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.
convos.findManualConvoTitleInAllQueries (cognitive 23) client/src/utils/convos.ts:1472— convos.findManualConvoTitleInAllQueries has cognitive complexity 23 (threshold 15). Drivers by points: loops 4 (11 pts), boolean chains 6, if/else 4 (5 pts), ternaries 1 (nesting depth added 8). Of this number, 20 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.
reentry.findSecretReentry (cognitive 23) packages/api/src/admin/reentry.ts:207— reentry.findSecretReentry has cognitive complexity 23 (threshold 15). Drivers by points: if/else 3 (12 pts), loops 3 (6 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 15). 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.
InMemoryJobStore.getJobIdsByUser (cognitive 23) packages/api/src/stream/implementations/InMemoryJobStore.ts:1468— InMemoryJobStore.getJobIdsByUser has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 9, ternaries 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.
edits.parseEditConflict (cognitive 23) packages/api/src/code/edits.ts:239— edits.parseEditConflict has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 2 (5 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.
inference.customSchema (cognitive 23) packages/api/src/agents/inference.ts:365— inference.customSchema has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (6 pts), boolean chains 4, match/switch 1 (nesting depth added 8). 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.
run.enqueueSubagentChildren (cognitive 23) packages/api/src/agents/run.ts:1693— run.enqueueSubagentChildren has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 5 (8 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.
handlers.handleEditFileCall (cognitive 23) packages/api/src/agents/handlers.ts:4488— handlers.handleEditFileCall has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (19 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.
protection.getResumeUserSubmittedMessageFieldPaths (cognitive 23) packages/api/src/agents/hitl/protection.ts:1242— protection.getResumeUserSubmittedMessageFieldPaths has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, loops 2 (3 pts), 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.
SubagentThreadTaskStore.controlInvocation (cognitive 23) packages/api/src/agents/subagentThreads.ts:2375— SubagentThreadTaskStore.controlInvocation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 7, 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.
SubagentThreadTaskStore.dropDeletedControlReceiptWork (cognitive 23) packages/api/src/agents/subagentThreads.ts:2887— SubagentThreadTaskStore.dropDeletedControlReceiptWork has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 5, loops 4 (5 pts), ternaries 1 (nesting depth added 7). Of this number, 16 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.
subagentCompletionWakeup.resolveOrchestrationSnapshot (cognitive 23) packages/api/src/agents/subagentCompletionWakeup.ts:245— subagentCompletionWakeup.resolveOrchestrationSnapshot has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, ternaries 3, error handling 2, loops 2 (nesting depth added 3). Of this number, 20 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.
mcpIdentity.stampMcpServerIdentities (cognitive 23) packages/api/src/agents/mcpIdentity.ts:42— mcpIdentity.stampMcpServerIdentities has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 4 (7 pts), boolean chains 4 (nesting depth added 8). Of this number, 15 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.
AgentExecutionEnrollment.settleInternal (cognitive 23) packages/api/src/agents/remote/lifecycle.ts:121— AgentExecutionEnrollment.settleInternal has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 3 (5 pts), boolean chains 3, ternaries 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.
attachments.primeAgentAttachments (cognitive 23) packages/api/src/code/attachments.ts:1029— attachments.primeAgentAttachments has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 4). Of this number, 21 points are the body's own statements and 2 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.
targets.createSubagentCodeRouting.attach (cognitive 23) packages/api/src/code/targets.ts:847— targets.createSubagentCodeRouting.attach has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 8, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 3). Of this number, 16 points are the body's own statements and 7 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.
initialize.initializeGoogle (cognitive 23) packages/api/src/endpoints/google/initialize.ts:28— initialize.initializeGoogle has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (8 pts), error handling 1 (2 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.
openid.resolveDirectOpenIDBearerConfig (cognitive 23) packages/api/src/mcp/openid.ts:126— openid.resolveDirectOpenIDBearerConfig has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (15 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.
submission.saveAbortedUserMessage (cognitive 23) packages/api/src/protection/private/submission.ts:554— submission.saveAbortedUserMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 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.
deletionService.createSkillDeletionService.deleteWithClaim (cognitive 23) packages/api/src/skills/deletionService.ts:130— deletionService.createSkillDeletionService.deleteWithClaim has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 4 (5 pts), ternaries 4 (5 pts) (nesting depth added 5). Of this number, 18 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.
failure.handleServedError (cognitive 23) packages/chat/src/core/resumable/failure.ts:19— failure.handleServedError has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, error handling 2 (3 pts), ternaries 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.
outcomes.handoffStartToReplacement (cognitive 23) packages/chat/src/core/resumable/outcomes.ts:143— outcomes.handoffStartToReplacement has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 1 (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.
resolution.stripInvalidOverrides (cognitive 23) packages/data-schemas/src/app/resolution.ts:1461— resolution.stripInvalidOverrides has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 4 (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.
appSnapshots.fitBoundAppSnapshots (cognitive 23) packages/data-schemas/src/methods/appSnapshots.ts:63— appSnapshots.fitBoundAppSnapshots has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 4 (5 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.
prompt.createPromptMethods.getListPromptGroupsByAccess (cognitive 23) packages/data-schemas/src/methods/prompt.ts:383— prompt.createPromptMethods.getListPromptGroupsByAccess has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), ternaries 5, 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.
static-checks.inlineDirectives (cognitive 23) scripts/static-checks.mts:995— static-checks.inlineDirectives has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (6 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 9). 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.
gateway.handleMediaCreate (cognitive 23) otel/langfuse-fanout/cmd/langfuse-fanout/main.go:321— gateway.handleMediaCreate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 5 (6 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getMessagesForConversation (cognitive 23) api/app/clients/BaseClient.js:1496— getMessagesForConversation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 4 (8 pts), boolean chains 2, loops 2, other 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.
startServer (cognitive 23) REDACTED:445— startServer has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (14 pts), ternaries 3 (4 pts), error handling 3, boolean chains 2 (nesting depth added 2). Of this number, 18 points are the body's own statements and 5 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.
images.router.post("/") (cognitive 22) api/server/routes/files/images.js:44— images.router.post("/") has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, error handling 3 (4 pts) (nesting depth added 4). 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
socialLogin.socialLogin (cognitive 22) api/strategies/socialLogin.js:15— socialLogin.socialLogin has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3, ternaries 2, error handling 1 (nesting depth added 6). None of this is in the body itself: all 22 points belong to 2 function literals inside it that branch (lines 16, 52). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useCodeWorkspace.useCodeWorkspace.environments (cognitive 22) client/src/hooks/Agents/useCodeWorkspace.ts:424— useCodeWorkspace.useCodeWorkspace.environments has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 9, 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.
useSharePointDownload.useSharePointDownload.downloadSharePointFiles (cognitive 22) client/src/hooks/Files/useSharePointDownload.ts:35— useSharePointDownload.useSharePointDownload.downloadSharePointFiles has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (9 pts), boolean chains 2, error handling 1 (nesting depth added 8). 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.
useTextarea.useTextarea (cognitive 22) client/src/hooks/Input/useTextarea.ts:46— useTextarea.useTextarea has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11, boolean chains 8, ternaries 3. Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 181, 158, 145, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useQueryParams.useQueryParams.newQueryConvo (cognitive 22) client/src/hooks/Input/useQueryParams.ts:320— useQueryParams.useQueryParams.newQueryConvo has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, loops 1 (2 pts), 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.
useSSE.useSSE (cognitive 22) client/src/hooks/SSE/useSSE.ts:43— useSSE.useSSE has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, ternaries 3 (4 pts), error handling 2, match/switch 1 (nesting depth added 3). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 231, 150, 171, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TwoFactorSetupScreen.TwoFactorSetupScreen (cognitive 22) client/src/components/Auth/TwoFactorSetupScreen.tsx:56— TwoFactorSetupScreen.TwoFactorSetupScreen has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12, boolean chains 9, ternaries 1. Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 155, 208, 93, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SteerPart.SteerPart (cognitive 22) client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx:25— SteerPart.SteerPart has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 13, if/else 6, ternaries 3. Of this number, 13 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.
useLazyHighlight.useLazyHighlight (cognitive 22) client/src/components/Chat/Messages/Content/Parts/useLazyHighlight.ts:87— useLazyHighlight.useLazyHighlight has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, ternaries 5, boolean chains 4. Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 106, 94, 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.
OutputRenderer.OutputRenderer (cognitive 22) client/src/components/Chat/Messages/Content/ToolOutput/OutputRenderer.tsx:129— OutputRenderer.OutputRenderer has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, ternaries 4 (8 pts), if/else 3 (nesting depth added 4). Of this number, 16 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.
MessageRow.MessageRow (cognitive 22) client/src/components/Chat/Messages/ui/MessageRow.tsx:89— MessageRow.MessageRow has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 18, ternaries 3 (4 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.
utils.filterItems (cognitive 22) client/src/components/Chat/Menus/Endpoints/utils.ts:17— utils.filterItems has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 9 (nesting depth added 5). 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 60, 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.
face.drawEye (cognitive 22) client/src/components/Lia/engine/face.ts:144— face.drawEye has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 5 (10 pts), loops 3 (6 pts), if/else 2 (5 pts), match/switch 1 (nesting depth added 11). Of this number, 20 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.
LiaEngine.render (cognitive 22) client/src/components/Lia/engine/engine.ts:649— LiaEngine.render has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 9 (10 pts), if/else 6, 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.
TwoFactorAuthentication.TwoFactorAuthentication (cognitive 22) client/src/components/Nav/SettingsTabs/Account/TwoFactorAuthentication.tsx:40— TwoFactorAuthentication.TwoFactorAuthentication has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 8, ternaries 3. 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 166, 81, 109, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
LangfusePromptsDialog.LangfusePromptsDialog (cognitive 22) client/src/components/Nav/SettingsTabs/Integrations/LangfusePromptsDialog.tsx:94— LangfusePromptsDialog.LangfusePromptsDialog 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 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.
ActionsInput.ActionsInput (cognitive 22) client/src/components/SidePanel/Builder/ActionsInput.tsx:33— ActionsInput.ActionsInput has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, boolean chains 6. Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 111, submitContext, 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.
DynamicTags.DynamicTags (cognitive 22) client/src/components/SidePanel/Parameters/DynamicTags.tsx:10— DynamicTags.DynamicTags has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 10, if/else 8, ternaries 4. 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 literals inside it that branch (lines 152, 57, 75, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ScheduleCard.ScheduleCard (cognitive 22) client/src/components/SidePanel/Schedules/ScheduleCard.tsx:157— ScheduleCard.ScheduleCard has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 13, ternaries 6 (7 pts), if/else 2 (nesting depth added 1). Of this number, 11 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.
mutations.useUploadFileMutation (cognitive 22) client/src/data-provider/Files/mutations.ts:17— mutations.useUploadFileMutation has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 4, ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 47, 120, 31, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useDrawerSwipe.findHorizontalScrollBlocker (cognitive 22) client/src/hooks/Nav/useDrawerSwipe.ts:171— useDrawerSwipe.findHorizontalScrollBlocker has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), ternaries 2 (8 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.
useWakeLock.useWakeLock (cognitive 22) client/src/hooks/useWakeLock.ts:55— useWakeLock.useWakeLock has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 3, error handling 2 (nesting depth added 2). None of this is in the body itself: all 22 points belong to 5 function literals inside it that branch (lines 58, 145, 109, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
privacy.sanitizeAttributes (cognitive 22) client/src/lib/rum/privacy.ts:55— privacy.sanitizeAttributes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
drafts.collectLiveAttachmentIds (cognitive 22) client/src/utils/drafts.ts:1102— drafts.collectLiveAttachmentIds has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (8 pts), boolean chains 3, 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.
imageResize.isAnimatedWebP (cognitive 22) client/src/utils/imageResize.ts:99— imageResize.isAnimatedWebP has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 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.
secrets.encryptConfigSecrets (cognitive 22) packages/api/src/admin/secrets.ts:1715— secrets.encryptConfigSecrets has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 5 (7 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.
groups.createAdminGroupsHandlers.updateGroup (cognitive 22) packages/api/src/admin/groups.ts:296— groups.createAdminGroupsHandlers.updateGroup has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 6, 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.
roles.createAdminRolesHandlers.removeRoleMember (cognitive 22) packages/api/src/admin/roles.ts:1182— roles.createAdminRolesHandlers.removeRoleMember has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (17 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
runtime.createActivityLabelHook (cognitive 22) packages/api/src/agents/activityLabels/runtime.ts:479— runtime.createActivityLabelHook has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, error handling 3 (4 pts), loops 2 (nesting depth added 2). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 5 function items inside it that branch (a function literal at line 554, a function literal at line 521, recentLabels, …). 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.
wiring.createActivityLabelWiring (cognitive 22) packages/api/src/agents/activityLabels/wiring.ts:218— wiring.createActivityLabelWiring has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (9 pts), loops 2 (nesting depth added 3). Most of this is not in the body itself: 10 of the 22 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 257, 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.
subagentActivity.createSubagentActivityStreamHandler (cognitive 22) packages/api/src/agents/subagentActivity.ts:600— subagentActivity.createSubagentActivityStreamHandler has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 8, error handling 2, ternaries 1 (nesting depth added 2). None of this is in the body itself: all 22 points belong to 2 function literals inside it that branch (lines 604, 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.
GenerationJobManagerClass.notifyReplacedGeneration (cognitive 22) packages/api/src/stream/GenerationJobManager.ts:1990— GenerationJobManagerClass.notifyReplacedGeneration has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, 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.
GenerationJobManagerClass.continueEarlyEventBootstrap (cognitive 22) packages/api/src/stream/GenerationJobManager.ts:5981— GenerationJobManagerClass.continueEarlyEventBootstrap has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (7 pts), boolean chains 5 (nesting depth added 7). 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 5994). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
GenerationJobManager.isOAuthReplayEvent (cognitive 22) packages/api/src/stream/GenerationJobManager.ts:573— GenerationJobManager.isOAuthReplayEvent has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, 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.
view.parseDigestRequest (cognitive 22) packages/api/src/agents/digest/view.ts:92— view.parseDigestRequest has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (8 pts), boolean chains 7, if/else 5 (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.
RedisSubagentTaskControlTransport.cancelScope (cognitive 22) packages/api/src/agents/subagentTaskRouting.ts:897— RedisSubagentTaskControlTransport.cancelScope has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 5 (6 pts), loops 4 (6 pts), boolean chains 2, error handling 1 (nesting depth added 7). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
edits.normalizeEditArgs (cognitive 22) packages/api/src/agents/edits.ts:45— edits.normalizeEditArgs has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, loops 1 (2 pts), 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.
checkpointer.deleteAgentCheckpoint (cognitive 22) packages/api/src/agents/checkpointer.ts:1075— checkpointer.deleteAgentCheckpoint has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 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.
backgroundClaims.claimBackgroundToolResult (cognitive 22) packages/api/src/agents/backgroundClaims.ts:6— backgroundClaims.claimBackgroundToolResult has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, error handling 2 (4 pts) (nesting depth added 6). 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, split the body into named stages: move each independent 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.synthesizeReasoningLabelGapEvents (cognitive 22) packages/api/src/agents/reasoningLabels/runtime.ts:192— runtime.synthesizeReasoningLabelGapEvents has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 7, ternaries 3 (6 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.
report.getEndpointOverrideReport (cognitive 22) packages/api/src/app/report.ts:122— report.getEndpointOverrideReport has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, ternaries 2 (3 pts), loops 2 (nesting depth added 7). Of this number, 19 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.
share.createOptionalShareFileAuth (cognitive 22) packages/api/src/auth/share.ts:42— share.createOptionalShareFileAuth has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10, boolean chains 5, ternaries 4 (5 pts), error handling 2 (nesting depth added 1). None of this is in the body itself: all 22 points belong to 4 function items inside it that branch (a function literal at line 95, verifySignedUser, getOpenIdUser, …). 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.
targets.createSubagentCodeRouting.place (cognitive 22) packages/api/src/code/targets.ts:790— targets.createSubagentCodeRouting.place has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 3 (8 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.
mime.sniffImageMimeType (cognitive 22) packages/api/src/files/mime.ts:60— mime.sniffImageMimeType has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
obo.resolveOboToken (cognitive 22) packages/api/src/mcp/oauth/obo.ts:293— obo.resolveOboToken has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 2 (4 pts), boolean chains 2, error handling 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.
MCPManager.getServerToolFunctionsSnapshot (cognitive 22) packages/api/src/mcp/MCPManager.ts:816— MCPManager.getServerToolFunctionsSnapshot has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 5, ternaries 2, error handling 1, loops 1 (nesting depth added 6). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
protection.collectSerializedFiles (cognitive 22) packages/api/src/shared-links/protection.ts:453— protection.collectSerializedFiles has cognitive complexity 22 (threshold 15). Drivers by points: loops 5 (10 pts), ternaries 2 (7 pts), if/else 2 (3 pts), boolean chains 2 (nesting depth added 11). Of this number, 17 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.
proxy.proxyRumRequest (cognitive 22) packages/api/src/rum/proxy.ts:220— proxy.proxyRumRequest has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 5 (9 pts), boolean chains 2, 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.
steer.collectAppliedSteerIds (cognitive 22) packages/chat/src/core/steer/steer.ts:28— steer.collectAppliedSteerIds has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts), boolean chains 2, ternaries 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.
Badge.Badge (cognitive 22) packages/client/src/components/Badge.tsx:27— Badge.Badge has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, ternaries 6 (8 pts), if/else 5 (nesting depth added 2). Of this number, 17 points are the body's own statements and 5 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.
SecretInput.SecretInput (cognitive 22) packages/client/src/components/SecretInput.tsx:35— SecretInput.SecretInput has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 12, ternaries 7, if/else 2, error handling 1. Of this number, 17 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.
RequestExecutor.execute (cognitive 22) packages/data-provider/src/actions.ts:306— RequestExecutor.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 4, boolean chains 3, loops 1 (2 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: 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.
azure.mapModelToAzureConfig (cognitive 22) packages/data-provider/src/azure.ts:138— azure.mapModelToAzureConfig has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 5, loops 1, 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.
vertex.processVertexModels (cognitive 22) packages/data-schemas/src/app/vertex.ts:69— vertex.processVertexModels has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (6 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.
resolution.mergeArrayByKey (cognitive 22) packages/data-schemas/src/app/resolution.ts:433— resolution.mergeArrayByKey has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3, 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.
userGroup.collectMemberIdsFromGroupUpdate (cognitive 22) packages/data-schemas/src/methods/userGroup.ts:111— userGroup.collectMemberIdsFromGroupUpdate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 6, loops 1 (nesting depth added 4). Of this number, 13 points are the body's own statements and 9 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.
share.advanceTargetToBranchTail (cognitive 22) packages/data-schemas/src/methods/share.ts:737— share.advanceTargetToBranchTail has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, loops 4 (nesting depth added 6). Of this number, 12 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.
share.createShareMethods.getSharedLinks (cognitive 22) packages/data-schemas/src/methods/share.ts:1101— share.createShareMethods.getSharedLinks has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 5 (7 pts), boolean chains 4, error handling 2 (3 pts) (nesting depth added 7). 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.
queuedTurn.createAgentQueuedTurnMethods.acquireLaneWriter (cognitive 22) packages/data-schemas/src/methods/queuedTurn.ts:883— queuedTurn.createAgentQueuedTurnMethods.acquireLaneWriter has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 3, loops 1 (nesting depth added 11). 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.
triggerDelivery.createAgentTriggerDeliveryMethods.retireAgentTriggerDelivery (cognitive 22) packages/data-schemas/src/methods/triggerDelivery.ts:2217— triggerDelivery.createAgentTriggerDeliveryMethods.retireAgentTriggerDelivery has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (8 pts), ternaries 2 (4 pts), error handling 1 (2 pts) (nesting depth added 5). Of this number, 13 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.
design.chosenByDisabled (cognitive 22) scripts/eslint/design.mjs:322— design.chosenByDisabled has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 9, 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.
createAgentHandler (cognitive 22) REDACTED:723— createAgentHandler has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 2, error handling 2, other 1, ternaries 1 (nesting depth added 4). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
callTool (cognitive 22) api/server/controllers/tools.js:110— callTool has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 4 (6 pts), boolean chains 3, loops 1, other 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.
getLogStores.clearExpiredFromCache (cognitive 21) api/cache/getLogStores.js:103— getLogStores.clearExpiredFromCache has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 5, 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.
messages.router.put("/:conversationId/:messageId") (cognitive 21) REDACTED:643— messages.router.put("/:conversationId/:messageId") has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, 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.
canAccessResource.canAccessResource (cognitive 21) api/server/middleware/accessResources/canAccessResource.js:35— canAccessResource.canAccessResource has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, error handling 2 (nesting depth added 2). 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 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.
convos.router.delete("/") (cognitive 21) REDACTED:509— convos.router.delete("/") has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11, boolean chains 6, error handling 2 (3 pts), ternaries 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.
useReplyWatcher.reconcileFirstPage (cognitive 21) client/src/hooks/Conversations/useReplyWatcher.ts:42— useReplyWatcher.reconcileFirstPage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10, boolean chains 6, ternaries 4 (5 pts) (nesting depth added 1). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 84, 55, 92, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useEndpoints.useEndpoints.mappedEndpoints (cognitive 21) client/src/hooks/Endpoint/useEndpoints.ts:123— useEndpoints.useEndpoints.mappedEndpoints has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 15, if/else 6. None of this is in the body itself: all 21 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.
VerifyEmail.RequestPasswordReset (cognitive 21) client/src/components/Auth/VerifyEmail.tsx:13— VerifyEmail.RequestPasswordReset has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (8 pts), ternaries 3 (4 pts) (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 literals inside it that branch (lines 87, 22, 23, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
FileRow.FileRow (cognitive 21) client/src/components/Chat/Input/Files/FileRow.tsx:21— FileRow.FileRow has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9, ternaries 5 (8 pts), boolean chains 4 (nesting depth added 3). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 127, 89, 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.
Ledger.Ledger::renderRow (cognitive 21) client/src/components/Chat/Trace/Ledger.tsx:433— Ledger.Ledger::renderRow has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 13, ternaries 5 (6 pts), if/else 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.
EndpointModelItem.EndpointModelItemComponent (cognitive 21) client/src/components/Chat/Menus/Endpoints/components/EndpointModelItem.tsx:33— EndpointModelItem.EndpointModelItemComponent has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, ternaries 7, if/else 5. 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: 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.
Header.Header (cognitive 21) client/src/components/Chat/Header.tsx:33— Header.Header has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 16, 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.
AssistantAvatar.Avatar (cognitive 21) client/src/components/SidePanel/Builder/AssistantAvatar.tsx:29— AssistantAvatar.Avatar has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, ternaries 2 (3 pts) (nesting depth added 3). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 5 function items inside it that branch (handleFileChange, a function literal at line 127, a function literal at line 64, …). 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.
useMCPServerForm.useMCPServerForm.onSubmit (cognitive 21) client/src/components/SidePanel/MCPBuilder/MCPServerDialog/hooks/useMCPServerForm.ts:185— useMCPServerForm.useMCPServerForm.onSubmit has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (9 pts), ternaries 2, 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.
MemoryPanel.MemoryPanel (cognitive 21) client/src/components/SidePanel/Memories/MemoryPanel.tsx:33— MemoryPanel.MemoryPanel has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (6 pts), ternaries 3 (4 pts), loops 1 (nesting depth added 2). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 94, 114, 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.
drafts.removeTabAttachmentPresence (cognitive 21) client/src/utils/drafts.ts:1030— drafts.removeTabAttachmentPresence has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, loops 2, ternaries 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.
json.extractJson (cognitive 21) client/src/utils/json.ts:18— json.extractJson has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 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.
migrate-prompt-permissions.migrateToPromptGroupPermissions (cognitive 21) config/migrate-prompt-permissions.js:23— migrate-prompt-permissions.migrateToPromptGroupPermissions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (4 pts), boolean chains 3, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 7). Of this number, 17 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.
InMemoryJobStore.claimParkedSteersDetailed (cognitive 21) packages/api/src/stream/implementations/InMemoryJobStore.ts:2437— InMemoryJobStore.claimParkedSteersDetailed has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (7 pts), error handling 1, loops 1, 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.
GenerationJobManagerClass.processDurableReplacementReceipts (cognitive 21) packages/api/src/stream/GenerationJobManager.ts:2126— GenerationJobManagerClass.processDurableReplacementReceipts has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (6 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.
GenerationJobManager.getPublishedProvenance (cognitive 21) packages/api/src/stream/GenerationJobManager.ts:396— GenerationJobManager.getPublishedProvenance has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 2 (4 pts), loops 3 (nesting depth added 5). Of this number, 16 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.
GenerationJobManager.getReplayStepId (cognitive 21) packages/api/src/stream/GenerationJobManager.ts:522— GenerationJobManager.getReplayStepId has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (13 pts), if/else 5, 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.
harvest.createBackgroundCodeResultHandler (cognitive 21) packages/api/src/agents/harvest.ts:306— harvest.createBackgroundCodeResultHandler has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 5 (7 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 6). None of this is in the body itself: all 21 points belong to one function literal inside it that branches (line 317). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
RedisSubagentTaskControlTransport.list (cognitive 21) packages/api/src/agents/subagentTaskRouting.ts:842— RedisSubagentTaskControlTransport.list has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (6 pts), boolean chains 1, 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.
skills.resolveAgentScopedSkillIds (cognitive 21) packages/api/src/agents/skills.ts:353— skills.resolveAgentScopedSkillIds has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 2 (5 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.
instructions.createRepositoryInstructionLoader (cognitive 21) packages/api/src/code/instructions.ts:47— instructions.createRepositoryInstructionLoader has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 5 (6 pts), boolean chains 3, error handling 1 (nesting depth added 4). None of this is in the body itself: all 21 points belong to one function literal inside it that branches (line 49). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
provenance.getUserSubmittedMessageFieldPathState (cognitive 21) packages/api/src/protection/provenance.ts:426— provenance.getUserSubmittedMessageFieldPathState has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, error handling 2, 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.
modelBoundContent.projectUserSubmittedPaths (cognitive 21) packages/api/src/middleware/modelBoundContent.ts:960— modelBoundContent.projectUserSubmittedPaths has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (5 pts), boolean chains 2, 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.
modelBoundContent.appendStoredMessageFileIds (cognitive 21) packages/api/src/middleware/modelBoundContent.ts:1499— modelBoundContent.appendStoredMessageFileIds has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 7, loops 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.
processing.createHostEditProcessor.apply (cognitive 21) packages/api/src/agents/files/processing.ts:59— processing.createHostEditProcessor.apply has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 2, error handling 2, ternaries 2, loops 1 (nesting depth added 1). 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 103, 153, 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.
handlers.detectToolInputSchemaKind (cognitive 21) packages/api/src/agents/handlers.ts:956— handlers.detectToolInputSchemaKind has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (11 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
handlers.handleCreateFileCall (cognitive 21) packages/api/src/agents/handlers.ts:4371— handlers.handleCreateFileCall has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 3, 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.
hookLoader.loadToolApprovalHooks (cognitive 21) REDACTED:67— hookLoader.loadToolApprovalHooks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (5 pts), boolean chains 3, loops 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.
SubagentThreadTaskStore.replayRetainedControl (cognitive 21) packages/api/src/agents/subagentThreads.ts:2278— SubagentThreadTaskStore.replayRetainedControl has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), error handling 3 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
context.extractMCPServers (cognitive 21) packages/api/src/agents/context.ts:26— context.extractMCPServers has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rebinding.collectBoundSecretLocations (cognitive 21) packages/api/src/app/rebinding.ts:1326— rebinding.collectBoundSecretLocations has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 5 (8 pts), ternaries 3 (nesting depth added 8). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ip.hasPrivateEmbeddedIPv4 (cognitive 21) packages/api/src/auth/ip.ts:69— ip.hasPrivateEmbeddedIPv4 has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 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.
session.createOpenIDSessionRefreshService.hydrateSessionFromResolvedTokens (cognitive 21) packages/api/src/auth/openid/session.ts:1771— session.createOpenIDSessionRefreshService.hydrateSessionFromResolvedTokens has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 7, ternaries 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.
http.createCodeEnvironmentHttpHandlers.remove (cognitive 21) packages/api/src/code/http.ts:1004— http.createCodeEnvironmentHttpHandlers.remove has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 4 (8 pts), boolean chains 1, error handling 1 (nesting depth added 7). 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.
priming.selectCodeFiles (cognitive 21) packages/api/src/files/code/priming.ts:102— priming.selectCodeFiles has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, ternaries 3, loops 2 (nesting depth added 4). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 143, 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.
MCPServersRegistry.deepEqual (cognitive 21) packages/api/src/mcp/registry/MCPServersRegistry.ts:156— MCPServersRegistry.deepEqual has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oidc.extractOpenIDTokenInfo (cognitive 21) REDACTED:176— oidc.extractOpenIDTokenInfo has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, error handling 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.
MCPConnection.fetchOrderedToolsSnapshot (cognitive 21) packages/api/src/mcp/connection.ts:3013— MCPConnection.fetchOrderedToolsSnapshot has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 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.
MCPManager.discoverServerTools (cognitive 21) packages/api/src/mcp/MCPManager.ts:605— MCPManager.discoverServerTools has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 7, if/else 7, ternaries 3 (4 pts), error handling 2 (3 pts) (nesting depth added 2). Of this number, 17 points are the body's own statements and 4 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.
defer.shouldDeferMCPOAuthSignIn (cognitive 21) packages/api/src/mcp/defer.ts:77— defer.shouldDeferMCPOAuthSignIn has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 7, 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.
authorization.completeMCPAuthorizationWithTokenWaiters (cognitive 21) packages/api/src/mcp/authorization.ts:63— authorization.completeMCPAuthorizationWithTokenWaiters has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 2 (5 pts), ternaries 1 (4 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.
protection.sanitizeInspectableEncodedValues (cognitive 21) packages/api/src/shared-links/protection.ts:1520— protection.sanitizeInspectableEncodedValues has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, ternaries 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.
protection.getBlockedMemoryFields (cognitive 21) packages/api/src/memory/protection.ts:45— protection.getBlockedMemoryFields has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (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.
handlers.createProjectHandlers.updateProject (cognitive 21) packages/api/src/projects/handlers.ts:238— handlers.createProjectHandlers.updateProject has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 2, ternaries 1 (2 pts), 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.
management.createSkillManagementHandlers.wrap (cognitive 21) packages/api/src/skills/management.ts:262— management.createSkillManagementHandlers.wrap has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 6, error handling 1, ternaries 1 (nesting depth added 5). None of this is in the body itself: all 21 points belong to one function literal inside it that branches (line 267). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
web.isCredentialUsable (cognitive 21) packages/api/src/web/web.ts:224— web.isCredentialUsable has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 8, 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.
promptCatalogSync.syncLangfusePromptCatalog (cognitive 21) packages/api/src/langfuse/promptCatalogSync.ts:80— promptCatalogSync.syncLangfusePromptCatalog has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), boolean chains 2, 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.
InputWithDropDown.InputWithDropdown (cognitive 21) packages/client/src/components/InputWithDropDown.tsx:16— InputWithDropDown.InputWithDropdown has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (6 pts), boolean chains 5, match/switch 1 (nesting depth added 5). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to 8 function items inside it that branch (handleKeyDown, handleSelect, a function literal at line 72, …). 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.
resolution.attributeIssue (cognitive 21) packages/data-schemas/src/app/resolution.ts:726— resolution.attributeIssue has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 3 (7 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parsers.redactErrorValue (cognitive 21) packages/data-schemas/src/config/parsers.ts:231— parsers.redactErrorValue has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 7, error handling 1 (2 pts), ternaries 1 (nesting depth added 5). None of this is in the body itself: all 21 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.
auditLog.buildFilter (cognitive 21) packages/data-schemas/src/methods/auditLog.ts:246— auditLog.buildFilter has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (15 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.
message.createMessageMethods.getMessagesForSubagentThreadView (cognitive 21) packages/data-schemas/src/methods/message.ts:2985— message.createMessageMethods.getMessagesForSubagentThreadView has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 6 (8 pts), loops 2, boolean chains 1, error handling 1 (nesting depth added 4). Of this number, 12 points are the body's own statements and 9 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.
queuedTurn.createAgentQueuedTurnMethods.ensureAgentQueuedTurnIndexes (cognitive 21) packages/data-schemas/src/methods/queuedTurn.ts:850— queuedTurn.createAgentQueuedTurnMethods.ensureAgentQueuedTurnIndexes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 1 (4 pts), boolean chains 3, error handling 1 (3 pts), loops 2 (3 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.
agent.operatorsMutateDocument (cognitive 21) packages/data-schemas/src/methods/agent.ts:816— agent.operatorsMutateDocument has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (5 pts), boolean chains 2, ternaries 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.
agent.createAgentMethods.getSharedResourceFileIds (cognitive 21) packages/data-schemas/src/methods/agent.ts:1843— agent.createAgentMethods.getSharedResourceFileIds has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (6 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.
useMemory (cognitive 21) api/server/controllers/agents/client.js:3305— useMemory has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9, boolean chains 6, error handling 3 (4 pts), ternaries 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.
PermissionsController.getResourcePermissions (cognitive 20) api/server/controllers/PermissionsController.js:244— PermissionsController.getResourcePermissions has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (6 pts), ternaries 2 (4 pts), 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.
AgentClient.buildMessages::prepareRuntimeAgent (cognitive 20) api/server/controllers/agents/client.js:3080— AgentClient.buildMessages::prepareRuntimeAgent has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 4 (7 pts), loops 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.
v1.blockFilteredAgentContent (cognitive 20) REDACTED:179— v1.blockFilteredAgentContent has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, error handling 2 (3 pts) (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.
chatV2.chatV2::getRequestFileIds (cognitive 20) REDACTED:294— chatV2.chatV2::getRequestFileIds has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useUpdateTagsInConvo.useUpdateTagsInConvo.replaceTagsInAllConversations (cognitive 20) client/src/hooks/Conversations/useUpdateTagsInConvo.ts:59— useUpdateTagsInConvo.useUpdateTagsInConvo.replaceTagsInAllConversations has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (8 pts), ternaries 2 (7 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 11). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 74, 65, 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.
usePastedTextEdit.usePastedTextEdit.saveEdit (cognitive 20) client/src/hooks/Files/usePastedTextEdit.ts:295— usePastedTextEdit.usePastedTextEdit.saveEdit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 6, ternaries 1 (nesting depth added 2). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
useHandleKeyUp.useHandleKeyUp (cognitive 20) client/src/hooks/Input/useHandleKeyUp.ts:54— useHandleKeyUp.useHandleKeyUp has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, boolean chains 6. None of this is in the body itself: all 20 points belong to 7 function literals inside it that branch (lines 170, 100, 109, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
DeploymentTheme.DeploymentTheme (cognitive 20) client/src/Providers/DeploymentTheme.tsx:234— DeploymentTheme.DeploymentTheme has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 13, if/else 4, ternaries 3. 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Card.TaskCard (cognitive 20) client/src/components/Chat/BackgroundTasks/Card.tsx:33— Card.TaskCard has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 14, ternaries 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.
Button.BackgroundTasksButton::jumpToTool (cognitive 20) client/src/components/Chat/BackgroundTasks/Button.tsx:92— Button.BackgroundTasksButton::jumpToTool has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 4, ternaries 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. This shape REPEATS in the file: one other method here (Button.BackgroundTasksButton) 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.
rail.useFoldPath (cognitive 20) client/src/components/Chat/Messages/Content/rail.tsx:522— rail.useFoldPath has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 5, loops 2, ternaries 1 (nesting depth added 1). None of this is in the body itself: all 20 points belong to 6 function literals inside it that branch (lines 587, 533, 523, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentHandoff.AgentHandoff (cognitive 20) client/src/components/Chat/Messages/Content/AgentHandoff.tsx:110— AgentHandoff.AgentHandoff has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, ternaries 5 (6 pts), if/else 3 (nesting depth added 1). Of this number, 11 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.
VirtualizedModelList.VirtualizedModelList (cognitive 20) client/src/components/Chat/Menus/Endpoints/components/VirtualizedModelList.tsx:41— VirtualizedModelList.VirtualizedModelList has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, ternaries 3 (nesting depth added 2). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 76, 70, 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.
ConvoOptions.ConvoOptions (cognitive 20) client/src/components/Conversations/ConvoOptions/ConvoOptions.tsx:27— ConvoOptions.ConvoOptions has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 7 (9 pts), boolean chains 8, if/else 3 (nesting depth added 2). Of this number, 14 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.
AgentHandoffs.AgentHandoffs (cognitive 20) client/src/components/SidePanel/Agents/Advanced/AgentHandoffs.tsx:33— AgentHandoffs.AgentHandoffs has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 13, if/else 4, ternaries 3. Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 135, a function literal at line 58, addHandoff, …). 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.
selectors.matchesMcpServer (cognitive 20) client/src/components/SidePanel/Agents/Tools/items/selectors.ts:107— selectors.matchesMcpServer has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, 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.
ToolsSection.ToolsSection (cognitive 20) client/src/components/SidePanel/Agents/Tools/ToolsSection.tsx:42— ToolsSection.ToolsSection has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, ternaries 3 (4 pts), match/switch 1 (nesting depth added 2). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 121, 245, 189, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.parseFrontmatter (cognitive 20) client/src/components/Skills/utils/frontmatter.ts:20— frontmatter.parseFrontmatter has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CreateSkillForm.CreateSkillForm (cognitive 20) client/src/components/Skills/forms/CreateSkillForm.tsx:63— CreateSkillForm.CreateSkillForm has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8, boolean chains 6, if/else 6. 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 166, a function literal at line 85, onSubmit, …). 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.
useAttachExisting.useAttachExisting (cognitive 20) client/src/hooks/Files/useAttachExisting.ts:50— useAttachExisting.useAttachExisting has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 3). None of this is in the body itself: all 20 points belong to one function literal inside it that branches (line 74). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
useBuildMessageTree.useBuildMessageTree::buildMessageTree (cognitive 20) client/src/hooks/Messages/useBuildMessageTree.ts:16— useBuildMessageTree.useBuildMessageTree::buildMessageTree has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (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.
secrets.getArraySecretInputError (cognitive 20) packages/api/src/admin/secrets.ts:1075— secrets.getArraySecretInputError 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.
GenerationJobManagerClass.notifyApprovalExpiredRuntime (cognitive 20) packages/api/src/stream/GenerationJobManager.ts:9265— GenerationJobManagerClass.notifyApprovalExpiredRuntime has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 2 (6 pts), loops 1 (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.
memory.createMemoryTool (cognitive 20) packages/api/src/agents/memory.ts:134— memory.createMemoryTool has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, ternaries 4, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 171). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
handlers.normalizeSkillMdContent (cognitive 20) packages/api/src/agents/handlers.ts:1614— handlers.normalizeSkillMdContent has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 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.
handlers.handleWorkspaceFileRead (cognitive 20) packages/api/src/agents/handlers.ts:2358— handlers.handleWorkspaceFileRead has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 6, boolean chains 2, 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.
handlers.mergeSandboxSessionArtifact (cognitive 20) packages/api/src/agents/handlers.ts:2699— handlers.mergeSandboxSessionArtifact has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
admission.collectApprovalAgents (cognitive 20) packages/api/src/agents/hitl/admission.ts:325— admission.collectApprovalAgents has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (8 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.
resume.resolveAskUserQuestionResume (cognitive 20) packages/api/src/agents/hitl/resume.ts:148— resume.resolveAskUserQuestionResume has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 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.
SubagentThreadTaskStore.controlResultFromReceipt (cognitive 20) packages/api/src/agents/subagentThreads.ts:881— SubagentThreadTaskStore.controlResultFromReceipt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8, ternaries 4 (8 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.
checks.checkCredentialDatabase (cognitive 20) packages/api/src/app/checks.ts:180— checks.checkCredentialDatabase has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 1, 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.
openidRoleSync.selectOpenIdRole (cognitive 20) packages/api/src/auth/openidRoleSync.ts:250— openidRoleSync.selectOpenIdRole has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, loops 2, ternaries 2 (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.
session.createOpenIDSessionRefreshService.publishCompletedFlightTokens (cognitive 20) packages/api/src/auth/openid/session.ts:1420— session.createOpenIDSessionRefreshService.publishCompletedFlightTokens has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (7 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.
localRefresh.createLocalRefreshHandler (cognitive 20) packages/api/src/auth/localRefresh.ts:87— localRefresh.createLocalRefreshHandler has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3, error handling 1, ternaries 1 (nesting depth added 4). None of this is in the body itself: all 20 points belong to one function literal inside it that branches (line 112). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
cloudfront-cookies.setCloudFrontCookies (cognitive 20) packages/api/src/cdn/cloudfront-cookies.ts:410— cloudfront-cookies.setCloudFrontCookies has cognitive complexity 20 (threshold 15). Drivers by points: loops 7 (10 pts), if/else 5 (7 pts), boolean chains 2, error handling 1 (nesting depth added 5). 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, 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.
lane.createLaneGitRecorder (cognitive 20) packages/api/src/code/lane.ts:79— lane.createLaneGitRecorder has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 9 (10 pts), boolean chains 4, error handling 3, if/else 3 (nesting depth added 1). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 5 function items inside it that branch (write, reserve, a function literal at line 180, …). 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.
inheritance.resolveSubagentCodeWorkspaceInheritance (cognitive 20) packages/api/src/code/inheritance.ts:104— inheritance.resolveSubagentCodeWorkspaceInheritance has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (7 pts), boolean chains 4 (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.
initialize.initializeAnthropic (cognitive 20) packages/api/src/endpoints/anthropic/initialize.ts:20— initialize.initializeAnthropic has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, 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.
speech.createSpeechChunkProcessor (cognitive 20) packages/api/src/files/speech.ts:33— speech.createSpeechChunkProcessor has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 7, ternaries 2 (nesting depth added 1). 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 57). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
MCPOAuthHandler.assertStoredClientBinding (cognitive 20) packages/api/src/mcp/oauth/handler.ts:511— MCPOAuthHandler.assertStoredClientBinding has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 7, ternaries 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.
utils.addRuntimeBodyPlaceholderFields (cognitive 20) packages/api/src/mcp/utils.ts:343— utils.addRuntimeBodyPlaceholderFields has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 4 (7 pts), ternaries 1 (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.
transform.createPiiTextTransformer.createSession.transform (cognitive 20) packages/api/src/protection/transform.ts:115— transform.createPiiTextTransformer.createSession.transform has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (5 pts), boolean chains 4, 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.
handlers.createSkillsHandlers.patch (cognitive 20) packages/api/src/skills/handlers.ts:538— handlers.createSkillsHandlers.patch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (16 pts), error handling 2, boolean chains 1, 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.
deletionService.createSkillDeletionService.startSkillDeletionSweep.sweepAbandonedIntents (cognitive 20) packages/api/src/skills/deletionService.ts:267— deletionService.createSkillDeletionService.startSkillDeletionSweep.sweepAbandonedIntents has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), error handling 4 (5 pts), loops 1 (nesting depth added 4). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 278, 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.
recoveryCli.runSkillUploadRecoveryCli (cognitive 20) packages/api/src/skills/recoveryCli.ts:39— recoveryCli.runSkillUploadRecoveryCli has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 7, 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.
crud.parseS3KeyParts (cognitive 20) packages/api/src/storage/s3/crud.ts:194— crud.parseS3KeyParts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (6 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.
conformance.helper.verifyAuthorizationFixture (cognitive 20) packages/api/src/schedules/authorization/conformance.helper.ts:13— conformance.helper.verifyAuthorizationFixture has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Summary.Summary (cognitive 20) packages/chat/src/components/Summary.tsx:202— Summary.Summary has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, if/else 7, ternaries 5. Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 241, 254, 214, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
settled.settleStart (cognitive 20) packages/chat/src/core/resumable/settled.ts:12— settled.settleStart has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 2 (3 pts), error handling 2, 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.
branch.collectAnchorSeries (cognitive 20) packages/chat/src/core/usage/branch.ts:207— branch.collectAnchorSeries has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 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.
Radio.Radio (cognitive 20) packages/client/src/components/Radio.tsx:38— Radio.Radio has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8, boolean chains 6, ternaries 6. Most of this is not in the body itself: 4 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 187, handleKeyDown, 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.
toolApprovalGrant.createToolApprovalGrantMethods::readGrants (cognitive 20) packages/data-schemas/src/methods/toolApprovalGrant.ts:42— toolApprovalGrant.createToolApprovalGrantMethods::readGrants has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3, ternaries 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.
aclEntry.createAclEntryMethods.replaceRoleBits (cognitive 20) packages/data-schemas/src/methods/aclEntry.ts:672— aclEntry.createAclEntryMethods.replaceRoleBits has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), ternaries 1 (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.
userGroup.createUserGroupMethods.searchPrincipals (cognitive 20) packages/data-schemas/src/methods/userGroup.ts:957— userGroup.createUserGroupMethods.searchPrincipals has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 6 (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.
message.createMessageMethods.recordSubagentTaskControlReceipt (cognitive 20) packages/data-schemas/src/methods/message.ts:2580— message.createMessageMethods.recordSubagentTaskControlReceipt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, ternaries 3 (4 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
message.createMessageMethods.listSubagentTasksForThreads (cognitive 20) packages/data-schemas/src/methods/message.ts:3837— message.createMessageMethods.listSubagentTasksForThreads has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 5 (7 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). Of this number, 16 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.
share.anonymizeMessages.messages (cognitive 20) packages/data-schemas/src/methods/share.ts:628— share.anonymizeMessages.messages has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 17, ternaries 3. 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
schedule.createScheduleMethods.createScheduleWithSlot (cognitive 20) packages/data-schemas/src/methods/schedule.ts:375— schedule.createScheduleMethods.createScheduleWithSlot has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 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.
triggerDelivery.createAgentTriggerDeliveryMethods.recoverAgentTriggerBatchReceipts (cognitive 20) packages/data-schemas/src/methods/triggerDelivery.ts:1953— triggerDelivery.createAgentTriggerDeliveryMethods.recoverAgentTriggerBatchReceipts has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 4 (6 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.
triggerDelivery.createAgentTriggerDeliveryMethods.settleAgentEventActorReceipt (cognitive 20) packages/data-schemas/src/methods/triggerDelivery.ts:3560— triggerDelivery.createAgentTriggerDeliveryMethods.settleAgentEventActorReceipt has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (5 pts), ternaries 3 (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.
createSamlCallback (cognitive 20) api/strategies/samlStrategy.js:191— createSamlCallback has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, error handling 1, other 1, ternaries 1 (nesting depth added 3). None of this is in the body itself: all 20 points belong to one function literal inside it that branches (line 192). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
BaseClient.mergeEditedContent (cognitive 19) api/app/clients/BaseClient.js:1641— BaseClient.mergeEditedContent has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, if/else 6, ternaries 1. 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.
BaseClient.addPreviousAttachments::processMessage (cognitive 19) api/app/clients/BaseClient.js:2017— BaseClient.addPreviousAttachments::processMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (BaseClient.addPreviousAttachments) 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.
formatMessages.formatMessage (cognitive 19) api/app/clients/prompts/formatMessages.js:50— formatMessages.formatMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 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.
connect.connectDb (cognitive 19) api/db/connect.js:43— connect.connectDb 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.
process.retrieveAndProcessFile (cognitive 19) api/server/services/Files/process.js:1578— process.retrieveAndProcessFile has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 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.
requireJwtAuth.requireJwtAuth (cognitive 19) api/server/middleware/requireJwtAuth.js:98— requireJwtAuth.requireJwtAuth has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts), ternaries 1 (nesting depth added 2). None of this is in the body itself: all 19 points belong to 4 function items inside it that branch (a function literal at line 176, logAuthenticationFailure, logFallbackSuccess, …). 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.
useCodeApprovalMode.collectReachableAgents (cognitive 19) client/src/hooks/Agents/useCodeApprovalMode.ts:230— useCodeApprovalMode.collectReachableAgents has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 3 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useTokenUsage.useTokenUsage (cognitive 19) client/src/hooks/Chat/useTokenUsage.ts:47— useTokenUsage.useTokenUsage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, ternaries 3 (nesting depth added 1). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 133, 153, 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.
useUnseenConversations.useUnseenConversations (cognitive 19) client/src/hooks/Conversations/useUnseenConversations.ts:289— useUnseenConversations.useUnseenConversations has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, loops 1, ternaries 1 (nesting depth added 5). None of this is in the body itself: all 19 points belong to 3 function literals inside it that branch (lines 318, 300, 297). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
descriptionMorph.measureWords (cognitive 19) client/src/components/Agents/descriptionMorph.ts:54— descriptionMorph.measureWords has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, loops 3 (nesting depth added 7). Of this number, 14 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.
parseJsonField.unescapeJsonString (cognitive 19) REDACTED:56— parseJsonField.unescapeJsonString has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 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.
ExecuteCode.ExecuteCode (cognitive 19) client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx:61— ExecuteCode.ExecuteCode has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 14, ternaries 4 (5 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.
MemoryCall.MemoryCall (cognitive 19) client/src/components/Chat/Messages/Content/Parts/MemoryCall.tsx:27— MemoryCall.MemoryCall has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 13, if/else 3 (4 pts), loops 1, ternaries 1 (nesting depth added 1). 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.
ActivityPhaseGroup.LivePhaseHeader (cognitive 19) client/src/components/Chat/Messages/Content/ActivityPhaseGroup.tsx:278— ActivityPhaseGroup.LivePhaseHeader has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8 (9 pts), boolean chains 7, if/else 3 (nesting depth added 1). Of this number, 14 points are the body's own statements and 5 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.
RetrievalCall.RetrievalCall (cognitive 19) client/src/components/Chat/Messages/Content/RetrievalCall.tsx:334— RetrievalCall.RetrievalCall has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 7, ternaries 4. Of this number, 10 points are the body's own statements and 9 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.
MessageRender.MessageRender (cognitive 19) client/src/components/Chat/Messages/ui/MessageRender.tsx:78— MessageRender.MessageRender has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 15, ternaries 3, if/else 1. 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Reasoning.ReasoningControl (cognitive 19) client/src/components/Chat/Input/Reasoning.tsx:48— Reasoning.ReasoningControl has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8 (10 pts), if/else 6, boolean chains 3 (nesting depth added 2). Of this number, 14 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.
Viewer.Viewer::renderBody (cognitive 19) client/src/components/Chat/Trace/Viewer.tsx:369— Viewer.Viewer::renderBody has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 15, if/else 3, 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.
SearchResults.SearchResults (cognitive 19) client/src/components/Chat/Menus/Endpoints/components/SearchResults.tsx:175— SearchResults.SearchResults has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, ternaries 4 (6 pts), if/else 4 (nesting depth added 2). 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 213, 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.
SortFilterHeader.SortFilterHeader (cognitive 19) client/src/components/Chat/Input/Files/Table/SortFilterHeader.tsx:19— SortFilterHeader.SortFilterHeader has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 5 (8 pts), boolean chains 3 (nesting depth added 4). 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 48, 118, 31). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
DataTable.DataTable (cognitive 19) client/src/components/Chat/Input/Files/Table/DataTable.tsx:60— DataTable.DataTable has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8 (10 pts), boolean chains 6, if/else 2 (3 pts) (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 4 function literals inside it that branch (lines 174, 204, 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.
state.storedControlState (cognitive 19) client/src/components/Chat/Subagents/state.ts:373— state.storedControlState has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, ternaries 4, 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.
ShareButton.ShareButton (cognitive 19) client/src/components/Conversations/ConvoOptions/ShareButton.tsx:33— ShareButton.ShareButton has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 4, if/else 4 (nesting depth added 2). 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, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
span.freeSpan (cognitive 19) client/src/components/Lia/engine/span.ts:6— span.freeSpan has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 8). 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.
PasskeyItem.PasskeyItem (cognitive 19) client/src/components/Nav/SettingsTabs/Account/Passkeys/PasskeyItem.tsx:62— PasskeyItem.PasskeyItem has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 6, ternaries 3 (4 pts) (nesting depth added 1). 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, 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.
Passkeys.Passkeys (cognitive 19) client/src/components/Nav/SettingsTabs/Account/Passkeys/Passkeys.tsx:38— Passkeys.Passkeys has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (6 pts), ternaries 2, error handling 1 (nesting depth added 1). 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.
MemoryCreateDialog.MemoryCreateDialog (cognitive 19) client/src/components/SidePanel/Memories/MemoryCreateDialog.tsx:25— MemoryCreateDialog.MemoryCreateDialog has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (6 pts), ternaries 3 (nesting depth added 1). 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
retention.estimatePayloadBytes (cognitive 19) client/src/data-provider/Messages/retention.ts:74— retention.estimatePayloadBytes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 1 (3 pts), loops 2, boolean chains 1 (nesting depth added 8). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
approval.parseAskUserQuestionsArgs (cognitive 19) client/src/utils/approval.ts:87— approval.parseAskUserQuestionsArgs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, ternaries 2 (3 pts), error handling 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.
files.validateFiles (cognitive 19) client/src/utils/files.ts:430— files.validateFiles has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 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.
convos.groupConversations (cognitive 19) client/src/utils/convos.ts:136— convos.groupConversations has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 4 (5 pts), boolean chains 3 (nesting depth added 2). 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 154, 191, 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.
messages.getLatestText (cognitive 19) client/src/utils/messages.ts:144— messages.getLatestText has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, 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.
flush-cache.flushFileCache (cognitive 19) config/flush-cache.js:228— flush-cache.flushFileCache has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 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.
runtime.createInspector.inspectFragment (cognitive 19) packages/api/src/protection/runtime.ts:321— runtime.createInspector.inspectFragment has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (17 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.
auditLog.createAdminAuditLogHandlers.exportAuditLogCsv (cognitive 19) packages/api/src/admin/auditLog.ts:418— auditLog.createAdminAuditLogHandlers.exportAuditLogCsv has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (18 pts), error handling 1 (nesting depth added 5). Of this number, 14 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.
config.filterInterfaceOverride (cognitive 19) packages/api/src/admin/config.ts:575— config.filterInterfaceOverride has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts), 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.
config.readRenames (cognitive 19) packages/api/src/admin/config.ts:1563— config.readRenames has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, 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.
langfuse.createAdminLangfuseHandlers.testConnection (cognitive 19) packages/api/src/admin/langfuse.ts:687— langfuse.createAdminLangfuseHandlers.testConnection has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 4, 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.
subagentActivity.createActivityWriter.send (cognitive 19) packages/api/src/agents/subagentActivity.ts:526— subagentActivity.createActivityWriter.send has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, 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.
InMemoryJobStore.enqueueSteerWithReceipt (cognitive 19) packages/api/src/stream/implementations/InMemoryJobStore.ts:1937— InMemoryJobStore.enqueueSteerWithReceipt has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 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.
InMemoryJobStore.discardSteerLeftover (cognitive 19) packages/api/src/stream/implementations/InMemoryJobStore.ts:2535— InMemoryJobStore.discardSteerLeftover has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (8 pts), error handling 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.
view.renderDigest (cognitive 19) packages/api/src/agents/digest/view.ts:656— view.renderDigest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 5 (7 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.
subagentTaskRouting.parseRequest (cognitive 19) packages/api/src/agents/subagentTaskRouting.ts:566— subagentTaskRouting.parseRequest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, 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.
background.getBackgroundCodeDelivery (cognitive 19) packages/api/src/agents/background.ts:3287— background.getBackgroundCodeDelivery has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (13 pts), boolean chains 4, 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.
skills.resolveSkillCatalog (cognitive 19) packages/api/src/agents/skills.ts:527— skills.resolveSkillCatalog has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 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.
linked.createLinkedInstructionsResolver::resolve (cognitive 19) packages/api/src/agents/instructions/linked.ts:320— linked.createLinkedInstructionsResolver::resolve has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 2 (5 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bridge.validWorkspaceCapabilities (cognitive 19) packages/api/src/code/bridge.ts:286— bridge.validWorkspaceCapabilities has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 15, if/else 4. Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 307, 312). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
modelBoundContent.getStoredProviderContributionState (cognitive 19) packages/api/src/middleware/modelBoundContent.ts:2392— modelBoundContent.getStoredProviderContributionState has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 3 (7 pts), loops 1 (2 pts), ternaries 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.
modelBoundContent.createModelBoundChatModelCallback (cognitive 19) packages/api/src/middleware/modelBoundContent.ts:3244— modelBoundContent.createModelBoundChatModelCallback has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (3 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 8). 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 3278). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
skillFiles.primeInvokedSkillsForProfiles (cognitive 19) packages/api/src/agents/skillFiles.ts:1003— skillFiles.primeInvokedSkillsForProfiles has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (5 pts), boolean chains 3, 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.
admission.unresolvedHookSpellings (cognitive 19) packages/api/src/agents/hitl/admission.ts:177— admission.unresolvedHookSpellings has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 4 (6 pts), boolean chains 3, ternaries 2 (nesting depth added 5). Of this number, 10 points are the body's own statements and 9 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.
protection.getResumeCheckpointContent (cognitive 19) packages/api/src/agents/hitl/protection.ts:326— protection.getResumeCheckpointContent has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 9). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 348, 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.
envelope.parseAgentTriggerEnvelope (cognitive 19) packages/api/src/agents/triggers/envelope.ts:332— envelope.parseAgentTriggerEnvelope has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 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.
pruning.historicalActorReferences (cognitive 19) packages/api/src/agents/checkpoints/pruning.ts:44— pruning.historicalActorReferences has cognitive complexity 19 (threshold 15). Drivers by points: if/else 2 (8 pts), loops 3 (6 pts), ternaries 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.
guard.createSubagentThreadTurnGuard (cognitive 19) packages/api/src/agents/guard.ts:151— guard.createSubagentThreadTurnGuard has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, ternaries 4, error handling 1 (nesting depth added 2). None of this is in the body itself: all 19 points belong to one function literal inside it that branches (line 152). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into 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.convertOcrToContextInPlace (cognitive 19) packages/api/src/agents/legacy.ts:11— legacy.convertOcrToContextInPlace has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4 (nesting depth added 8). 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, 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.
view.createParentSubagentIndexHandler (cognitive 19) packages/api/src/agents/view.ts:490— view.createParentSubagentIndexHandler has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8, if/else 4 (5 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 1). None of this is in the body itself: all 19 points belong to 3 function literals inside it that branch (lines 491, 538, 520). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
metrics.createMetrics.metricsMiddleware (cognitive 19) REDACTED:948— metrics.createMetrics.metricsMiddleware has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, ternaries 2 (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 4 function items inside it that branch (complete, markSSEStream, a function literal at line 966, …). 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.
handlers.createPasskeyHandlers.authenticatePasskey (cognitive 19) packages/api/src/auth/passkey/handlers.ts:602— handlers.createPasskeyHandlers.authenticatePasskey has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, boolean chains 4, 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.
session.createOpenIDSessionRefreshService.publishResolvedSessionTokens (cognitive 19) packages/api/src/auth/openid/session.ts:1221— session.createOpenIDSessionRefreshService.publishResolvedSessionTokens has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 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.
config.mergeAccessibleCodeEnvironments (cognitive 19) packages/api/src/code/config.ts:127— config.mergeAccessibleCodeEnvironments has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (6 pts), ternaries 2, error handling 1 (nesting depth added 1). Of this number, 11 points are the body's own statements and 8 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.
attachments.importOne (cognitive 19) packages/api/src/code/attachments.ts:482— attachments.importOne has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (4 pts), error handling 2 (3 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.
rename.createRenameConversationHandler (cognitive 19) packages/api/src/conversations/rename.ts:40— rename.createRenameConversationHandler has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, error handling 1, ternaries 1 (nesting depth added 2). None of this is in the body itself: all 19 points belong 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.
process.processCodeOutput::writeOutput (cognitive 19) packages/api/src/files/code/process.ts:312— process.processCodeOutput::writeOutput has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 6 (9 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. This shape REPEATS in the file: one other method here (process.processCodeOutput) 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.
process.processCodeOutput (cognitive 19) packages/api/src/files/code/process.ts:118— process.processCodeOutput has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16 (21 pts), ternaries 9 (13 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 (process.processCodeOutput::writeOutput) 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.
env.processUserPlaceholders (cognitive 19) packages/api/src/utils/env.ts:204— env.processUserPlaceholders has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, 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.
recovery.loadMCPServerCatalogs (cognitive 19) packages/api/src/mcp/catalog/recovery.ts:1050— recovery.loadMCPServerCatalogs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 3 (5 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 7). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MCPConnection.refreshChangedTools (cognitive 19) packages/api/src/mcp/connection.ts:2217— MCPConnection.refreshChangedTools has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 4, 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.
MCPConnection.isConnected (cognitive 19) packages/api/src/mcp/connection.ts:3154— MCPConnection.isConnected has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
code.withCodeApiRateLimit (cognitive 19) packages/api/src/utils/code.ts:275— code.withCodeApiRateLimit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), ternaries 1 (3 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 11). 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.
content.compactContentParts (cognitive 19) packages/api/src/utils/content.ts:77— content.compactContentParts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, ternaries 2 (4 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.
utils.resolveLangfuseHeaders (cognitive 19) packages/api/src/langfuse/utils.ts:157— utils.resolveLangfuseHeaders has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2, 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.
access.createSharedLinkAccessMiddleware (cognitive 19) REDACTED:44— access.createSharedLinkAccessMiddleware has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (16 pts), ternaries 2, boolean chains 1 (nesting depth added 3). None of this is in the body itself: all 19 points belong to 3 function literals inside it that branch (lines 113, 55, 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.
run.createScheduledMCPRunPolicy.registerGraph (cognitive 19) packages/api/src/schedules/authorization/run.ts:47— run.createScheduledMCPRunPolicy.registerGraph has cognitive complexity 19 (threshold 15). Drivers by points: loops 3 (6 pts), ternaries 3 (6 pts), if/else 2 (5 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.
steer.insertQueuedOrigin (cognitive 19) packages/chat/src/core/steer/steer.ts:264— steer.insertQueuedOrigin has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 6). 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.
useSteering.useSteering (cognitive 19) packages/chat/src/react/steering/useSteering.ts:130— useSteering.useSteering has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, ternaries 4, if/else 3. 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
useSteerEscalate.useSteerEscalate (cognitive 19) packages/chat/src/react/steering/useSteerEscalate.ts:47— useSteerEscalate.useSteerEscalate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (5 pts), boolean chains 3, error handling 1 (nesting depth added 4). None of this is in the body itself: all 19 points belong to 4 function literals inside it that branch (lines 88, 71, 96, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
langchain.stripLangChainTroubleshootingUrl (cognitive 19) packages/data-provider/src/langchain.ts:62— langchain.stripLangChainTroubleshootingUrl has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (7 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.
resolution.findShapeIssues (cognitive 19) packages/data-schemas/src/app/resolution.ts:1061— resolution.findShapeIssues has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, if/else 7, ternaries 3 (5 pts) (nesting depth added 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, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
resolution.startLayerTrack (cognitive 19) packages/data-schemas/src/app/resolution.ts:2160— resolution.startLayerTrack has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (5 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
retry.retryWithBackoff (cognitive 19) packages/data-schemas/src/utils/retry.ts:27— retry.retryWithBackoff has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (7 pts), ternaries 2 (7 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.
message.createMessageMethods.parseBackgroundToolResults (cognitive 19) packages/data-schemas/src/methods/message.ts:1985— message.createMessageMethods.parseBackgroundToolResults has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 4 (7 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.
triggerDelivery.createAgentTriggerDeliveryMethods.recoverAgentTriggerUserPurges (cognitive 19) packages/data-schemas/src/methods/triggerDelivery.ts:4872— triggerDelivery.createAgentTriggerDeliveryMethods.recoverAgentTriggerUserPurges has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
checks.checkLabel (cognitive 19) scripts/activity-labels/checks.mts:112— checks.checkLabel has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, loops 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.
static-checks.introducedWithinAllowance (cognitive 19) scripts/static-checks.mts:1405— static-checks.introducedWithinAllowance has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 3 (4 pts), boolean chains 3, error handling 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 5). 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.
main.loadConfig (cognitive 19) otel/langfuse-fanout/cmd/langfuse-fanout/main.go:168— main.loadConfig has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
generateActivityLabelViaRun (cognitive 19) api/server/controllers/agents/client.js:1304— generateActivityLabelViaRun has cognitive complexity 19 (threshold 15). Drivers by points: other 7, boolean chains 4, ternaries 4, if/else 3, error handling 1. Of this number, 10 points are the body's own statements and 9 belong to 6 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.
getEventActorContext (cognitive 19) api/server/controllers/agents/client.js:2237— getEventActorContext has cognitive complexity 19 (threshold 15). Drivers by points: other 7, ternaries 5, if/else 2 (3 pts), loops 3, 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.
processFileUpload (cognitive 19) api/server/services/Files/process.js:629— processFileUpload has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 5, other 5, ternaries 5, if/else 4. 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, 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.
filterFile (cognitive 19) api/server/services/Files/process.js:1780— filterFile has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, boolean chains 4, ternaries 3 (4 pts), other 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.
getPreparedCodeOutputBuffer (cognitive 19) api/server/services/Files/Code/process.js:157— getPreparedCodeOutputBuffer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 7, loops 1, other 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.
indexSync (cognitive 19) api/db/indexSync.js:359— indexSync has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 2 (4 pts), boolean chains 2 (nesting depth added 6). Of this number, 12 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.
AgentClient.finalizeSubagentContent (cognitive 18) api/server/controllers/agents/client.js:804— AgentClient.finalizeSubagentContent has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, error handling 1 (2 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.
oauth.createOAuthHandler (cognitive 18) api/server/controllers/auth/oauth.js:21— oauth.createOAuthHandler has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, error handling 1 (nesting depth added 4). None of this is in the body itself: all 18 points belong 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.
STTService.processSpeechToText (cognitive 18) api/server/services/Files/Audio/STTService.js:348— STTService.processSpeechToText has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, error handling 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.
memories.router.post("/") (cognitive 18) api/server/routes/memories.js:180— memories.router.post("/") has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, error handling 1 (nesting depth added 2). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
initialize.initializeClient (cognitive 18) api/server/services/Endpoints/azureAssistants/initialize.js:50— initialize.initializeClient has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, ternaries 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.
handle.waitForRun (cognitive 18) api/server/services/Runs/handle.js:61— handle.waitForRun has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ToolService.loadToolDefinitionsWrapper::getActionToolDefinitions (cognitive 18) api/server/services/ToolService.js:1322— ToolService.loadToolDefinitionsWrapper::getActionToolDefinitions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, loops 2 (3 pts), 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.
credentials.loadAuthValues::findAuthValue (cognitive 18) api/server/services/Tools/credentials.js:28— credentials.loadAuthValues::findAuthValue has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 5, 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.
useDefaultConvo.useDefaultConvo (cognitive 18) client/src/hooks/Conversations/useDefaultConvo.ts:26— useDefaultConvo.useDefaultConvo has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). None of this is in the body itself: all 18 points belong 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.
AgentPanelContext.AgentPanelProvider (cognitive 18) client/src/Providers/AgentPanelContext.tsx:36— AgentPanelContext.AgentPanelProvider has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 3 (4 pts), loops 2 (3 pts) (nesting depth added 2). 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 101, 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.
ErrorDisplay.ErrorDisplay::getErrorInfo (cognitive 18) client/src/components/Agents/ErrorDisplay.tsx:133— ErrorDisplay.ErrorDisplay::getErrorInfo has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), 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.
undockedWindow.mirrorDocumentStyles (cognitive 18) client/src/components/Artifacts/undockedWindow.ts:353— undockedWindow.mirrorDocumentStyles has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 4 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 5). None of this is in the body itself: all 18 points belong to 3 function items inside it that branch (sync, a function literal at line 396, 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.
useTasks.useBackgroundTasks.stopRows (cognitive 18) client/src/components/Chat/BackgroundTasks/useTasks.ts:193— useTasks.useBackgroundTasks.stopRows has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 5, if/else 5, ternaries 4, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 2). Of this number, 9 points are the body's own statements and 9 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.
Button.BackgroundTasksButton (cognitive 18) client/src/components/Chat/BackgroundTasks/Button.tsx:22— Button.BackgroundTasksButton has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 27, if/else 17 (20 pts), ternaries 6 (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 (Button.BackgroundTasksButton::jumpToTool) 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.
ApprovalContext.ApprovalStateProvider (cognitive 18) client/src/components/Chat/Messages/Content/ApprovalContext.tsx:170— ApprovalContext.ApprovalStateProvider has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 1). None of this is in the body itself: all 18 points belong to 8 function literals inside it that branch (lines 232, 320, 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.
background.parseBackgroundTaskOutput (cognitive 18) client/src/components/Chat/Messages/Content/Parts/background.ts:264— background.parseBackgroundTaskOutput has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, 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.
MessagesView.MessagesViewContent (cognitive 18) client/src/components/Chat/Messages/MessagesView.tsx:28— MessagesView.MessagesViewContent has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, ternaries 4 (5 pts), if/else 3 (nesting depth added 1). Of this number, 11 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.
Files.FileGrid (cognitive 18) client/src/components/Chat/Input/Composer/Files.tsx:204— Files.FileGrid has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 6, ternaries 2. Most of this is not in the body itself: 4 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 268, a function literal at line 228, a function literal at line 262, …). 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.
SearchContent.SearchContent (cognitive 18) client/src/components/Chat/Messages/Content/SearchContent.tsx:30— SearchContent.SearchContent has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 6, if/else 4 (6 pts), ternaries 3 (6 pts) (nesting depth added 5). 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 57). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
EventSubagentActivityGroup.EventSubagentRows (cognitive 18) client/src/components/Chat/Subagents/EventSubagentActivityGroup.tsx:85— EventSubagentActivityGroup.EventSubagentRows has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, ternaries 6, if/else 4 (5 pts) (nesting depth added 1). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 179, 122, 118, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.PendingToolApprovalPanel (cognitive 18) client/src/components/Chat/approval/Review.tsx:56— Review.PendingToolApprovalPanel has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 4, ternaries 4. Of this number, 9 points are the body's own statements and 9 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.
PinnedSection.DraggablePinnedRow (cognitive 18) client/src/components/Conversations/PinnedSection.tsx:99— PinnedSection.DraggablePinnedRow has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 6, if/else 6, ternaries 6. Of this number, 9 points are the body's own statements and 9 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.
Google.GoogleSettings (cognitive 18) client/src/components/Endpoints/Settings/Google.tsx:14— Google.GoogleSettings has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, loops 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 3 function items inside it that branch (a function literal at line 57, renderComponent, a function literal at line 22). 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.
ModelError.ModelError (cognitive 18) client/src/components/Messages/Content/Error/ModelError.tsx:22— ModelError.ModelError has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 5 (6 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.
SharedLinks.SharedLinks (cognitive 18) client/src/components/Nav/SettingsTabs/Data/SharedLinks.tsx:41— SharedLinks.SharedLinks has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6, boolean chains 5, if/else 5, error handling 1, loops 1. Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 98, 137, 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.
AgentConfig.AgentConfig (cognitive 18) client/src/components/SidePanel/Agents/AgentConfig.tsx:21— AgentConfig.AgentConfig has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, ternaries 8. Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 192, 225, 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.
AgentPanel.composeAgentUpdatePayload (cognitive 18) client/src/components/SidePanel/Agents/AgentPanel.tsx:138— AgentPanel.composeAgentUpdatePayload has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 10, boolean chains 6, 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.
Panel.Parameters (cognitive 18) client/src/components/SidePanel/Parameters/Panel.tsx:27— Panel.Parameters has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 5, ternaries 3. Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 102, 53, 93, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
mutations.useConversationTagMutation (cognitive 18) client/src/data-provider/mutations.ts:1181— mutations.useConversationTagMutation has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, ternaries 2 (3 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 4 function items inside it that branch (onMutationSuccess, a function literal at line 1194, a function literal at line 1236, …). 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.
useAskAnswerMode.useAskAnswerMode.handleComposerKeyDown (cognitive 18) client/src/hooks/Input/useAskAnswerMode.ts:522— useAskAnswerMode.useAskAnswerMode.handleComposerKeyDown has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 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.
bootstrap.installRumBootstrap (cognitive 18) client/src/lib/rum/bootstrap.js:24— bootstrap.installRumBootstrap has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (6 pts), error handling 3, ternaries 1 (2 pts) (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 8 function items inside it that branch (enqueueRumEvent, persistRumQueue, 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.
files.isProviderAttachType (cognitive 18) client/src/utils/files.ts:532— files.isProviderAttachType has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (8 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.
drafts.findAnchoredInsertStart (cognitive 18) client/src/utils/drafts.ts:147— drafts.findAnchoredInsertStart has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 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.
drafts.registerComposerDraft (cognitive 18) client/src/utils/drafts.ts:373— drafts.registerComposerDraft has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (8 pts), ternaries 2 (nesting depth added 2). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
messages.isSameStreamedPart (cognitive 18) client/src/utils/messages.ts:237— messages.isSameStreamedPart has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 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.
richtext.serializeNode (cognitive 18) REDACTED:288— richtext.serializeNode has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 1 (2 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
AccessControlService.grantPermission (cognitive 18) packages/api/src/acl/accessControlService.ts:129— AccessControlService.grantPermission has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, ternaries 1 (2 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.
config.createAdminConfigHandlers.toggleConfig (cognitive 18) packages/api/src/admin/config.ts:5028— config.createAdminConfigHandlers.toggleConfig has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, error handling 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.
InMemoryJobStore.consumeParkedSteer (cognitive 18) packages/api/src/stream/implementations/InMemoryJobStore.ts:2795— InMemoryJobStore.consumeParkedSteer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, error handling 1 (nesting depth added 1). 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: 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.
GenerationJobManagerClass.recoverStaleTerminalPersistence (cognitive 18) packages/api/src/stream/GenerationJobManager.ts:1406— GenerationJobManagerClass.recoverStaleTerminalPersistence has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, error handling 1, ternaries 1 (nesting depth added 4). 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.
GenerationJobManagerClass.getOrCreateRuntimeState (cognitive 18) packages/api/src/stream/GenerationJobManager.ts:3213— GenerationJobManagerClass.getOrCreateRuntimeState has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, error handling 1 (2 pts), ternaries 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.
settled.waitForGenerationSettled (cognitive 18) packages/api/src/stream/settled.ts:28— settled.waitForGenerationSettled has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 3, error handling 1 (nesting depth added 1). 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 60, 41, 51, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tree.activityTreeFromProjection (cognitive 18) packages/api/src/agents/digest/tree.ts:464— tree.activityTreeFromProjection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (5 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ActivityRecorder.record (cognitive 18) packages/api/src/agents/digest/recorder.ts:127— ActivityRecorder.record has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (6 pts), loops 1 (2 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.
usage.recordCollectedUsage::processUsageGroup (cognitive 18) packages/api/src/agents/usage.ts:945— usage.recordCollectedUsage::processUsageGroup has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 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. This shape REPEATS in the file: one other method here (usage.recordCollectedUsage) 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.
orphans.normalizeToolResourceFiles (cognitive 18) packages/api/src/agents/orphans.ts:48— orphans.normalizeToolResourceFiles has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), ternaries 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.
provenance.isEffectiveUserSubmittedPath (cognitive 18) packages/api/src/protection/provenance.ts:154— provenance.isEffectiveUserSubmittedPath has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 7, loops 1, 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.
modelBoundContent.projectModelBoundSourceFiles::appendResolvedFiles (cognitive 18) packages/api/src/middleware/modelBoundContent.ts:615— modelBoundContent.projectModelBoundSourceFiles::appendResolvedFiles has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (3 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 (modelBoundContent.projectModelBoundSourceFiles) 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.
modelBoundContent.getStoredSubmittedPathState (cognitive 18) packages/api/src/middleware/modelBoundContent.ts:2311— modelBoundContent.getStoredSubmittedPathState has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 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.
modelBoundContent.createModelBoundProviderContentIndex (cognitive 18) packages/api/src/middleware/modelBoundContent.ts:2693— modelBoundContent.createModelBoundProviderContentIndex has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (7 pts), error handling 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.
runtime.buildHITLRunWiring (cognitive 18) packages/api/src/agents/hitl/runtime.ts:59— runtime.buildHITLRunWiring has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 9). 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 134). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
answers.collectRetainedAnswers (cognitive 18) packages/api/src/agents/hitl/answers.ts:203— answers.collectRetainedAnswers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 8). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compaction.settleExistingRowsBeforeErrorTurn (cognitive 18) packages/api/src/agents/compaction.ts:497— compaction.settleExistingRowsBeforeErrorTurn has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, ternaries 2 (3 pts) (nesting depth added 4). 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, split the body into named stages: move each independent 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.stampSteerPartMedia (cognitive 18) packages/api/src/agents/steering/media.ts:232— media.stampSteerPartMedia has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, ternaries 2 (3 pts), error handling 1 (nesting depth added 5). Of this number, 9 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.
engine.createAgentTriggerDeliveryEngine.runClaimPass (cognitive 18) packages/api/src/agents/triggers/engine.ts:677— engine.createAgentTriggerDeliveryEngine.runClaimPass has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (nesting depth added 5). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rebinding.findCustomEndpointDrops (cognitive 18) packages/api/src/app/rebinding.ts:606— rebinding.findCustomEndpointDrops has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (4 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.
googleRefresh.resolveAdminUser (cognitive 18) packages/api/src/auth/googleRefresh.ts:179— googleRefresh.resolveAdminUser has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, 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.
cloudfront.initializeCloudFront (cognitive 18) packages/api/src/cdn/cloudfront.ts:12— cloudfront.initializeCloudFront has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
responses.getResponsesApiRouting (cognitive 18) packages/api/src/endpoints/config/responses.ts:17— responses.getResponsesApiRouting has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MCPTokenStorage.adoptRotatedTokens (cognitive 18) packages/api/src/mcp/oauth/tokens.ts:1509— MCPTokenStorage.adoptRotatedTokens has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 13, 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.
errors.extractSSEErrorMessage (cognitive 18) packages/api/src/mcp/errors.ts:145— errors.extractSSEErrorMessage has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 8, 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.
oidc.processOpenIDPlaceholders (cognitive 18) REDACTED:269— oidc.processOpenIDPlaceholders has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (7 pts), match/switch 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.
MCPConnectionFactory.connectTo (cognitive 18) packages/api/src/mcp/MCPConnectionFactory.ts:2270— MCPConnectionFactory.connectTo 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.
error.ErrorController (cognitive 18) packages/api/src/middleware/error.ts:61— error.ErrorController has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 7, 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.
bearer.createScheduledMCPBearerHeaderResolver (cognitive 18) packages/api/src/schedules/bearer.ts:356— bearer.createScheduledMCPBearerHeaderResolver has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 7, ternaries 1. Of this number, 9 points are the body's own statements and 9 belong to 4 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.
requirements.resolveScheduledMCPRequirements::visitDirectTree (cognitive 18) packages/api/src/schedules/requirements.ts:228— requirements.resolveScheduledMCPRequirements::visitDirectTree has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, 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. This shape REPEATS in the file: one other method here (requirements.resolveScheduledMCPRequirements) 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.
handlers.createSchedulesHandlers.runScheduleNow (cognitive 18) packages/api/src/schedules/handlers.ts:1166— handlers.createSchedulesHandlers.runScheduleNow has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3 (6 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.
deployment.createDeploymentSkillMethods (cognitive 18) packages/api/src/skills/deployment.ts:492— deployment.createDeploymentSkillMethods has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 7 (nesting depth added 2). None of this is in the body itself: all 18 points belong to 8 function literals inside it that branch (lines 590, 497, 504, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
handlers.createSkillsHandlers.create (cognitive 18) packages/api/src/skills/handlers.ts:426— handlers.createSkillsHandlers.create has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 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.
mcp.readStdioServer (cognitive 18) packages/api/src/plugins/mcp.ts:213— mcp.readStdioServer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, loops 2, ternaries 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.
skills.loadPluginSkills (cognitive 18) packages/api/src/plugins/skills.ts:35— skills.loadPluginSkills has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 2 (3 pts), 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.
crud.saveReadableToS3 (cognitive 18) packages/api/src/storage/s3/crud.ts:428— crud.saveReadableToS3 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 2 (4 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 6). 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.
crud.extractKeyFromS3Url (cognitive 18) packages/api/src/storage/s3/crud.ts:669— crud.extractKeyFromS3Url has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, 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.
crud.refreshS3FileUrls (cognitive 18) packages/api/src/storage/s3/crud.ts:963— crud.refreshS3FileUrls has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 1 (2 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.
agent.getProxyExemptions (cognitive 18) packages/api/src/web/agent.ts:34— agent.getProxyExemptions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, error handling 2 (4 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.
run.createScheduledMCPRunPolicy.registerAgent (cognitive 18) packages/api/src/schedules/authorization/run.ts:78— run.createScheduledMCPRunPolicy.registerAgent has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 4 (7 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.
branch.prunedBranchTokens (cognitive 18) packages/chat/src/core/usage/branch.ts:123— branch.prunedBranchTokens has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, ternaries 1 (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.
MultiSelect.MultiSelect (cognitive 18) packages/client/src/components/MultiSelect.tsx:84— MultiSelect.MultiSelect has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 12, if/else 3, ternaries 3. Of this number, 11 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.
runs.reconcileContextUsage (cognitive 18) packages/data-provider/src/types/runs.ts:442— runs.reconcileContextUsage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
parsers.parseTextParts (cognitive 18) packages/data-provider/src/parsers.ts:377— parsers.parseTextParts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 6). 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.
resolve-llm-delivery-path.resolveUploadDestination (cognitive 18) packages/data-provider/src/resolve-llm-delivery-path.ts:507— resolve-llm-delivery-path.resolveUploadDestination has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, ternaries 3 (6 pts), if/else 5 (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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parameterSettings.resolveReasoningSettingForTarget (cognitive 18) packages/data-provider/src/parameterSettings.ts:1447— parameterSettings.resolveReasoningSettingForTarget has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, ternaries 6 (7 pts), if/else 4 (nesting depth added 1). 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: 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.
derive.recordConfigTouches (cognitive 18) packages/data-schemas/src/app/derive.ts:254— derive.recordConfigTouches has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (8 pts), if/else 3 (7 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.
resolution.filterMCPServerOverrides (cognitive 18) packages/data-schemas/src/app/resolution.ts:1536— resolution.filterMCPServerOverrides has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, ternaries 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.
store.createConfigOperations.deleteConfig (cognitive 18) packages/data-schemas/src/app/store.ts:652— store.createConfigOperations.deleteConfig has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, error handling 1 (2 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.
conformance.describeConfigStoreConformance (cognitive 18) packages/data-schemas/src/app/conformance.ts:115— conformance.describeConfigStoreConformance has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 5, loops 2, error handling 1, ternaries 1. None of this is in the body itself: all 18 points belong to 13 function literals inside it that branch (lines 817, 839, 864, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
object-traverse.isObject (cognitive 18) packages/data-schemas/src/utils/object-traverse.ts:48— object-traverse.isObject 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.
stripUIResourceMarkers.collectMarkerRanges (cognitive 18) packages/data-schemas/src/utils/stripUIResourceMarkers.ts:367— stripUIResourceMarkers.collectMarkerRanges has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
eviction.evictAuthUserDocs (cognitive 18) packages/data-schemas/src/utils/eviction.ts:26— eviction.evictAuthUserDocs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 2 (4 pts), loops 2 (3 pts), boolean chains 2, ternaries 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.
tenantIsolation.applyTenantIsolation (cognitive 18) packages/data-schemas/src/models/plugins/tenantIsolation.ts:124— tenantIsolation.applyTenantIsolation has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, boolean chains 2, loops 1 (2 pts), error handling 1, ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 6 function items inside it that branch (a function literal at line 194, a function literal at line 233, updateGuard, …). 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.
subagentContent.createSubagentContentMethods.streamSubagentContentBatches (cognitive 18) packages/data-schemas/src/methods/subagentContent.ts:235— subagentContent.createSubagentContentMethods.streamSubagentContentBatches has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, loops 1 (nesting depth added 5). 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, split the body into named stages: move each independent 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.normalizeProjectFileRecord (cognitive 18) packages/data-schemas/src/methods/file.ts:189— file.normalizeProjectFileRecord has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 15 (17 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.
message.retainSubagentControlReceipts (cognitive 18) packages/data-schemas/src/methods/message.ts:117— message.retainSubagentControlReceipts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 8, ternaries 1 (nesting depth added 2). Of this number, 15 points are the body's own statements and 3 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.
chatProject.createChatProjectMethods.updateChatProject (cognitive 18) packages/data-schemas/src/methods/chatProject.ts:480— chatProject.createChatProjectMethods.updateChatProject has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 4). 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.
triggerDelivery.createAgentTriggerDeliveryMethods.deadLetterAgentTriggerDelivery (cognitive 18) packages/data-schemas/src/methods/triggerDelivery.ts:4469— triggerDelivery.createAgentTriggerDeliveryMethods.deadLetterAgentTriggerDelivery has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (6 pts), ternaries 2 (3 pts), error handling 1 (nesting depth added 2). 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, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
insights.createInsightsMethods.getInsights (cognitive 18) packages/data-schemas/src/methods/insights.ts:288— insights.createInsightsMethods.getInsights has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 12, loops 4, boolean chains 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: 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.
tenantIndexes.dropSupersededTenantIndexes (cognitive 18) packages/data-schemas/src/migrations/tenantIndexes.ts:86— tenantIndexes.dropSupersededTenantIndexes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 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.
searchTokens.applySearchTokens (cognitive 18) packages/data-schemas/src/models/plugins/searchTokens.ts:15— searchTokens.applySearchTokens has cognitive complexity 18 (threshold 15). Drivers by points: loops 7 (12 pts), if/else 4 (5 pts), boolean chains 1 (nesting depth added 6). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 61, 35, 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.
prepareEventActorContext (cognitive 18) api/server/controllers/agents/client.js:2164— prepareEventActorContext has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), other 4, boolean chains 1, error handling 1, loops 1, 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.
buildMessages::wrapLazyResolvers::resolve (cognitive 18) api/server/controllers/agents/client.js:3188— buildMessages::wrapLazyResolvers::resolve has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (9 pts), other 5, if/else 2 (3 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.
runMemory (cognitive 18) api/server/controllers/agents/client.js:3595— runMemory has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3, boolean chains 2, loops 1 (2 pts), other 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.
blockFilteredActionContent (cognitive 18) REDACTED:117— blockFilteredActionContent has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), error handling 3 (4 pts), loops 1, other 1 (nesting depth added 2). 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 128, 163). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
setMessageOptions (cognitive 18) api/app/clients/BaseClient.js:452— setMessageOptions has cognitive complexity 18 (threshold 15). Drivers by points: other 9, if/else 5, 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.
loadHistory (cognitive 18) api/app/clients/BaseClient.js:1277— loadHistory has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (2 pts), other 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.
registerUser (cognitive 18) api/server/services/AuthService.js:393— registerUser has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), error handling 2 (4 pts), other 3, ternaries 2, boolean chains 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
computeCanEditByServer (cognitive 18) REDACTED:299— computeCanEditByServer has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 4 (5 pts), error handling 2 (3 pts), boolean chains 1, other 1 (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.
processAddedConvo (cognitive 18) api/server/services/Endpoints/agents/addedConvo.js:77— processAddedConvo has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, error handling 1, other 1, 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.
migrateCodeFileDuplicates (cognitive 18) config/migrate-code-file-duplicates.js:72— migrateCodeFileDuplicates has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (5 pts), error handling 2 (4 pts), loops 2 (4 pts), other 4, boolean chains 1 (nesting depth added 6). None of this is in the body itself: all 18 points belong to 5 function literals inside it that branch (lines 83, 119, 134, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
messages.router.post("/artifact/:messageId") (cognitive 17) REDACTED:432— messages.router.post("/artifact/:messageId") has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 2, 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
share.router.post("/:conversationId") (cognitive 17) REDACTED:641— share.router.post("/:conversationId") has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, error handling 1, 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.
share.router.patch("/:shareId") (cognitive 17) REDACTED:709— share.router.patch("/:shareId") has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, error handling 1, 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.
GraphApiService.getEntraGroupDetailsBatch::processBatch (cognitive 17) api/server/services/GraphApiService.js:314— GraphApiService.getEntraGroupDetailsBatch::processBatch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 1 (4 pts), boolean chains 3, loops 1 (2 pts), 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.
PermissionService.performEntraGroupMembershipSync (cognitive 17) api/server/services/PermissionService.js:518— PermissionService.performEntraGroupMembershipSync has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, error handling 1, 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.
useExportConversation.useExportConversation.exportMarkdown (cognitive 17) client/src/hooks/Conversations/useExportConversation.ts:196— useExportConversation.useExportConversation.exportMarkdown has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), 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. This shape REPEATS in the file: one other method here (useExportConversation.useExportConversation.exportText) 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.
useExportConversation.useExportConversation.exportText (cognitive 17) client/src/hooks/Conversations/useExportConversation.ts:251— useExportConversation.useExportConversation.exportText has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), 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. This shape REPEATS in the file: one other method here (useExportConversation.useExportConversation.exportMarkdown) 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.
useToolToggle.useToolToggle (cognitive 17) client/src/hooks/Plugins/useToolToggle.ts:29— useToolToggle.useToolToggle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 7, ternaries 1 (2 pts) (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 8 function literals inside it that branch (lines 128, 114, 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.
CategoryTabs.CategoryTabs (cognitive 17) client/src/components/Agents/CategoryTabs.tsx:25— CategoryTabs.CategoryTabs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 5, boolean chains 4, match/switch 1 (nesting depth added 1). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 4 function items inside it that branch (getCategoryDisplayName, handleKeyDown, a function literal at line 132, …). 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.
LoginForm.LoginForm (cognitive 17) client/src/components/Auth/LoginForm.tsx:26— LoginForm.LoginForm has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, ternaries 7, if/else 3. 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: 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.
DiffView.parseUnifiedDiff (cognitive 17) client/src/components/Chat/Messages/Content/Parts/DiffView.tsx:34— DiffView.parseUnifiedDiff has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, 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.
OutputRenderer.extractText (cognitive 17) client/src/components/Chat/Messages/Content/ToolOutput/OutputRenderer.tsx:55— OutputRenderer.extractText has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, error handling 1 (2 pts) (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.
background.parseTask (cognitive 17) client/src/components/Chat/Messages/Content/Parts/background.ts:217— background.parseTask has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 10, boolean chains 5, 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.
rail.traceTo (cognitive 17) client/src/components/Chat/Messages/Content/rail.tsx:408— rail.traceTo has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, ternaries 2 (nesting depth added 1). 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.
HoverButtons.HoverButtons (cognitive 17) client/src/components/Chat/Messages/HoverButtons.tsx:96— HoverButtons.HoverButtons has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 12, if/else 5. Of this number, 12 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.
CodeWorkspaceMenu.GitContext (cognitive 17) client/src/components/Chat/Input/CodeWorkspaceMenu.tsx:288— CodeWorkspaceMenu.GitContext has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 14, if/else 2, ternaries 1. Of this number, 13 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.
ImagePreview.ImagePreview (cognitive 17) client/src/components/Chat/Input/Files/ImagePreview.tsx:18— ImagePreview.ImagePreview has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, ternaries 5 (7 pts), boolean chains 3 (nesting depth added 2). Of this number, 10 points are the body's own statements and 7 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.
Thinking.ThinkingControl (cognitive 17) client/src/components/Chat/Input/Composer/Thinking.tsx:22— Thinking.ThinkingControl has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8, boolean chains 4, if/else 3 (4 pts), loops 1 (nesting depth added 1). Of this number, 9 points are the body's own statements and 8 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.
model.resolveParents (cognitive 17) client/src/components/Chat/Trace/model.ts:269— model.resolveParents has cognitive complexity 17 (threshold 15). Drivers by points: if/else 2 (7 pts), loops 4 (6 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.
utils.getDisplayValue (cognitive 17) client/src/components/Chat/Menus/Endpoints/utils.ts:197— utils.getDisplayValue has cognitive complexity 17 (threshold 15). Drivers by points: if/else 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.
state.acceptedOmissions (cognitive 17) client/src/components/Chat/Subagents/state.ts:715— state.acceptedOmissions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, 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.
ParentSubagentsProvider.ParentSubagentsProvider (cognitive 17) client/src/components/Chat/Subagents/ParentSubagentsProvider.tsx:34— ParentSubagentsProvider.ParentSubagentsProvider has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 3 (4 pts), ternaries 2 (3 pts), loops 2 (nesting depth added 2). Of this number, 10 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.
outcome.hasTerminalOutcome::matches (cognitive 17) client/src/components/Chat/Subagents/outcome.ts:17— outcome.hasTerminalOutcome::matches has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (7 pts), if/else 2 (6 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (outcome.hasTerminalOutcome) 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.
recovery.recoveredToolPart (cognitive 17) client/src/components/Chat/Subagents/recovery.ts:211— recovery.recoveredToolPart has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, loops 1 (2 pts), ternaries 2 (nesting depth added 5). Of this number, 12 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.
ConvoLink.ConvoLink (cognitive 17) client/src/components/Conversations/ConvoLink.tsx:41— ConvoLink.ConvoLink has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, ternaries 4, if/else 3. Of this number, 9 points are the body's own statements and 8 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.
mcpServerUtils.shouldShowActionButton (cognitive 17) client/src/components/MCP/mcpServerUtils.ts:192— mcpServerUtils.shouldShowActionButton has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, 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.
ProviderError.ProviderError (cognitive 17) client/src/components/Messages/Content/Error/ProviderError.tsx:48— ProviderError.ProviderError has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (12 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.
Export.MermaidExport (cognitive 17) client/src/components/Messages/Content/Mermaid/Export.tsx:56— Export.MermaidExport 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: 4 of the 17 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 190, 183, 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.
Avatar.Avatar (cognitive 17) client/src/components/Nav/SettingsTabs/Account/Avatar.tsx:57— Avatar.Avatar has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 4 (6 pts), boolean chains 5 (nesting depth added 3). 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 items inside it that branch (a function literal at line 95, handleUpload, a function literal at line 138, …). 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.
PluginAuthForm.PluginAuthForm (cognitive 17) client/src/components/Plugins/Store/PluginAuthForm.tsx:87— PluginAuthForm.PluginAuthForm has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 11, ternaries 4, if/else 2. Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 119, 131). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Background.ActionBackground (cognitive 17) client/src/components/SidePanel/Agents/Actions/Background.tsx:18— Background.ActionBackground has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (5 pts), boolean chains 2, loops 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 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.
InstructionsPromptFields.InstructionsPromptFields (cognitive 17) client/src/components/SidePanel/Agents/InstructionsPromptFields.tsx:119— InstructionsPromptFields.InstructionsPromptFields 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: 2 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 145, 135, 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.
ApiKeyDialog.ApiKeyDialog (cognitive 17) client/src/components/SidePanel/Agents/Search/ApiKeyDialog.tsx:16— ApiKeyDialog.ApiKeyDialog has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 13, if/else 4. Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (handleVisibleSubmit, 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.
ApprovalOption.ApprovalOption (cognitive 17) client/src/components/SidePanel/Agents/ApprovalOption.tsx:28— ApprovalOption.ApprovalOption has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (9 pts), boolean chains 4, if/else 4 (nesting depth added 1). Of this number, 12 points are the body's own statements and 5 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.
AgentFooter.AgentFooter (cognitive 17) client/src/components/SidePanel/Agents/AgentFooter.tsx:22— AgentFooter.AgentFooter has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 15, ternaries 2. 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SkillListItem.buildFileTree (cognitive 17) client/src/components/Skills/lists/SkillListItem.tsx:55— SkillListItem.buildFileTree has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (4 pts), ternaries 1 (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.
admission.admit (cognitive 17) client/src/data-provider/Schedules/admission.ts:103— admission.admit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 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.
useKeyboardShortcuts.resolveShortcutBindings (cognitive 17) client/src/hooks/useKeyboardShortcuts.ts:434— useKeyboardShortcuts.resolveShortcutBindings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
endpoints.getDefaultModelSpec (cognitive 17) client/src/utils/endpoints.ts:418— endpoints.getDefaultModelSpec has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, 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.
latex.tokenizeMathSpan (cognitive 17) client/src/utils/latex.ts:37— latex.tokenizeMathSpan has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5 (nesting depth added 2). None of this is in the body itself: all 17 points belong to 4 function items inside it that branch (content, open, escape, …). 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.
presets.getPresetTitle (cognitive 17) client/src/utils/presets.ts:6— presets.getPresetTitle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 4 (7 pts), boolean chains 3 (nesting depth added 5). 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.
flush-cache.main (cognitive 17) config/flush-cache.js:290— flush-cache.main 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, and 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.createConfiguredContentInspector (cognitive 17) packages/api/src/protection/runtime.ts:406— runtime.createConfiguredContentInspector has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
catalog.createAdminConfigCatalogHandlers.getConfigCatalog (cognitive 17) packages/api/src/admin/catalog.ts:482— catalog.createAdminConfigCatalogHandlers.getConfigCatalog has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 4, ternaries 4, error handling 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
roles.createAdminRolesHandlers.moveRoleDependents (cognitive 17) packages/api/src/admin/roles.ts:497— roles.createAdminRolesHandlers.moveRoleDependents has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (5 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 5). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
errors.getModelStreamFailure (cognitive 17) packages/api/src/agents/errors.ts:124— errors.getModelStreamFailure has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 7, loops 1, 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.
avatars.resolveAvatarRefresh (cognitive 17) packages/api/src/agents/avatars.ts:234— avatars.resolveAvatarRefresh has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 3, loops 2 (3 pts), error handling 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.
InMemoryJobStore.drainSteers (cognitive 17) packages/api/src/stream/implementations/InMemoryJobStore.ts:2045— InMemoryJobStore.drainSteers has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 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.
InMemoryJobStore.removeSteer (cognitive 17) packages/api/src/stream/implementations/InMemoryJobStore.ts:2247— InMemoryJobStore.removeSteer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, loops 1, 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.
InMemoryJobStore.parkLeftovers (cognitive 17) packages/api/src/stream/implementations/InMemoryJobStore.ts:2598— InMemoryJobStore.parkLeftovers has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, error handling 1 (2 pts), loops 1 (nesting depth added 4). 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.
GenerationJobManagerClass.terminalizeUnexposedGeneration (cognitive 17) packages/api/src/stream/GenerationJobManager.ts:2445— GenerationJobManagerClass.terminalizeUnexposedGeneration has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 4, error handling 2 (4 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GenerationJobManagerClass.fenceGenerationClaimForRecovery (cognitive 17) packages/api/src/stream/GenerationJobManager.ts:3546— GenerationJobManagerClass.fenceGenerationClaimForRecovery has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 4 (8 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.
GenerationJobManagerClass.resumeClaimedGeneration (cognitive 17) packages/api/src/stream/GenerationJobManager.ts:3846— GenerationJobManagerClass.resumeClaimedGeneration has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 6, error handling 2 (3 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.
GenerationJobManagerClass.finishFencedRuntimeRetirement (cognitive 17) packages/api/src/stream/GenerationJobManager.ts:7437— GenerationJobManagerClass.finishFencedRuntimeRetirement has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BackgroundTaskRegistryClass.aggregateUsage (cognitive 17) packages/api/src/agents/background.ts:1038— BackgroundTaskRegistryClass.aggregateUsage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
background.serializeSubagentSnapshot (cognitive 17) packages/api/src/agents/background.ts:2372— background.serializeSubagentSnapshot has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 12, 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.
handlers.createOpenAIToolCallStream.finish (cognitive 17) packages/api/src/agents/openai/handlers.ts:440— handlers.createOpenAIToolCallStream.finish has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (5 pts), loops 4 (5 pts), boolean chains 3, error handling 1 (2 pts), 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.
policy.isToolApprovalPauseCapable (cognitive 17) REDACTED:109— policy.isToolApprovalPauseCapable has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4 (nesting depth added 4). 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.
manifest.createRunFileManifest.publish (cognitive 17) packages/api/src/agents/files/manifest.ts:327— manifest.createRunFileManifest.publish has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 3). Of this number, 9 points are the body's own statements and 8 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.
skillFiles.collectSkillUploadFiles (cognitive 17) packages/api/src/agents/skillFiles.ts:189— skillFiles.collectSkillUploadFiles has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 5). 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.
parse.parseSkillMarkdown (cognitive 17) packages/api/src/skills/parse.ts:100— parse.parseSkillMarkdown has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, ternaries 1 (2 pts), 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.
handlers.writeSandboxTextForAuthoring (cognitive 17) packages/api/src/agents/handlers.ts:2874— handlers.writeSandboxTextForAuthoring has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 6, boolean chains 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.
compaction.markAbortedCompactionContent (cognitive 17) packages/api/src/agents/compaction.ts:220— compaction.markAbortedCompactionContent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compaction.resolveFinalizedCompactionTurn (cognitive 17) packages/api/src/agents/compaction.ts:642— compaction.resolveFinalizedCompactionTurn has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
turn.createAgentEventActorTurn (cognitive 17) packages/api/src/agents/triggers/turn.ts:94— turn.createAgentEventActorTurn has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), error handling 3 (4 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 3). None of this is in the body itself: all 17 points belong to 2 function items inside it that branch (run, historyPersisted). 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.
view.publicTaskSummaries (cognitive 17) packages/api/src/agents/view.ts:441— view.publicTaskSummaries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (4 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.
queuedTurns.parseQueuedTurnAdmissionSource (cognitive 17) packages/api/src/agents/queuedTurns.ts:149— queuedTurns.parseQueuedTurnAdmissionSource has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, ternaries 5, 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.
ip.isPrivateIPv4 (cognitive 17) packages/api/src/auth/ip.ts:20— ip.isPrivateIPv4 has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, 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.
email.createEmailChangeService.requestEmailChange (cognitive 17) packages/api/src/auth/email.ts:413— email.createEmailChangeService.requestEmailChange has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, boolean chains 3, 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.
flight.createOpenIDRefreshFlightService.waitForOpenIDRefreshFlight (cognitive 17) packages/api/src/auth/openid/flight.ts:629— flight.createOpenIDRefreshFlightService.waitForOpenIDRefreshFlight has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, error handling 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.
router.createCodeSetupRouter::machine (cognitive 17) packages/api/src/code/setup/router.ts:192— router.createCodeSetupRouter::machine has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, ternaries 2 (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.
llm.applyGeminiFlashOverrides (cognitive 17) packages/api/src/endpoints/google/llm.ts:292— llm.applyGeminiFlashOverrides 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
providers.getProviderConfig (cognitive 17) packages/api/src/endpoints/config/providers.ts:195— providers.getProviderConfig has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 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.
finalize.finalizeFileDeletion (cognitive 17) packages/api/src/files/finalize.ts:10— finalize.finalizeFileDeletion has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 2 (3 pts), loops 3, 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.
sweep.sweepExpiredFiles (cognitive 17) packages/api/src/files/sweep.ts:268— sweep.sweepExpiredFiles has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 3 (4 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 5). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MCPTokenStorage.hasStoredAuthorization (cognitive 17) packages/api/src/mcp/oauth/tokens.ts:417— MCPTokenStorage.hasStoredAuthorization has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 7, error handling 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.
OAuthLifecycleRelay.add (cognitive 17) packages/api/src/mcp/oauth/pending.ts:134— OAuthLifecycleRelay.add has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), error handling 2 (4 pts), boolean chains 3, 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.
utils.normalizeAgentToolKeys (cognitive 17) packages/api/src/mcp/utils.ts:109— utils.normalizeAgentToolKeys has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, loops 1 (2 pts), ternaries 2 (nesting depth added 3). Of this number, 13 points are the body's own statements and 4 belong to 4 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.
parsers.parseAsString (cognitive 17) packages/api/src/mcp/parsers.ts:250— parsers.parseAsString has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 1 (nesting depth added 5). 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 257). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into 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.shouldBypassEnvProxy (cognitive 17) packages/api/src/mcp/connection.ts:885— connection.shouldBypassEnvProxy 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.
tools.createMCPToolCacheService.cacheMCPServerTools (cognitive 17) packages/api/src/mcp/tools.ts:499— tools.createMCPToolCacheService.cacheMCPServerTools has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, ternaries 2 (3 pts), 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.
handlers.createMemoryManagementHandlers.updateById (cognitive 17) packages/api/src/memory/handlers.ts:72— handlers.createMemoryManagementHandlers.updateById has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 7, 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.
previews.findSubagentAttachmentCalls (cognitive 17) packages/api/src/messages/previews.ts:391— previews.findSubagentAttachmentCalls has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, ternaries 2 (4 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
previews.previewToolCall (cognitive 17) packages/api/src/messages/previews.ts:717— previews.previewToolCall has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 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.
erasure.settleFromObservedJob (cognitive 17) packages/api/src/schedules/erasure.ts:180— erasure.settleFromObservedJob has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, 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.
service.createSchedulesService.claimScheduleResume (cognitive 17) packages/api/src/schedules/service.ts:1836— service.createSchedulesService.claimScheduleResume has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 5, ternaries 2 (3 pts) (nesting depth added 1). 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 1859, 1890). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.buildLangfuseConfig (cognitive 17) packages/api/src/langfuse/config.ts:249— config.buildLangfuseConfig has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
resume.getResumeMessageIndexes (cognitive 17) packages/chat/src/core/resumable/resume.ts:127— resume.getResumeMessageIndexes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 6, 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.
terminal.authorizeTerminalTeardown (cognitive 17) packages/chat/src/core/resumable/terminal.ts:197— terminal.authorizeTerminalTeardown has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, ternaries 1 (2 pts), 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.
registry.messageToolChars (cognitive 17) packages/chat/src/core/usage/registry.ts:136— registry.messageToolChars has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 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.
OriginalDialog.DialogContent (cognitive 17) packages/client/src/components/OriginalDialog.tsx:224— OriginalDialog.DialogContent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, ternaries 2 (nesting depth added 1). 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 283, 243, 320, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Composer.Composer (cognitive 17) packages/client/src/components/Composer.tsx:103— Composer.Composer has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 4, ternaries 3 (4 pts) (nesting depth added 1). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (handleKeyDown, handleKeyDown::defaultVerdict). 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.resolveCodeEnvironmentSelection (cognitive 17) packages/data-provider/src/code/workspace.ts:270— workspace.resolveCodeEnvironmentSelection has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3 (4 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.
config.isPrivateIPv4Literal (cognitive 17) packages/data-provider/src/config.ts:276— config.isPrivateIPv4Literal 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.
parts.toToolPart (cognitive 17) packages/data-provider/src/parts.ts:494— parts.toToolPart has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 11, 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.
parameterSettings.resolveReasoningSetting (cognitive 17) packages/data-provider/src/parameterSettings.ts:1369— parameterSettings.resolveReasoningSetting has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 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.
parsers.sanitizeErrorNode (cognitive 17) packages/data-schemas/src/config/parsers.ts:906— parsers.sanitizeErrorNode 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.
file.createFileMethods.getDeferredProvisionFiles (cognitive 17) packages/data-schemas/src/methods/file.ts:1028— file.createFileMethods.getDeferredProvisionFiles has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, error handling 1, 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.
codeEnvironment.createCodeEnvironmentMethods.createCodeEnvironmentWithinOwnerLimit (cognitive 17) packages/data-schemas/src/methods/codeEnvironment.ts:565— codeEnvironment.createCodeEnvironmentMethods.createCodeEnvironmentWithinOwnerLimit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 4, error handling 1 (2 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 5). 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.
conversation.createConversationMethods.recordAgentEventActorReconciliation (cognitive 17) packages/data-schemas/src/methods/conversation.ts:1566— conversation.createConversationMethods.recordAgentEventActorReconciliation 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.
triggerDelivery.createAgentTriggerDeliveryMethods.claimAgentBackgroundToolResults (cognitive 17) packages/data-schemas/src/methods/triggerDelivery.ts:2819— triggerDelivery.createAgentTriggerDeliveryMethods.claimAgentBackgroundToolResults has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (6 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.
static-checks.findUnusedI18nKeys (cognitive 17) scripts/static-checks.mts:1762— static-checks.findUnusedI18nKeys has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 4). Of this number, 11 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.
buildPreLoginPayload (cognitive 17) api/server/routes/config.js:76— buildPreLoginPayload has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 15, 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.
handleAbortError (cognitive 17) api/server/middleware/abortMiddleware.js:168— handleAbortError has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, boolean chains 3, error handling 1 (2 pts), other 1, ternaries 1 (nesting depth added 1). 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: 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.
exchangeOboToken (cognitive 17) api/server/services/OboTokenService.js:168— exchangeOboToken has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 1 (2 pts) (nesting depth added 6). 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.
title.addTitle (cognitive 16) api/server/services/Endpoints/agents/title.js:35— title.addTitle has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 1, 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.
PermissionService.grantPermission (cognitive 16) api/server/services/PermissionService.js:63— PermissionService.grantPermission has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
openidStrategy.hasOpenIdAdminRole (cognitive 16) api/strategies/openidStrategy.js:560— openidStrategy.hasOpenIdAdminRole has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 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.
reasoning.resolveSubmittedReasoning (cognitive 16) client/src/hooks/Chat/ask/reasoning.ts:40— reasoning.resolveSubmittedReasoning has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 9 (10 pts), boolean chains 5, if/else 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.
useUnseenBadge.useUnseenBadge (cognitive 16) client/src/hooks/Conversations/useUnseenBadge.ts:71— useUnseenBadge.useUnseenBadge has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, loops 4, boolean chains 3, ternaries 3. Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 84, 138, 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.
useMermaid.useMermaid (cognitive 16) client/src/hooks/Mermaid/useMermaid.ts:56— useMermaid.useMermaid has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 5, error handling 2, boolean chains 1 (nesting depth added 2). None of this is in the body itself: all 16 points belong to 3 function items inside it that branch (fetchSvg, a function literal at line 73, a function literal at line 99). 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.
opening.useTurnHandlers.createdHandler (cognitive 16) client/src/hooks/SSE/opening.ts:201— opening.useTurnHandlers.createdHandler has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 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.
announcements.useResumeAnnouncements (cognitive 16) client/src/hooks/SSE/announcements.ts:22— announcements.useResumeAnnouncements has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 7. 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 81, 155). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CopyLink.CopyLink (cognitive 16) client/src/components/Agents/CopyLink.tsx:21— CopyLink.CopyLink has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7, boolean chains 4, if/else 4, error handling 1. Of this number, 8 points are the body's own statements and 8 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.
Login.Login (cognitive 16) client/src/components/Auth/Login.tsx:25— Login.Login has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, ternaries 2 (3 pts) (nesting depth added 2). 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 literals inside it that branch (lines 37, 65, 80, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TwoFactorScreen.TwoFactorScreen (cognitive 16) client/src/components/Auth/TwoFactorScreen.tsx:31— TwoFactorScreen.TwoFactorScreen has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 4, ternaries 4. Of this number, 8 points are the body's own statements and 8 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.
ToolMermaidArtifact.ToolMermaidArtifact (cognitive 16) client/src/components/Chat/Messages/Content/Parts/ToolMermaidArtifact.tsx:25— ToolMermaidArtifact.ToolMermaidArtifact has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (10 pts), boolean chains 5, if/else 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.
Attachment.AttachmentGroup (cognitive 16) client/src/components/Chat/Messages/Content/Parts/Attachment.tsx:504— Attachment.AttachmentGroup has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 6, ternaries 2. 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: 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.
Reasoning.Reasoning (cognitive 16) client/src/components/Chat/Messages/Content/Parts/Reasoning.tsx:169— Reasoning.Reasoning has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 4, ternaries 2. 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.
live.toolCallLine (cognitive 16) client/src/components/Chat/Messages/Content/live.ts:108— live.toolCallLine has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (9 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.
RetrievalCall.parseRetrievalOutput (cognitive 16) client/src/components/Chat/Messages/Content/RetrievalCall.tsx:212— RetrievalCall.parseRetrievalOutput 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). To reduce it, split the body into named stages: move each independent 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.TokenUsageIndicator (cognitive 16) client/src/components/Chat/Input/TokenUsage/index.tsx:84— index.TokenUsageIndicator has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 5 (6 pts), if/else 2 (nesting depth added 1). 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
EndpointItem.EndpointItem (cognitive 16) client/src/components/Chat/Menus/Endpoints/components/EndpointItem.tsx:254— EndpointItem.EndpointItem has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 3, ternaries 1 (2 pts) (nesting depth added 1). 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, name the conditions: bind each compound test to a 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.Wakeup (cognitive 16) client/src/components/Chat/Messages/Content/Wakeup.tsx:101— Wakeup.Wakeup has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 2). 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 141, 122, 204). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
attachments.useLiveSubagentToolCalls (cognitive 16) client/src/components/Chat/Subagents/attachments.ts:162— attachments.useLiveSubagentToolCalls has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 5, loops 3, boolean chains 1 (nesting depth added 3). None of this is in the body itself: all 16 points belong to 6 function literals inside it that branch (lines 206, 232, 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.
MCPConfigDialog.MCPConfigDialog (cognitive 16) client/src/components/MCP/MCPConfigDialog.tsx:30— MCPConfigDialog.MCPConfigDialog has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, ternaries 1 (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 2 function items inside it that branch (renderStatusBadge, a function literal at line 49). 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.processTree (cognitive 16) client/src/components/MCPUIResource/plugin.ts:12— plugin.processTree has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 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 13). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
FavoriteItem.FavoriteItem (cognitive 16) client/src/components/Nav/Favorites/FavoriteItem.tsx:49— FavoriteItem.FavoriteItem has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 2. Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 6 function items inside it that branch (handleSelect, handleRemove, handleKeyDown, …). 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.
ProjectsView.ProjectsView (cognitive 16) client/src/components/Projects/ProjectsView.tsx:181— ProjectsView.ProjectsView has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 5, ternaries 2. Of this number, 8 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.
AdminSettingsDialog.AdminSettingsDialog (cognitive 16) client/src/components/ui/AdminSettingsDialog.tsx:112— AdminSettingsDialog.AdminSettingsDialog has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (6 pts), ternaries 1 (nesting depth added 1). Of this number, 9 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.
useArtifacts.hasEnclosedArtifact (cognitive 16) client/src/hooks/Artifacts/useArtifacts.ts:114— useArtifacts.hasEnclosedArtifact has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 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.
attachments.mergeAttachments (cognitive 16) client/src/utils/attachments.ts:67— attachments.mergeAttachments has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 2, ternaries 2 (nesting depth added 2). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 92, 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.
convos.updatePinnedConvosQuery (cognitive 16) client/src/utils/convos.ts:1328— convos.updatePinnedConvosQuery has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 7). 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 1341, 1376). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tools.getSpecOperationNames (cognitive 16) packages/api/src/actions/tools.ts:46— tools.getSpecOperationNames has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
secrets.carryRenamedArraySecrets (cognitive 16) packages/api/src/admin/secrets.ts:1378— secrets.carryRenamedArraySecrets has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 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.
secrets.writeSecretIntoSection (cognitive 16) packages/api/src/admin/secrets.ts:1568— secrets.writeSecretIntoSection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 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.
grants.createAdminGrantsHandlers.assignGrant (cognitive 16) packages/api/src/admin/grants.ts:385— grants.createAdminGrantsHandlers.assignGrant has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 3, boolean chains 2, ternaries 1 (nesting depth added 2). 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, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.createActivityPhaseWiring (cognitive 16) packages/api/src/agents/activityPhases/runtime.ts:822— runtime.createActivityPhaseWiring has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 7 (8 pts) (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 4 function literals inside it that branch (lines 898, 849, 834, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.createActivityPhaseWiring.handlers (cognitive 16) packages/api/src/agents/activityPhases/runtime.ts:1538— runtime.createActivityPhaseWiring.handlers has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, 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.
aggregation.feedSubagentAggregator (cognitive 16) packages/api/src/agents/aggregation.ts:32— aggregation.feedSubagentAggregator has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, ternaries 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
avatars.refreshListAvatars (cognitive 16) packages/api/src/agents/avatars.ts:389— avatars.refreshListAvatars has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (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 416). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
InMemoryJobStore.createJob::assertOwnerCompatible (cognitive 16) packages/api/src/stream/implementations/InMemoryJobStore.ts:324— InMemoryJobStore.createJob::assertOwnerCompatible has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 4, ternaries 2 (4 pts), 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. This shape REPEATS in the file: one other method here (InMemoryJobStore.createJob) 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.
GenerationJobManagerClass.overflowEarlyEventBuffer (cognitive 16) packages/api/src/stream/GenerationJobManager.ts:5861— GenerationJobManagerClass.overflowEarlyEventBuffer has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 4 (6 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.
tools.buildHistoricalToolNames (cognitive 16) packages/api/src/agents/tools.ts:152— tools.buildHistoricalToolNames has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 4, loops 3 (4 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.
tools.collectHistoricalToolCalls (cognitive 16) packages/api/src/agents/tools.ts:271— tools.collectHistoricalToolCalls has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 5). Of this number, 10 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.
client.countRetainedToolTokens (cognitive 16) packages/api/src/agents/client.ts:422— client.countRetainedToolTokens has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 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.
usage.recordCollectedUsage (cognitive 16) packages/api/src/agents/usage.ts:895— usage.recordCollectedUsage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 7, ternaries 3 (6 pts), error handling 1 (2 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. This shape REPEATS in the file: one other method here (usage.recordCollectedUsage::processUsageGroup) 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.
skills.resolveModelSpecSkillIds (cognitive 16) packages/api/src/agents/skills.ts:261— skills.resolveModelSpecSkillIds has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 2, error handling 1 (2 pts), loops 2 (nesting depth added 4). 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.
skills.unionPrimeAllowedTools (cognitive 16) packages/api/src/agents/skills.ts:1773— skills.unionPrimeAllowedTools has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 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.
workspace.workspaceAdmissionRetryDelay (cognitive 16) packages/api/src/code/workspace.ts:556— workspace.workspaceAdmissionRetryDelay has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, error handling 1 (2 pts), ternaries 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.
intent.sanitizeIntentLabels (cognitive 16) packages/api/src/agents/intent.ts:398— intent.sanitizeIntentLabels has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 1 (2 pts), ternaries 2 (nesting depth added 6). Of this number, 10 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.
handlers.handleAttachedWorkspaceCreateFileCall (cognitive 16) packages/api/src/agents/handlers.ts:3918— handlers.handleAttachedWorkspaceCreateFileCall has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, error handling 1, 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.
byom.resolveAttachedCodeApprovalMode (cognitive 16) packages/api/src/agents/hitl/byom.ts:298— byom.resolveAttachedCodeApprovalMode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
service.inspectSubmittedRequest (cognitive 16) packages/api/src/agents/openai/service.ts:350— service.inspectSubmittedRequest has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (4 pts), error handling 2, boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SubagentThreadTaskStore.controlResultReceipt (cognitive 16) packages/api/src/agents/subagentThreads.ts:962— SubagentThreadTaskStore.controlResultReceipt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, 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.
compaction.snapshotEntry (cognitive 16) packages/api/src/agents/compaction.ts:813— compaction.snapshotEntry has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (6 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.
executor.parseCompletion (cognitive 16) packages/api/src/agents/hooks/executor.ts:580— executor.parseCompletion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, 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.
request.handleSteerArmInternal (cognitive 16) packages/api/src/agents/steering/request.ts:1036— request.handleSteerArmInternal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 5. 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.
outcome.toolEvidence (cognitive 16) packages/api/src/agents/triggers/outcome.ts:79— outcome.toolEvidence has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts) (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 86). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
view.projectedTaskActivity (cognitive 16) packages/api/src/agents/view.ts:281— view.projectedTaskActivity has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 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.
host.generateReasoningLabelRevision (cognitive 16) packages/api/src/agents/reasoningLabels/host.ts:257— host.generateReasoningLabelRevision has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 3 (4 pts), error handling 2, ternaries 1 (nesting depth added 1). Of this number, 14 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.
email.createEmailChangeService.confirmEmailChange (cognitive 16) packages/api/src/auth/email.ts:598— email.createEmailChangeService.confirmEmailChange has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, error handling 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.
handlers.createPasskeyHandlers.registerPasskeyVerify (cognitive 16) packages/api/src/auth/passkey/handlers.ts:401— handlers.createPasskeyHandlers.registerPasskeyVerify has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), error handling 3, boolean chains 2, ternaries 1 (nesting depth added 1). 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: 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.
decision.resolveConversationCodeEnvironmentDecision (cognitive 16) packages/api/src/code/decision.ts:78— decision.resolveConversationCodeEnvironmentDecision has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (8 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.
filter.filterFilesByEndpointRuntimeConfig (cognitive 16) packages/api/src/files/filter.ts:29— filter.filterFilesByEndpointRuntimeConfig has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, loops 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.
authorization.authenticateRequest (cognitive 16) packages/api/src/images/authorization.ts:240— authorization.authenticateRequest has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (6 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.
connection.parseIPv6ToBigInt (cognitive 16) packages/api/src/mcp/connection.ts:742— connection.parseIPv6ToBigInt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, ternaries 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.
MCPConnectionFactory.create (cognitive 16) packages/api/src/mcp/MCPConnectionFactory.ts:165— MCPConnectionFactory.create has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 6). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MCPManager.recoverOAuthConnection (cognitive 16) packages/api/src/mcp/MCPManager.ts:994— MCPManager.recoverOAuthConnection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 8). 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.
axios.logAxiosError (cognitive 16) packages/api/src/utils/axios.ts:44— axios.logAxiosError has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 6, ternaries 2, 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.
math.math (cognitive 16) packages/api/src/utils/math.ts:19— math.math has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 1 (2 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.
balance.buildBalanceUpdateFields (cognitive 16) packages/api/src/middleware/balance.ts:66— balance.buildBalanceUpdateFields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 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.
protection.assertSharedFileMetadataAllowed (cognitive 16) packages/api/src/shared-links/protection.ts:1581— protection.assertSharedFileMetadataAllowed has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, ternaries 2, loops 1 (nesting depth added 2). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
parts.parseAttachmentCallQueries (cognitive 16) packages/api/src/messages/parts.ts:252— parts.parseAttachmentCallQueries has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), boolean chains 4, ternaries 2 (4 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.
feedback.sendFeedbackScore (cognitive 16) packages/api/src/langfuse/feedback.ts:125— feedback.sendFeedbackScore has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (8 pts), if/else 5, boolean chains 3 (nesting depth added 1). 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 160, 143, 154). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
prompt.toolCallsOf (cognitive 16) packages/api/src/langfuse/prompt.ts:94— prompt.toolCallsOf has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 3 (5 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.
RedisEventTransport.subscribe (cognitive 16) packages/api/src/stream/implementations/RedisEventTransport.ts:1366— RedisEventTransport.subscribe has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, ternaries 1 (nesting depth added 2). 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 1426, 1442, 1411). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
content.createDualMessageContent (cognitive 16) packages/chat/src/core/content.ts:50— content.createDualMessageContent has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (8 pts), boolean chains 4, 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.
actions.useDuringRunActions (cognitive 16) packages/chat/src/react/steering/actions.ts:20— actions.useDuringRunActions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 5. None of this is in the body itself: all 16 points belong to 5 function literals inside it that branch (lines 60, 159, 204, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RequestExecutor.setParams (cognitive 16) packages/data-provider/src/actions.ts:201— RequestExecutor.setParams has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 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.
resolution.getChildSchema (cognitive 16) packages/data-schemas/src/app/resolution.ts:871— resolution.getChildSchema has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
search.withSearchTokens (cognitive 16) packages/data-schemas/src/utils/search.ts:215— search.withSearchTokens has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, loops 1 (nesting depth added 4). 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.
message.pruneProjectedThreadViewMessage (cognitive 16) packages/data-schemas/src/methods/message.ts:656— message.pruneProjectedThreadViewMessage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), 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.
message.createMessageMethods.getSteplessToolCallFallback (cognitive 16) packages/data-schemas/src/methods/message.ts:1573— message.createMessageMethods.getSteplessToolCallFallback has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 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.
message.createMessageMethods.readBackgroundToolResultClaim (cognitive 16) packages/data-schemas/src/methods/message.ts:1930— message.createMessageMethods.readBackgroundToolResultClaim has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 3 (6 pts), ternaries 1 (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.
chatProject.createChatProjectMethods.addChatProjectFile (cognitive 16) packages/data-schemas/src/methods/chatProject.ts:546— chatProject.createChatProjectMethods.addChatProjectFile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 2, error handling 2, ternaries 2. 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, 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.
conversation.createConversationMethods.setConvoLaneGit (cognitive 16) packages/data-schemas/src/methods/conversation.ts:3127— conversation.createConversationMethods.setConvoLaneGit has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 3 (5 pts), boolean chains 1, loops 1 (nesting depth added 4). 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.
triggerDelivery.createAgentTriggerDeliveryMethods.enqueueAgentTriggerDelivery (cognitive 16) packages/data-schemas/src/methods/triggerDelivery.ts:1181— triggerDelivery.createAgentTriggerDeliveryMethods.enqueueAgentTriggerDelivery has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3, 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.
triggerDelivery.createAgentTriggerDeliveryMethods.releaseWaitingDelivery (cognitive 16) packages/data-schemas/src/methods/triggerDelivery.ts:2026— triggerDelivery.createAgentTriggerDeliveryMethods.releaseWaitingDelivery has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 1 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
browserSetup.createBrowserSetupStore.start (cognitive 16) packages/data-schemas/src/methods/browserSetup.ts:117— browserSetup.createBrowserSetupStore.start has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 4, ternaries 2 (3 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.
probe.pipelineTargetsTenant (cognitive 16) packages/data-schemas/src/tenant/probe.ts:150— probe.pipelineTargetsTenant has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, 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.
publishStagedApproval (cognitive 16) api/server/controllers/agents/client.js:4216— publishStagedApproval has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 5, error handling 2 (3 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
loadActionToolsForExecution (cognitive 16) api/server/services/ToolService.js:2594— loadActionToolsForExecution has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, loops 2, other 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.
uploadAgentAvatarHandler (cognitive 16) REDACTED:1913— uploadAgentAvatarHandler has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 4 (5 pts), boolean chains 1, other 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.
getMessagesWithinTokenLimit (cognitive 16) api/app/clients/BaseClient.js:716— getMessagesWithinTokenLimit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, loops 1 (2 pts), other 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.
processAgentFileUpload::createTextFile (cognitive 16) api/server/services/Files/process.js:966— processAgentFileUpload::createTextFile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 4 (6 pts), other 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.
readSandboxFile (cognitive 16) api/server/services/Files/Code/process.js:1024— readSandboxFile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 3, other 2, error handling 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.
writeSandboxFile (cognitive 16) api/server/services/Files/Code/process.js:1604— writeSandboxFile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, boolean chains 4, ternaries 3, other 2, 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.
abortMessage (cognitive 16) api/server/middleware/abortMiddleware.js:25— abortMessage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), other 5, boolean chains 3, ternaries 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.
collectTypeSpecifiers (cognitive 16) config/circular-deps.mjs:86— collectTypeSpecifiers has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 4 (5 pts), loops 2 (3 pts), other 2 (nesting depth added 2). 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.
Cross-context type AgentCapabilities (data-provider → client) client/src/hooks/Agents/useAgentCapabilities.ts:21— AgentCapabilities (context data-provider) is exposed in client's public surface via useAgentCapabilities.useAgentCapabilities — couples the contexts.
Cross-context type StepEvent (chat → client) client/src/hooks/SSE/useStepHandler.ts:328— StepEvent (context chat) is exposed in client's public surface via useStepHandler.useStepHandler.stepHandler — couples the contexts.
Cross-context type PtcToolCallStatus (data-provider → client) client/src/common/ptc.ts:8— PtcToolCallStatus (context data-provider) is exposed in client's public surface via PtcTraceStatus.PtcTraceStatus — couples the contexts.
Cross-context type SubagentUpdatePhase (data-provider → client) client/src/components/Chat/Subagents/state.ts:65— SubagentUpdatePhase (context data-provider) is exposed in client's public surface via SubagentProgress.status — couples the contexts.
Cross-context type SubagentTaskContentResponse (data-provider → client) client/src/components/Chat/Subagents/recovery.ts:36— SubagentTaskContentResponse (context data-provider) is exposed in client's public surface via recovery.reduceRecoveredContent — couples the contexts.
Cross-context type SettingsTabValues (data-provider → client) client/src/components/Nav/Settings/types.ts:8— SettingsTabValues (context data-provider) is exposed in client's public surface via SettingsTab.SettingsTab — couples the contexts.
Cross-context type Provider (api → client) client/src/components/SidePanel/Agents/parameters.ts:47— Provider (context api) is exposed in client's public surface via parameters.resolveAgentParameterSettings — couples the contexts.
Cross-context type TokenExchangeMethodEnum (data-provider → client) client/src/components/SidePanel/MCPBuilder/MCPServerDialog/hooks/useMCPServerForm.ts:43— TokenExchangeMethodEnum (context data-provider) is exposed in client's public surface via AuthConfig.oauth_token_exchange_method — couples the contexts.
Cross-context type InvocationMode (data-provider → client) client/src/components/Skills/utils/parseSkillMd.ts:7— InvocationMode (context data-provider) is exposed in client's public surface via ParsedSkillMd.invocationMode — couples the contexts.
Cross-context type TLangfuseConnectionTestResponse (data-provider → client) client/src/data-provider/Langfuse/index.ts:60— TLangfuseConnectionTestResponse (context data-provider) is exposed in client's public surface via index.useTestLangfuseConnectionMutation — couples the contexts.
Cross-context type TBannerResponse (data-provider → client) client/src/data-provider/Misc/queries.ts:8— TBannerResponse (context data-provider) is exposed in client's public surface via queries.useGetBannerQuery — couples the contexts.
Cross-context type ConfigPathInputs (data-schemas → api) packages/api/src/admin/config.ts:914— ConfigPathInputs (context data-schemas) is exposed in api's public surface via AdminConfigDeps.unsetConfigField — couples the contexts.
Cross-context type PrincipalModel (data-provider → api) packages/api/src/admin/langfuse.ts:102— PrincipalModel (context data-provider) is exposed in api's public surface via AdminLangfuseDeps.patchConfigFields — couples the contexts.
Cross-context type SubagentDigestStatus (data-provider → api) packages/api/src/agents/digest/tree.ts:35— SubagentDigestStatus (context data-provider) is exposed in api's public surface via ActivityLeaf.status — couples the contexts.
Cross-context type SubagentActivityItem (data-provider → api) packages/api/src/agents/digest/tree.ts:464— SubagentActivityItem (context data-provider) is exposed in api's public surface via tree.activityTreeFromProjection — couples the contexts.
Cross-context type FormattedMemoriesResult (data-schemas → api) packages/api/src/agents/memory.ts:555— FormattedMemoriesResult (context data-schemas) is exposed in api's public surface via memory.getRequestMemories — couples the contexts.
Cross-context type ReasoningResponseKey (data-provider → api) packages/api/src/agents/run.ts:357— ReasoningResponseKey (context data-provider) is exposed in api's public surface via run.getReasoningKey — couples the contexts.
Cross-context type BackgroundToolResultClaim (data-schemas → api) packages/api/src/agents/handlers.ts:369— BackgroundToolResultClaim (context data-schemas) is exposed in api's public surface via ToolExecuteOptions.backgroundToolCompletion — couples the contexts.
Cross-context type SubagentContentFrame (data-provider → api) packages/api/src/agents/subagentContent.ts:49— SubagentContentFrame (context data-provider) is exposed in api's public surface via subagentContent.subagentContentFrame — couples the contexts.
Cross-context type AgentSortOption (data-provider → api) packages/api/src/agents/marketplace.ts:33— AgentSortOption (context data-provider) is exposed in api's public surface via MarketplaceListSelection.sort — couples the contexts.
Cross-context type ReasoningLabelEvents (data-provider → api) packages/api/src/agents/reasoningLabels/host.ts:106— ReasoningLabelEvents (context data-provider) is exposed in api's public surface via CreateReasoningLabelHostWiringOptions.emitEvent — couples the contexts.
Cross-context type EmailChangeErrorCode (data-provider → api) packages/api/src/auth/email.ts:185— EmailChangeErrorCode (context data-provider) is exposed in api's public surface via EmailChangeResult.code — couples the contexts.
Cross-context type PasskeyDeviceType (data-schemas → api) packages/api/src/auth/passkey.ts:50— PasskeyDeviceType (context data-schemas) is exposed in api's public surface via VerifiedPasskeyRegistration.deviceType — couples the contexts.
Cross-context type AnthropicEffort (data-provider → api) packages/api/src/endpoints/anthropic/helpers.ts:75— AnthropicEffort (context data-provider) is exposed in api's public surface via helpers.configureReasoning — couples the contexts.
Cross-context type ThinkingDisplay (data-provider → api) packages/api/src/endpoints/anthropic/helpers.ts:75— ThinkingDisplay (context data-provider) is exposed in api's public surface via helpers.configureReasoning — couples the contexts.
Cross-context type ReasoningParameterFormat (data-provider → api) packages/api/src/endpoints/openai/llm.ts:601— ReasoningParameterFormat (context data-provider) is exposed in api's public surface via llm.getOpenAILLMConfig — couples the contexts.
Cross-context type MCPReinitializeFailureReason (data-provider → api) packages/api/src/mcp/reinitialize.ts:10— MCPReinitializeFailureReason (context data-provider) is exposed in api's public surface via MCPReinitializeStopResult.failureReason — couples the contexts.
Cross-context type ArtifactModes (data-provider → api) packages/api/src/prompts/artifacts/index.ts:63— ArtifactModes (context data-provider) is exposed in api's public surface via index.generateArtifactsPrompt — couples the contexts.
Cross-context type UpdateSkillResult (data-schemas → api) packages/api/src/skills/handlers.ts:71— UpdateSkillResult (context data-schemas) is exposed in api's public surface via SkillsHandlersDeps.updateSkill — couples the contexts.
Cross-context type TWebSearchCategories (data-schemas → api) packages/api/src/web/web.ts:376— TWebSearchCategories (context data-schemas) is exposed in api's public surface via WebSearchAuthResult.authTypes — couples the contexts.
Cross-context type AuthType (data-provider → api) packages/api/src/web/web.ts:376— AuthType (context data-provider) is exposed in api's public surface via WebSearchAuthResult.authTypes — couples the contexts.
Cross-context type TWebSearchKeys (data-schemas → api) packages/api/src/web/web.ts:114— TWebSearchKeys (context data-schemas) is exposed in api's public surface via web.extractWebSearchEnvVars — couples the contexts.
Cross-context type BedrockDocumentFormat (data-provider → api) packages/api/src/types/files.ts:111— BedrockDocumentFormat (context data-provider) is exposed in api's public surface via BedrockDocumentBlock.document — couples the contexts.
Cross-context type MessageContentComplex (data-provider → chat) packages/chat/src/core/steps/content.ts:171— MessageContentComplex (context data-provider) is exposed in chat's public surface via content.updateContent — couples the contexts.
Cross-context type TAttachment (data-provider → chat) packages/chat/src/core/resumable/host.ts:277— TAttachment (context data-provider) is exposed in chat's public surface via ResumableEvents.attachmentHandler — couples the contexts.
Cross-context type FileSources (data-provider → chat) packages/chat/src/core/files.ts:16— FileSources (context data-provider) is exposed in chat's public surface via ExtendedFile.source — couples the contexts.
Cross-context type TEndpointsConfig (data-provider → chat) packages/chat/src/core/content.ts:50— TEndpointsConfig (context data-provider) is exposed in chat's public surface via content.createDualMessageContent — couples the contexts.
Cross-context type ChatFrame (data-provider → chat) packages/chat/src/core/transport/frames.ts:63— ChatFrame (context data-provider) is exposed in chat's public surface via frames.normalizeFrame — couples the contexts.
Cross-context type Provider (api → data-provider) packages/data-provider/src/parameterSettings.ts:1447— Provider (context api) is exposed in data-provider's public surface via parameterSettings.resolveReasoningSettingForTarget — couples the contexts.
Cross-context type TAttachment (data-provider → data-schemas) packages/data-schemas/src/schema/toolCall.ts:10— TAttachment (context data-provider) is exposed in data-schemas's public surface via IToolCallData.attachments — couples the contexts.
Cross-context type TFeedbackRating (data-provider → data-schemas) packages/data-schemas/src/types/message.ts:80— TFeedbackRating (context data-provider) is exposed in data-schemas's public surface via IMessage.feedback — couples the contexts.
Cross-context type SkillsScope (data-provider → data-schemas) packages/data-schemas/src/types/agent.ts:37— SkillsScope (context data-provider) is exposed in data-schemas's public surface via IAgent.skills_scope — couples the contexts.
Cross-context type MemoryScope (data-provider → data-schemas) packages/data-schemas/src/types/agent.ts:69— MemoryScope (context data-provider) is exposed in data-schemas's public surface via IAgent.memory_scope — couples the contexts.
Cross-context type SearchCategories (data-provider → data-schemas) packages/data-schemas/src/types/web.ts:19— SearchCategories (context data-provider) is exposed in data-schemas's public surface via TWebSearchCategories.TWebSearchCategories — couples the contexts.
Cross-context type AgentSortOption (data-provider → data-schemas) packages/data-schemas/src/methods/agent.ts:131— AgentSortOption (context data-provider) is exposed in data-schemas's public surface via AgentListSortOption.AgentListSortOption — couples the contexts.
Change coupling clique: BashCall.tsx, ExecuteCode.tsx, FileAuthoringCall.tsx, ReadFileCall.tsx, SkillCall.tsx client/src/components/Chat/Messages/Content/Parts/BashCall.tsx— 5 files — `client/src/components/Chat/Messages/Content/Parts/BashCall.tsx`, `client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx`, `client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx`, `client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsx`, `client/src/components/Chat/Messages/Content/Parts/SkillCall.tsx` — all change together with no explicit dependency: a fully-connected co-change clique, not 10 separate couplings. They share one concern (thin parallel siblings over a common abstraction), so extract the shared part into ONE unit and the whole clique's coupling clears at once — you do not need to break each pair individually.
Duplicated block (9 lines × 2) otel/langfuse-fanout/cmd/langfuse-fanout/main.go:859— otel/langfuse-fanout/cmd/langfuse-fanout/main.go:859-867 | otel/langfuse-fanout/cmd/langfuse-fanout/main.go:935-943 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `otel/langfuse-fanout/cmd/langfuse-fanout/main.go:859` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) otel/langfuse-fanout/cmd/langfuse-fanout/main.go:1210— otel/langfuse-fanout/cmd/langfuse-fanout/main.go:1210-1219 | otel/langfuse-fanout/cmd/langfuse-fanout/metrics.go:263-272 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `otel/langfuse-fanout/cmd/langfuse-fanout/main.go:1210` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Off the main sequence: librechat-data-provider — librechat-data-provider: abstractness 0.04, instability 0.00, distance 0.96 — zone of pain — concrete and depended on by 6 project(s), so it's rigid to change.
Unfinished stub — throws a "not implemented" error api/app/clients/BaseClient.js:350— A shipped function's whole body still throws a "not implemented" error — generated scaffolding that was never completed. Implement it or remove the dead surface.
Unfinished stub — throws a "not implemented" exception api/app/clients/BaseClient.js:350— `summarizeMessages` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
IC1 · Incompleteness & stubs· Markup wires an event to an empty handler · ×1
Markup wires an event to an empty handler client/src/components/Prompts/forms/PromptForm.tsx:227— `onSave` 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.
IC1 · Incompleteness & stubs· Empty method body · ×1
Empty method body — does nothing with its inputs packages/data-provider/src/data-service.ts:1579— `deleteSkillNode` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it.
Duplication concentrated across 5 sibling directories (147 clone groups) client/src/components/Chat/Messages/Content/Parts/Thinking.tsx:268— 147 duplicated blocks under the repository root have copies in at least two of the sibling directories api, client, config, packages, scripts — 76 of them are reported below, and 71 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 147 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 147 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 147 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 35 sibling directories (88 clone groups) packages/api/src/agents/migration.ts:35— 88 duplicated blocks under packages/api/src/ have copies in at least two of the sibling directories acl, actions, admin, agents, apiKeys, app (+29 more sibling(s) not listed) — 40 of them are reported below, and 48 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 88 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 88 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 88 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 24 sibling directories (87 clone groups) client/src/components/Chat/Messages/ui/MessageRender.tsx:29— 87 duplicated blocks under client/src/components/ have copies in at least two of the sibling directories Agents, Appearance, Artifacts, Auth, Bookmarks, Chat (+18 more sibling(s) not listed) — 39 of them are reported below, and 48 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 87 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 87 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 87 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 4 sibling directories (66 clone groups) packages/api/src/agents/usage.ts:436— 66 duplicated blocks under packages/ have copies in at least two of the sibling directories api, chat, data-provider, data-schemas — 20 of them are reported below, and 46 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 66 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 66 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 66 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 (43 clone groups) client/src/data-provider/mutations.ts:1283— 43 duplicated blocks under client/src/ have copies in at least two of the sibling directories Providers, components, data-provider, hooks, locales, routes (+2 more sibling(s) not listed) — 23 of them are reported below, and 20 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 43 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 43 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 43 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 (23 clone groups) client/src/components/SidePanel/Agents/ActionsInput.tsx:37— 23 duplicated blocks under client/src/components/SidePanel/ have copies in at least two of the sibling directories Agents, Bookmarks, Builder, MCPBuilder, Memories, Parameters (+1 more sibling(s) not listed) — 18 of them are reported below, and 5 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 23 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 23 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 23 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 4 sibling directories (13 clone groups) api/server/controllers/agents/client.js:3424— 13 duplicated blocks under api/server/ have copies in at least two of the sibling directories controllers, middleware, routes, services — 7 of them are reported below, and 6 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 7 sibling directories (13 clone groups) client/src/components/Chat/Menus/Endpoints/ModelSelectorContext.tsx:285— 13 duplicated blocks under client/src/components/Chat/ have copies in at least two of the sibling directories BackgroundTasks, Input, Menus, Messages, Subagents, Trace (+1 more sibling(s) not listed) — 7 of them are reported below, and 6 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 13 sibling directories (10 clone groups) client/src/data-provider/Memories/queries.ts:84— 10 duplicated blocks under client/src/data-provider/ have copies in at least two of the sibling directories Agents, Auth, BackgroundTasks, Endpoints, Files, Insights (+7 more sibling(s) not listed) — 2 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 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 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 10 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 (8 clone groups) client/src/hooks/Agents/useAgentUploadTarget.ts:62— 8 duplicated blocks under client/src/hooks/ have copies in at least two of the sibling directories Agents, Chat, Conversations, Files, Input, MCP (+2 more sibling(s) not listed) — 4 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 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 7 sibling directories (8 clone groups) packages/api/src/agents/activityPhases/runtime.ts:204— 8 of the duplicated blocks reported below have copies in at least two of the sibling directories activityLabels, activityPhases, hitl, openai, reasoningLabels, responses (+1 more sibling(s) not listed) under packages/api/src/agents/. 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 3 sibling directories (6 clone groups) packages/api/src/endpoints/google/llm.ts:661— 6 duplicated blocks under packages/api/src/endpoints/ have copies in at least two of the sibling directories anthropic, google, openai — 5 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 6 and which does not depend on how exactly each block's copies still match. 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.
Duplication concentrated across 8 sibling directories (5 clone groups) client/src/components/Nav/SettingsTabs/Data/SharedLinks.tsx:55— 5 duplicated blocks under client/src/components/Nav/SettingsTabs/ have copies in at least two of the sibling directories Account, ApiKeys, Chat, Data, General, Integrations (+2 more sibling(s) not listed) — 4 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 5 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 5 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 5 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 (5 clone groups) client/src/components/Nav/SettingsTabs/Speech/STT/EngineSTTDropdown.tsx:11— 5 duplicated blocks under client/src/components/Nav/SettingsTabs/Speech/ have copies in at least two of the sibling directories STT, TTS — 3 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 5 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 5 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 5 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 4 sibling directories (5 clone groups) packages/data-schemas/src/schema/preset.ts:10— 5 duplicated blocks under packages/data-schemas/src/ have copies in at least two of the sibling directories app, methods, schema, types — 2 of them are reported below, and 3 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 5 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 5 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 5 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.
Duplicated block (254 lines × 2 locations) api/server/controllers/agents/openai.js:539— api/server/controllers/agents/openai.js:539 · api/server/controllers/agents/responses.js:794 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (186 matched lines × 2 locations) · ×1
Duplicated block with local edits (186 matched lines × 2 locations) client/src/components/SidePanel/Agents/ActionsInput.tsx:37— client/src/components/SidePanel/Agents/ActionsInput.tsx:37 · client/src/components/SidePanel/Builder/ActionsInput.tsx:25 — the two spans are one implementation copied and then locally edited — 965 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 (162 matched lines × 2 locations) · ×1
Duplicated block with local edits (162 matched lines × 2 locations) client/src/components/Chat/Input/Mention.tsx:58— client/src/components/Chat/Input/Mention.tsx:58 · client/src/components/Chat/Input/PromptsCommand.tsx:81 — the two spans are one implementation copied and then locally edited — 913 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 (159 matched lines × 2 locations) · ×1
Duplicated block with local edits (159 matched lines × 2 locations) client/src/components/Nav/SettingsTabs/Data/SharedLinks.tsx:55— client/src/components/Nav/SettingsTabs/Data/SharedLinks.tsx:55 · client/src/components/Nav/SettingsTabs/General/ArchivedChatsTable.tsx:61 — the two spans are one implementation copied and then locally edited — 763 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 (134 matched lines × 2 locations) · ×1
Duplicated block with local edits (134 matched lines × 2 locations) config/migrate-agent-permissions.js:6— config/migrate-agent-permissions.js:6 · config/migrate-prompt-permissions.js:6 — the two spans are one implementation copied and then locally edited — 908 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 (132 matched lines × 2 locations) · ×1
Duplicated block with local edits (132 matched lines × 2 locations) client/src/components/Skills/forms/CreateSkillForm.tsx:98— client/src/components/Skills/forms/CreateSkillForm.tsx:98 · client/src/components/Skills/forms/SkillForm.tsx:108 — the two spans are one implementation copied and then locally edited — 635 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 (128 matched lines × 2 locations) · ×1
Duplicated block with local edits (128 matched lines × 2 locations) client/src/components/Chat/Messages/Content/Parts/BashCall.tsx:40— client/src/components/Chat/Messages/Content/Parts/BashCall.tsx:40 · client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx:70 — the two spans are one implementation copied and then locally edited — 658 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 (123 matched lines × 2 locations) · ×1
Duplicated block with local edits (123 matched lines × 2 locations) client/src/components/Chat/Messages/ui/MessageRender.tsx:29— client/src/components/Chat/Messages/ui/MessageRender.tsx:29 · client/src/components/Messages/ContentRender.tsx:38 — the two spans are one implementation copied and then locally edited — 626 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 (115 matched lines × 2 locations) · ×1
Duplicated block with local edits (115 matched lines × 2 locations) REDACTED:47— REDACTED:47 · api/server/controllers/assistants/v2.js:21 — the two spans are one implementation copied and then locally edited — 389 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 (110 matched lines × 2 locations) · ×1
Duplicated block with local edits (110 matched lines × 2 locations) REDACTED:104— REDACTED:104 · REDACTED:33 — the two spans are one implementation copied and then locally edited — 708 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 (108 lines × 2 locations) api/server/controllers/assistants/chatV1.js:539— api/server/controllers/assistants/chatV1.js:539 · REDACTED:360 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
R10 · Code Duplication· Duplicated block with local edits (106 matched lines × 2 locations) · ×1
Duplicated block with local edits (106 matched lines × 2 locations) api/server/controllers/assistants/chatV1.js:140— api/server/controllers/assistants/chatV1.js:140 · api/server/controllers/assistants/errors.js:59 — the two spans are one implementation copied and then locally edited — 611 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 (101 lines × 2 locations) api/server/controllers/assistants/chatV1.js:692— api/server/controllers/assistants/chatV1.js:692 · REDACTED:520 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (96 matched lines × 2 locations) · ×1
Duplicated block with local edits (96 matched lines × 2 locations) packages/api/src/pulls/github.ts:220— packages/api/src/pulls/github.ts:220 · packages/api/src/pulls/gitlab.ts:143 — the two spans are one implementation copied and then locally edited — 522 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 (95 matched lines × 2 locations) · ×1
Duplicated block with local edits (95 matched lines × 2 locations) client/src/components/Chat/Messages/MessageParts.tsx:36— client/src/components/Chat/Messages/MessageParts.tsx:36 · client/src/components/Messages/ContentRender.tsx:98 — the two spans are one implementation copied and then locally edited — 467 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 (92 matched lines × 2 locations) · ×1
Duplicated block with local edits (92 matched lines × 2 locations) packages/api/src/agents/responses/handlers.ts:326— packages/api/src/agents/responses/handlers.ts:326 · packages/api/src/agents/responses/handlers.ts:603 — the two spans are one implementation copied and then locally edited — 539 tokens are still identical, in the same order in both spans, 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 (88 lines × 2 locations) api/app/clients/tools/structured/FluxAPI.js:263— api/app/clients/tools/structured/FluxAPI.js:263 · api/app/clients/tools/structured/FluxAPI.js:497 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (86 matched lines × 2 locations) · ×1
Duplicated block with local edits (86 matched lines × 2 locations) client/src/components/Conversations/ProjectsSection.tsx:189— client/src/components/Conversations/ProjectsSection.tsx:189 · client/src/components/Projects/ProjectsView.tsx:40 — the two spans are one implementation copied and then locally edited — 430 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 (85 matched lines × 2 locations) · ×1
Duplicated block with local edits (85 matched lines × 2 locations) client/src/components/SidePanel/Memories/MemoryCreateDialog.tsx:50— client/src/components/SidePanel/Memories/MemoryCreateDialog.tsx:50 · client/src/components/SidePanel/Memories/MemoryEditDialog.tsx:63 — the two spans are one implementation copied and then locally edited — 521 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 initializeAgent (cyclomatic 288, cognitive 332) packages/api/src/agents/initialize.ts:1221— initializeAgent has cyclomatic complexity 288 and cognitive complexity 332; 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 ResumableAgentController (cyclomatic 238, cognitive 348) api/server/controllers/agents/request.js:769— ResumableAgentController has cyclomatic complexity 238 and cognitive complexity 348; 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 ResumeAgentController (cyclomatic 208, cognitive 335) api/server/controllers/agents/resume.js:772— ResumeAgentController has cyclomatic complexity 208 and cognitive complexity 335; 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 192, cognitive 317) packages/api/src/agents/triggers/outcome.ts:323— (anonymous) has cyclomatic complexity 192 and cognitive complexity 317; 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 getOpenAILLMConfig (cyclomatic 159, cognitive 257) packages/api/src/endpoints/openai/llm.ts:601— getOpenAILLMConfig has cyclomatic complexity 159 and cognitive complexity 257; 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 startGeneration (cyclomatic 155, cognitive 234) api/server/controllers/agents/request.js:2261— startGeneration has cyclomatic complexity 155 and cognitive complexity 234; 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 SubagentThreadPanel (cyclomatic 150, cognitive 142) client/src/components/Chat/Subagents/SubagentThreadPanel.tsx:127— SubagentThreadPanel has cyclomatic complexity 150 and cognitive complexity 142; 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 runCheckBackgroundTask (cyclomatic 127, cognitive 396) packages/api/src/agents/background.ts:2518— runCheckBackgroundTask has cyclomatic complexity 127 and cognitive complexity 396; 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 deserializeJob (cyclomatic 124, cognitive 125) packages/api/src/stream/implementations/RedisJobStore.ts:5620— deserializeJob has cyclomatic complexity 124 and cognitive complexity 125; 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 isValidResult (cyclomatic 121, cognitive 99) packages/api/src/code/workspace.ts:928— isValidResult has cyclomatic complexity 121 and cognitive complexity 99; 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 callTool (cyclomatic 117, cognitive 214) packages/api/src/mcp/MCPManager.ts:1486— callTool has cyclomatic complexity 117 and cognitive complexity 214; 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 subscribeWithResume (cyclomatic 117, cognitive 192) packages/api/src/stream/GenerationJobManager.ts:6168— subscribeWithResume has cyclomatic complexity 117 and cognitive complexity 192; 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 updateInterfacePermissions (cyclomatic 117, cognitive 170) packages/api/src/app/permissions.ts:104— updateInterfacePermissions has cyclomatic complexity 117 and cognitive complexity 170; 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 validateSettingDefinitions (cyclomatic 112, cognitive 184) packages/data-provider/src/generate.ts:256— validateSettingDefinitions has cyclomatic complexity 112 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 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 recordScheduleOutcome (cyclomatic 111, cognitive 141) packages/api/src/schedules/service.ts:1428— recordScheduleOutcome has cyclomatic complexity 111 and cognitive complexity 141; 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 createJob (cyclomatic 108, cognitive 106) packages/api/src/stream/implementations/RedisJobStore.ts:2053— createJob has cyclomatic complexity 108 and cognitive complexity 106; 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 executeWorkspaceTool (cyclomatic 107, cognitive 143) packages/api/src/code/workspace.ts:1310— executeWorkspaceTool has cyclomatic complexity 107 and cognitive complexity 143; 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 createJob (cyclomatic 106, cognitive 139) packages/api/src/stream/GenerationJobManager.ts:2542— createJob has cyclomatic complexity 106 and cognitive complexity 139; 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 extractMessageContent (cyclomatic 103, cognitive 259) packages/api/src/protection/adapters/messages.ts:781— extractMessageContent has cyclomatic complexity 103 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 foldSubagentEvent (cyclomatic 98, cognitive 152) client/src/utils/subagentContent.ts:219— foldSubagentEvent has cyclomatic complexity 98 and cognitive complexity 152; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files· packages/api/src/stream/GenerationJobManager.ts · ×1
packages/api/src/stream/GenerationJobManager.ts: 9351 lines of code packages/api/src/stream/GenerationJobManager.ts:1— packages/api/src/stream/GenerationJobManager.ts has 9351 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/api/src/agents/handlers.ts · ×1
packages/api/src/agents/handlers.ts: 7557 lines of code packages/api/src/agents/handlers.ts:1— packages/api/src/agents/handlers.ts has 7557 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· api/server/controllers/agents/client.js · ×1
api/server/controllers/agents/client.js: 6151 lines of code api/server/controllers/agents/client.js:1— api/server/controllers/agents/client.js has 6151 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/data-provider/src/config.ts · ×1
packages/data-provider/src/config.ts: 5730 lines of code packages/data-provider/src/config.ts:1— packages/data-provider/src/config.ts has 5730 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/api/src/stream/implementations/RedisJobStore.ts · ×1
packages/api/src/stream/implementations/RedisJobStore.ts: 5703 lines of code packages/api/src/stream/implementations/RedisJobStore.ts:1— packages/api/src/stream/implementations/RedisJobStore.ts has 5703 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/data-schemas/src/methods/triggerDelivery.ts · ×1
packages/data-schemas/src/methods/triggerDelivery.ts: 4926 lines of code packages/data-schemas/src/methods/triggerDelivery.ts:1— packages/data-schemas/src/methods/triggerDelivery.ts has 4926 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/api/src/admin/config.ts · ×1
packages/api/src/admin/config.ts: 4770 lines of code packages/api/src/admin/config.ts:1— packages/api/src/admin/config.ts has 4770 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/data-schemas/src/methods/conversation.ts · ×1
packages/data-schemas/src/methods/conversation.ts: 4429 lines of code packages/data-schemas/src/methods/conversation.ts:1— packages/data-schemas/src/methods/conversation.ts has 4429 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/data-schemas/src/methods/message.ts · ×1
packages/data-schemas/src/methods/message.ts: 4282 lines of code packages/data-schemas/src/methods/message.ts:1— packages/data-schemas/src/methods/message.ts has 4282 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/api/src/agents/subagentThreads.ts · ×1
packages/api/src/agents/subagentThreads.ts: 4036 lines of code packages/api/src/agents/subagentThreads.ts:1— packages/api/src/agents/subagentThreads.ts has 4036 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/api/src/middleware/modelBoundContent.ts · ×1
packages/api/src/middleware/modelBoundContent.ts: 3793 lines of code packages/api/src/middleware/modelBoundContent.ts:1— packages/api/src/middleware/modelBoundContent.ts has 3793 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· api/server/controllers/agents/request.js · ×1
api/server/controllers/agents/request.js: 3541 lines of code api/server/controllers/agents/request.js:1— api/server/controllers/agents/request.js has 3541 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/api/src/agents/background.ts · ×1
packages/api/src/agents/background.ts: 3220 lines of code packages/api/src/agents/background.ts:1— packages/api/src/agents/background.ts has 3220 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/api/src/mcp/connection.ts · ×1
packages/api/src/mcp/connection.ts: 3052 lines of code packages/api/src/mcp/connection.ts:1— packages/api/src/mcp/connection.ts has 3052 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/api/src/agents/run.ts · ×1
packages/api/src/agents/run.ts: 3035 lines of code packages/api/src/agents/run.ts:1— packages/api/src/agents/run.ts has 3035 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/data-schemas/src/methods/queuedTurn.ts · ×1
packages/data-schemas/src/methods/queuedTurn.ts: 2881 lines of code packages/data-schemas/src/methods/queuedTurn.ts:1— packages/data-schemas/src/methods/queuedTurn.ts has 2881 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/data-schemas/src/app/resolution.ts · ×1
packages/data-schemas/src/app/resolution.ts: 2856 lines of code packages/data-schemas/src/app/resolution.ts:1— packages/data-schemas/src/app/resolution.ts has 2856 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/api/src/agents/initialize.ts · ×1
packages/api/src/agents/initialize.ts: 2829 lines of code packages/api/src/agents/initialize.ts:1— packages/api/src/agents/initialize.ts has 2829 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/data-provider/src/artifacts.ts · ×1
packages/data-provider/src/artifacts.ts: 2790 lines of code packages/data-provider/src/artifacts.ts:1— packages/data-provider/src/artifacts.ts has 2790 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/api/src/stream/implementations/InMemoryJobStore.ts · ×1
packages/api/src/stream/implementations/InMemoryJobStore.ts: 2769 lines of code packages/api/src/stream/implementations/InMemoryJobStore.ts:1— packages/api/src/stream/implementations/InMemoryJobStore.ts has 2769 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/data-schemas/src/methods/agent.ts · ×1
packages/data-schemas/src/methods/agent.ts: 2592 lines of code packages/data-schemas/src/methods/agent.ts:1— packages/data-schemas/src/methods/agent.ts has 2592 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/api/src/mcp/MCPManager.ts · ×1
packages/api/src/mcp/MCPManager.ts: 2586 lines of code packages/api/src/mcp/MCPManager.ts:1— packages/api/src/mcp/MCPManager.ts has 2586 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· api/server/services/ToolService.js · ×1
api/server/services/ToolService.js: 2533 lines of code api/server/services/ToolService.js:1— api/server/services/ToolService.js has 2533 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/api/src/schedules/service.ts · ×1
packages/api/src/schedules/service.ts: 2440 lines of code packages/api/src/schedules/service.ts:1— packages/api/src/schedules/service.ts has 2440 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/api/src/mcp/MCPConnectionFactory.ts · ×1
packages/api/src/mcp/MCPConnectionFactory.ts: 2421 lines of code packages/api/src/mcp/MCPConnectionFactory.ts:1— packages/api/src/mcp/MCPConnectionFactory.ts has 2421 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/data-schemas/src/methods/schedule.ts · ×1
packages/data-schemas/src/methods/schedule.ts: 2272 lines of code packages/data-schemas/src/methods/schedule.ts:1— packages/data-schemas/src/methods/schedule.ts has 2272 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/api/src/skills/sync/github.ts · ×1
packages/api/src/skills/sync/github.ts: 2259 lines of code packages/api/src/skills/sync/github.ts:1— packages/api/src/skills/sync/github.ts has 2259 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· api/server/controllers/agents/resume.js · ×1
api/server/controllers/agents/resume.js: 2246 lines of code api/server/controllers/agents/resume.js:1— api/server/controllers/agents/resume.js has 2246 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/api/src/protection/adapters/submissions.ts · ×1
packages/api/src/protection/adapters/submissions.ts: 2184 lines of code packages/api/src/protection/adapters/submissions.ts:1— packages/api/src/protection/adapters/submissions.ts has 2184 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· api/server/services/Endpoints/agents/initialize.js · ×1
api/server/services/Endpoints/agents/initialize.js: 2121 lines of code api/server/services/Endpoints/agents/initialize.js:1— api/server/services/Endpoints/agents/initialize.js has 2121 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/api/src/mcp/oauth/handler.ts · ×1
packages/api/src/mcp/oauth/handler.ts: 2116 lines of code packages/api/src/mcp/oauth/handler.ts:1— packages/api/src/mcp/oauth/handler.ts has 2116 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/api/src/auth/openid/session.ts · ×1
packages/api/src/auth/openid/session.ts: 2106 lines of code packages/api/src/auth/openid/session.ts:1— packages/api/src/auth/openid/session.ts has 2106 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: 2103 lines of code REDACTED:1— REDACTED has 2103 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/data-schemas/src/methods/skill.ts · ×1
packages/data-schemas/src/methods/skill.ts: 2088 lines of code packages/data-schemas/src/methods/skill.ts:1— packages/data-schemas/src/methods/skill.ts has 2088 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/api/src/mcp/oauth/tokens.ts · ×1
packages/api/src/mcp/oauth/tokens.ts: 2044 lines of code packages/api/src/mcp/oauth/tokens.ts:1— packages/api/src/mcp/oauth/tokens.ts has 2044 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· client/src/data-provider/mutations.ts · ×1
client/src/data-provider/mutations.ts: 1985 lines of code client/src/data-provider/mutations.ts:1— client/src/data-provider/mutations.ts has 1985 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· api/app/clients/BaseClient.js · ×1
api/app/clients/BaseClient.js: 1923 lines of code api/app/clients/BaseClient.js:1— api/app/clients/BaseClient.js has 1923 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/data-schemas/src/methods/file.ts · ×1
packages/data-schemas/src/methods/file.ts: 1919 lines of code packages/data-schemas/src/methods/file.ts:1— packages/data-schemas/src/methods/file.ts has 1919 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/api/src/admin/secrets.ts · ×1
packages/api/src/admin/secrets.ts: 1886 lines of code packages/api/src/admin/secrets.ts:1— packages/api/src/admin/secrets.ts has 1886 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/api/src/stream/implementations/RedisEventTransport.ts · ×1
packages/api/src/stream/implementations/RedisEventTransport.ts: 1845 lines of code packages/api/src/stream/implementations/RedisEventTransport.ts:1— packages/api/src/stream/implementations/RedisEventTransport.ts has 1845 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
Dead file (~113 LoC) client/src/components/MCP/MCPServerMenuItem.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~105 LoC) client/src/components/Nav/NavToggle.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~102 LoC) client/src/components/MCP/StackedMCPIcons.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~84 LoC) client/src/components/Skills/forms/InvocationModePicker.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~77 LoC) scripts/activity-labels/rescore.mts— no import path from any entry point (376 application, 87 tooling, 2926 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 (~46 LoC) client/src/components/Chat/Menus/Models/fakeData.ts— no import path from any entry point (376 application, 87 tooling, 2926 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 (~45 LoC) client/src/hooks/Chat/contract.check.ts— no import path from any entry point (376 application, 87 tooling, 2926 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 (~44 LoC) client/src/components/Chat/Menus/Bookmarks/BookmarkMenuItems.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~42 LoC) client/src/components/SidePanel/Agents/ImageVision.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~38 LoC) client/src/components/SidePanel/data.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~26 LoC) packages/client/src/svgs/ChatIcon.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~23 LoC) packages/client/src/svgs/ConvoIcon.tsx— no import path from any entry point (376 application, 87 tooling, 2926 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 (~18 LoC) api/utils/logger.js— no import path from any entry point (376 application, 87 tooling, 2926 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 (~17 LoC) client/jest.resolver.cjs— no import path from any entry point (376 application, 87 tooling, 2926 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 (~14 LoC) config/jest.setup.logging.cjs— no import path from any entry point (376 application, 87 tooling, 2926 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
Unlisted import '@anthropic-ai/sdk' api/typedefs.js:208— Imported only as a TYPE and declared in no reachable REDACTED. The import is erased at compile time, so nothing is installed and no runtime resolution depends on it — but type-checking a clean clone will fail. Declare the typings it resolves through (or the package itself) in the owning REDACTED.
Unlisted import '@google/generative-ai' api/typedefs.js:232— Imported only as a TYPE and declared in no reachable REDACTED. The import is erased at compile time, so nothing is installed and no runtime resolution depends on it — but type-checking a clean clone will fail. Declare the typings it resolves through (or the package itself) in the owning REDACTED.
Unlisted import '@librechat/agents' client/src/components/Chat/Subagents/outcome.test.ts:40— Imported only as a TYPE and declared in no reachable REDACTED. The import is erased at compile time, so nothing is installed and no runtime resolution depends on it — but type-checking a clean clone will fail. Declare the typings it resolves through (or the package itself) in the owning REDACTED.
Unused dependency 'brace-expansion' — Declared in the root 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 'caniuse-lite' — Declared in the root 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 'elliptic' — Declared in the root 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.
Mock-dominated test: creates schema indexes before the first assistant lookup when auto-indexing is disabled packages/data-schemas/src/schema/assistant.spec.ts:12— This test sets up 3 test doubles (for example `jest.fn`) 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: re-indexes even when the title matches so every changed field stays current packages/data-schemas/src/models/plugins/mongoMeili.findOneAndUpdate.spec.ts:246— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 2 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: cleanupMeiliIndex handles empty MeiliSearch index packages/data-schemas/src/models/plugins/mongoMeili.spec.ts:1871— 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: logs the error name and code, never the message packages/data-schemas/src/methods/auditLog.spec.ts:172— This test sets up 3 test doubles (for example `jest
.spyOn`) 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: pins every mutable collection read to one primary snapshot transaction packages/data-schemas/src/methods/mcpAuthority.spec.ts:411— This test sets up 6 test doubles (for example `jest.spyOn`) against 0 real object(s) of its own, and its only verification is 9 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: should invalidate cached auth user documents on update packages/data-schemas/src/methods/user.methods.spec.ts:642— This test sets up 3 test doubles (for example `jest.fn`) 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: waits at the barrier when the cache can read but not delete packages/data-schemas/src/methods/user.methods.spec.ts:753— This test sets up 3 test doubles (for example `jest.fn`) 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: should invalidate cached auth user documents on delete packages/data-schemas/src/methods/user.methods.spec.ts:781— This test sets up 3 test doubles (for example `jest.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: should invalidate cached auth documents after a successful claim packages/data-schemas/src/methods/user.methods.spec.ts:896— This test sets up 3 test doubles (for example `jest.fn`) 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: invalidates cached auth user documents after a successful enrollment write packages/data-schemas/src/methods/user.methods.spec.ts:1211— This test sets up 3 test doubles (for example `jest.fn`) 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: does not wait when the auth user cache is off packages/data-schemas/src/methods/user.methods.spec.ts:1322— This test sets up 4 test doubles (for example `jest.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: should invalidate cached auth user documents on acceptance packages/data-schemas/src/methods/user.methods.spec.ts:1486— This test sets up 3 test doubles (for example `jest.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: should invalidate cached auth user documents when memories preference changes packages/data-schemas/src/methods/user.methods.spec.ts:1995— This test sets up 4 test doubles (for example `jest.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: invalidates cached auth user documents packages/data-schemas/src/methods/user.methods.spec.ts:2048— This test sets up 3 test doubles (for example `jest.fn`) 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: stops listening for the reduced motion preference on unmount packages/client/src/svgs/__tests__/Spinner.spec.tsx:94— This test sets up 3 test doubles (for example `jest.fn`) 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: does not paginate on scroll while the replacement page is loading packages/client/src/components/DataTable/DataTable.spec.tsx:848— This test sets up 3 test doubles (for example `jest.fn`) 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: re-arms when the sort changes under a same-sized page packages/client/src/components/DataTable/DataTable.spec.tsx:975— This test sets up 3 test doubles (for example `jest.fn`) 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: routes connection events to their handlers packages/chat/src/core/__tests__/subscription.spec.ts:89— This test sets up 7 test doubles (for example `jest.fn`) 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: builds the shared-server OAuth hooks for the target account packages/api/src/user/resolver.spec.ts:52— This test sets up 5 test doubles (for example `jest.fn`) 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: should not classify MCP tools with _action in name as action tools packages/api/src/tools/definitions.spec.ts:221— This test sets up 3 test doubles (for example `jest.fn`) 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: should not call getActionToolDefinitions when no action tools present packages/api/src/tools/definitions.spec.ts:253— This test sets up 3 test doubles (for example `jest.fn`) 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: enables ioredis instrumentation when explicitly configured packages/api/src/telemetry/sdk.spec.ts:262— 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 6 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: delivers tagged events and preserves legacy in-memory callback arity packages/api/src/stream/__tests__/RedisEventTransport.spec.ts:45— This test sets up 3 test doubles (for example `jest.fn`) against 1 real object(s) of its own, and its only verification is 6 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: round-trips tagged events and preserves legacy Redis callback arity packages/api/src/stream/__tests__/RedisEventTransport.spec.ts:79— This test sets up 4 test doubles (for example `jest.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: ignores sequenced events while only internal abort listeners are attached packages/api/src/stream/__tests__/RedisEventTransport.spec.ts:161— This test sets up 3 test doubles (for example `jest.fn`) 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.
Interpolated log message defeats structured logging packages/data-schemas/src/utils/retry.ts:57— `error` at line 57 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 packages/data-schemas/src/utils/retry.ts:67— `warn` at line 67 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 packages/data-schemas/src/utils/retry.ts:157— `warn` at line 157 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 packages/data-schemas/src/utils/tempChatRetention.ts:36— `warn` at line 36 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 packages/data-schemas/src/utils/tempChatRetention.ts:48— `warn` at line 48 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 packages/data-schemas/src/utils/tempChatRetention.ts:56— `warn` at line 56 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 packages/data-schemas/src/utils/tempChatRetention.ts:61— `warn` at line 61 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 packages/data-schemas/src/models/index.ts:177— `error` at line 177 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:144— `warn` at line 144 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:493— `info` at line 493 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:500— `info` at line 500 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:506— `info` at line 506 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:508— `info` at line 508 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:549— `info` at line 549 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:566— `info` at line 566 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:727— `debug` at line 727 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:1052— `debug` at line 1052 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:1057— `info` at line 1057 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:1063— `debug` at line 1063 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:1067— `debug` at line 1067 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:1069— `warn` at line 1069 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:1072— `info` at line 1072 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:1076— `warn` at line 1076 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:1078— `warn` at line 1078 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 packages/data-schemas/src/models/plugins/mongoMeili.ts:1082— `error` at line 1082 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.
+ 15 more in this group — see findings.md.
P2 · Observability· Console output used as the logging channel · ×39
Console output used as the logging channel config/circular-deps.mjs:216— `config/circular-deps.mjs` reports through `console.*` at line 216 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 config/circular-deps.mjs:219— `config/circular-deps.mjs` reports through `console.*` at line 219 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 config/circular-deps.mjs:221— `config/circular-deps.mjs` reports through `console.*` at line 221 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 config/circular-deps.mjs:231— `config/circular-deps.mjs` reports through `console.*` at line 231 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 config/connect.js:33— `config/connect.js` reports through `console.*` at line 33 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 config/delete-banner.js:29— `config/delete-banner.js` reports through `console.*` at line 29 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 config/delete-banner.js:30— `config/delete-banner.js` reports through `console.*` at line 30 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 config/delete-banner.js:31— `config/delete-banner.js` reports through `console.*` at line 31 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 config/delete-banner.js:32— `config/delete-banner.js` reports through `console.*` at line 32 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 config/delete-banner.js:44— `config/delete-banner.js` reports through `console.*` at line 44 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 config/delete-banner.js:53— `config/delete-banner.js` reports through `console.*` at line 53 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 config/delete-banner.js:54— `config/delete-banner.js` reports through `console.*` at line 54 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 config/helpers.js:120— `config/helpers.js` reports through `console.*` at line 120 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 config/helpers.js:121— `config/helpers.js` reports through `console.*` at line 121 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 config/helpers.js:122— `config/helpers.js` reports through `console.*` at line 122 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 config/helpers.js:123— `config/helpers.js` reports through `console.*` at line 123 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 config/helpers.js:124— `config/helpers.js` reports through `console.*` at line 124 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 config/helpers.js:125— `config/helpers.js` reports through `console.*` at line 125 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 config/helpers.js:126— `config/helpers.js` reports through `console.*` at line 126 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 config/helpers.js:127— `config/helpers.js` reports through `console.*` at line 127 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 config/helpers.js:128— `config/helpers.js` reports through `console.*` at line 128 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 config/list-balances.js:40— `config/list-balances.js` reports through `console.*` at line 40 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 config/list-balances.js:41— `config/list-balances.js` reports through `console.*` at line 41 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 config/list-users.js:15— `config/list-users.js` reports through `console.*` at line 15 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 config/list-users.js:16— `config/list-users.js` 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.
Silent fallback default in catch client/src/hooks/Config/useAnalytics.ts:37— `findContainerScript` swallows every exception into `return false` — 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 client/src/components/Chat/Messages/Content/Parts/SubagentCall.tsx:557— `extractSubagentType` swallows every exception into `return 'agent'` — 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 client/src/components/Chat/Messages/Content/Parts/BackgroundTaskCall.tsx:57— `BackgroundTaskCall` 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 client/src/components/Chat/Messages/Content/ToolApproval.tsx:246— `ToolApproval` swallows every exception into `return false` — 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 client/src/components/Chat/Messages/Content/AgentHandoff.tsx:44— `formatValue` 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 client/src/components/SidePanel/MCPBuilder/MCPServerDialog/utils/urlUtils.ts:41— `extractServerNameFromUrl` 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 client/src/lib/rum/redact.ts:117— `urlToPath` swallows every exception into `return '[url]'` — 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 client/src/lib/rum/logs.ts:238— `currentRouteTemplate` 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 client/src/lib/rum/privacy.ts:41— `sanitizeTelemetryUrl` swallows every exception into `return '[redacted]'` — 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 client/src/utils/files.ts:682— `readStoredPasteIds` 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 client/src/utils/files.ts:826— `readStoredRetainedDeletions` 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 client/src/utils/files.ts:977— `readPendingDiscardStore` 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 client/src/utils/drafts.ts:694— `encodeBase64` 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 client/src/utils/drafts.ts:707— `decodeBase64` 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 client/src/utils/subagentContent.ts:807— `summarizeOutput` 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/api/src/agents/activity.ts:66— `safeJson` 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/api/src/agents/execution.ts:494— `describeAuthFailure` swallows every exception into `return 'undescribable rejection'` — 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/api/src/agents/usage.ts:666— `parseUsageEvents` 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/api/src/utils/errors.ts:57— `redactUrl` swallows every exception into `return '[url]'` — 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/api/src/agents/run.ts:305— `extractInvokedSkillsFromPayload` 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/api/src/agents/ptc.ts:78— `safeStringify` 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/api/src/agents/hitl/resume.ts:625— `findAskUserQuestionContentIndex` swallows every exception into `return false` — 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/api/src/agents/hooks/runtime.ts:464— `hook` (in `registerPluginHooks`) 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/api/src/mcp/connection.ts:285— `getJSONRPCRequestIds` 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/api/src/mcp/sandbox.ts:63— `parseCspParam` 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.
Duplicated predicate client/src/hooks/Chat/cache.ts:12— `!!conversationId && conversationId !== Constants.NEW_CONVO && conversationId !== Constants.PENDING_CONVO` appears character-identically in 3 files — client/src/hooks/Chat/cache.ts, packages/chat/src/core/resumable/messages.ts, packages/data-provider/src/react-query/react-query-service.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:67— `!!process.env.LDAP_URL && !!process.env.LDAP_USER_SEARCH_BASE` appears character-identically in 2 files — REDACTED, api/server/services/Config/ldap.js. 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:114— `!Array.isArray(allowedAddresses) || allowedAddresses.length === 0` appears character-identically in 2 files — REDACTED, packages/api/src/oauth/tokens.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 api/server/services/ToolService.js:2702— `!Array.isArray(allowedDomains) || allowedDomains.length === 0` appears character-identically in 5 files — api/server/services/ToolService.js, REDACTED, packages/api/src/mcp/oauth/hardenedFetch.ts, packages/api/src/mcp/registry/MCPServerInspector.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 client/src/hooks/Messages/useCopyToClipboard.ts:56— `!Array.isArray(content) || content.length === 0` appears character-identically in 4 files — client/src/hooks/Messages/useCopyToClipboard.ts, packages/chat/src/core/pending.ts, packages/chat/src/core/usage/estimate.ts, packages/data-provider/src/messages.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/api/src/agents/run.ts:258— `!Array.isArray(messages) || messages.length === 0` appears character-identically in 2 files — packages/api/src/agents/run.ts, packages/api/src/oauth/failure.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 api/server/services/PermissionService.js:213— `!Array.isArray(resourceIds) || resourceIds.length === 0` appears character-identically in 3 files — api/server/services/PermissionService.js, packages/api/src/acl/accessControlService.ts, packages/data-schemas/src/methods/aclEntry.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/api/src/utils/code.ts:161— `!Number.isInteger(concurrency) || concurrency < 1` appears character-identically in 2 files — packages/api/src/utils/code.ts, packages/api/src/utils/promise.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/api/src/middleware/modelBoundContent.ts:215— `!Number.isSafeInteger(length) || length < 0` appears character-identically in 5 files — packages/api/src/middleware/modelBoundContent.ts, packages/api/src/protection/adapters/messages.ts, packages/api/src/protection/adapters/submissions.ts, packages/api/src/protection/files.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/api/src/agents/checkpoints/deletion.ts:231— `!Number.isSafeInteger(limit) || limit <= 0` appears character-identically in 2 files — packages/api/src/agents/checkpoints/deletion.ts, packages/data-schemas/src/methods/triggerDelivery.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:249— `!actions_result || !actions_result.length` appears character-identically in 2 files — REDACTED, 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 api/server/controllers/agents/openai.js:423— `!artifactWritesCovered && artifactPromises.length > 0` appears character-identically in 2 files — api/server/controllers/agents/openai.js, api/server/controllers/agents/responses.js. 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 client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx:40— `!attachments || attachments.length === 0` appears character-identically in 6 files — client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx, client/src/components/Chat/Messages/Content/Parts/Attachment.tsx, client/src/components/Chat/Messages/Content/Parts/handle.ts, client/src/hooks/SSE/atoms.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 api/server/services/AuthService.js:646— `!config || config.imageSigning !== 'cookies' || !config.privateKey || !config.keyPairId` appears character-identically in 2 files — api/server/services/AuthService.js, packages/api/src/cdn/cloudfront-cookies.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 client/src/hooks/Conversations/useNavigateToConvo.tsx:278— `!conversation.endpointType && endpointType` appears character-identically in 2 files — client/src/hooks/Conversations/useNavigateToConvo.tsx, client/src/hooks/useNewConvo.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 api/server/controllers/agents/request.js:189— `!conversationId || conversationId === Constants.NEW_CONVO` appears character-identically in 3 files — api/server/controllers/agents/request.js, api/server/middleware/validate/convoAccess.js, client/src/hooks/Conversations/useConversationSeen.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/api/src/skills/deployment.ts:1082— `!cursor || cursor === 'undefined' || cursor === 'null'` appears character-identically in 2 files — packages/api/src/skills/deployment.ts, packages/data-schemas/src/methods/skill.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/api/src/agents/checkpointer.ts:807— `!db || mongoose.connection.readyState !== 1` appears character-identically in 4 files — packages/api/src/agents/checkpointer.ts, packages/api/src/agents/checkpoints/deletion.ts, packages/api/src/agents/checkpoints/pruning.ts, packages/api/src/agents/checkpoints/storage.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 client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx:166— `!enableUserMsgMarkdown && 'whitespace-pre-wrap'` appears character-identically in 2 files — client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx, client/src/components/Chat/Messages/PendingTurn.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/api/tsdown.config.mjs:27— `!id.startsWith('.') && !id.startsWith('~') && !path.isAbsolute(id)` appears character-identically in 2 files — packages/api/tsdown.config.mjs, packages/client/tsdown.config.mjs. 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 api/server/routes/config.js:184— `!info.commit && !info.branch && !info.buildDate` appears character-identically in 2 files — api/server/routes/config.js, packages/api/src/app/build.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/api/src/agents/added.ts:158— `!isAgentsEndpoint(endpoint) && !endpointConfig` appears character-identically in 2 files — packages/api/src/agents/added.ts, packages/api/src/agents/load.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 client/src/components/Nav/SettingsTabs/ProviderKeys/utils.ts:68— `!isAgentsEndpoint(endpoint) && !isAssistantsEndpoint(endpoint)` appears character-identically in 2 files — client/src/components/Nav/SettingsTabs/ProviderKeys/utils.ts, client/src/utils/endpoints.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/api/src/code/decision.ts:51— `!isCodeWorkspaceSelections(selections) || selections.length === 0` appears character-identically in 3 files — packages/api/src/code/decision.ts, packages/api/src/code/targets.ts, packages/data-provider/src/code/workspace.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 client/src/hooks/Files/useClientResize.ts:43— `!isFileConfigLoaded && !isFileConfigError && !isFileConfigPaused` appears character-identically in 2 files — client/src/hooks/Files/useClientResize.ts, client/src/hooks/Files/useUploadOptions.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.
Fat interface: AdminRolesDeps (17 required operations) packages/api/src/admin/roles.ts:122— `AdminRolesDeps` declares 17 required operations: `listRoles`, `countRoles`, `getRoleByName`, `createRoleByName`, `updateRoleByName`, `updateAccessPermissions`, `deleteRoleByName`, `findUser`, `updateUser`, `updateUsersByRole`, `findUserIdsByRole`, `updateUsersRoleByIds`, `listUsersByRole`, `countUsersByRole`, `deleteConfig`, `deleteAclEntries`, `deleteGrantsForPrincipal`. 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: AdminUsersDeps (17 required operations) packages/api/src/admin/users.ts:68— `AdminUsersDeps` declares 17 required operations: `findUsers`, `countUsers`, `beginAgentTriggerUserDeletion`, `cancelAgentTriggerUserDeletion`, `drainAgentTriggerDeliveriesForUser`, `prepareAgentTriggerUserPurge`, `cancelAgentTriggerUserPurge`, `purgeAgentTriggerDeliveriesForUser`, `quiesceUserSchedules`, `restoreUserSchedulesFromDeletion`, `resolveErasure`, `deleteUserById`, `deleteUserCodeEnvironments`, `invalidateCodeEnvironmentConfigCache`, `deleteConfig`, `deleteAclEntries`, `deletePasskeysByUser`. 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: IJobStore (31 required operations) packages/api/src/stream/interfaces/IJobStore.ts:963— `IJobStore` declares 31 required operations: `initialize`, `createJob`, `getJob`, `updateJob`, `transitionStatus`, `claimIdempotencyKey`, `releaseIdempotencyKey`, `deleteJob`, `hasJob`, `getRunningJobs`, `cleanup`, `getJobCount`, `getJobCountByStatus`, `destroy`, `getActiveJobIdsByUser`, `setGraph`, `setContentParts`, `getContentParts`, `getRunSteps`, `appendChunk`, `clearContentState`, `setCollectedUsage`, `getCollectedUsage`, `enqueueSteer`, `drainSteers`, `closeAndDrainSteers`, `peekSteers`, `removeSteer`, `parkSteers`, `claimParkedSteers`, `clearSteers`. 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: IJobStoreV2 (57 required operations) packages/api/src/stream/interfaces/IJobStore.ts:1109— `IJobStoreV2` declares 57 required operations: `initialize`, `createJob`, `getJob`, `updateJob`, `markProviderExecutionDrained`, `beginProviderExecution`, `getCleanupBlockingJobIdsByUser`, `finalizeTerminalPersistence`, `transitionStatus`, `transitionStatusAndDrainSteers`, `claimIdempotencyKey`, `takeoverIdempotencyKey`, `markIdempotencyKeyStarted`, `adoptIdempotencyKeyForJob`, `releaseIdempotencyKey`, `deleteJob`, `hasJob`, `getRunningJobs`, `cleanup`, `getJobCount`, `getJobCountByStatus`, `destroy`, `getActiveJobIdsByUser`, `setGraph`, `setContentParts`, `getContentParts`, `settleEarlyBufferRecovery`, `finalizeEarlyBufferOverflow`, `hasSubscriberAttached`, `claimFirstSubscriber`, `detachSubscriber`, `hasActiveSubscriber`, `getRunSteps`, `appendChunk`, `clearContentState`, `setCollectedUsage`, `getCollectedUsage`, `enqueueSteer`, `enqueueSteerVersioned`, `enqueueSteerWithReceipt`, and 17 more. 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: AgentTriggerService (20 required operations) packages/api/src/agents/triggers/service.ts:197— `AgentTriggerService` declares 20 required operations: `initialize`, `stop`, `dispatch`, `enqueue`, `getDelivery`, `getDeliveryStatus`, `getDeadLetters`, `requeue`, `retire`, `renewProducerLease`, `persistBackgroundToolResult`, `getBackgroundToolResultClaim`, `getBackgroundCompletionResultBatchSize`, `getBackgroundCompletionReceiptBatching`, `getCompletionWaitMaxIntervalMs`, `expediteCompletionWakeups`, `drainUser`, `prepareUserPurge`, `cancelUserPurge`, `purgeUser`. 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: OpenIDRefreshRecoveryDeps (23 required operations) packages/api/src/auth/openid/recovery.ts:128— `OpenIDRefreshRecoveryDeps` declares 23 required operations: `findOpenIDUser`, `getOpenIdConfig`, `getOpenIdEmail`, `getOpenIdIssuer`, `createAuthIdentityContext`, `refreshOpenIDSession`, `storeOpenIDSession`, `setOpenIDAuthTokens`, `getOpenIDAppAuthToken`, `clearOpenIDAuthTokens`, `deleteOpenIDSession`, `createRefreshTokenBridgeFlightKey`, `createOpenIDRefreshFlightKey`, `storeRefreshTokenBridge`, `deleteRefreshTokenBridges`, `acquireOpenIDRefreshFlight`, `completeOpenIDRefreshFlight`, `failOpenIDRefreshFlight`, `waitForOpenIDRefreshFlight`, `assertOpenIDRefreshFlightAvailable`, `assertOpenIDRefreshSessionGenerationAvailable`, `revokeOpenIDRefreshFlights`, `withOpenIDRefreshFlightLease`. 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: ScheduleEngineDeps (17 required operations) packages/api/src/schedules/types.ts:184— `ScheduleEngineDeps` declares 17 required operations: `getLimits`, `getUserContext`, `isOutOfBalance`, `agentAccess`, `projectAccess`, `hasScheduleAccess`, `resolveFiles`, `enqueueTrigger`, `getTriggerDelivery`, `runInTenantContext`, `getJobStatus`, `abortScheduledJob`, `clearReconciledJob`, `countActiveRunsGlobal`, `isGloballyDisabled`, `isOwnerDeleting`, `withGlobalCapacitySlot`. 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: SchedulesService (19 required operations) packages/api/src/schedules/service.ts:216— `SchedulesService` declares 19 required operations: `getLimits`, `fireScheduleNow`, `recordScheduleOutcome`, `recordMCPToolAuthFailure`, `getMCPReceiptRetryPolicy`, `registerMCPSettlement`, `beginScheduledStop`, `acknowledgeScheduledStopPersistence`, `claimScheduleResume`, `releaseScheduleResumeClaim`, `finalizeScheduleResumeClaim`, `releaseScheduleResumeFence`, `isScheduleLive`, `deleteScheduleForOwner`, `quiesceUserSchedules`, `restoreUserSchedulesFromDeletion`, `initializeScheduleEngine`, `initializeScheduleErasureSweep`, `reconcileRetainedJobs`. 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: SkillsHandlersDeps (16 required operations) packages/api/src/skills/handlers.ts:66— `SkillsHandlersDeps` declares 16 required operations: `createSkill`, `getSkillById`, `listSkillsByAccess`, `updateSkill`, `deleteSkill`, `deleteSkillById`, `listSkillFiles`, `deleteSkillFile`, `findAccessibleResources`, `findPubliclyAccessibleResources`, `hasPublicPermission`, `grantPermission`, `getSkillFileByPath`, `updateSkillFileContent`, `getStrategyFunctions`, `isValidObjectIdString`. 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: MessagePartsHost (19 required operations) packages/chat/src/react/host.tsx:60— `MessagePartsHost` declares 19 required operations: `useMessage`, `renderMarkdown`, `useSmoothStreaming`, `useAgent`, `renderAgentIcon`, `useFontSize`, `useShowThinking`, `useAutoExpandTools`, `useLaTeXParsing`, `useChatDirection`, `useUserTextPreferences`, `useUser`, `useFileMap`, `useToast`, `useSandboxStarting`, `useToolArtifactClaim`, `useSteerEscalating`, `usePaneConversationId`, `useLiveAppliedSteer`. 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: ResumableCache (18 required operations) packages/chat/src/core/resumable/host.ts:167— `ResumableCache` declares 18 required operations: `invalidateMessages`, `fetchMessages`, `refreshConversation`, `refreshConversationLists`, `refreshPinnedConversations`, `setStreamStatus`, `removeStreamStatus`, `invalidateStreamStatus`, `addActiveJob`, `removeActiveJob`, `fetchConversation`, `setConversation`, `upsertConversation`, `removeConversation`, `getConversation`, `removeConversationQueries`, `queueTitleGeneration`, `addOptimisticConversation`. 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: SteerHost (17 required operations) packages/chat/src/react/steer/host.tsx:82— `SteerHost` declares 17 required operations: `useSteerMessage`, `useSteerMessageAsync`, `useCancelSteer`, `useArmSteer`, `useMarkFilesUsage`, `useEnqueueQueuedTurn`, `useCancelQueuedTurn`, `useQueuedTurns`, `useQueuedTurnCache`, `useFetchStreamStatus`, `useLatestMessage`, `useCodeApprovalMode`, `useLocalize`, `useNotify`, `useFileMap`, `useClearFilesToDelete`, `useSettings`. 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: MessageMethods (24 required operations) packages/data-schemas/src/methods/message.ts:742— `MessageMethods` declares 24 required operations: `getPersistedPrivateTextId`, `hasPersistedPrivateText`, `getPrivateMessageTexts`, `saveMessage`, `getConversationTraceRefs`, `hasSampledTraceMessage`, `recordSubagentTaskControlReceipt`, `getSubagentTaskControlReceipt`, `getSubagentTaskControlReplay`, `bulkSaveMessages`, `updateToolCallResult`, `claimBackgroundToolResults`, `confirmBackgroundToolResultClaim`, `releaseBackgroundToolResultClaims`, `updateMessage`, `claimSubagentTaskResult`, `releaseSubagentTaskResultClaim`, `getMessages`, `getMessagesForSubagentThreadView`, `listSubagentTasksForThreads`, `getMessage`, `getMessagesByCursor`, `searchMessages`, `deleteMessages`. 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: ConversationMethods (50 required operations) packages/data-schemas/src/methods/conversation.ts:288— `ConversationMethods` declares 50 required operations: `getConvoFiles`, `searchConversation`, `saveConvo`, `stampForcedRetention`, `setConvoPinned`, `appendConvoMessageReference`, `getConvoCodeEnvironmentDecision`, `reserveConvoLaneGitSeq`, `getConvoLaneContext`, `setConvoLaneGit`, `getConvoLaneGit`, `getConvosLaneGit`, `addConvoToolApprovalAllows`, `readAdmittedConvoCodeEnvironmentDecision`, `replaceConvoCodeEnvironmentDecision`, `bulkSaveConvos`, `getConvosByCursor`, `getConvosQueried`, `getConvo`, `getConvoTitleState`, `getSubagentThreadForParent`, `listSubagentThreadsForParent`, `getAgentEventBinding`, `getAgentEventActorSnapshot`, `commitAgentEventActorState`, `storeAgentEventActorSuspension`, `claimAgentEventActorSuspension`, `settleAgentEventActorSuspension`, `cancelAgentEventActorSuspension`, `beginAgentEventActorLegacyTurn`, `completeAgentEventActorLegacyTurn`, `recordAgentEventActorReconciliation`, `resolveAgentEventActorReconciliation`, `clearAgentEventActorReconciliation`, `getAgentEventActorReconciliationStorageMetrics`, `expireLegacyAgentEventActorReceipts`, `reserveSubagentThread`, `acquireSubagentThreadLease`, `renewSubagentThreadLease`, `releaseSubagentThreadLease`, and 10 more. 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: PromptMethods (20 required operations) packages/data-schemas/src/methods/prompt.ts:114— `PromptMethods` declares 20 required operations: `getPromptGroups`, `deletePromptGroup`, `getAllPromptGroups`, `getListPromptGroupsByAccess`, `incrementPromptGroupUsage`, `createPromptGroup`, `savePrompt`, `getPrompts`, `getPrompt`, `getPromptGroup`, `getOwnedPromptGroupIds`, `getPromptGroupAccessContext`, `invalidatePromptGroupAccessContext`, `deletePrompt`, `deleteUserPrompts`, `updatePromptGroup`, `makePromptProduction`, `updatePromptLabels`, `findLangfusePromptGroup`, `createLangfusePromptGroup`. 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: SkillLifecycleMethods (32 required operations) packages/data-schemas/src/methods/skillLifecycle.ts:58— `SkillLifecycleMethods` declares 32 required operations: `beginSkillDeletion`, `getSkillDeletion`, `discoverUnjournaledDeletions`, `listPendingSkillDeletions`, `listSkillDeletionTombstones`, `noteSkillDeletionAttempt`, `claimSkillDeletion`, `refreshSkillDeletionClaim`, `releaseSkillDeletionClaim`, `completeSkillDeletion`, `reopenSkillDeletion`, `scheduleSkillDeletionRecheck`, `reserveSkillUploadIntent`, `transitionSkillUploadIntent`, `listSkillUploadIntents`, `iterateSkillCleanupFiles`, `iterateSkillCleanupIntents`, `hasInFlightSkillUploads`, `listExistingSkillFileIds`, `getSkillUploadIntent`, `recoverStoppedSkillUploadIntent`, `finishSkillUploadCleanupHold`, `recoverStoppedSkillUploadCleanupHold`, `listAbandonedSkillUploadIntents`, `claimAbandonedSkillUploadIntent`, `refreshAbandonedSkillUploadIntentClaim`, `noteAbandonedSkillUploadIntentAttempt`, `releaseAbandonedSkillUploadIntentClaim`, `skillFileExistsForIntent`, `markSkillUploadIntentCleaned`, `queueCommittedSkillUploadCleanup`, `scheduleAbandonedSkillUploadIntentRecheck`. 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: AgentQueuedTurnMethods (25 required operations) packages/data-schemas/src/methods/queuedTurn.ts:200— `AgentQueuedTurnMethods` declares 25 required operations: `ensureAgentQueuedTurnIndexes`, `enqueueAgentQueuedTurn`, `getAgentQueuedTurnByClientRequestId`, `listActiveAgentQueuedTurns`, `listAgentQueuedTurnReceipts`, `findQueuedTurnsNeedingDelivery`, `claimQueuedTurnsForAdmissionReconciliation`, `deferAgentQueuedTurnAdmissionReconciliation`, `reserveAgentQueuedTurnDelivery`, `markQueuedTurnScheduled`, `cancelAgentQueuedTurn`, `claimNextAgentQueuedTurn`, `releaseAgentQueuedTurn`, `beginAgentQueuedTurnAdmission`, `markAgentQueuedTurnAdmitted`, `hasAgentQueuedTurnAdmissionReceipt`, `deadLetterAgentQueuedTurn`, `getEffectiveAgentQueuedTurnPredecessor`, `deleteAgentQueuedTurns`, `prepareAgentQueuedTurnConversationDeletion`, `deletePreparedAgentQueuedTurnConversations`, `markAgentQueuedTurnDeliveryRetired`, `beginAgentQueuedTurnMissingDeliveryRetirement`, `markAgentQueuedTurnMissingDeliveryRetired`, `deleteAllAgentQueuedTurnsForUser`. 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: AgentTriggerDeliveryMethods (54 required operations) packages/data-schemas/src/methods/triggerDelivery.ts:360— `AgentTriggerDeliveryMethods` declares 54 required operations: `ensureAgentTriggerDeliveryIndexes`, `enqueueAgentTriggerDelivery`, `claimNextAgentTriggerDelivery`, `findEarlierAgentTriggerDelivery`, `getAgentTriggerDeliveryBatch`, `releaseAgentTriggerDelivery`, `beginAgentTriggerDeliveryAttempt`, `deferAgentTriggerDeliveryAttempt`, `completeAgentTriggerDelivery`, `retireAgentTriggerDelivery`, `renewAgentTriggerDeliveryProducerLease`, `getAgentTriggerDeliveryProducerLease`, `listPendingAgentBackgroundToolCompletions`, `listUndeliveredAgentTriggerTaskIds`, `expediteAgentTriggerDeliveries`, `persistAgentBackgroundToolResult`, `getAgentBackgroundToolResult`, `getAgentBackgroundToolResultClaim`, `claimAgentBackgroundToolResults`, `releaseAgentBackgroundToolResultClaims`, `claimAgentBackgroundToolResultBatch`, `getAgentBackgroundToolResultBatch`, `beginAgentBackgroundToolResultBatchDispatch`, `confirmAgentBackgroundToolResultBatch`, `settleAgentTriggerHandlingOutcome`, `admitAgentEventActorAction`, `releaseAgentEventActorAction`, `getAgentEventActorActionAdmission`, `hasAgentEventActorActionAdmission`, `reserveAgentEventActorDetachedAction`, `markAgentEventActorDetachedActionRunning`, `markAgentEventActorDetachedActionLaunchIndeterminate`, `settleAgentEventActorDetachedAction`, `getAgentEventActorDetachedAction`, `settleAgentEventActorReceipt`, `getAgentEventActorReceipt`, `backfillAgentEventActorReceipt`, `getAgentEventActorReceiptStorageMetrics`, `retryAgentTriggerDelivery`, `deadLetterAgentTriggerDelivery`, and 14 more. 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.
X23 · Unguarded diagnostic materialisation· Diagnostic log message is built whether or not it is wanted · ×11
Diagnostic log message is built whether or not it is wanted packages/data-schemas/src/app/turnstile.ts:37— `debug` at line 37 is called with an argument built by `JSON.stringify(loadedTurnstile, null, 2)` (line 38), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
Diagnostic log message is built whether or not it is wanted packages/api/src/mcp/tools.ts:489— `debug` at line 489 is called with an argument built by `Object.keys(serverTools)` (line 490), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
Diagnostic log message is built whether or not it is wanted packages/api/src/app/permissions.ts:783— `debug` at line 783 is called with an argument built by `Object.keys(missingFields)` (line 784), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
Diagnostic log message is built whether or not it is wanted packages/api/src/agents/handlers.ts:5519— `debug` at line 5519 is called with an argument built by `JSON.stringify(kindCounts)` (line 5524), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
Diagnostic log message is built whether or not it is wanted api/strategies/appleStrategy.js:22— `debug` at line 22 is called with an argument built by `JSON.stringify(decoded, null, 2)` (line 22), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
Diagnostic log message is built whether or not it is wanted api/server/services/Files/Code/process.js:724— `debug` at line 724 is called with an argument built by `resourceFiles.map((f) => f?.file_id)` (line 726), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
Diagnostic log message is built whether or not it is wanted REDACTED:275— `debug` at line 275 is called with an argument built by `destroyedFileIds.join(', ')` (line 276), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
Diagnostic log message is built whether or not it is wanted REDACTED:295— `debug` at line 295 is called with an argument built by `ownedFiles.filter((f) => f.file_id)` (line 297), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
Diagnostic log message is built whether or not it is wanted REDACTED:338— `debug` at line 338 is called with an argument built by `authorizedFiles.filter((f) => f.file_id)` (line 340), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
Diagnostic log message is built whether or not it is wanted REDACTED:213— `debug` at line 213 is called with an argument built by `serversWithoutTools.join(', ')` (line 214), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
Diagnostic log message is built whether or not it is wanted api/server/controllers/agents/client.js:333— `debug` at line 333 is called with an argument built by `Object.keys(fadingTiers)` (line 334), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
Orphaned file client/src/hooks/useWakeLock.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 config/update-banner.js: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/api/src/files/sse.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 utils/update_env.py: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 api/db/utils.js: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 client/src/components/MCPUIResource/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 packages/client/src/svgs/ThumbDownIcon.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.
IC1 · Incompleteness & stubs· Empty method body · ×6
Empty method body api/server/services/Endpoints/agents/subagentThreadStore.js:96— `disconnectTaskRouting` has an empty body — confirm it's an intentional no-op and not an unfinished method.
Empty method body client/src/Providers/MessagesViewContext.tsx:182— `ask` has an empty body — confirm it's an intentional no-op and not an unfinished method.
Empty method body client/src/Providers/MessagesViewContext.tsx:183— `regenerate` has an empty body — confirm it's an intentional no-op and not an unfinished method.
Empty method body client/src/Providers/MessagesViewContext.tsx:184— `handleContinue` has an empty body — confirm it's an intentional no-op and not an unfinished method.
Empty method body client/src/Providers/MessagesViewContext.tsx:186— `setMessages` has an empty body — confirm it's an intentional no-op and not an unfinished method.
Empty method body client/src/components/Nav/KeyboardDeleteDialog.tsx:6— `retainView` has an empty body — confirm it's an intentional no-op and not an unfinished method.
Unused export 'default' client/src/components/Agents/SmartLoader.tsx:66— Nothing imports this binding — it is safe to review for removal.
Unused export 'default' client/src/components/Chat/Messages/Content/ParallelContent.tsx:370— Nothing imports this binding — it is safe to review for removal.
Unused export 'default' client/src/components/Skills/display/SkillDetailHeader.tsx:120— Nothing ultimately consumes this binding: its only referrer is the re-export in client/src/components/Skills/display/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in client/src/components/Skills/display/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'default' client/src/components/Skills/tree/SkillFileEditor.tsx:14— Nothing ultimately consumes this binding: its only referrer is the re-export in client/src/components/Skills/tree/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in client/src/components/Skills/tree/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'default' client/src/components/Skills/tree/SkillFilePreview.tsx:13— Nothing ultimately consumes this binding: its only referrer is the re-export in client/src/components/Skills/tree/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in client/src/components/Skills/tree/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'default' client/src/components/Skills/tree/TreeToolbar.tsx:51— Nothing ultimately consumes this binding: its only referrer is the re-export in client/src/components/Skills/tree/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in client/src/components/Skills/tree/index.ts in the same commit, or the barrel will import a name that no longer exists.
Hand-rolled JSON/XML parsing via regex packages/api/openapi/router.smoke.cjs:60— 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 client/src/lib/rum/redact.ts:31— 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 client/src/components/Chat/Messages/Content/Parts/intent.ts:30— 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 client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx:40— 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 client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx:41— 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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 191 significant file(s) lose their only recent owner: packages/api/src/middleware/modelBoundContent.ts, api/server/services/Endpoints/agents/initialize.js, packages/api/src/agents/activityPhases/runtime.ts, api/typedefs.js, packages/data-schemas/src/methods/mcpAuthority.ts, packages/api/src/agents/checkpointer.ts, packages/api/src/agents/subagentTaskRouting.ts, packages/api/src/agents/triggers/outcome.ts (+183 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 112 significant file(s) lose their only recent owner: packages/data-provider/src/themes/registry.ts, packages/data-provider/src/themes/types.ts, packages/data-provider/src/themes/highContrast.ts, client/src/components/Messages/Content/Mermaid/Mermaid.tsx, client/src/components/Projects/ProjectWorkspace.tsx, client/src/components/SidePanel/Agents/Tools/SkillsSection.tsx, client/src/components/Chat/Messages/Content/EditContentParts.tsx, REDACTED (+104 more). Pair on, review, or document these before any departure.
Blanket warning suppression config/delete-user.js:3— A bare `eslint-disable` or `@ts-nocheck` with no rule list switches every lint rule or the whole type checker off for the rest of the file — hidden debt. Disable the specific rule on the specific line, with a justification, instead.
Blanket warning suppression config/packages.js:2— A bare `eslint-disable` or `@ts-nocheck` with no rule list switches every lint rule or the whole type checker off for the rest of the file — hidden debt. Disable the specific rule on the specific line, with a justification, instead.
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.
C5 · Data-Subject Rights· Partial data-subject-rights support · ×1
Partial data-subject-rights support — Corroborated rights: erasure ✓ · export ✗ · consent ✗. Each tick means this scan found code in the repository implementing that right — a deletion/anonymisation path for erasure, a data-export or portability path for export, and consent state recorded alongside the personal data it authorises. A ✗ therefore means no such code was recognised HERE, not that the right is unsupported: a capability provided by a platform, a manual runbook, or code spelled in a way this scan does not match is not visible to it. Confirm before treating a cross as a gap; where it is one, the right has to be fulfilled manually.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 2 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 (305 single-owned of 2042 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; 2042 of the 3649 production source files in this repository met that bar). They are anonymized user #3 (1 file(s)), anonymized user #4 (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/data-schemas/src/methods/insights.ts, packages/api/src/agents/responses/clientTools.ts.
Documentation: no build, run or usage example README.md:1— the repository holds project manifests and neither `README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 7 of 9 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `packages/api` (292470 LoC, 2561 module-visible types across 110 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 2042 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; 2042 of the 3649 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: client/src/hooks/useWakeLock.ts, utils/update_env.py, config/update-banner.js, client/src/components/MCPUIResource/plugin.ts, packages/client/src/svgs/ThumbDownIcon.tsx, packages/api/src/files/sse.ts, api/db/utils.js. 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.
D40 · Network Egress Confinement· No network policy · ×1
No network policy — No Kubernetes NetworkPolicy (or Cilium policy) found. Without one, every pod can talk to every other pod and reach out to the internet by default. Add a default-deny policy and open only the flows you need.
DM9 · Scattered domain decisions· Rule about [id, kind] decided in 3 places · ×1
Rule about [id, kind] decided in 3 places — client.src.components.SidePanel.Agents.Tools.items.types.BuiltinItem's [id, kind] are judged in client.src.components.SidePanel.Agents.Tools.ItemDialog.ItemDialog, client.src.components.SidePanel.Agents.Tools.ToolCard, client.src.components.SidePanel.Agents.Tools.ToolsMarketplaceDialog — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
DM9 · Scattered domain decisions· Rule about [conversationId, runId] decided in 2 places · ×1
Rule about [conversationId, runId] decided in 2 places — packages.api.src.agents.files.manifest.RunFileScope's [conversationId, runId] are judged in packages.api.src.agents.files.manifest, packages.api.src.agents.files.session — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
DM9 · Scattered domain decisions· Rule about [metadata, status] decided in 3 places · ×1
Rule about [metadata, status] decided in 3 places — packages.api.src.agents.subagentCompletionWakeup.GenerationState's [metadata, status] are judged in packages.api.src.agents.backgroundCompletionWakeup, packages.api.src.agents.queuedTurns, packages.api.src.agents.subagentCompletionWakeup — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
DM9 · Scattered domain decisions· Rule about [bindingId, sourceKeyId] decided in 4 places · ×1
Rule about [bindingId, sourceKeyId] decided in 4 places — packages.api.src.agents.triggers.envelope.AgentContinueTarget's [bindingId, sourceKeyId] are judged in packages.api.src.agents.triggers.batch, packages.api.src.agents.triggers.continuation, packages.api.src.agents.triggers.delivery, packages.api.src.agents.triggers.service — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
DM9 · Scattered domain decisions· Rule about [id, type] decided in 6 places · ×1
Rule about [id, type] decided in 6 places — packages.api.src.agents.triggers.envelope.AgentTriggerSource's [id, type] are judged in packages.api.src.agents.backgroundCompletionWakeup, packages.api.src.agents.queuedTurns, packages.api.src.agents.subagentCompletionWakeup, packages.api.src.agents.triggers.batch, packages.api.src.agents.triggers.bindingResolver, packages.api.src.agents.triggers.host — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
DM9 · Scattered domain decisions· Rule about [code, status] decided in 2 places · ×1
Rule about [code, status] decided in 2 places — packages.api.src.agents.triggers.host.AgentTriggerExecutionError's [code, status] are judged in packages.api.src.agents.triggers.engine, packages.api.src.agents.triggers.host — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
DM9 · Scattered domain decisions· Rule about [key, ownerId] decided in 2 places · ×1
Rule about [key, ownerId] decided in 2 places — packages.api.src.auth.openid.types.OpenIDPublicationGeneration's [key, ownerId] are judged in packages.api.src.auth.openid.recovery, packages.api.src.auth.openid.session — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
DM9 · Scattered domain decisions· Rule about [generation, key] decided in 2 places · ×1
Rule about [generation, key] decided in 2 places — packages.api.src.mcp.registry.cache.ReadThroughAllCache.FillToken's [generation, key] are judged in packages.api.src.mcp.registry.cache.ReadThroughAllCache.ReadThroughAllCache, packages.api.src.mcp.registry.cache.ReadThroughCache.ReadThroughCache — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
DM9 · Scattered domain decisions· Rule about [providerDrained, terminalHostActionPending, terminalPersistencePending] decided in 2 places · ×1
Rule about [providerDrained, terminalHostActionPending, terminalPersistencePending] decided in 2 places — packages.api.src.schedules.types.JobState's [providerDrained, terminalHostActionPending, terminalPersistencePending] are judged in packages.api.src.schedules.engine, packages.api.src.schedules.erasure — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
DM9 · Scattered domain decisions· Rule about [scheduleId, scheduledFor] decided in 2 places · ×1
Rule about [scheduleId, scheduledFor] decided in 2 places — packages.api.src.schedules.types.JobState's [scheduleId, scheduledFor] are judged in packages.api.src.schedules.engine, packages.api.src.schedules.erasure — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
DM9 · Scattered domain decisions· Rule about [createdAt, providerDrained, terminalHostActionPending, terminalPersistencePending] decided in 2 places · ×1
Rule about [createdAt, providerDrained, terminalHostActionPending, terminalPersistencePending] decided in 2 places — packages.api.src.stream.interfaces.IJobStore.SerializableJobData's [createdAt, providerDrained, terminalHostActionPending, terminalPersistencePending] are judged in packages.api.src.schedules.service, packages.api.src.stream.GenerationJobManager.GenerationJobManagerClass — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
DM9 · Scattered domain decisions· Rule about [createdAt, userId] decided in 2 places · ×1
Rule about [createdAt, userId] decided in 2 places — packages.api.src.stream.interfaces.IJobStore.SerializableJobData's [createdAt, userId] are judged in packages.api.src.schedules.service, packages.api.src.stream.GenerationJobManager.GenerationJobManagerClass — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
DM9 · Scattered domain decisions· Rule about [status, terminalPersistencePending] decided in 2 places · ×1
Rule about [status, terminalPersistencePending] decided in 2 places — packages.api.src.stream.interfaces.IJobStore.SerializableJobData's [status, terminalPersistencePending] are judged in packages.api.src.stream.GenerationJobManager.GenerationJobManagerClass, packages.api.src.stream.settled — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
DM9 · Scattered domain decisions· Rule about [bytes, items] decided in 2 places · ×1
Rule about [bytes, items] decided in 2 places — packages.api.src.stream.internal.replay.ReplayLimits's [bytes, items] are judged in packages.api.src.stream.implementations.InMemoryEventTransport.InMemoryEventTransport, packages.api.src.stream.implementations.RedisEventTransport.RedisEventTransport — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
DM9 · Scattered domain decisions· Rule about [active, createdAt] decided in 5 places · ×1
Rule about [active, createdAt] decided in 5 places — packages.chat.src.core.resumable.host.StreamStatusResponse's [active, createdAt] are judged in packages.chat.src.core.resumable.ceiling, packages.chat.src.core.resumable.missing, packages.chat.src.core.resumable.reconcile, packages.chat.src.core.resumable.subscription.ResumableSubscription, packages.chat.src.core.resumable.terminal — the same decision, restated. Every copy is a chance to drift, and copies drift silently because each one looks correct on its own. Move the judgement onto the type that owns the members and let the call sites ask it.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
Logging is not universal — Only 9/10 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`.
No SAST — No static application security testing detected. For this repository's stack, add CodeQL's javascript-typescript pack, `semgrep --config=p/typescript`, or eslint-plugin-security as a CI step. What was searched, so you can tell an absence from a miss: the 266605 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
Unused export 'isHttps' client/src/components/SidePanel/MCPBuilder/MCPServerDialog/utils/urlUtils.ts:64— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'detectTransportFromUrl' · ×1
Unused export 'detectTransportFromUrl' client/src/components/SidePanel/MCPBuilder/MCPServerDialog/utils/urlUtils.ts:94— Nothing imports this binding — it is safe to review for removal.
R8 · Dependency Hygiene· Type-only dependency 'https-proxy-agent' in production deps · ×1
Type-only dependency 'https-proxy-agent' in production deps api/typedefs.js:1662— Every import is type-only — move it to devDependencies.
R8 · Dependency Hygiene· Test-only dependency 'bcryptjs' in production deps · ×1
Test-only dependency 'bcryptjs' in production deps REDACTED:64— Only test files import it (first: api/server/controllers/auth/PasskeyController.spec.js:27) — move it to devDependencies.
X2 · Cancellation propagation· Not all functions that make a request accept a context.Context or an AbortSignal · ×1
Not all functions that make a request accept a context.Context or an AbortSignal — Only 60/109 functions that make a cancellable request (fetch, axios, ky, ofetch; net/http, net.Dial) accept a context.Context or an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, a cancelled request, a shutdown, an expired deadline. Take a `signal` (Go: `ctx context.Context`) 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 — ~0.6 `!` null assertions per 1k TypeScript source lines — 423 assertion(s) across the 709376 source line(s) of the 3178 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: packages/api/src/mcp/MCPConnectionFactory.ts (53), client/src/components/Chat/Subagents/state.ts (25), packages/api/src/mcp/MCPManager.ts (17). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
Outdated: github.com/prometheus/client_golang — `github.com/prometheus/client_golang` is required at v1.23.2 in REDACTED, but v1.25.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/prometheus/client_golang@v1.25.0 && go mod tidy` and commit the updated REDACTED and go.sum.
Outdated: github.com/redis/go-redis/v9 — `github.com/redis/go-redis/v9` is required at v9.17.2 in REDACTED, but v9.23.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/redis/go-redis/v9@v9.23.0 && go mod tidy` and commit the updated REDACTED and go.sum.
Outdated: go.opentelemetry.io/proto/otlp — `go.opentelemetry.io/proto/otlp` is required at v1.9.0 in REDACTED, but v1.11.1 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get go.opentelemetry.io/proto/otlp@v1.11.1 && go mod tidy` and commit the updated REDACTED and go.sum.
Outdated: google.golang.org/protobuf — `google.golang.org/protobuf` is required at v1.36.11 in REDACTED, but v1.36.12 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get google.golang.org/protobuf@v1.36.12 && go mod tidy` and commit the updated REDACTED and go.sum.
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 72 file(s) — `client/src/components/Balance/Summary.tsx`, `client/src/components/Chat/Input/Files/Table/ColumnVisibilityDropdown.tsx`, `client/src/components/Chat/Messages/Content/Wakeup.tsx`, `client/src/components/Chat/Messages/MultiMessage.tsx`, `client/src/components/Chat/Subagents/SubagentActivity.tsx`, … (+67 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 — The repository ships application workloads but no cluster-governance resources (CRDs, admission webhooks, or a committed policy engine). Runtime threat-detection (Falco/Tetragon) and admission control (Kyverno/OPA-Gatekeeper/PodSecurity) are cluster-OPERATOR controls owned by the platform, not shipped by an application repo/chart — nothing for this repo to assess.
Run 01a17965-8d4d-7684-8fbe-e42a9d493e73 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 396 · Warnings: 5562 · Recommendations: 1642 · Info: 4 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 26-10-2026 @ 18:07 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.