Public report of pydantic/pydantic-ai, published 5 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.2). 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, 5 November 2026, 07:05 UTC · Survey ID cd_6eba997a84284ab3a33af52e4426deb6
pydantic/pydantic-ai
Measured 5 November 2026, 07:03 UTC, at code version 8b455f2
Test reliability is not measured: The suite could not be re-run, but the repository declares tests of its own unreliable.
CAI scoreAt riskUp 2 since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 313,043 lines of product code in 8 projects, tests not counted · Estimated rebuild effort: about 6.6 person-years · Weakest lens: Accessibility, 39
Findings by how serious they are
44 critical1429 serious78 minor
14 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
5 November 2026, 07:03 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
85of 85 dimensions measured by tools.
1534of 1551 findings point to an exact file and line, so you can open each one in the code. The other 17 concern the repository as a whole, such as missing documentation.
85dimensions across 8 lenses, read from 313,043 lines of product code in 8 projects.
pydantic/pydantic-ai is rated At risk because critical security findings are open, most of them in its code. It scores 52 out of 100, which the At risk rating leaves unchanged.
Accessibility, at 39, is the weakest lens and counts most in the score. The best first step for the work it takes is replacing the three exposed passwords or keys and switching the old ones off, worth about 3 points. Fixing focus, motion and contrast would lift Accessibility itself, worth about 6 points. Raising Accessibility to 70 would lift the score to about 63.
Twenty weaknesses in the code could be used by an attacker. Three known security holes in the packages the code depends on can be used by attackers, and three passwords or keys are open to anyone who can read the repository. Fixing the weaknesses the scanner points to, updating the vulnerable packages and replacing each exposed password or key would close these risks. Correcting the flagged pipeline settings would fix the four weaknesses in the build pipeline's configuration, and the three places where the code runs text as code or as a command need a direct call instead. The three buttons or links with no name need a name, even when they only show an icon.
The product code is 313,043 lines, about €960,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 Accessibility rose from 39 to 70, the lowest score rated Strong, the score would rise from 52 to about 63.
Code composition: what the lines of code are
Product code 31%Tests 69%
New since the last survey: 440 findings
These 440 critical or serious findings weren't in the previous survey, on 20 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 334 findings
These 334 critical or serious findings were in the previous survey, on 20 October 2026, and are gone from this one. The first 100 are listed here.
€320,000 to €1,600,000, for 5,303 to 16,824 hours of work, about 6.6 person-years for 3 to 13 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 52. 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
Large: 313,043 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 3 Leaked secret finding(s) in Secret Scanning — start with REDACTED (2), REDACTED.
Raises the score by about 3 points · Low effort · Secret Scanning
2
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.
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 €960,000 to build again, about 6.6 person-years of work. Its weakest lens is Accessibility, at 39 (Weak). Accessibility is about whether the interface is built so that everyone can use it, including people who can't see the screen or can't use a mouse. Because the weakest lens counts most in the score, work on Accessibility also moves the score most.
Based on: the rebuild estimate · the Accessibility grade · how much each lens counts
What to do: Start with the Accessibility actions in Top priorities.
If you do one thing first · First action
Resolve the 3 Leaked secret finding(s) in Secret Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 3 points for low effort, because it clears the 3 Secret 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 7.2 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 2% to 5% on every change. The history of the code shows how much it changes: about 1,952,531 lines over the last 90 days, which is about 7,918,598 lines a year. At that pace, the extra work comes to an estimated 410.1 to 2639.5 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
912 modules, with 1157 dependencies between them. 2 loops run through 39 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 872 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.
pydantic_ai_slim.pydantic_ai.embeddings.result uses pydantic_ai_slim.pydantic_ai.usage, so a change to pydantic_ai_slim.pydantic_ai.usage can break pydantic_ai_slim.pydantic_ai.embeddings.result, while a change to pydantic_ai_slim.pydantic_ai.embeddings.result can't break pydantic_ai_slim.pydantic_ai.usage.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.embeddings.result uses a module listed above it, which is the healthy direction.
15→31 pydantic_ai_slim.pydantic_ai.output uses pydantic_ai_slim.pydantic_ai.messagespart of a loop✕
Connections
1 pair of types, where a type in pydantic_ai_slim.pydantic_ai.output uses a type in pydantic_ai_slim.pydantic_ai.messages.
pydantic_ai_slim.pydantic_ai.output uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai.output, while a change to pydantic_ai_slim.pydantic_ai.output can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
16→22 pydantic_ai_slim.pydantic_ai.profiles.openai uses pydantic_ai_slim.pydantic_ai.profilespart of a loop✕
Connections
1 pair of types, where a type in pydantic_ai_slim.pydantic_ai.profiles.openai uses a type in pydantic_ai_slim.pydantic_ai.profiles.
pydantic_ai_slim.pydantic_ai.profiles.openai uses pydantic_ai_slim.pydantic_ai.profiles, so a change to pydantic_ai_slim.pydantic_ai.profiles can break pydantic_ai_slim.pydantic_ai.profiles.openai, while a change to pydantic_ai_slim.pydantic_ai.profiles.openai can't break pydantic_ai_slim.pydantic_ai.profiles.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
pydantic_ai_slim.pydantic_ai.realtime.codec uses pydantic_ai_slim.pydantic_ai.usage, so a change to pydantic_ai_slim.pydantic_ai.usage can break pydantic_ai_slim.pydantic_ai.realtime.codec, while a change to pydantic_ai_slim.pydantic_ai.realtime.codec can't break pydantic_ai_slim.pydantic_ai.usage.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.realtime.codec uses a module listed above it, which is the healthy direction.
src.pydantic_clai2.pydantic_clai2.builtin_plugins uses src.pydantic_clai2.pydantic_clai2.config.api_keys, so a change to src.pydantic_clai2.pydantic_clai2.config.api_keys can break src.pydantic_clai2.pydantic_clai2.builtin_plugins, while a change to src.pydantic_clai2.pydantic_clai2.builtin_plugins can't break src.pydantic_clai2.pydantic_clai2.config.api_keys.
Position
Below the diagonal: src.pydantic_clai2.pydantic_clai2.builtin_plugins uses a module listed above it, which is the healthy direction.
src.pydantic_clai2.pydantic_clai2.builtin_plugins uses src.pydantic_clai2.pydantic_clai2.plugins.menus, so a change to src.pydantic_clai2.pydantic_clai2.plugins.menus can break src.pydantic_clai2.pydantic_clai2.builtin_plugins, while a change to src.pydantic_clai2.pydantic_clai2.builtin_plugins can't break src.pydantic_clai2.pydantic_clai2.plugins.menus.
Position
Below the diagonal: src.pydantic_clai2.pydantic_clai2.builtin_plugins uses a module listed above it, which is the healthy direction.
src.pydantic_clai2.pydantic_clai2.builtin_plugins.web uses src.pydantic_clai2.pydantic_clai2.plugins, so a change to src.pydantic_clai2.pydantic_clai2.plugins can break src.pydantic_clai2.pydantic_clai2.builtin_plugins.web, while a change to src.pydantic_clai2.pydantic_clai2.builtin_plugins.web can't break src.pydantic_clai2.pydantic_clai2.plugins.
Position
Below the diagonal: src.pydantic_clai2.pydantic_clai2.builtin_plugins.web uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in src.pydantic_clai2.pydantic_clai2.builtin_plugins.web uses a type in src.pydantic_clai2.pydantic_clai2.plugins.menus.
src.pydantic_clai2.pydantic_clai2.builtin_plugins.web uses src.pydantic_clai2.pydantic_clai2.plugins.menus, so a change to src.pydantic_clai2.pydantic_clai2.plugins.menus can break src.pydantic_clai2.pydantic_clai2.builtin_plugins.web, while a change to src.pydantic_clai2.pydantic_clai2.builtin_plugins.web can't break src.pydantic_clai2.pydantic_clai2.plugins.menus.
Position
Below the diagonal: src.pydantic_clai2.pydantic_clai2.builtin_plugins.web uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.capabilities.abstract uses pydantic_ai_slim.pydantic_ai._deferred, so a change to pydantic_ai_slim.pydantic_ai._deferred can break pydantic_ai_slim.pydantic_ai.capabilities.abstract, while a change to pydantic_ai_slim.pydantic_ai.capabilities.abstract can't break pydantic_ai_slim.pydantic_ai._deferred.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.capabilities.abstract uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.capabilities.abstract uses pydantic_ai_slim.pydantic_ai.tools, so a change to pydantic_ai_slim.pydantic_ai.tools can break pydantic_ai_slim.pydantic_ai.capabilities.abstract, while a change to pydantic_ai_slim.pydantic_ai.capabilities.abstract can't break pydantic_ai_slim.pydantic_ai.tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.capabilities.abstract uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.capabilities.abstract uses pydantic_ai_slim.pydantic_ai.workspaces.workspace, so a change to pydantic_ai_slim.pydantic_ai.workspaces.workspace can break pydantic_ai_slim.pydantic_ai.capabilities.abstract, while a change to pydantic_ai_slim.pydantic_ai.capabilities.abstract can't break pydantic_ai_slim.pydantic_ai.workspaces.workspace.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.capabilities.abstract uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.capabilities.abstract uses pydantic_ai_slim.pydantic_ai.output, so a change to pydantic_ai_slim.pydantic_ai.output can break pydantic_ai_slim.pydantic_ai.capabilities.abstract, while a change to pydantic_ai_slim.pydantic_ai.capabilities.abstract can't break pydantic_ai_slim.pydantic_ai.output.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.capabilities.abstract uses a module listed above it, which is the healthy direction.
20→27 pydantic_ai_slim.pydantic_ai.capabilities.abstract uses pydantic_ai_slim.pydantic_ai.modelspart of a loop✕
Connections
2 pairs of types, where a type in pydantic_ai_slim.pydantic_ai.capabilities.abstract uses a type in pydantic_ai_slim.pydantic_ai.models.
pydantic_ai_slim.pydantic_ai.capabilities.abstract uses pydantic_ai_slim.pydantic_ai.models, so a change to pydantic_ai_slim.pydantic_ai.models can break pydantic_ai_slim.pydantic_ai.capabilities.abstract, while a change to pydantic_ai_slim.pydantic_ai.capabilities.abstract can't break pydantic_ai_slim.pydantic_ai.models.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
20→31 pydantic_ai_slim.pydantic_ai.capabilities.abstract uses pydantic_ai_slim.pydantic_ai.messagespart of a loop✕
Connections
2 pairs of types, where a type in pydantic_ai_slim.pydantic_ai.capabilities.abstract uses a type in pydantic_ai_slim.pydantic_ai.messages.
pydantic_ai_slim.pydantic_ai.capabilities.abstract uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai.capabilities.abstract, while a change to pydantic_ai_slim.pydantic_ai.capabilities.abstract can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
pydantic_ai_slim.pydantic_ai.embeddings.base uses pydantic_ai_slim.pydantic_ai.embeddings.result, so a change to pydantic_ai_slim.pydantic_ai.embeddings.result can break pydantic_ai_slim.pydantic_ai.embeddings.base, while a change to pydantic_ai_slim.pydantic_ai.embeddings.base can't break pydantic_ai_slim.pydantic_ai.embeddings.result.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.embeddings.base uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.profiles uses pydantic_ai_slim.pydantic_ai.realtime.profiles, so a change to pydantic_ai_slim.pydantic_ai.realtime.profiles can break pydantic_ai_slim.pydantic_ai.profiles, while a change to pydantic_ai_slim.pydantic_ai.profiles can't break pydantic_ai_slim.pydantic_ai.realtime.profiles.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.profiles uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.profiles uses pydantic_ai_slim.pydantic_ai.profiles.openai, so a change to pydantic_ai_slim.pydantic_ai.profiles.openai can break pydantic_ai_slim.pydantic_ai.profiles, while a change to pydantic_ai_slim.pydantic_ai.profiles can't break pydantic_ai_slim.pydantic_ai.profiles.openai.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.profiles uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.anthropic uses pydantic_ai_slim.pydantic_ai.native_tools, so a change to pydantic_ai_slim.pydantic_ai.native_tools can break pydantic_ai_slim.pydantic_ai.models.anthropic, while a change to pydantic_ai_slim.pydantic_ai.models.anthropic can't break pydantic_ai_slim.pydantic_ai.native_tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.anthropic uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.anthropic uses pydantic_ai_slim.pydantic_ai.settings, so a change to pydantic_ai_slim.pydantic_ai.settings can break pydantic_ai_slim.pydantic_ai.models.anthropic, while a change to pydantic_ai_slim.pydantic_ai.models.anthropic can't break pydantic_ai_slim.pydantic_ai.settings.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.anthropic uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.anthropic uses pydantic_ai_slim.pydantic_ai.tools, so a change to pydantic_ai_slim.pydantic_ai.tools can break pydantic_ai_slim.pydantic_ai.models.anthropic, while a change to pydantic_ai_slim.pydantic_ai.models.anthropic can't break pydantic_ai_slim.pydantic_ai.tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.anthropic uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.anthropic uses pydantic_ai_slim.pydantic_ai.usage, so a change to pydantic_ai_slim.pydantic_ai.usage can break pydantic_ai_slim.pydantic_ai.models.anthropic, while a change to pydantic_ai_slim.pydantic_ai.models.anthropic can't break pydantic_ai_slim.pydantic_ai.usage.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.anthropic uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.anthropic uses pydantic_ai_slim.pydantic_ai.capabilities.abstract, so a change to pydantic_ai_slim.pydantic_ai.capabilities.abstract can break pydantic_ai_slim.pydantic_ai.models.anthropic, while a change to pydantic_ai_slim.pydantic_ai.models.anthropic can't break pydantic_ai_slim.pydantic_ai.capabilities.abstract.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.anthropic uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.anthropic uses pydantic_ai_slim.pydantic_ai.profiles, so a change to pydantic_ai_slim.pydantic_ai.profiles can break pydantic_ai_slim.pydantic_ai.models.anthropic, while a change to pydantic_ai_slim.pydantic_ai.models.anthropic can't break pydantic_ai_slim.pydantic_ai.profiles.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.anthropic uses a module listed above it, which is the healthy direction.
23→27 pydantic_ai_slim.pydantic_ai.models.anthropic uses pydantic_ai_slim.pydantic_ai.modelspart of a loop✕
Connections
5 pairs of types, where a type in pydantic_ai_slim.pydantic_ai.models.anthropic uses a type in pydantic_ai_slim.pydantic_ai.models.
pydantic_ai_slim.pydantic_ai.models.anthropic uses pydantic_ai_slim.pydantic_ai.models, so a change to pydantic_ai_slim.pydantic_ai.models can break pydantic_ai_slim.pydantic_ai.models.anthropic, while a change to pydantic_ai_slim.pydantic_ai.models.anthropic can't break pydantic_ai_slim.pydantic_ai.models.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
23→31 pydantic_ai_slim.pydantic_ai.models.anthropic uses pydantic_ai_slim.pydantic_ai.messagespart of a loop✕
Connections
19 pairs of types, where a type in pydantic_ai_slim.pydantic_ai.models.anthropic uses a type in pydantic_ai_slim.pydantic_ai.messages.
pydantic_ai_slim.pydantic_ai.models.anthropic uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai.models.anthropic, while a change to pydantic_ai_slim.pydantic_ai.models.anthropic can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
23→34 pydantic_ai_slim.pydantic_ai.models.anthropic uses pydantic_ai_slim.pydantic_ai.exceptionspart of a loop✕
Connections
1 pair of types, where a type in pydantic_ai_slim.pydantic_ai.models.anthropic uses a type in pydantic_ai_slim.pydantic_ai.exceptions.
pydantic_ai_slim.pydantic_ai.models.anthropic uses pydantic_ai_slim.pydantic_ai.exceptions, so a change to pydantic_ai_slim.pydantic_ai.exceptions can break pydantic_ai_slim.pydantic_ai.models.anthropic, while a change to pydantic_ai_slim.pydantic_ai.models.anthropic can't break pydantic_ai_slim.pydantic_ai.exceptions.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
pydantic_ai_slim.pydantic_ai.models.decision uses pydantic_ai_slim.pydantic_ai.settings, so a change to pydantic_ai_slim.pydantic_ai.settings can break pydantic_ai_slim.pydantic_ai.models.decision, while a change to pydantic_ai_slim.pydantic_ai.models.decision can't break pydantic_ai_slim.pydantic_ai.settings.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.decision uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.decision uses pydantic_ai_slim.pydantic_ai.tools, so a change to pydantic_ai_slim.pydantic_ai.tools can break pydantic_ai_slim.pydantic_ai.models.decision, while a change to pydantic_ai_slim.pydantic_ai.models.decision can't break pydantic_ai_slim.pydantic_ai.tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.decision uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.decision uses pydantic_ai_slim.pydantic_ai.usage, so a change to pydantic_ai_slim.pydantic_ai.usage can break pydantic_ai_slim.pydantic_ai.models.decision, while a change to pydantic_ai_slim.pydantic_ai.models.decision can't break pydantic_ai_slim.pydantic_ai.usage.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.decision uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.decision uses pydantic_ai_slim.pydantic_ai.profiles, so a change to pydantic_ai_slim.pydantic_ai.profiles can break pydantic_ai_slim.pydantic_ai.models.decision, while a change to pydantic_ai_slim.pydantic_ai.models.decision can't break pydantic_ai_slim.pydantic_ai.profiles.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.decision uses a module listed above it, which is the healthy direction.
24→27 pydantic_ai_slim.pydantic_ai.models.decision uses pydantic_ai_slim.pydantic_ai.modelspart of a loop✕
Connections
3 pairs of types, where a type in pydantic_ai_slim.pydantic_ai.models.decision uses a type in pydantic_ai_slim.pydantic_ai.models.
pydantic_ai_slim.pydantic_ai.models.decision uses pydantic_ai_slim.pydantic_ai.models, so a change to pydantic_ai_slim.pydantic_ai.models can break pydantic_ai_slim.pydantic_ai.models.decision, while a change to pydantic_ai_slim.pydantic_ai.models.decision can't break pydantic_ai_slim.pydantic_ai.models.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
24→31 pydantic_ai_slim.pydantic_ai.models.decision uses pydantic_ai_slim.pydantic_ai.messagespart of a loop✕
Connections
2 pairs of types, where a type in pydantic_ai_slim.pydantic_ai.models.decision uses a type in pydantic_ai_slim.pydantic_ai.messages.
pydantic_ai_slim.pydantic_ai.models.decision uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai.models.decision, while a change to pydantic_ai_slim.pydantic_ai.models.decision can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
24→34 pydantic_ai_slim.pydantic_ai.models.decision uses pydantic_ai_slim.pydantic_ai.exceptionspart of a loop✕
Connections
1 pair of types, where a type in pydantic_ai_slim.pydantic_ai.models.decision uses a type in pydantic_ai_slim.pydantic_ai.exceptions.
pydantic_ai_slim.pydantic_ai.models.decision uses pydantic_ai_slim.pydantic_ai.exceptions, so a change to pydantic_ai_slim.pydantic_ai.exceptions can break pydantic_ai_slim.pydantic_ai.models.decision, while a change to pydantic_ai_slim.pydantic_ai.models.decision can't break pydantic_ai_slim.pydantic_ai.exceptions.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
pydantic_ai_slim.pydantic_ai.models.openai uses pydantic_ai_slim.pydantic_ai.native_tools, so a change to pydantic_ai_slim.pydantic_ai.native_tools can break pydantic_ai_slim.pydantic_ai.models.openai, while a change to pydantic_ai_slim.pydantic_ai.models.openai can't break pydantic_ai_slim.pydantic_ai.native_tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.openai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.openai uses pydantic_ai_slim.pydantic_ai.settings, so a change to pydantic_ai_slim.pydantic_ai.settings can break pydantic_ai_slim.pydantic_ai.models.openai, while a change to pydantic_ai_slim.pydantic_ai.models.openai can't break pydantic_ai_slim.pydantic_ai.settings.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.openai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.openai uses pydantic_ai_slim.pydantic_ai.tools, so a change to pydantic_ai_slim.pydantic_ai.tools can break pydantic_ai_slim.pydantic_ai.models.openai, while a change to pydantic_ai_slim.pydantic_ai.models.openai can't break pydantic_ai_slim.pydantic_ai.tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.openai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.openai uses pydantic_ai_slim.pydantic_ai.usage, so a change to pydantic_ai_slim.pydantic_ai.usage can break pydantic_ai_slim.pydantic_ai.models.openai, while a change to pydantic_ai_slim.pydantic_ai.models.openai can't break pydantic_ai_slim.pydantic_ai.usage.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.openai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.openai uses pydantic_ai_slim.pydantic_ai.output, so a change to pydantic_ai_slim.pydantic_ai.output can break pydantic_ai_slim.pydantic_ai.models.openai, while a change to pydantic_ai_slim.pydantic_ai.models.openai can't break pydantic_ai_slim.pydantic_ai.output.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.openai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.openai uses pydantic_ai_slim.pydantic_ai.profiles.openai, so a change to pydantic_ai_slim.pydantic_ai.profiles.openai can break pydantic_ai_slim.pydantic_ai.models.openai, while a change to pydantic_ai_slim.pydantic_ai.models.openai can't break pydantic_ai_slim.pydantic_ai.profiles.openai.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.openai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.openai uses pydantic_ai_slim.pydantic_ai.capabilities.abstract, so a change to pydantic_ai_slim.pydantic_ai.capabilities.abstract can break pydantic_ai_slim.pydantic_ai.models.openai, while a change to pydantic_ai_slim.pydantic_ai.models.openai can't break pydantic_ai_slim.pydantic_ai.capabilities.abstract.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.openai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.openai uses pydantic_ai_slim.pydantic_ai.profiles, so a change to pydantic_ai_slim.pydantic_ai.profiles can break pydantic_ai_slim.pydantic_ai.models.openai, while a change to pydantic_ai_slim.pydantic_ai.models.openai can't break pydantic_ai_slim.pydantic_ai.profiles.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.openai uses a module listed above it, which is the healthy direction.
25→27 pydantic_ai_slim.pydantic_ai.models.openai uses pydantic_ai_slim.pydantic_ai.modelspart of a loop✕
Connections
9 pairs of types, where a type in pydantic_ai_slim.pydantic_ai.models.openai uses a type in pydantic_ai_slim.pydantic_ai.models.
pydantic_ai_slim.pydantic_ai.models.openai uses pydantic_ai_slim.pydantic_ai.models, so a change to pydantic_ai_slim.pydantic_ai.models can break pydantic_ai_slim.pydantic_ai.models.openai, while a change to pydantic_ai_slim.pydantic_ai.models.openai can't break pydantic_ai_slim.pydantic_ai.models.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
25→31 pydantic_ai_slim.pydantic_ai.models.openai uses pydantic_ai_slim.pydantic_ai.messagespart of a loop✕
Connections
21 pairs of types, where a type in pydantic_ai_slim.pydantic_ai.models.openai uses a type in pydantic_ai_slim.pydantic_ai.messages.
pydantic_ai_slim.pydantic_ai.models.openai uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai.models.openai, while a change to pydantic_ai_slim.pydantic_ai.models.openai can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
pydantic_ai_slim.pydantic_ai.providers uses pydantic_ai_slim.pydantic_ai.profiles.openai, so a change to pydantic_ai_slim.pydantic_ai.profiles.openai can break pydantic_ai_slim.pydantic_ai.providers, while a change to pydantic_ai_slim.pydantic_ai.providers can't break pydantic_ai_slim.pydantic_ai.profiles.openai.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.providers uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.providers uses pydantic_ai_slim.pydantic_ai.profiles, so a change to pydantic_ai_slim.pydantic_ai.profiles can break pydantic_ai_slim.pydantic_ai.providers, while a change to pydantic_ai_slim.pydantic_ai.providers can't break pydantic_ai_slim.pydantic_ai.profiles.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.providers uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models uses pydantic_ai_slim.pydantic_ai.native_tools, so a change to pydantic_ai_slim.pydantic_ai.native_tools can break pydantic_ai_slim.pydantic_ai.models, while a change to pydantic_ai_slim.pydantic_ai.models can't break pydantic_ai_slim.pydantic_ai.native_tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models uses pydantic_ai_slim.pydantic_ai.settings, so a change to pydantic_ai_slim.pydantic_ai.settings can break pydantic_ai_slim.pydantic_ai.models, while a change to pydantic_ai_slim.pydantic_ai.models can't break pydantic_ai_slim.pydantic_ai.settings.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models uses pydantic_ai_slim.pydantic_ai.tools, so a change to pydantic_ai_slim.pydantic_ai.tools can break pydantic_ai_slim.pydantic_ai.models, while a change to pydantic_ai_slim.pydantic_ai.models can't break pydantic_ai_slim.pydantic_ai.tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models uses pydantic_ai_slim.pydantic_ai.usage, so a change to pydantic_ai_slim.pydantic_ai.usage can break pydantic_ai_slim.pydantic_ai.models, while a change to pydantic_ai_slim.pydantic_ai.models can't break pydantic_ai_slim.pydantic_ai.usage.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models uses pydantic_ai_slim.pydantic_ai.output, so a change to pydantic_ai_slim.pydantic_ai.output can break pydantic_ai_slim.pydantic_ai.models, while a change to pydantic_ai_slim.pydantic_ai.models can't break pydantic_ai_slim.pydantic_ai.output.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models uses pydantic_ai_slim.pydantic_ai.profiles.openai, so a change to pydantic_ai_slim.pydantic_ai.profiles.openai can break pydantic_ai_slim.pydantic_ai.models, while a change to pydantic_ai_slim.pydantic_ai.models can't break pydantic_ai_slim.pydantic_ai.profiles.openai.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models uses pydantic_ai_slim.pydantic_ai.profiles, so a change to pydantic_ai_slim.pydantic_ai.profiles can break pydantic_ai_slim.pydantic_ai.models, while a change to pydantic_ai_slim.pydantic_ai.models can't break pydantic_ai_slim.pydantic_ai.profiles.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models uses pydantic_ai_slim.pydantic_ai.models.anthropic, so a change to pydantic_ai_slim.pydantic_ai.models.anthropic can break pydantic_ai_slim.pydantic_ai.models, while a change to pydantic_ai_slim.pydantic_ai.models can't break pydantic_ai_slim.pydantic_ai.models.anthropic.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models uses pydantic_ai_slim.pydantic_ai.models.decision, so a change to pydantic_ai_slim.pydantic_ai.models.decision can break pydantic_ai_slim.pydantic_ai.models, while a change to pydantic_ai_slim.pydantic_ai.models can't break pydantic_ai_slim.pydantic_ai.models.decision.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models uses pydantic_ai_slim.pydantic_ai.models.openai, so a change to pydantic_ai_slim.pydantic_ai.models.openai can break pydantic_ai_slim.pydantic_ai.models, while a change to pydantic_ai_slim.pydantic_ai.models can't break pydantic_ai_slim.pydantic_ai.models.openai.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models uses a module listed above it, which is the healthy direction.
27→31 pydantic_ai_slim.pydantic_ai.models uses pydantic_ai_slim.pydantic_ai.messagespart of a loop✕
Connections
27 pairs of types, where a type in pydantic_ai_slim.pydantic_ai.models uses a type in pydantic_ai_slim.pydantic_ai.messages. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
pydantic_ai_slim.pydantic_ai.models uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai.models, while a change to pydantic_ai_slim.pydantic_ai.models can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
27→34 pydantic_ai_slim.pydantic_ai.models uses pydantic_ai_slim.pydantic_ai.exceptionspart of a loop✕
Connections
10 pairs of types, where a type in pydantic_ai_slim.pydantic_ai.models uses a type in pydantic_ai_slim.pydantic_ai.exceptions.
pydantic_ai_slim.pydantic_ai.models uses pydantic_ai_slim.pydantic_ai.exceptions, so a change to pydantic_ai_slim.pydantic_ai.exceptions can break pydantic_ai_slim.pydantic_ai.models, while a change to pydantic_ai_slim.pydantic_ai.models can't break pydantic_ai_slim.pydantic_ai.exceptions.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
pydantic_ai_slim.pydantic_ai.providers._openai_compatible uses pydantic_ai_slim.pydantic_ai.providers, so a change to pydantic_ai_slim.pydantic_ai.providers can break pydantic_ai_slim.pydantic_ai.providers._openai_compatible, while a change to pydantic_ai_slim.pydantic_ai.providers._openai_compatible can't break pydantic_ai_slim.pydantic_ai.providers.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.providers._openai_compatible uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.wrapper uses pydantic_ai_slim.pydantic_ai.native_tools, so a change to pydantic_ai_slim.pydantic_ai.native_tools can break pydantic_ai_slim.pydantic_ai.models.wrapper, while a change to pydantic_ai_slim.pydantic_ai.models.wrapper can't break pydantic_ai_slim.pydantic_ai.native_tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.wrapper uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.wrapper uses pydantic_ai_slim.pydantic_ai.usage, so a change to pydantic_ai_slim.pydantic_ai.usage can break pydantic_ai_slim.pydantic_ai.models.wrapper, while a change to pydantic_ai_slim.pydantic_ai.models.wrapper can't break pydantic_ai_slim.pydantic_ai.usage.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.wrapper uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.wrapper uses pydantic_ai_slim.pydantic_ai.profiles, so a change to pydantic_ai_slim.pydantic_ai.profiles can break pydantic_ai_slim.pydantic_ai.models.wrapper, while a change to pydantic_ai_slim.pydantic_ai.models.wrapper can't break pydantic_ai_slim.pydantic_ai.profiles.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.wrapper uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.wrapper uses pydantic_ai_slim.pydantic_ai.models, so a change to pydantic_ai_slim.pydantic_ai.models can break pydantic_ai_slim.pydantic_ai.models.wrapper, while a change to pydantic_ai_slim.pydantic_ai.models.wrapper can't break pydantic_ai_slim.pydantic_ai.models.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.wrapper uses a module listed above it, which is the healthy direction.
29→31 pydantic_ai_slim.pydantic_ai.models.wrapper uses pydantic_ai_slim.pydantic_ai.messagespart of a loop✕
Connections
1 pair of types, where a type in pydantic_ai_slim.pydantic_ai.models.wrapper uses a type in pydantic_ai_slim.pydantic_ai.messages.
pydantic_ai_slim.pydantic_ai.models.wrapper uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai.models.wrapper, while a change to pydantic_ai_slim.pydantic_ai.models.wrapper can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
pydantic_ai_slim.pydantic_ai.models.instrumented uses pydantic_ai_slim.pydantic_ai.usage, so a change to pydantic_ai_slim.pydantic_ai.usage can break pydantic_ai_slim.pydantic_ai.models.instrumented, while a change to pydantic_ai_slim.pydantic_ai.models.instrumented can't break pydantic_ai_slim.pydantic_ai.usage.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.instrumented uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.instrumented uses pydantic_ai_slim.pydantic_ai.models, so a change to pydantic_ai_slim.pydantic_ai.models can break pydantic_ai_slim.pydantic_ai.models.instrumented, while a change to pydantic_ai_slim.pydantic_ai.models.instrumented can't break pydantic_ai_slim.pydantic_ai.models.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.instrumented uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.models.instrumented uses pydantic_ai_slim.pydantic_ai.models.wrapper, so a change to pydantic_ai_slim.pydantic_ai.models.wrapper can break pydantic_ai_slim.pydantic_ai.models.instrumented, while a change to pydantic_ai_slim.pydantic_ai.models.instrumented can't break pydantic_ai_slim.pydantic_ai.models.wrapper.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.models.instrumented uses a module listed above it, which is the healthy direction.
30→31 pydantic_ai_slim.pydantic_ai.models.instrumented uses pydantic_ai_slim.pydantic_ai.messagespart of a loop✕
Connections
3 pairs of types, where a type in pydantic_ai_slim.pydantic_ai.models.instrumented uses a type in pydantic_ai_slim.pydantic_ai.messages.
pydantic_ai_slim.pydantic_ai.models.instrumented uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai.models.instrumented, while a change to pydantic_ai_slim.pydantic_ai.models.instrumented can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
pydantic_ai_slim.pydantic_ai.messages uses pydantic_ai_slim.pydantic_ai._deferred, so a change to pydantic_ai_slim.pydantic_ai._deferred can break pydantic_ai_slim.pydantic_ai.messages, while a change to pydantic_ai_slim.pydantic_ai.messages can't break pydantic_ai_slim.pydantic_ai._deferred.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.messages uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.messages uses pydantic_ai_slim.pydantic_ai.settings, so a change to pydantic_ai_slim.pydantic_ai.settings can break pydantic_ai_slim.pydantic_ai.messages, while a change to pydantic_ai_slim.pydantic_ai.messages can't break pydantic_ai_slim.pydantic_ai.settings.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.messages uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.messages uses pydantic_ai_slim.pydantic_ai.usage, so a change to pydantic_ai_slim.pydantic_ai.usage can break pydantic_ai_slim.pydantic_ai.messages, while a change to pydantic_ai_slim.pydantic_ai.messages can't break pydantic_ai_slim.pydantic_ai.usage.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.messages uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.messages uses pydantic_ai_slim.pydantic_ai.models.instrumented, so a change to pydantic_ai_slim.pydantic_ai.models.instrumented can break pydantic_ai_slim.pydantic_ai.messages, while a change to pydantic_ai_slim.pydantic_ai.messages can't break pydantic_ai_slim.pydantic_ai.models.instrumented.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.messages uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.capabilities.wrapper uses pydantic_ai_slim.pydantic_ai._deferred, so a change to pydantic_ai_slim.pydantic_ai._deferred can break pydantic_ai_slim.pydantic_ai.capabilities.wrapper, while a change to pydantic_ai_slim.pydantic_ai.capabilities.wrapper can't break pydantic_ai_slim.pydantic_ai._deferred.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.capabilities.wrapper uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.capabilities.wrapper uses pydantic_ai_slim.pydantic_ai.tools, so a change to pydantic_ai_slim.pydantic_ai.tools can break pydantic_ai_slim.pydantic_ai.capabilities.wrapper, while a change to pydantic_ai_slim.pydantic_ai.capabilities.wrapper can't break pydantic_ai_slim.pydantic_ai.tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.capabilities.wrapper uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.capabilities.wrapper uses pydantic_ai_slim.pydantic_ai.workspaces.workspace, so a change to pydantic_ai_slim.pydantic_ai.workspaces.workspace can break pydantic_ai_slim.pydantic_ai.capabilities.wrapper, while a change to pydantic_ai_slim.pydantic_ai.capabilities.wrapper can't break pydantic_ai_slim.pydantic_ai.workspaces.workspace.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.capabilities.wrapper uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.capabilities.wrapper uses pydantic_ai_slim.pydantic_ai.output, so a change to pydantic_ai_slim.pydantic_ai.output can break pydantic_ai_slim.pydantic_ai.capabilities.wrapper, while a change to pydantic_ai_slim.pydantic_ai.capabilities.wrapper can't break pydantic_ai_slim.pydantic_ai.output.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.capabilities.wrapper uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.capabilities.wrapper uses pydantic_ai_slim.pydantic_ai.capabilities.abstract, so a change to pydantic_ai_slim.pydantic_ai.capabilities.abstract can break pydantic_ai_slim.pydantic_ai.capabilities.wrapper, while a change to pydantic_ai_slim.pydantic_ai.capabilities.wrapper can't break pydantic_ai_slim.pydantic_ai.capabilities.abstract.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.capabilities.wrapper uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.capabilities.wrapper uses pydantic_ai_slim.pydantic_ai.models, so a change to pydantic_ai_slim.pydantic_ai.models can break pydantic_ai_slim.pydantic_ai.capabilities.wrapper, while a change to pydantic_ai_slim.pydantic_ai.capabilities.wrapper can't break pydantic_ai_slim.pydantic_ai.models.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.capabilities.wrapper uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.capabilities.wrapper uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai.capabilities.wrapper, while a change to pydantic_ai_slim.pydantic_ai.capabilities.wrapper can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.capabilities.wrapper uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.durable_exec._operation uses pydantic_ai_slim.pydantic_ai.models, so a change to pydantic_ai_slim.pydantic_ai.models can break pydantic_ai_slim.pydantic_ai.durable_exec._operation, while a change to pydantic_ai_slim.pydantic_ai.durable_exec._operation can't break pydantic_ai_slim.pydantic_ai.models.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.durable_exec._operation uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.durable_exec._operation uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai.durable_exec._operation, while a change to pydantic_ai_slim.pydantic_ai.durable_exec._operation can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.durable_exec._operation uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.exceptions uses pydantic_ai_slim.pydantic_ai.usage, so a change to pydantic_ai_slim.pydantic_ai.usage can break pydantic_ai_slim.pydantic_ai.exceptions, while a change to pydantic_ai_slim.pydantic_ai.exceptions can't break pydantic_ai_slim.pydantic_ai.usage.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.exceptions uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.exceptions uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai.exceptions, while a change to pydantic_ai_slim.pydantic_ai.exceptions can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.exceptions uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.images uses pydantic_ai_slim.pydantic_ai.usage, so a change to pydantic_ai_slim.pydantic_ai.usage can break pydantic_ai_slim.pydantic_ai.images, while a change to pydantic_ai_slim.pydantic_ai.images can't break pydantic_ai_slim.pydantic_ai.usage.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.images uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.images uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai.images, while a change to pydantic_ai_slim.pydantic_ai.images can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.images uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai._agent_graph uses pydantic_ai_slim.pydantic_ai._deferred, so a change to pydantic_ai_slim.pydantic_ai._deferred can break pydantic_ai_slim.pydantic_ai._agent_graph, while a change to pydantic_ai_slim.pydantic_ai._agent_graph can't break pydantic_ai_slim.pydantic_ai._deferred.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai._agent_graph uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai._agent_graph uses pydantic_ai_slim.pydantic_ai.settings, so a change to pydantic_ai_slim.pydantic_ai.settings can break pydantic_ai_slim.pydantic_ai._agent_graph, while a change to pydantic_ai_slim.pydantic_ai._agent_graph can't break pydantic_ai_slim.pydantic_ai.settings.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai._agent_graph uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai._agent_graph uses pydantic_ai_slim.pydantic_ai.usage, so a change to pydantic_ai_slim.pydantic_ai.usage can break pydantic_ai_slim.pydantic_ai._agent_graph, while a change to pydantic_ai_slim.pydantic_ai._agent_graph can't break pydantic_ai_slim.pydantic_ai.usage.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai._agent_graph uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai._agent_graph uses pydantic_ai_slim.pydantic_ai.workspaces.workspace, so a change to pydantic_ai_slim.pydantic_ai.workspaces.workspace can break pydantic_ai_slim.pydantic_ai._agent_graph, while a change to pydantic_ai_slim.pydantic_ai._agent_graph can't break pydantic_ai_slim.pydantic_ai.workspaces.workspace.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai._agent_graph uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai._agent_graph uses pydantic_ai_slim.pydantic_ai.models, so a change to pydantic_ai_slim.pydantic_ai.models can break pydantic_ai_slim.pydantic_ai._agent_graph, while a change to pydantic_ai_slim.pydantic_ai._agent_graph can't break pydantic_ai_slim.pydantic_ai.models.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai._agent_graph uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai._agent_graph uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai._agent_graph, while a change to pydantic_ai_slim.pydantic_ai._agent_graph can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai._agent_graph uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai._agent_graph uses pydantic_ai_slim.pydantic_ai.exceptions, so a change to pydantic_ai_slim.pydantic_ai.exceptions can break pydantic_ai_slim.pydantic_ai._agent_graph, while a change to pydantic_ai_slim.pydantic_ai._agent_graph can't break pydantic_ai_slim.pydantic_ai.exceptions.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai._agent_graph uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.durable_exec uses pydantic_ai_slim.pydantic_ai.workspaces.workspace, so a change to pydantic_ai_slim.pydantic_ai.workspaces.workspace can break pydantic_ai_slim.pydantic_ai.durable_exec, while a change to pydantic_ai_slim.pydantic_ai.durable_exec can't break pydantic_ai_slim.pydantic_ai.workspaces.workspace.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.durable_exec uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.durable_exec uses pydantic_ai_slim.pydantic_ai.models, so a change to pydantic_ai_slim.pydantic_ai.models can break pydantic_ai_slim.pydantic_ai.durable_exec, while a change to pydantic_ai_slim.pydantic_ai.durable_exec can't break pydantic_ai_slim.pydantic_ai.models.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.durable_exec uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.durable_exec uses pydantic_ai_slim.pydantic_ai.models.wrapper, so a change to pydantic_ai_slim.pydantic_ai.models.wrapper can break pydantic_ai_slim.pydantic_ai.durable_exec, while a change to pydantic_ai_slim.pydantic_ai.durable_exec can't break pydantic_ai_slim.pydantic_ai.models.wrapper.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.durable_exec uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.durable_exec uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai.durable_exec, while a change to pydantic_ai_slim.pydantic_ai.durable_exec can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.durable_exec uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.durable_exec uses pydantic_ai_slim.pydantic_ai.durable_exec._operation, so a change to pydantic_ai_slim.pydantic_ai.durable_exec._operation can break pydantic_ai_slim.pydantic_ai.durable_exec, while a change to pydantic_ai_slim.pydantic_ai.durable_exec can't break pydantic_ai_slim.pydantic_ai.durable_exec._operation.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.durable_exec uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.durable_exec uses pydantic_ai_slim.pydantic_ai.exceptions, so a change to pydantic_ai_slim.pydantic_ai.exceptions can break pydantic_ai_slim.pydantic_ai.durable_exec, while a change to pydantic_ai_slim.pydantic_ai.durable_exec can't break pydantic_ai_slim.pydantic_ai.exceptions.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.durable_exec uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.realtime.model uses pydantic_ai_slim.pydantic_ai.native_tools, so a change to pydantic_ai_slim.pydantic_ai.native_tools can break pydantic_ai_slim.pydantic_ai.realtime.model, while a change to pydantic_ai_slim.pydantic_ai.realtime.model can't break pydantic_ai_slim.pydantic_ai.native_tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.realtime.model uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.realtime.model uses pydantic_ai_slim.pydantic_ai.realtime.profiles, so a change to pydantic_ai_slim.pydantic_ai.realtime.profiles can break pydantic_ai_slim.pydantic_ai.realtime.model, while a change to pydantic_ai_slim.pydantic_ai.realtime.model can't break pydantic_ai_slim.pydantic_ai.realtime.profiles.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.realtime.model uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.realtime.model uses pydantic_ai_slim.pydantic_ai.models, so a change to pydantic_ai_slim.pydantic_ai.models can break pydantic_ai_slim.pydantic_ai.realtime.model, while a change to pydantic_ai_slim.pydantic_ai.realtime.model can't break pydantic_ai_slim.pydantic_ai.models.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.realtime.model uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.realtime.model uses pydantic_ai_slim.pydantic_ai.exceptions, so a change to pydantic_ai_slim.pydantic_ai.exceptions can break pydantic_ai_slim.pydantic_ai.realtime.model, while a change to pydantic_ai_slim.pydantic_ai.realtime.model can't break pydantic_ai_slim.pydantic_ai.exceptions.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.realtime.model uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai uses pydantic_ai_slim.pydantic_ai._deferred, so a change to pydantic_ai_slim.pydantic_ai._deferred can break pydantic_ai_slim.pydantic_ai, while a change to pydantic_ai_slim.pydantic_ai can't break pydantic_ai_slim.pydantic_ai._deferred.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai uses pydantic_ai_slim.pydantic_ai.native_tools, so a change to pydantic_ai_slim.pydantic_ai.native_tools can break pydantic_ai_slim.pydantic_ai, while a change to pydantic_ai_slim.pydantic_ai can't break pydantic_ai_slim.pydantic_ai.native_tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai uses pydantic_ai_slim.pydantic_ai.tools, so a change to pydantic_ai_slim.pydantic_ai.tools can break pydantic_ai_slim.pydantic_ai, while a change to pydantic_ai_slim.pydantic_ai can't break pydantic_ai_slim.pydantic_ai.tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai uses pydantic_ai_slim.pydantic_ai.usage, so a change to pydantic_ai_slim.pydantic_ai.usage can break pydantic_ai_slim.pydantic_ai, while a change to pydantic_ai_slim.pydantic_ai can't break pydantic_ai_slim.pydantic_ai.usage.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai uses pydantic_ai_slim.pydantic_ai.workspaces.workspace, so a change to pydantic_ai_slim.pydantic_ai.workspaces.workspace can break pydantic_ai_slim.pydantic_ai, while a change to pydantic_ai_slim.pydantic_ai can't break pydantic_ai_slim.pydantic_ai.workspaces.workspace.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai uses pydantic_ai_slim.pydantic_ai.output, so a change to pydantic_ai_slim.pydantic_ai.output can break pydantic_ai_slim.pydantic_ai, while a change to pydantic_ai_slim.pydantic_ai can't break pydantic_ai_slim.pydantic_ai.output.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai uses pydantic_ai_slim.pydantic_ai.embeddings.base, so a change to pydantic_ai_slim.pydantic_ai.embeddings.base can break pydantic_ai_slim.pydantic_ai, while a change to pydantic_ai_slim.pydantic_ai can't break pydantic_ai_slim.pydantic_ai.embeddings.base.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai uses pydantic_ai_slim.pydantic_ai.profiles, so a change to pydantic_ai_slim.pydantic_ai.profiles can break pydantic_ai_slim.pydantic_ai, while a change to pydantic_ai_slim.pydantic_ai can't break pydantic_ai_slim.pydantic_ai.profiles.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai uses pydantic_ai_slim.pydantic_ai.models, so a change to pydantic_ai_slim.pydantic_ai.models can break pydantic_ai_slim.pydantic_ai, while a change to pydantic_ai_slim.pydantic_ai can't break pydantic_ai_slim.pydantic_ai.models.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai uses pydantic_ai_slim.pydantic_ai.models.instrumented, so a change to pydantic_ai_slim.pydantic_ai.models.instrumented can break pydantic_ai_slim.pydantic_ai, while a change to pydantic_ai_slim.pydantic_ai can't break pydantic_ai_slim.pydantic_ai.models.instrumented.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai uses a module listed above it, which is the healthy direction.
46 pairs of types, where a type in pydantic_ai_slim.pydantic_ai uses a type in pydantic_ai_slim.pydantic_ai.messages. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
pydantic_ai_slim.pydantic_ai uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai, while a change to pydantic_ai_slim.pydantic_ai can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai uses pydantic_ai_slim.pydantic_ai.exceptions, so a change to pydantic_ai_slim.pydantic_ai.exceptions can break pydantic_ai_slim.pydantic_ai, while a change to pydantic_ai_slim.pydantic_ai can't break pydantic_ai_slim.pydantic_ai.exceptions.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai uses pydantic_ai_slim.pydantic_ai._agent_graph, so a change to pydantic_ai_slim.pydantic_ai._agent_graph can break pydantic_ai_slim.pydantic_ai, while a change to pydantic_ai_slim.pydantic_ai can't break pydantic_ai_slim.pydantic_ai._agent_graph.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.realtime uses pydantic_ai_slim.pydantic_ai.native_tools, so a change to pydantic_ai_slim.pydantic_ai.native_tools can break pydantic_ai_slim.pydantic_ai.realtime, while a change to pydantic_ai_slim.pydantic_ai.realtime can't break pydantic_ai_slim.pydantic_ai.native_tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.realtime uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.realtime uses pydantic_ai_slim.pydantic_ai.realtime.profiles, so a change to pydantic_ai_slim.pydantic_ai.realtime.profiles can break pydantic_ai_slim.pydantic_ai.realtime, while a change to pydantic_ai_slim.pydantic_ai.realtime can't break pydantic_ai_slim.pydantic_ai.realtime.profiles.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.realtime uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.realtime uses pydantic_ai_slim.pydantic_ai.tools, so a change to pydantic_ai_slim.pydantic_ai.tools can break pydantic_ai_slim.pydantic_ai.realtime, while a change to pydantic_ai_slim.pydantic_ai.realtime can't break pydantic_ai_slim.pydantic_ai.tools.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.realtime uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.realtime uses pydantic_ai_slim.pydantic_ai.usage, so a change to pydantic_ai_slim.pydantic_ai.usage can break pydantic_ai_slim.pydantic_ai.realtime, while a change to pydantic_ai_slim.pydantic_ai.realtime can't break pydantic_ai_slim.pydantic_ai.usage.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.realtime uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.realtime uses pydantic_ai_slim.pydantic_ai.realtime.codec, so a change to pydantic_ai_slim.pydantic_ai.realtime.codec can break pydantic_ai_slim.pydantic_ai.realtime, while a change to pydantic_ai_slim.pydantic_ai.realtime can't break pydantic_ai_slim.pydantic_ai.realtime.codec.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.realtime uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.realtime uses pydantic_ai_slim.pydantic_ai.models, so a change to pydantic_ai_slim.pydantic_ai.models can break pydantic_ai_slim.pydantic_ai.realtime, while a change to pydantic_ai_slim.pydantic_ai.realtime can't break pydantic_ai_slim.pydantic_ai.models.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.realtime uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.realtime uses pydantic_ai_slim.pydantic_ai.messages, so a change to pydantic_ai_slim.pydantic_ai.messages can break pydantic_ai_slim.pydantic_ai.realtime, while a change to pydantic_ai_slim.pydantic_ai.realtime can't break pydantic_ai_slim.pydantic_ai.messages.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.realtime uses a module listed above it, which is the healthy direction.
pydantic_ai_slim.pydantic_ai.realtime uses pydantic_ai_slim.pydantic_ai.realtime.model, so a change to pydantic_ai_slim.pydantic_ai.realtime.model can break pydantic_ai_slim.pydantic_ai.realtime, while a change to pydantic_ai_slim.pydantic_ai.realtime can't break pydantic_ai_slim.pydantic_ai.realtime.model.
Position
Below the diagonal: pydantic_ai_slim.pydantic_ai.realtime uses a module listed above it, which is the healthy direction.
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
33
High / Critical
A03:2025 — Software Supply Chain Failures
11
High / Critical
A07:2025 — Authentication Failures
3
High / Critical
Roadmap
Top priorities: 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; Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href; Resolve the 3 Leaked secret finding(s) in Secret Scanning — start with REDACTED (2), REDACTED.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 3 Leaked secret finding(s) in Secret Scanning — start with REDACTED (2), REDACTED.
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.
Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, then assert with your test runner's axe binding (jest-axe, vitest-axe, cypress-axe or @axe-core/playwright) in tests, then gate axe/pa11y/Lighthouse in CI.
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.
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 — 44
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 — 1429
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 — 78
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 14
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 85 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 85 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, 1534 of 1551 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT READ here — but this repository measures it: a coverage step in CI (`coverage run`) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.py), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored. To have the real number read, produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) 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. You can widen what we reach: optional: produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) 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 — then the real number is read on the next scan.
D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This repository declares 3 of its own test(s) unreliable. The built-in reliability runner does not support this repository's ecosystem (.py), so the suite was not re-run and no reliability score is given — these are the repository's own declarations, not our measurement.
D12 Dependency Hygiene — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. This repository's 4 shipped Python distribution(s) across 7 manifest(s) WERE read; what went unanswered is the currency half, because it grades an EXACT pin against the newest release and every declaration here is a floor or a range — which installs the newest release it admits and so cannot be behind one. So pypi.org was never asked. This is a true statement about the repository, and the healthy one, NOT a gap on our side: no reader we could write would find a currency question here.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is an ADMISSION gap, not an environment fault: it declares a published package (src/pydantic_ai_harness/pyproject.toml), but no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict. For npm the surface is what a published package.json's entry points (exports, main, module, types) export, followed through the source; an entry that names build output the tree does not commit (dist/, build/) is not followed back to source, because only a tsconfig outDir/rootDir pair states that mapping and a bundler's input lives in executable configuration this engine does not evaluate.
D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D28 Secrets (history) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `gitleaks` TIMED OUT after 230.4s against a 230.4s budget, so we killed its process tree. The budget is ours; the work may simply be larger than it allows. Nothing about this repository is asserted by the absence of a result; the budget is ours to raise, and raising it is our backlog item, not an action for this repository's owner.
D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `pydantic_ai_slim/pydantic_ai/_mcp_apps.py`, `pydantic_ai_slim/pydantic_ai/_sync_stream.py`, `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_operation_backend.py`, `pydantic_ai_slim/pydantic_ai/models/openai.py`, `pydantic_ai_slim/pydantic_ai/ui/_event_stream.py`, … (+10 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.
AC6 Visual & motion safety — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 9 further occurrence(s) are not listed individually; the score already reflects all 49.
AX1 Captive dependencies — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in src/pydantic_clai2/pydantic_clai2/commands.py, 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.
AXB2 Runtime readiness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. (rule: no-root-manifest). The renderer reported: the dev server (`npm run dev`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered.
AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DevServer (dev). the dev server (`npm run dev`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered.
C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'sqlite3' is imported (src/pydantic_clai2/pydantic_clai2/__main__.py:6), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'sqlite3' is imported (src/pydantic_clai2/pydantic_clai2/__main__.py:6), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
C5 Data-Subject Rights — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'sqlite3' is imported (src/pydantic_clai2/pydantic_clai2/__main__.py:6), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
Repo exclusion declarations: 4 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
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.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
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.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
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.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
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.
DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
272 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was App.App at 230. A further 1 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 providers.infer_provider_class at 42 — they are counted neither in the figure above nor in this dimension's score. 1 file carries no cyclomatic complexity row at all for this reason — every one of its over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: pydantic_ai_slim/pydantic_ai/providers/__init__.py (providers.infer_provider_class at 42). 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.
+ 267 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 3 bodies over 120 down to 120 or less in Cyclomatic Complexity — start with App.App (cyclomatic 230), OpenAIResponsesStreamedResponse._get_event_iterator (cyclomatic 145), OpenAIResponsesModel._map_messages (cyclomatic 125). — 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 3 together lifts Cyclomatic Complexity from 5.1 to about 5.8/10, projected with the scoring formula itself and assuming each lands exactly at 120; 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.
+ 471 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 11 bodies over 120 down to 120 or less in Cognitive Complexity — start with OpenAIResponsesModel._map_messages (cognitive 283), web_fetch._convert_html (cognitive 267), VercelAIAdapter.load_messages (cognitive 267). — 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 11 together lifts Cognitive Complexity from 4.1 to about 5.2/10, projected with the scoring formula itself and assuming each lands exactly at 120; 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 Classes8.5 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
Resolve the 84 FileTooLong finding(s) in God Classes — start with _toolset.py (7), __init__.py (6), _adapter.py (4). — One of this dimension's main actionable groups (84 warning-level).
Resolve the 22 TooManyMethods finding(s) in God Classes — start with _toolset.py (2), _session.py, hooks.py. — One of this dimension's main actionable groups (22 warning-level).
Resolve the 10 FunctionTooLong finding(s) in God Classes — start with App.tsx, Sidebar.tsx, Composer.tsx. — One of this dimension's main actionable groups (10 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.
161 duplicated block group(s) detected. A further 5 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 2 of the 166 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 61 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 16 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with issue_pr_attention_monitor.py (2), community_demand.py, feature_digest.py. — One of this dimension's main actionable groups (16 warning-level).
Resolve the 14 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with hooks.py (2), issue_pr_attention_monitor.py, spec.py. — One of this dimension's main actionable groups (14 warning-level).
Resolve the 13 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with _store.py (2), google.py, openai.py. — One of this dimension's main actionable groups (13 warning-level).
Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling8.0 / 10Strong✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
8 production modules (npm+Python), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 2 module(s) off the main sequence.
Off the main sequence: pydantic-graph · ×2
What to do
Resolve the 2 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (2 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 7 Low cohesion finding(s) in Cohesion (LCOM4) — start with _agent.py (2), __init__.py (2), model.py. — One of this dimension's main actionable groups (7 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 Distribution10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
26428 test methods: 26409 unit, 19 integration, 0 BDD, 0 e2e. The Python suite contributes 26428 test function(s) across 920 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.
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 3 Leaked secret finding(s) in Secret Scanning — start with REDACTED (2), REDACTED. — One of this dimension's main actionable groups (3 issue-level).
Enforce Secret Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 9 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 4 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (5 reached that way). Requirements it states ONLY under an extra, a PEP 735 dependency group, a Poetry dev group or a dev-named requirements file are excluded: pip does not install any of them for a consumer. ★ This repository commits no dependency lockfile that this pass reads, so each licence is the one PyPI publishes for the distribution's CURRENT release rather than for a pinned version. This repository publishes itself under MIT, which is its own choice and is not judged here.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Resolve the 109 Hotspot finding(s) in Churn × Complexity Hotspots — start with _toolset.py (6), __init__.py (5), _adapter.py (4). — One of this dimension's main actionable groups (109 warning-level).
Resolve the 1 Repeated repair finding(s) in Churn × Complexity Hotspots — start with span_tree.py. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor9.4 / 10Exemplary✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
50 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is pydantic_ai_slim/pydantic_ai/realtime/_session.py. Counted over 858 of the 1114 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 · ×3
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
149 deducted task-comment markers across 313043 LoC (0.0/KLoC) → score 9.9. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
TodoComment · ×107tests/conftest.py:329
TodoComment repeated across 21 filestests/test_tool_failed_wire.py:22
TodoComment repeated across 14 filestests/test_tool_failed_wire.py:116
What to do
Resolve the 107 TodoComment finding(s) in Explicit Debt — start with google.py (7), __init__.py (7), messages.py (5). — One of this dimension's main actionable groups (107 warning-level).
Resolve the 1 TodoComment repeated across 21 files finding(s) in Explicit Debt — start with test_tool_failed_wire.py. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 TodoComment repeated across 14 files finding(s) in Explicit Debt — start with test_tool_failed_wire.py. — One of this dimension's main actionable groups (1 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.
1 of 1 documentation facets pass in full. 431 document(s) read across 2 unit(s).
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).
Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.
4 of 8 build units (Python, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.
Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
97 % of calls cross a namespace and 0 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.
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).
33 finding(s): 0 critical, 28 high, 5 medium, 0 low. semgrep hit a parse error in 24 file(s) — `.agents/skills/branch-context/append-handoff.sh` (lines 26–324), `.agents/skills/branch-context/latest-handoff.sh` (lines 15–155), `.github/scripts/prefetch-open-issues.sh` (line 50), `.github/workflows/pydantic-ai-bug-hunter.lock.yml`, `examples/pydantic_ai_examples/realtime_text_to_audio.py`, … (+19 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 18 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
+ 7 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 13 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (13 issue-level).
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (4 issue-level).
Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED. — One of this dimension's main actionable groups (3 issue-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
Resolve the 2 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
Resolve the 1 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 3 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (3). — One of this dimension's main actionable groups (3 warning-level).
Detailed fixes: d30_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.
2 of 858 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is pydantic_ai_slim/pydantic_ai/models/ollama.py. Counted over 858 of the 1114 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 5 Change coupling finding(s) in Change Coupling — start with headless.py (2), _agent.py, _output.py. — One of this dimension's main actionable groups (5 warning-level).
Resolve the 2 Change-coupling hub finding(s) in Change Coupling — start with app.py, service.py. — 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.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 4 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
✓ On the Gold path — maintain.
Detailed fixes: d44_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives10.0 / 10Exemplary○ Nothing flagged
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.
Do you agree with this assessment?
AC2 · Forms & labels7.0 / 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 <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label. — REDACTED:29
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) — src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:304, src/pydantic_clai2/web-ui/src/components/SettingsForm.tsx:159
This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×2) — src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:319, src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:398
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. — src/pydantic_clai2/web-ui/src/components/QuestionCard.tsx:86
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.
A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope). — REDACTED:93
Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. — src/pydantic_clai2/web-ui/src/components/SettingsWindow.tsx:191
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. (×2) — src/pydantic_clai2/web-ui/src/components/CommandMenu.tsx:22, src/pydantic_clai2/web-ui/src/components/GitChip.tsx:144
This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. (×3) — src/pydantic_clai2/web-ui/src/components/DialogLayer.tsx:52, src/pydantic_clai2/web-ui/src/components/NewSessionDialog.tsx:164, src/pydantic_clai2/web-ui/src/components/SettingsWindow.tsx:144
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler. — REDACTED:29
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.
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.
`.send` sets color: #ffffff on background-color: #e520e9 — 3.7:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — src/pydantic_clai2/web-ui/src/styles.css:1637
`.hero-icon` sets color: #e520e9 on background-color: #f1eee2 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — src/pydantic_clai2/web-ui/src/styles.css:3606
`.changes-count` sets color: #fdfcf6 on background-color: #e520e9 — 3.6:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — src/pydantic_clai2/web-ui/src/styles.css:4362
`.send` sets color: #ffffff on background-color: #e520e9 — 3.7:1, below the 4.5:1 WCAG AA minimum for normal text. This is a MINIFIED, build-generated sheet — editing the literal here is undone by the next vendor drop or rebuild, so override the rule in your own stylesheet (or fix it upstream / in the source the bundle is built from). — src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.hero-icon` sets color: #e520e9 on background-color: #f1eee2 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. This is a MINIFIED, build-generated sheet — editing the literal here is undone by the next vendor drop or rebuild, so override the rule in your own stylesheet (or fix it upstream / in the source the bundle is built from). — src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.changes-count` sets color: #fdfcf6 on background-color: #e520e9 — 3.6:1, below the 4.5:1 WCAG AA minimum for normal text. This is a MINIFIED, build-generated sheet — editing the literal here is undone by the next vendor drop or rebuild, so override the rule in your own stylesheet (or fix it upstream / in the source the bundle is built from). — src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.search input` 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) — src/pydantic_clai2/web-ui/src/styles.css:276, src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.rename` 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) — src/pydantic_clai2/web-ui/src/styles.css:565, src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.composer textarea` 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) — src/pydantic_clai2/web-ui/src/styles.css:1524, src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.switch.permissions select` 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) — src/pydantic_clai2/web-ui/src/styles.css:2193, src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.theme-picker select` 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) — src/pydantic_clai2/web-ui/src/styles.css:2244, src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.monty-input textarea` 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) — src/pydantic_clai2/web-ui/src/styles.css:2474, src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.plugins-panel` 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) — src/pydantic_clai2/web-ui/src/styles.css:2619, src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.dialog-options` 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) — src/pydantic_clai2/web-ui/src/styles.css:3380, src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.settings-window` 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) — src/pydantic_clai2/web-ui/src/styles.css:3667, src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.palette-search input` 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) — src/pydantic_clai2/web-ui/src/styles.css:4258, src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.dialog-view` 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) — src/pydantic_clai2/web-ui/src/styles.css:4338, src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.chevron` moves (`transition: transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — src/pydantic_clai2/web-ui/src/styles.css:381
`.spinner.row-spinner` moves (`animation: spin 0.9s linear 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. — src/pydantic_clai2/web-ui/src/styles.css:540
`.spinner` moves (`animation: spin 0.7s linear infinite,
appear 0.15s ease 0.12s 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. — src/pydantic_clai2/web-ui/src/styles.css:810
`.opening-overlay .spinner` moves (`animation: spin 0.7s linear 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. — src/pydantic_clai2/web-ui/src/styles.css:832
`.shimmer` moves (`animation: shimmer 1.8s linear 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. — src/pydantic_clai2/web-ui/src/styles.css:1221
`.working .dot` moves (`animation: bounce 1.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. — src/pydantic_clai2/web-ui/src/styles.css:1462
`.toggle span` moves (`transition: transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — src/pydantic_clai2/web-ui/src/styles.css:2761
`.spinner.worker-spinner` moves (`animation: spin 0.7s linear 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. — src/pydantic_clai2/web-ui/src/styles.css:3194
`.setting-open svg` moves (`transition: transform 0.12s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — src/pydantic_clai2/web-ui/src/styles.css:3873
`.changes-chevron` moves (`transition: transform 0.12s`) 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. — src/pydantic_clai2/web-ui/src/styles.css:4505
`.chevron` moves (`transition: transform .15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
`.spinner.row-spinner` moves (`animation: spin .9s linear 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. — src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1
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.
Do you agree with this assessment?
AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified
Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.
Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.
Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.
No accessibility enforcement found — no a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 38 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here. — src/pydantic_clai2/web-ui/package.json:19
What to do
Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, then assert with your test runner's axe binding (jest-axe, vitest-axe, cypress-axe or @axe-core/playwright) in tests, then gate axe/pa11y/Lighthouse in CI.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether 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.
Do you agree with this assessment?
AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified
Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.
Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.
Other · 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.
Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain aggregate fused to a persistence ORM (Django/SQLAlchemy) on its own declaration (active-record) couples the domain to infrastructure. The clean-architecture dependency rule.
Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.
Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
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.
1 ADR-shaped document(s) detected by content — `.agents/skills/branch-context/pr-decisions.template.md`. They are not under a conventional ADR folder (docs/adr/) and are not named NNNN-title.md, and this check found them by their decision signature rather than by where they live — so a reader who does not already know these paths has no route to them. Detected by content signature only: records kept outside the repository, or written without a Status/Decision/Consequences shape, are not visible to this check and are not counted here.
What to do
Move ADRs under docs/adr/ (or docs/adrs/) and name them NNNN-title.md so they're easy to find.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
CONTRIBUTING.md links to `install.md#slim-install`, but `install.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — CONTRIBUTING.md:227
What to do
Reconcile the README with reality: CONTRIBUTING.md links to `install.md#slim-install`, but `install.md` does not exist.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability8.5 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Only 2/4 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `clai`, `pydantic_ai_slim`.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 2174675 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. — .github/workflows/benchmark.yml:8
`REDACTED` schedules updates, but no `package-ecosystem` entry covers `pip`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list. — REDACTED:1
What to do
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Dependabot is configured but does not watch `pip` — add that `package-ecosystem` entry to REDACTED so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
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.
`httpx.AsyncClient(` 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. — src/pydantic_ai_harness/pydantic_ai_harness/media/_s3.py:263
What to do
Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.
Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.
Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Do you agree with this assessment?
R1 · Type Safety9.8 / 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.
REDACTED:108 · src/pydantic_clai2/web-ui/src/components/WorkerView.tsx:115 — the two spans are one implementation copied and then locally edited — 174 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:108
src/pydantic_clai2/web-ui/src/components/GitChip.tsx:116 · src/pydantic_clai2/web-ui/src/components/NewSessionDialog.tsx:115 — the two spans are one implementation copied and then locally edited — 132 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. — src/pydantic_clai2/web-ui/src/components/GitChip.tsx:116
src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:204 · src/pydantic_clai2/web-ui/src/components/SettingsForm.tsx:108 — the two spans are one implementation copied and then locally edited — 163 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. — src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:204
src/pydantic_clai2/web-ui/src/components/NewSessionDialog.tsx:249 · src/pydantic_clai2/web-ui/src/components/NewSessionDialog.tsx:293 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — src/pydantic_clai2/web-ui/src/components/NewSessionDialog.tsx:249
src/pydantic_clai2/web-ui/src/components/Composer.tsx:166 · src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:251 — 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. — src/pydantic_clai2/web-ui/src/components/Composer.tsx:166
src/pydantic_clai2/web-ui/src/components/icons.tsx:105 · src/pydantic_clai2/web-ui/src/components/icons.tsx:166 — 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. — src/pydantic_clai2/web-ui/src/components/icons.tsx:105
src/pydantic_clai2/web-ui/src/components/PluginsPanel.tsx:43 · src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:221 — the two spans are one implementation copied and then locally edited — 54 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. — src/pydantic_clai2/web-ui/src/components/PluginsPanel.tsx:43
REDACTED:86 · src/pydantic_clai2/web-ui/src/components/SettingsWindow.tsx:97 — the two spans are one implementation copied and then locally edited — 71 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:86
src/pydantic_clai2/web-ui/src/components/McpSection.tsx:45 · src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:62 — 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. — src/pydantic_clai2/web-ui/src/components/McpSection.tsx:45
src/pydantic_clai2/web-ui/src/components/Composer.tsx:113 · src/pydantic_clai2/web-ui/src/components/WorkerView.tsx:113 — 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. — src/pydantic_clai2/web-ui/src/components/Composer.tsx:113
src/pydantic_clai2/web-ui/src/components/QueuePanel.tsx:74 · src/pydantic_clai2/web-ui/src/components/Transcript.tsx:89 — 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. — src/pydantic_clai2/web-ui/src/components/QueuePanel.tsx:74
REDACTED:104 · src/pydantic_clai2/web-ui/src/components/DialogLayer.tsx:146 — 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. — REDACTED:104
src/pydantic_clai2/web-ui/src/components/WorkerView.tsx:57 · src/pydantic_clai2/web-ui/src/components/WorkersTree.tsx:58 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — src/pydantic_clai2/web-ui/src/components/WorkerView.tsx:57
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.
src/pydantic_clai2/web-ui/src/markdown.ts:2 imports highlight.js/lib/core, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/pydantic_clai2/web-ui/src/markdown.ts:2
src/pydantic_clai2/web-ui/src/markdown.ts:3 imports highlight.js/lib/languages/bash, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/pydantic_clai2/web-ui/src/markdown.ts:3
src/pydantic_clai2/web-ui/src/markdown.ts:4 imports highlight.js/lib/languages/css, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/pydantic_clai2/web-ui/src/markdown.ts:4
src/pydantic_clai2/web-ui/src/markdown.ts:5 imports highlight.js/lib/languages/diff, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/pydantic_clai2/web-ui/src/markdown.ts:5
src/pydantic_clai2/web-ui/src/markdown.ts:6 imports highlight.js/lib/languages/go, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/pydantic_clai2/web-ui/src/markdown.ts:6
src/pydantic_clai2/web-ui/src/markdown.ts:7 imports highlight.js/lib/languages/javascript, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/pydantic_clai2/web-ui/src/markdown.ts:7
src/pydantic_clai2/web-ui/src/markdown.ts:8 imports highlight.js/lib/languages/json, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/pydantic_clai2/web-ui/src/markdown.ts:8
src/pydantic_clai2/web-ui/src/markdown.ts:9 imports highlight.js/lib/languages/markdown, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/pydantic_clai2/web-ui/src/markdown.ts:9
src/pydantic_clai2/web-ui/src/markdown.ts:10 imports highlight.js/lib/languages/python, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/pydantic_clai2/web-ui/src/markdown.ts:10
src/pydantic_clai2/web-ui/src/markdown.ts:11 imports highlight.js/lib/languages/rust, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/pydantic_clai2/web-ui/src/markdown.ts:11
src/pydantic_clai2/web-ui/src/markdown.ts:12 imports highlight.js/lib/languages/sql, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/pydantic_clai2/web-ui/src/markdown.ts:12
src/pydantic_clai2/web-ui/src/markdown.ts:13 imports highlight.js/lib/languages/typescript, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/pydantic_clai2/web-ui/src/markdown.ts:13
src/pydantic_clai2/web-ui/src/markdown.ts:14 imports highlight.js/lib/languages/xml, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/pydantic_clai2/web-ui/src/markdown.ts:14
src/pydantic_clai2/web-ui/src/markdown.ts:15 imports highlight.js/lib/languages/yaml, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/pydantic_clai2/web-ui/src/markdown.ts:15
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.
App has cyclomatic complexity 115 and cognitive complexity 94; 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. — src/pydantic_clai2/web-ui/src/App.tsx:85
reduce has cyclomatic complexity 40 and cognitive complexity 38; 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. — src/pydantic_clai2/web-ui/src/state.ts:376
onKeyDown has cyclomatic complexity 37 and cognitive complexity 45; 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. — src/pydantic_clai2/web-ui/src/components/Composer.tsx:288
onKey has cyclomatic complexity 36 and cognitive complexity 28; 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. — src/pydantic_clai2/web-ui/src/App.tsx:577
Sidebar has cyclomatic complexity 33 and cognitive complexity 33; 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. — src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:134
row has cyclomatic complexity 32 and cognitive complexity 30; 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. — src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:378
ToolCard has cyclomatic complexity 32 and cognitive complexity 28; 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. — REDACTED:262
Changes has cyclomatic complexity 30 and cognitive complexity 23; 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. — src/pydantic_clai2/web-ui/src/components/GitChip.tsx:194
summarize has cyclomatic complexity 29 and cognitive complexity 39; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:103
MenuRow has cyclomatic complexity 24 and cognitive complexity 21; 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. — src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:172
controlFor has cyclomatic complexity 23 and cognitive complexity 30; 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. — src/pydantic_clai2/web-ui/src/settings.ts:52
Control has cyclomatic complexity 22 and cognitive complexity 27; 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. — src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:271
Editor has cyclomatic complexity 22 and cognitive complexity 25; 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. — src/pydantic_clai2/web-ui/src/components/SettingsForm.tsx:140
Detail has cyclomatic complexity 22 and cognitive complexity 15; 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. — src/pydantic_clai2/web-ui/src/components/PluginsPanel.tsx:157
Composer has cyclomatic complexity 21 and cognitive complexity 17; 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. — src/pydantic_clai2/web-ui/src/components/Composer.tsx:67
(anonymous) has cyclomatic complexity 19 and cognitive complexity 25; 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. — src/pydantic_clai2/web-ui/src/App.tsx:506
DiffView has cyclomatic complexity 18 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:57
EntryView has cyclomatic complexity 16 and cognitive complexity 20; 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. — src/pydantic_clai2/web-ui/src/components/Transcript.tsx:144
CellView has cyclomatic complexity 16 and cognitive complexity 15; 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. — REDACTED:49
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.
src/pydantic_clai2/web-ui/src/App.tsx has 935 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/pydantic_clai2/web-ui/src/App.tsx:1
src/pydantic_clai2/web-ui/src/components/Sidebar.tsx has 663 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:1
src/pydantic_clai2/web-ui/src/components/Composer.tsx has 499 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/pydantic_clai2/web-ui/src/components/Composer.tsx:1
src/pydantic_clai2/web-ui/src/components/GitChip.tsx has 477 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/pydantic_clai2/web-ui/src/components/GitChip.tsx:1
src/pydantic_clai2/web-ui/src/state.ts has 452 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/pydantic_clai2/web-ui/src/state.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. — src/pydantic_clai2/web-ui/src/main.tsx:1
What to do
Add tests that import the unreached modules (directly or through their public entry).
React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).
Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.
What to do
Bump outdated dependencies to current versions to limit upgrade debt.
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
Do you agree with this assessment?
R7 · Dead Code9.9 / 10Exemplary✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
1 file(s) (~183 LoC) were excluded from dead-code analysis — declare main/module/exports or a conventional entry (src/index.*, an index.html script) so reachability can see this package. — tests/ui_roundtrip
Nothing imports this binding — it is safe to review for removal. — src/pydantic_clai2/web-ui/src/components/icons.tsx:124
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.
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 · 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.
The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception. — pydantic_ai_slim/pydantic_ai/_sync_stream.py:161
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 document1.4 / 10Critical✓ 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.
`isView` is exported, takes a document from its caller (line 186) and hands it to `isObject`, which calls itself at line 205 (`isObject`) with a piece of `value` — and nowhere in `isObject` 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 `isObject` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/pydantic_clai2/web-ui/src/sidebarModel.ts:205
`isList` is exported, takes a document from its caller (line 201) and hands it to `hasStrings`, which calls itself at line 206 (`hasStrings`) with a piece of `value` — and nowhere in `hasStrings` 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 `hasStrings` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/pydantic_clai2/web-ui/src/sidebarModel.ts:206
`isList` is exported, takes a document from its caller (line 201) and hands it to `isWorktree`, which calls itself at line 208 (`isWorktree`) with a piece of `value` — and nowhere in `isWorktree` 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 `isWorktree` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/pydantic_clai2/web-ui/src/sidebarModel.ts:208
`is_run_context` is public and takes `annotation: object` from its caller, and it calls itself at line 76 (`is_run_context`) with a piece of `annotation` — and nowhere in `is_run_context` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `is_run_context` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:76
`normalize_json_value` is public, takes a document from its caller (line 181) and hands it to `_normalize_json_value`, which calls itself at line 194 (`_normalize_json_value`) with a piece of `value` (and at line 196, line 203) — and nowhere in `_normalize_json_value` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_normalize_json_value` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/pydantic_ai_harness/pydantic_ai_harness/render/_compat.py:194
`externalize_media` is public and takes `node: object` from its caller, and it calls itself at line 216 (`externalize_media`) with a piece of `node` (and at line 228) — and nowhere in `externalize_media` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `externalize_media` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/pydantic_ai_harness/pydantic_ai_harness/media/_walker.py:216
`restore_media` is public and takes `node: object` from its caller, and it calls itself at line 372 (`restore_media`) with a piece of `node` (and at line 381) — and nowhere in `restore_media` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `restore_media` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/pydantic_ai_harness/pydantic_ai_harness/media/_walker.py:372
`claim` is public, takes a document from its caller (line 772) and hands it to `_canonical`, which calls itself at line 190 (`_canonical`) with a piece of `value` (and at line 193, line 195) — and nowhere in `_canonical` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_canonical` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_speculation.py:190
`render_banner` is public, takes a document from its caller (line 315) and hands it to `_output_type_name`, which calls itself at line 515 (`_output_type_name`) with a piece of `output_type` — and nowhere in `_output_type_name` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_output_type_name` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — pydantic_ai_slim/pydantic_ai/_display.py:515
`redact_binary_content` is public, takes a document from its caller (line 280) and hands it to `_redact_binary_content`, which calls itself at line 329 (`_redact_binary_content`) with a piece of `value` (and at line 335, line 336, line 346, line 347, line 348, line 352, line 355) — and nowhere in `_redact_binary_content` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_redact_binary_content` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — pydantic_ai_slim/pydantic_ai/_instrumentation.py:329
`contains_ref` is public and takes `node: JsonValue` from its caller, and it calls itself at line 270 (`contains_ref`) with a piece of `node` (and at line 272) — and nowhere in `contains_ref` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `contains_ref` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — pydantic_ai_slim/pydantic_ai/_utils.py:270
`has_cited_document` is public and takes `value: object` from its caller, and it calls itself at line 126 (`has_cited_document`) with a piece of `value` (and at line 130) — and nowhere in `has_cited_document` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `has_cited_document` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — pydantic_ai_slim/pydantic_ai/models/anthropic/_citations.py:126
`compute_key` is public, takes a document from its caller (line 263) and hands it to `project`, which calls itself at line 245 (`project`) with a piece of `value` — and nowhere in `project` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `project` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_cache_policies.py:245
What to do
Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.
Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether async functions that make a cancellable request accept or pass on an AbortSignal (adoption curve).
Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.
Only 0/2 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
`call` 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 })`. — src/pydantic_clai2/web-ui/src/api.ts:62
`retry` 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 })`. — src/pydantic_clai2/web-ui/src/api.ts:306
What to do
Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back. Also whether a `finally` that gives the primitive back unconditionally can run in a state where the method does not hold it: after a timed wait whose result was discarded, after an acquire inside the `try` that can fail, after the body already released it, or never, because a `return` left between the acquire and the `try`.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped4.8 / 10Weak✓ 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.
`row.html||' '` 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:111
`html` 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:29
`highlight(code,'python')` 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:78
`highlight(cell(item.args).code.trim(),'python')` 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:341
`highlight(JSON.stringify(args,null,2),'json')` 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:374
`escape(href)` 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. — src/pydantic_clai2/web-ui/src/markdown.ts:77
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 element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×15) — src/pydantic_clai2/web-ui/src/api.ts:79, src/pydantic_clai2/web-ui/src/sidebarModel.ts:144, src/pydantic_clai2/web-ui/src/sidebarModel.ts:218, …
`except Exception` 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. (×13) — REDACTED:58, src/pydantic_ai_harness/pydantic_ai_harness/youdotcom/_toolset.py:178, src/pydantic_ai_harness/pydantic_ai_harness/dynamic_workflow/_toolset.py:226, …
What to do
Swallowed exception (empty catch)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 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.
D11 Test Reliability — 3 observation(s) recorded · This repository declares 3 of its own test(s) unreliable. The built-in reliability runner does not support this repository's ecosystem (.py), so the suite was not re-run and no reliability score is given — these are the repository's own declarations, not our measurement.
X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X6 Hand-rolled structured-format parsing — 3 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 31 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 4 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: this repository stores data through 'sqlite3' (src/pydantic_clai2/pydantic_clai2/__main__.py:6) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and MongoEngine model fields, Alembic and Django migration columns, CREATE TABLE and ALTER TABLE … ADD columns in SQL files). Personal data may be written through raw SQL or a hosted backend, so whether its changes need an audit trail could not be established, and the trail's absence is not scored.
C4 Data Retention — Not assessed: this repository stores data through 'sqlite3' (src/pydantic_clai2/pydantic_clai2/__main__.py:6) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and mongoengine model fields, Alembic and Django migration columns, SQL schemas). Personal data may be written through raw SQL or a hosted backend, so whether a retention limit applies here could not be established, and its absence is not scored.
C5 Data-Subject Rights — Not assessed: this repository stores data through 'sqlite3' (src/pydantic_clai2/pydantic_clai2/__main__.py:6) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and mongoengine model fields, Alembic and Django migration columns, CREATE TABLE and ALTER TABLE … ADD columns in SQL files). Personal data may be written through raw SQL or a hosted backend, so whether data-subject rights apply here could not be established, and their absence is not scored.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 39 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
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
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
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 — the dev server (`npm run dev`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered. This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) 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. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
D10 Test Quality — ~682152 lines of test source are present (.py) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
D12 Dependency Hygiene — Dependency currency not established — no declaration carries an exact pin to grade
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# and TypeScript only; JavaScript, Python, html not measured.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Aggregate roots were found in only one source directory (pydantic_ai_slim), which is a layered codebase, not two contexts. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D25 ADR Conformance — no ADRs to check
D28 Secrets (history) — gitleaks killed before it finished — this repository's git history not scanned
D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
D32 Data Compliance (PII/GDPR) — 15 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage not included — suite not readable by the collector
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
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P12 CI test-gate honesty — Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
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 (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
PF2 Allocation hygiene — Not applicable: Python runs on a garbage-collected runtime that gives a program no allocation-control idiom to choose on a hot path — no pools, stack allocation or value types — so allocation awareness is not something this code can be rated on.
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) 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. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
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.
D11 · Test Reliability· Test declared unreliable · ×3
Test declared unreliable: test_code_mode_runs_over_websocket_in_temporal_workflow tests/harness/code_mode/test_temporal.py:419— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "Hangs intermittently in CI: https://github.com/pydantic/pydantic-ai/issues/8824". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
Test declared unreliable: test_code_mode_runs_over_websocket tests/harness/code_mode/test_websocket.py:49— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "Hangs intermittently in CI: https://github.com/pydantic/pydantic-ai/issues/8824". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
Test declared unreliable: test_disconnect_mid_snippet_reports_started_calls tests/harness/code_mode/test_websocket.py:236— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "Hangs intermittently in CI: https://github.com/pydantic/pydantic-ai/issues/8824". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
AC2 · Forms & labels· <button> with no accessible text · ×2
<button> with no accessible text src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:304— 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 src/pydantic_clai2/web-ui/src/components/SettingsForm.tsx:159— 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).
AC2 · Forms & labels· <input> without a programmatic label · ×2
<input> without a programmatic label src/pydantic_clai2/web-ui/src/components/QuestionCard.tsx:86— 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 src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:398— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC2 · Forms & labels· Custom control with no accessible name on <div> · ×1
Custom control with no accessible name on <div> REDACTED:29— This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label.
AC2 · Forms & labels· <select> without a programmatic label · ×1
<select> without a programmatic label src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:319— 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> · ×1
Click handler on a non-interactive <div> REDACTED:29— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Hotspot: pydantic_ai_slim/pydantic_ai/models/openai.py pydantic_ai_slim/pydantic_ai/models/openai.py:6640— pydantic_ai_slim/pydantic_ai/models/openai.py changed 119 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 145 in OpenAIResponsesStreamedResponse._get_event_iterator at line 6640. 2 of those changes were fix/bug commits, and the other 117 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/models/openai.py`: 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: src/pydantic_clai2/web-ui/src/App.tsx src/pydantic_clai2/web-ui/src/App.tsx:85— src/pydantic_clai2/web-ui/src/App.tsx changed 40 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 230 in App.App at line 85. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- src/pydantic_clai2/web-ui/src/App.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: pydantic_ai_slim/pydantic_ai/agent/__init__.py pydantic_ai_slim/pydantic_ai/agent/__init__.py:1650— pydantic_ai_slim/pydantic_ai/agent/__init__.py changed 84 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 100 in Agent._prepare_run at line 1650. 4 of those changes were fix/bug commits, and the other 80 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/agent/__init__.py`: 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: pydantic_ai_slim/pydantic_ai/models/bedrock.py pydantic_ai_slim/pydantic_ai/models/bedrock.py:1758— pydantic_ai_slim/pydantic_ai/models/bedrock.py changed 56 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 87 in BedrockConverseModel._map_messages at line 1758. 3 of those changes were fix/bug commits, and the other 53 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/models/bedrock.py`: 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: src/pydantic_clai2/pydantic_clai2/app.py src/pydantic_clai2/pydantic_clai2/app.py:162— src/pydantic_clai2/pydantic_clai2/app.py changed 150 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in app.chat at line 162. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- src/pydantic_clai2/pydantic_clai2/app.py`: 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: pydantic_ai_slim/pydantic_ai/models/__init__.py pydantic_ai_slim/pydantic_ai/models/__init__.py:2814— pydantic_ai_slim/pydantic_ai/models/__init__.py changed 99 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in models.infer_model at line 2814. 4 of those changes were fix/bug commits, and the other 95 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/models/__init__.py`: 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: pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2235— pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py changed 88 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in AnthropicModel._process_response at line 2235. 1 of those changes was a fix/bug commit, and the other 87 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py`: 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: src/pydantic_clai2/web-ui/src/components/Sidebar.tsx src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:134— src/pydantic_clai2/web-ui/src/components/Sidebar.tsx changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 136 in Sidebar.Sidebar at line 134. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- src/pydantic_clai2/web-ui/src/components/Sidebar.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: pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py:384— pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 92 in VercelAIAdapter.load_messages at line 384. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py`: 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: pydantic_ai_slim/pydantic_ai/_agent_graph.py pydantic_ai_slim/pydantic_ai/_agent_graph.py:2335— pydantic_ai_slim/pydantic_ai/_agent_graph.py changed 85 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in ModelRequestNode._stream at line 2335. 1 of those changes was a fix/bug commit, and the other 84 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/_agent_graph.py`: 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: pydantic_ai_slim/pydantic_ai/realtime/openai.py pydantic_ai_slim/pydantic_ai/realtime/openai.py:1055— pydantic_ai_slim/pydantic_ai/realtime/openai.py changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in OpenAIRealtimeConnection._decode_frame at line 1055. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/realtime/openai.py`: 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: pydantic_ai_slim/pydantic_ai/ui/ag_ui/_adapter.py pydantic_ai_slim/pydantic_ai/ui/ag_ui/_adapter.py:560— pydantic_ai_slim/pydantic_ai/ui/ag_ui/_adapter.py changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in AGUIAdapter.load_messages at line 560. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/ui/ag_ui/_adapter.py`: 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: pydantic_ai_slim/pydantic_ai/realtime/_session.py pydantic_ai_slim/pydantic_ai/realtime/_session.py:681— pydantic_ai_slim/pydantic_ai/realtime/_session.py changed 90 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in RealtimeSession.__init__ at line 681. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/realtime/_session.py`: 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: src/pydantic_clai2/web-ui/src/components/Composer.tsx src/pydantic_clai2/web-ui/src/components/Composer.tsx:67— src/pydantic_clai2/web-ui/src/components/Composer.tsx changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 131 in Composer.Composer at line 67. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- src/pydantic_clai2/web-ui/src/components/Composer.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: src/pydantic_clai2/pydantic_clai2/runtime/session.py src/pydantic_clai2/pydantic_clai2/runtime/session.py:934— src/pydantic_clai2/pydantic_clai2/runtime/session.py changed 51 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in Session.prompt at line 934. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- src/pydantic_clai2/pydantic_clai2/runtime/session.py`: 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: pydantic_ai_slim/pydantic_ai/realtime/openai_live.py pydantic_ai_slim/pydantic_ai/realtime/openai_live.py:1299— pydantic_ai_slim/pydantic_ai/realtime/openai_live.py changed 49 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in OpenAILiveConnection.frames at line 1299. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/realtime/openai_live.py`: 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: pydantic_ai_slim/pydantic_ai/realtime/_core.py pydantic_ai_slim/pydantic_ai/realtime/_core.py:591— pydantic_ai_slim/pydantic_ai/realtime/_core.py changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in SessionCore.apply at line 591. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/realtime/_core.py`: 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: pydantic_ai_slim/pydantic_ai/realtime/google.py pydantic_ai_slim/pydantic_ai/realtime/google.py:1932— pydantic_ai_slim/pydantic_ai/realtime/google.py changed 43 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in GoogleRealtimeConnection.frames at line 1932. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/realtime/google.py`: 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: src/pydantic_ai_harness/pydantic_ai_harness/compaction/_summarizing_compaction.py src/pydantic_ai_harness/pydantic_ai_harness/compaction/_summarizing_compaction.py:236— src/pydantic_ai_harness/pydantic_ai_harness/compaction/_summarizing_compaction.py changed 48 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in _summarizing_compaction.format_transcript at line 236. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- src/pydantic_ai_harness/pydantic_ai_harness/compaction/_summarizing_compaction.py`: 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: src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_toolset.py src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_toolset.py:1133— src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_toolset.py changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in CodeModeToolset._execute_code at line 1133. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_toolset.py`: 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: src/pydantic_clai2/pydantic_clai2/plugins/loader.py src/pydantic_clai2/pydantic_clai2/plugins/loader.py:1047— src/pydantic_clai2/pydantic_clai2/plugins/loader.py changed 67 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in SessionPlugins._command at line 1047. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- src/pydantic_clai2/pydantic_clai2/plugins/loader.py`: 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: pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py:322— pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 97 in web_fetch._convert_html at line 322. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py`: 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: pydantic_ai_slim/pydantic_ai/providers/__init__.py pydantic_ai_slim/pydantic_ai/providers/__init__.py:257— pydantic_ai_slim/pydantic_ai/providers/__init__.py changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in providers.infer_provider_class at line 257. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_ai_slim/pydantic_ai/providers/__init__.py`: 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: src/pydantic_clai2/pydantic_clai2/ui/prompt/live_prompt.py src/pydantic_clai2/pydantic_clai2/ui/prompt/live_prompt.py:235— src/pydantic_clai2/pydantic_clai2/ui/prompt/live_prompt.py changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in LivePrompt._route at line 235. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- src/pydantic_clai2/pydantic_clai2/ui/prompt/live_prompt.py`: 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: .github/scripts/agentic_workflow_guard.py .github/scripts/agentic_workflow_guard.py:1149— .github/scripts/agentic_workflow_guard.py changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 64 in agentic_workflow_guard.check_provider_health_monitor at line 1149. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- .github/scripts/agentic_workflow_guard.py`: 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.
TodoComment tests/conftest.py:329— # TODO: identifier is not used for == comparison should we ignore it? — 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 tests/conftest.py:1749— # TODO(v3): remove `legacy_retry_prompt_part` along with `RetryPromptPart` — 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 tests/test_capability_image_generation.py:156— # TODO(v3): drop with the deprecated `fallback_model` spelling itself. — 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 tests/realtime/test_elevenlabs_ws.py:70— # The `session.update` the server accepted: the shape every `_session_config` TODO is checked against. — 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 tests/models/test_bedrock.py:1209— # TODO(Marcelo): Anthropic models don't support tools on the Bedrock Converse Interface. — 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 tests/models/test_model.py:60— # TODO(Marcelo): We need to add Vertex AI to the test cases. — 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 tests/harness/compaction/test_compaction.py:292— # TODO(v3): remove along with `RetryPromptPart` — 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 tests/harness/compaction/test_compaction.py:685— # TODO(v3): remove along with `RetryPromptPart` — 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 tests/harness/compaction/test_token_retention.py:345— # TODO(v3): remove the legacy cases along with `RetryPromptPart` — 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 tests/graph/builder/test_basenode_integration.py:49— # pyright: ignore[reportReturnType] # TODO: GraphBuilder.DepsT has no TypeVar default (BaseNode gained one in https://github.com/pydantic/pydantic-ai/pull/5307). Check: drop this ignore.
TodoComment tests/graph/builder/test_basenode_integration.py:155— # pyright: ignore[reportReturnType] # TODO: GraphBuilder.DepsT has no TypeVar default (BaseNode gained one in https://github.com/pydantic/pydantic-ai/pull/5307). Check: drop this ignore.
TodoComment tests/evals/test_dataset.py:1861— # TODO: Add an "example" that actually makes use of this functionality — 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 src/pydantic_clai2/pydantic_clai2/ui/telemetry.py:259— # TODO(v3): remove the `UiSpan` alias and this `__getattr__`. — 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 src/pydantic_clai2/pydantic_clai2/ui/rendering/spinners.py:298— # TODO(v3): remove the `make_spinner` alias and this `__getattr__`. — 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 src/pydantic_clai2/pydantic_clai2/plugins/sign_in.py:192— # TODO(v3): remove the `SignInRequired` alias and this `__getattr__`. — 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 src/pydantic_ai_harness/pydantic_ai_harness/_judge.py:141— # TODO(v3): remove RetryPromptPart — 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 src/pydantic_ai_harness/pydantic_ai_harness/conversation_search/_toolset.py:231— # TODO(v3): remove RetryPromptPart — 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 src/pydantic_ai_harness/pydantic_ai_harness/compaction/_shared.py:153— # TODO(v3): remove RetryPromptPart — 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 pydantic_ai_slim/pydantic_ai/messages.py:2816— # TODO(v3): remove RetryPromptPart — 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 src/pydantic_ai_harness/pydantic_ai_harness/_task_report.py:22— # TODO: switch to `wrap()` from the public `pydantic_ai.framing` module once it lands (#10957), registering
TodoComment src/pydantic_ai_harness/pydantic_ai_harness/trajectory_judge/_capability.py:106— # TODO: switch to `wrap()` from the public `pydantic_ai.framing` module once it lands (#10957), registering
TodoComment src/pydantic_ai_harness/pydantic_ai_harness/repo_context/_loader.py:16— # TODO: switch to `wrap()` from the public `pydantic_ai.framing` module once it lands (#10957), registering
TodoComment src/pydantic_ai_harness/pydantic_ai_harness/compaction/_summarizing_compaction.py:336— # TODO: switch to `wrap()` from the public `pydantic_ai.framing` module once it lands (#10957), registering
TodoComment src/pydantic_ai_harness/pydantic_ai_harness/system_reminders/_capability.py:717— # TODO: switch to the public `pydantic_ai.framing.wrap()` with registered tags (#10957).
TodoComment src/pydantic_ai_harness/pydantic_ai_harness/memory/_capability.py:560— # TODO: switch to `pydantic_ai.framing.wrap()` with `memory` registered as a framing tag (#10957).
FileTooLong: models/openai.py pydantic_ai_slim/pydantic_ai/models/openai.py— FileTooLong — 5410 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4910 over it, 10.82× 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: pydantic_ai/messages.py pydantic_ai_slim/pydantic_ai/messages.py— FileTooLong — 3496 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2996 over it, 6.99× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: agent/__init__.py pydantic_ai_slim/pydantic_ai/agent/__init__.py— FileTooLong — 3427 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2927 over it, 6.85× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: pydantic_ai/_agent_graph.py pydantic_ai_slim/pydantic_ai/_agent_graph.py— FileTooLong — 2928 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2428 over it, 5.86× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: anthropic/__init__.py pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py— FileTooLong — 2692 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2192 over it, 5.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: models/__init__.py pydantic_ai_slim/pydantic_ai/models/__init__.py— FileTooLong — 2542 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2042 over it, 5.08× 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: realtime/_session.py pydantic_ai_slim/pydantic_ai/realtime/_session.py— FileTooLong — 1921 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1421 over it, 3.84× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: models/bedrock.py pydantic_ai_slim/pydantic_ai/models/bedrock.py— FileTooLong — 1798 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1298 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: realtime/openai_live.py pydantic_ai_slim/pydantic_ai/realtime/openai_live.py— FileTooLong — 1678 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1178 over it, 3.36× 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: scripts/issue_pr_attention_monitor.py .github/scripts/issue_pr_attention_monitor.py— FileTooLong — 1658 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1158 over it, 3.32× 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: durable_exec/_base.py pydantic_ai_slim/pydantic_ai/durable_exec/_base.py— FileTooLong — 1458 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 958 over it, 2.92× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: realtime/elevenlabs_agents.py pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py— FileTooLong — 1401 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 901 over it, 2.80× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: models/decision.py pydantic_ai_slim/pydantic_ai/models/decision.py— FileTooLong — 1381 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 881 over it, 2.76× 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: pydantic_graph/graph_builder.py pydantic_graph/pydantic_graph/graph_builder.py— FileTooLong — 1379 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 879 over it, 2.76× 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: agent/abstract.py pydantic_ai_slim/pydantic_ai/agent/abstract.py— FileTooLong — 1377 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 877 over it, 2.75× 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: runtime/session_runtime.py src/pydantic_clai2/pydantic_clai2/runtime/session_runtime.py— FileTooLong — 1346 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 846 over it, 2.69× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: realtime/_core.py pydantic_ai_slim/pydantic_ai/realtime/_core.py— FileTooLong — 1330 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 830 over it, 2.66× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: filesystem/_toolset.py src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py— FileTooLong — 1321 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 821 over it, 2.64× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: realtime/google.py pydantic_ai_slim/pydantic_ai/realtime/google.py— FileTooLong — 1308 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 808 over it, 2.62× 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: pydantic_ai/mcp.py pydantic_ai_slim/pydantic_ai/mcp.py— FileTooLong — 1299 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 799 over it, 2.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: reporting/__init__.py pydantic_evals/pydantic_evals/reporting/__init__.py— FileTooLong — 1271 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 771 over it, 2.54× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: realtime/openai.py pydantic_ai_slim/pydantic_ai/realtime/openai.py— FileTooLong — 1242 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 742 over it, 2.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: pydantic_ai/_output.py pydantic_ai_slim/pydantic_ai/_output.py— FileTooLong — 1237 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 737 over it, 2.47× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: models/xai.py pydantic_ai_slim/pydantic_ai/models/xai.py— FileTooLong — 1213 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 713 over it, 2.43× 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: scripts/agent_provider_health.py .github/scripts/agent_provider_health.py— FileTooLong — 1191 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 691 over it, 2.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
+ 59 more in this group — see findings.md.
AC6 · Visual & motion safety· Focus outline removed in CSS without a · ×22
Focus outline removed in CSS without a :focus replacement src/pydantic_clai2/web-ui/src/styles.css:276— `.search input` 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 src/pydantic_clai2/web-ui/src/styles.css:565— `.rename` 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 src/pydantic_clai2/web-ui/src/styles.css:1524— `.composer textarea` 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 src/pydantic_clai2/web-ui/src/styles.css:2193— `.switch.permissions select` 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 src/pydantic_clai2/web-ui/src/styles.css:2244— `.theme-picker select` 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 src/pydantic_clai2/web-ui/src/styles.css:2474— `.monty-input textarea` 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 src/pydantic_clai2/web-ui/src/styles.css:2619— `.plugins-panel` 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 src/pydantic_clai2/web-ui/src/styles.css:3380— `.dialog-options` 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 src/pydantic_clai2/web-ui/src/styles.css:3667— `.settings-window` 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 src/pydantic_clai2/web-ui/src/styles.css:4258— `.palette-search input` 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 src/pydantic_clai2/web-ui/src/styles.css:4338— `.dialog-view` 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 src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.search input` 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 src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.rename` 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 src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.composer textarea` 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 src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.switch.permissions select` 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 src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.theme-picker select` 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 src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.monty-input textarea` 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 src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.plugins-panel` 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 src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.dialog-options` 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 src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.settings-window` 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 src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.palette-search input` 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 src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.dialog-view` 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.
TooManyMethods: RealtimeSession pydantic_ai_slim/pydantic_ai/realtime/_session.py:623— TooManyMethods — 113 methods. The bar is 30 methods; this is 83 over it, 3.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: _HookRegistration pydantic_ai_slim/pydantic_ai/capabilities/hooks.py:344— TooManyMethods — 101 methods. The bar is 30 methods; this is 71 over it, 3.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: SessionCore pydantic_ai_slim/pydantic_ai/realtime/_core.py:448— TooManyMethods — 88 methods. The bar is 30 methods; this is 58 over it, 2.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BaseDurabilityCapability pydantic_ai_slim/pydantic_ai/durable_exec/_base.py:332— TooManyMethods — 85 methods. The bar is 30 methods; this is 55 over it, 2.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SessionPlugins src/pydantic_clai2/pydantic_clai2/plugins/loader.py:171— TooManyMethods — 68 methods. The bar is 30 methods; this is 38 over it, 2.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: Model pydantic_ai_slim/pydantic_ai/models/__init__.py:753— TooManyMethods — 66 methods. The bar is 30 methods; this is 36 over it, 2.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: FileSystemToolset src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:407— TooManyMethods — 66 methods. The bar is 30 methods; this is 36 over it, 2.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WebService src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/service.py:103— TooManyMethods — 64 methods. The bar is 30 methods; this is 34 over it, 2.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: OpenAILiveConnection pydantic_ai_slim/pydantic_ai/realtime/openai_live.py:813— 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: WorkspaceBackendSuite pydantic_ai_slim/pydantic_ai/workspaces/conformance.py:48— TooManyMethods — 47 methods. The bar is 30 methods; this is 17 over it, 1.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: OpenAILifecycle pydantic_ai_slim/pydantic_ai/realtime/_openai_lifecycle.py:104— TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.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: AbstractAgent pydantic_ai_slim/pydantic_ai/agent/abstract.py:356— 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: LivePrompt src/pydantic_clai2/pydantic_clai2/ui/prompt/live_prompt.py:56— 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: InferredLifecycle pydantic_ai_slim/pydantic_ai/realtime/_inferred_lifecycle.py:78— TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DelegationTasks src/pydantic_ai_harness/pydantic_ai_harness/subagents/_tasks.py:173— TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: OpenRouterModel pydantic_ai_slim/pydantic_ai/models/openrouter.py:823— TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PydanticAIACPAgent src/pydantic_ai_harness/pydantic_ai_harness/experimental/acp/_adapter.py:216— TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: OpenAIRealtimeConnection pydantic_ai_slim/pydantic_ai/realtime/openai.py:465— TooManyMethods — 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Tasks src/pydantic_clai2/pydantic_clai2/runtime/tasks.py:276— TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SubAgentToolset src/pydantic_ai_harness/pydantic_ai_harness/subagents/_toolset.py:394— TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SessionChannel src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/channel.py:68— TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SettingsStore src/pydantic_clai2/pydantic_clai2/config/settings_store.py:99— TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (5 lines × 2) .github/scripts/community_demand.py:122— .github/scripts/community_demand.py:122-126 | .github/scripts/issue_pr_attention_monitor.py:536-540 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `client` to `attention.GitHubClient` in one and `GitHubClient` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (5 lines × 2) .github/scripts/feature_digest.py:136— .github/scripts/feature_digest.py:136-140 | .github/scripts/issue_pr_attention_monitor.py:1517-1521 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) .github/scripts/issue_pr_attention_monitor.py:1352— .github/scripts/issue_pr_attention_monitor.py:1352-1356 | .github/scripts/issue_pr_attention_monitor.py:1422-1426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) pydantic_evals/pydantic_evals/evaluators/agentic.py:346— pydantic_evals/pydantic_evals/evaluators/agentic.py:346-350 | pydantic_evals/pydantic_evals/evaluators/agentic.py:358-362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_evals/pydantic_evals/evaluators/agentic.py:346` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/media/_s3.py:281— src/pydantic_ai_harness/pydantic_ai_harness/media/_s3.py:281-285 | src/pydantic_ai_harness/pydantic_ai_harness/media/_s3.py:302-306 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/memory/_sqlite.py:202— src/pydantic_ai_harness/pydantic_ai_harness/memory/_sqlite.py:202-206 | src/pydantic_ai_harness/pydantic_ai_harness/memory/_sqlite.py:269-273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/planning/_postgres.py:116— src/pydantic_ai_harness/pydantic_ai_harness/planning/_postgres.py:116-120 | src/pydantic_ai_harness/pydantic_ai_harness/planning/_store.py:286-290 — 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 `src/pydantic_ai_harness/pydantic_ai_harness/planning/_postgres.py:116` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `row` to `Sequence[object]` in one and `tuple[object, ...]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (5 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_mongo.py:151— src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_mongo.py:151-155 | src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_mongo.py:157-161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_mongo.py:151` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/naming.py:46— src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/naming.py:46-50 | src/pydantic_clai2/pydantic_clai2/runtime/session_naming.py:34-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) src/pydantic_clai2/pydantic_clai2/builtin_plugins/github.py:70— src/pydantic_clai2/pydantic_clai2/builtin_plugins/github.py:70-74 | src/pydantic_clai2/pydantic_clai2/builtin_plugins/posthog.py:127-131 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) src/pydantic_clai2/pydantic_clai2/config/settings_store.py:67— src/pydantic_clai2/pydantic_clai2/config/settings_store.py:67-71 | src/pydantic_clai2/pydantic_clai2/mcp/store.py:197-201 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) src/pydantic_clai2/pydantic_clai2/models/openrouter.py:68— src/pydantic_clai2/pydantic_clai2/models/openrouter.py:68-72 | src/pydantic_clai2/pydantic_clai2/models/vllm.py:116-120 — before extracting anything, compare `src/pydantic_clai2/pydantic_clai2/models/openrouter.py` and `src/pydantic_clai2/pydantic_clai2/models/vllm.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `account` to `str = 'openrouter'` in one and `str = 'vllm'` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (5 lines × 2) src/pydantic_clai2/pydantic_clai2/builtin_plugins/day_ai.py:180— src/pydantic_clai2/pydantic_clai2/builtin_plugins/day_ai.py:180-184 | src/pydantic_clai2/pydantic_clai2/builtin_plugins/logfire_mcp.py:334-338 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) .github/scripts/issue_pr_attention_monitor.py:975— .github/scripts/issue_pr_attention_monitor.py:975-979 | .github/scripts/issue_pr_attention_monitor.py:1740-1744 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/e2b_sandbox/_backend.py:480— src/pydantic_ai_harness/pydantic_ai_harness/e2b_sandbox/_backend.py:480-484 | src/pydantic_ai_harness/pydantic_ai_harness/modal_sandbox/_backend.py:457-461 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/playwright/_toolset.py:2250— src/pydantic_ai_harness/pydantic_ai_harness/playwright/_toolset.py:2250-2254 | src/pydantic_ai_harness/pydantic_ai_harness/playwright/_toolset.py:2272-2276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Swallowed exception (empty catch) src/pydantic_clai2/web-ui/src/api.ts:79— 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) src/pydantic_clai2/web-ui/src/sidebarModel.ts:144— 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) src/pydantic_clai2/web-ui/src/sidebarModel.ts:218— 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) src/pydantic_clai2/web-ui/src/App.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) src/pydantic_clai2/web-ui/src/components/SidePanel.tsx:30— 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) REDACTED:181— 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) src/pydantic_ai_harness/pydantic_ai_harness/sprites_sandbox/_backend.py:365— 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) src/pydantic_ai_harness/pydantic_ai_harness/render_sandbox/_backend.py:312— 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) src/pydantic_ai_harness/pydantic_ai_harness/daytona_sandbox/_backend.py:371— 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) pydantic_evals/pydantic_evals/_online.py:266— 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) pydantic_evals/pydantic_evals/_online.py:300— 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) pydantic_evals/pydantic_evals/_online.py:528— 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) pydantic_ai_slim/pydantic_ai/workspaces/workspace.py:226— 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) pydantic_ai_slim/pydantic_ai/workspaces/workspace.py:294— 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) pydantic_ai_slim/pydantic_ai/ui/_event_stream.py:319— 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.
Duplicated block (9 lines × 2) .github/scripts/issue_pr_attention_monitor.py:1504— .github/scripts/issue_pr_attention_monitor.py:1504-1512 | .github/scripts/semantic_owner_router.py:389-397 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9 lines × 2) pydantic_ai_slim/pydantic_ai/agent/spec.py:132— pydantic_ai_slim/pydantic_ai/agent/spec.py:132-140 | pydantic_evals/pydantic_evals/dataset.py:800-808 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) pydantic_ai_slim/pydantic_ai/capabilities/hooks.py:1194— pydantic_ai_slim/pydantic_ai/capabilities/hooks.py:1194-1202 | pydantic_ai_slim/pydantic_ai/capabilities/hooks.py:1253-1261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) pydantic_ai_slim/pydantic_ai/capabilities/hooks.py:1311— pydantic_ai_slim/pydantic_ai/capabilities/hooks.py:1311-1319 | pydantic_ai_slim/pydantic_ai/capabilities/hooks.py:1373-1381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `output` to `RawOutput` in one and `Any` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (9 lines × 2) pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:216— pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:216-224 | pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:272-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_dynamic_toolset.py:54— pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_dynamic_toolset.py:54-62 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_function_toolset.py:35-43 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9 lines × 2) pydantic_ai_slim/pydantic_ai/messages.py:6846— pydantic_ai_slim/pydantic_ai/messages.py:6846-6854 | pydantic_ai_slim/pydantic_ai/messages.py:6886-6894 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) pydantic_ai_slim/pydantic_ai/models/openai.py:6962— pydantic_ai_slim/pydantic_ai/models/openai.py:6962-6970 | pydantic_ai_slim/pydantic_ai/models/openai.py:6990-6998 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) pydantic_evals/pydantic_evals/reporting/__init__.py:1050— pydantic_evals/pydantic_evals/reporting/__init__.py:1050-1058 | pydantic_evals/pydantic_evals/reporting/__init__.py:1076-1084 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/approval_reviewer/_capability.py:239— src/pydantic_ai_harness/pydantic_ai_harness/approval_reviewer/_capability.py:239-247 | src/pydantic_ai_harness/pydantic_ai_harness/tool_call_judge/_capability.py:262-270 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:807— src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:807-815 | src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:877-885 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) src/pydantic_ai_harness/scripts/playwright_smoke.py:227— src/pydantic_ai_harness/scripts/playwright_smoke.py:227-235 | src/pydantic_ai_harness/scripts/playwright_smoke.py:372-380 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/pydantic_ai_harness/scripts/playwright_smoke.py:226` calls `encode` and `src/pydantic_ai_harness/scripts/playwright_smoke.py:371` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) src/pydantic_clai2/pydantic_clai2/models/openrouter.py:147— src/pydantic_clai2/pydantic_clai2/models/openrouter.py:147-155 | src/pydantic_clai2/pydantic_clai2/models/vllm.py:188-196 — before extracting anything, compare `src/pydantic_clai2/pydantic_clai2/models/openrouter.py` and `src/pydantic_clai2/pydantic_clai2/models/vllm.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (9 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/spend/_redis.py:282— src/pydantic_ai_harness/pydantic_ai_harness/spend/_redis.py:282-295 | src/pydantic_ai_harness/pydantic_ai_harness/spend/_store.py:293-301 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Boundary violation [package:third-party-deep-import] src/pydantic_clai2/web-ui/src/markdown.ts:2— src/pydantic_clai2/web-ui/src/markdown.ts:2 imports highlight.js/lib/core, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/pydantic_clai2/web-ui/src/markdown.ts:3— src/pydantic_clai2/web-ui/src/markdown.ts:3 imports highlight.js/lib/languages/bash, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/pydantic_clai2/web-ui/src/markdown.ts:4— src/pydantic_clai2/web-ui/src/markdown.ts:4 imports highlight.js/lib/languages/css, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/pydantic_clai2/web-ui/src/markdown.ts:5— src/pydantic_clai2/web-ui/src/markdown.ts:5 imports highlight.js/lib/languages/diff, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/pydantic_clai2/web-ui/src/markdown.ts:6— src/pydantic_clai2/web-ui/src/markdown.ts:6 imports highlight.js/lib/languages/go, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/pydantic_clai2/web-ui/src/markdown.ts:7— src/pydantic_clai2/web-ui/src/markdown.ts:7 imports highlight.js/lib/languages/javascript, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/pydantic_clai2/web-ui/src/markdown.ts:8— src/pydantic_clai2/web-ui/src/markdown.ts:8 imports highlight.js/lib/languages/json, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/pydantic_clai2/web-ui/src/markdown.ts:9— src/pydantic_clai2/web-ui/src/markdown.ts:9 imports highlight.js/lib/languages/markdown, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/pydantic_clai2/web-ui/src/markdown.ts:10— src/pydantic_clai2/web-ui/src/markdown.ts:10 imports highlight.js/lib/languages/python, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/pydantic_clai2/web-ui/src/markdown.ts:11— src/pydantic_clai2/web-ui/src/markdown.ts:11 imports highlight.js/lib/languages/rust, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/pydantic_clai2/web-ui/src/markdown.ts:12— src/pydantic_clai2/web-ui/src/markdown.ts:12 imports highlight.js/lib/languages/sql, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/pydantic_clai2/web-ui/src/markdown.ts:13— src/pydantic_clai2/web-ui/src/markdown.ts:13 imports highlight.js/lib/languages/typescript, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/pydantic_clai2/web-ui/src/markdown.ts:14— src/pydantic_clai2/web-ui/src/markdown.ts:14 imports highlight.js/lib/languages/xml, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/pydantic_clai2/web-ui/src/markdown.ts:15— src/pydantic_clai2/web-ui/src/markdown.ts:15 imports highlight.js/lib/languages/yaml, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Duplicated block (8 lines × 2) pydantic_ai_slim/pydantic_ai/models/google.py:890— pydantic_ai_slim/pydantic_ai/models/google.py:890-897 | pydantic_ai_slim/pydantic_ai/models/google.py:1286-1293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `pydantic_ai_slim/pydantic_ai/models/google.py:1295` calls `_translate_thinking` and `pydantic_ai_slim/pydantic_ai/models/google.py:899` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) pydantic_ai_slim/pydantic_ai/models/openai.py:6886— pydantic_ai_slim/pydantic_ai/models/openai.py:6886-6893 | pydantic_ai_slim/pydantic_ai/models/openai.py:6907-6914 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `pydantic_ai_slim/pydantic_ai/models/openai.py:6903` calls `endswith` and `pydantic_ai_slim/pydantic_ai/models/openai.py:6884` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/media/_store.py:445— src/pydantic_ai_harness/pydantic_ai_harness/media/_store.py:445-452 | src/pydantic_ai_harness/pydantic_ai_harness/media/_store.py:476-483 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/render/_transports.py:128— src/pydantic_ai_harness/pydantic_ai_harness/render/_transports.py:128-135 | src/pydantic_ai_harness/pydantic_ai_harness/render/_transports.py:189-196 — both copies are in the same file, so extract the 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 `src/pydantic_ai_harness/pydantic_ai_harness/render/_transports.py:128` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/pydantic_ai_harness/pydantic_ai_harness/render/_transports.py:136` calls `function_tool_original_name` and `src/pydantic_ai_harness/pydantic_ai_harness/render/_transports.py:197` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_mongo.py:363— src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_mongo.py:363-370 | src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:819-826 — 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 `src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_mongo.py:363` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:686— src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:686-693 | src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:1362-1369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) src/pydantic_clai2/pydantic_clai2/models/openrouter.py:114— src/pydantic_clai2/pydantic_clai2/models/openrouter.py:114-121 | src/pydantic_clai2/pydantic_clai2/models/vllm.py:164-171 — before extracting anything, compare `src/pydantic_clai2/pydantic_clai2/models/openrouter.py` and `src/pydantic_clai2/pydantic_clai2/models/vllm.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) pydantic_ai_slim/pydantic_ai/realtime/_openai_webrtc.py:96— pydantic_ai_slim/pydantic_ai/realtime/_openai_webrtc.py:96-113 | pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:802-809 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/boxd_sandbox/_backend.py:132— src/pydantic_ai_harness/pydantic_ai_harness/boxd_sandbox/_backend.py:132-139 | src/pydantic_ai_harness/pydantic_ai_harness/daytona_sandbox/_backend.py:225-232 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `client` to `AsyncBoxd` in one and `AsyncDaytona` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (8 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/linear/_capability.py:67— src/pydantic_ai_harness/pydantic_ai_harness/linear/_capability.py:67-74 | src/pydantic_ai_harness/pydantic_ai_harness/posthog/_capability.py:124-131 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/spend/_redis.py:263— src/pydantic_ai_harness/pydantic_ai_harness/spend/_redis.py:263-270 | src/pydantic_ai_harness/pydantic_ai_harness/spend/_store.py:274-281 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) src/pydantic_clai2/pydantic_clai2/builtin_plugins/ordinal.py:163— src/pydantic_clai2/pydantic_clai2/builtin_plugins/ordinal.py:163-170 | src/pydantic_clai2/pydantic_clai2/builtin_plugins/posthog.py:195-202 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) pydantic_ai_slim/pydantic_ai/embeddings/instrumented.py:32— pydantic_ai_slim/pydantic_ai/embeddings/instrumented.py:32-39 | pydantic_ai_slim/pydantic_ai/models/instrumented.py:72-79 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `model` to `EmbeddingModel` in one and `Model` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×13
Recursive walk over a caller-supplied document has no depth cap src/pydantic_clai2/web-ui/src/sidebarModel.ts:205— `isView` is exported, takes a document from its caller (line 186) and hands it to `isObject`, which calls itself at line 205 (`isObject`) with a piece of `value` — and nowhere in `isObject` 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 `isObject` 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 src/pydantic_clai2/web-ui/src/sidebarModel.ts:206— `isList` is exported, takes a document from its caller (line 201) and hands it to `hasStrings`, which calls itself at line 206 (`hasStrings`) with a piece of `value` — and nowhere in `hasStrings` 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 `hasStrings` 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 src/pydantic_clai2/web-ui/src/sidebarModel.ts:208— `isList` is exported, takes a document from its caller (line 201) and hands it to `isWorktree`, which calls itself at line 208 (`isWorktree`) with a piece of `value` — and nowhere in `isWorktree` 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 `isWorktree` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap REDACTED:76— `is_run_context` is public and takes `annotation: object` from its caller, and it calls itself at line 76 (`is_run_context`) with a piece of `annotation` — and nowhere in `is_run_context` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `is_run_context` 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 src/pydantic_ai_harness/pydantic_ai_harness/render/_compat.py:194— `normalize_json_value` is public, takes a document from its caller (line 181) and hands it to `_normalize_json_value`, which calls itself at line 194 (`_normalize_json_value`) with a piece of `value` (and at line 196, line 203) — and nowhere in `_normalize_json_value` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_normalize_json_value` 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 src/pydantic_ai_harness/pydantic_ai_harness/media/_walker.py:216— `externalize_media` is public and takes `node: object` from its caller, and it calls itself at line 216 (`externalize_media`) with a piece of `node` (and at line 228) — and nowhere in `externalize_media` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `externalize_media` 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 src/pydantic_ai_harness/pydantic_ai_harness/media/_walker.py:372— `restore_media` is public and takes `node: object` from its caller, and it calls itself at line 372 (`restore_media`) with a piece of `node` (and at line 381) — and nowhere in `restore_media` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `restore_media` 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 src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_speculation.py:190— `claim` is public, takes a document from its caller (line 772) and hands it to `_canonical`, which calls itself at line 190 (`_canonical`) with a piece of `value` (and at line 193, line 195) — and nowhere in `_canonical` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_canonical` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap pydantic_ai_slim/pydantic_ai/_display.py:515— `render_banner` is public, takes a document from its caller (line 315) and hands it to `_output_type_name`, which calls itself at line 515 (`_output_type_name`) with a piece of `output_type` — and nowhere in `_output_type_name` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_output_type_name` 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 pydantic_ai_slim/pydantic_ai/_instrumentation.py:329— `redact_binary_content` is public, takes a document from its caller (line 280) and hands it to `_redact_binary_content`, which calls itself at line 329 (`_redact_binary_content`) with a piece of `value` (and at line 335, line 336, line 346, line 347, line 348, line 352, line 355) — and nowhere in `_redact_binary_content` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_redact_binary_content` 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 pydantic_ai_slim/pydantic_ai/_utils.py:270— `contains_ref` is public and takes `node: JsonValue` from its caller, and it calls itself at line 270 (`contains_ref`) with a piece of `node` (and at line 272) — and nowhere in `contains_ref` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `contains_ref` 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 pydantic_ai_slim/pydantic_ai/models/anthropic/_citations.py:126— `has_cited_document` is public and takes `value: object` from its caller, and it calls itself at line 126 (`has_cited_document`) with a piece of `value` (and at line 130) — and nowhere in `has_cited_document` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `has_cited_document` 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 pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_cache_policies.py:245— `compute_key` is public, takes a document from its caller (line 263) and hands it to `project`, which calls itself at line 245 (`project`) with a piece of `value` — and nowhere in `project` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `project` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Swallowed exception (caught, then discarded) REDACTED:58— `except Exception` 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) src/pydantic_ai_harness/pydantic_ai_harness/youdotcom/_toolset.py:178— `except Exception` 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) src/pydantic_ai_harness/pydantic_ai_harness/dynamic_workflow/_toolset.py:226— `except Exception` 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) src/pydantic_ai_harness/pydantic_ai_harness/daytona_sandbox/_backend.py:189— `except Exception` 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) src/pydantic_ai_harness/pydantic_ai_harness/daytona_sandbox/_backend.py:384— `except Exception` 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) src/pydantic_ai_harness/pydantic_ai_harness/daytona_sandbox/_backend.py:814— `except Exception` 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) src/pydantic_ai_harness/pydantic_ai_harness/boxd_sandbox/_backend.py:257— `except Exception` 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) pydantic_evals/pydantic_evals/online.py:826— `except Exception` 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) pydantic_ai_slim/pydantic_ai/_display.py:465— `except Exception` 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) pydantic_ai_slim/pydantic_ai/_template.py:30— `except Exception` 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) pydantic_ai_slim/pydantic_ai/ui/ag_ui/_utils.py:150— `except Exception` 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) pydantic_ai_slim/pydantic_ai/durable_exec/_toolset.py:90— `except Exception` 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) pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_model_errors.py:152— `except Exception` 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· Animation without a prefers-reduced-motion guard · ×12
Animation without a prefers-reduced-motion guard src/pydantic_clai2/web-ui/src/styles.css:381— `.chevron` moves (`transition: transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/pydantic_clai2/web-ui/src/styles.css:540— `.spinner.row-spinner` moves (`animation: spin 0.9s linear 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 src/pydantic_clai2/web-ui/src/styles.css:810— `.spinner` moves (`animation: spin 0.7s linear infinite,
appear 0.15s ease 0.12s 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 src/pydantic_clai2/web-ui/src/styles.css:832— `.opening-overlay .spinner` moves (`animation: spin 0.7s linear 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 src/pydantic_clai2/web-ui/src/styles.css:1221— `.shimmer` moves (`animation: shimmer 1.8s linear 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 src/pydantic_clai2/web-ui/src/styles.css:1462— `.working .dot` moves (`animation: bounce 1.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.
Animation without a prefers-reduced-motion guard src/pydantic_clai2/web-ui/src/styles.css:2761— `.toggle span` moves (`transition: transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/pydantic_clai2/web-ui/src/styles.css:3194— `.spinner.worker-spinner` moves (`animation: spin 0.7s linear 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 src/pydantic_clai2/web-ui/src/styles.css:3873— `.setting-open svg` moves (`transition: transform 0.12s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/pydantic_clai2/web-ui/src/styles.css:4505— `.changes-chevron` moves (`transition: transform 0.12s`) 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 src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.chevron` moves (`transition: transform .15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.spinner.row-spinner` moves (`animation: spin .9s linear 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.
FunctionTooLong: App.App src/pydantic_clai2/web-ui/src/App.tsx:85— FunctionTooLong — App runs 705 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 605 over it, 7.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.
FunctionTooLong: Sidebar.Sidebar src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:134— FunctionTooLong — Sidebar runs 454 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 354 over it, 4.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: Composer.Composer src/pydantic_clai2/web-ui/src/components/Composer.tsx:67— FunctionTooLong — Composer runs 353 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 253 over it, 3.53× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: NewSessionDialog.NewSessionDialog src/pydantic_clai2/web-ui/src/components/NewSessionDialog.tsx:50— FunctionTooLong — NewSessionDialog runs 240 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 140 over it, 2.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: GitChip.Changes src/pydantic_clai2/web-ui/src/components/GitChip.tsx:194— FunctionTooLong — Changes runs 174 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 74 over it, 1.74× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: SettingsForm.Editor src/pydantic_clai2/web-ui/src/components/SettingsForm.tsx:140— FunctionTooLong — Editor runs 142 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 42 over it, 1.42× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: SettingsWindow.SettingsWindow src/pydantic_clai2/web-ui/src/components/SettingsWindow.tsx:111— FunctionTooLong — SettingsWindow runs 120 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 20 over it, 1.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: CommandPalette.CommandPalette REDACTED:37— FunctionTooLong — CommandPalette runs 113 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× 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: PluginsPanel.PluginsPanel src/pydantic_clai2/web-ui/src/components/PluginsPanel.tsx:25— FunctionTooLong — PluginsPanel runs 109 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 9 over it, 1.09× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: MenuForm.MenuForm src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:29— FunctionTooLong — MenuForm runs 105 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 5 over it, 1.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.
Duplicated block (6 lines × 2) pydantic_ai_slim/pydantic_ai/durable_exec/_base.py:1314— pydantic_ai_slim/pydantic_ai/durable_exec/_base.py:1314-1319 | pydantic_ai_slim/pydantic_ai/durable_exec/_base.py:1402-1407 — both copies are in the same file, so extract the 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 `pydantic_ai_slim/pydantic_ai/durable_exec/_base.py:1314` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) pydantic_ai_slim/pydantic_ai/models/bedrock.py:1326— pydantic_ai_slim/pydantic_ai/models/bedrock.py:1326-1331 | pydantic_ai_slim/pydantic_ai/models/bedrock.py:1607-1613 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) pydantic_ai_slim/pydantic_ai/models/mistral.py:351— pydantic_ai_slim/pydantic_ai/models/mistral.py:351-356 | pydantic_ai_slim/pydantic_ai/models/mistral.py:403-408 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) scripts/verify_vertex_gcs_all_types.py:23— scripts/verify_vertex_gcs_all_types.py:23-28 | scripts/verify_vertex_gcs_tool_result.py:17-22 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/memory/_in_memory.py:130— src/pydantic_ai_harness/pydantic_ai_harness/memory/_in_memory.py:130-135 | src/pydantic_ai_harness/pydantic_ai_harness/memory/_in_memory.py:159-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/pydantic_ai_harness/pydantic_ai_harness/memory/_in_memory.py:129` calls `encode_metadata` and `src/pydantic_ai_harness/pydantic_ai_harness/memory/_in_memory.py:158` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) src/pydantic_clai2/pydantic_clai2/runtime/claude_code_sessions.py:176— src/pydantic_clai2/pydantic_clai2/runtime/claude_code_sessions.py:176-181 | src/pydantic_clai2/pydantic_clai2/runtime/codex_sessions.py:220-225 — 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 `src/pydantic_clai2/pydantic_clai2/runtime/claude_code_sessions.py:176` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6 lines × 2) pydantic_ai_slim/pydantic_ai/models/openrouter.py:1465— pydantic_ai_slim/pydantic_ai/models/openrouter.py:1465-1470 | pydantic_ai_slim/pydantic_ai/models/snowflake.py:270-275 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/shell/_toolset.py:172— src/pydantic_ai_harness/pydantic_ai_harness/shell/_toolset.py:172-177 | src/pydantic_ai_harness/pydantic_ai_harness/smart_search/_toolset.py:89-94 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) pydantic_ai_slim/pydantic_ai/models/openrouter.py:1437— pydantic_ai_slim/pydantic_ai/models/openrouter.py:1437-1442 | pydantic_ai_slim/pydantic_ai/models/snowflake.py:258-263 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_pinning.py:39— src/pydantic_ai_harness/pydantic_ai_harness/compaction/_pinning.py:39-44 | src/pydantic_ai_harness/pydantic_ai_harness/compaction/_receipts.py:103-108 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) pydantic_ai_slim/pydantic_ai/models/groq.py:679— pydantic_ai_slim/pydantic_ai/models/groq.py:679-689 | pydantic_ai_slim/pydantic_ai/models/huggingface.py:464-474 — before extracting anything, compare `pydantic_ai_slim/pydantic_ai/models/groq.py` and `pydantic_ai_slim/pydantic_ai/models/huggingface.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/models/groq.py:679` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) pydantic_ai_slim/pydantic_ai/models/groq.py:784— pydantic_ai_slim/pydantic_ai/models/groq.py:784-794 | pydantic_ai_slim/pydantic_ai/models/mistral.py:822-834 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11 lines × 2) pydantic_evals/pydantic_evals/reporting/__init__.py:1092— pydantic_evals/pydantic_evals/reporting/__init__.py:1092-1102 | pydantic_evals/pydantic_evals/reporting/__init__.py:1274-1284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `case` to `ReportCase` in one and `ReportCaseFailure` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (11 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/boxlite_sandbox/_backend.py:537— src/pydantic_ai_harness/pydantic_ai_harness/boxlite_sandbox/_backend.py:537-547 | src/pydantic_ai_harness/pydantic_ai_harness/smol_sandbox/_backend.py:362-372 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (11 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/memory/_toolset.py:465— src/pydantic_ai_harness/pydantic_ai_harness/memory/_toolset.py:465-475 | src/pydantic_ai_harness/pydantic_ai_harness/memory/_toolset.py:568-578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:458— src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:458-468 | src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:1664-1674 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:458` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:1661` calls `isinstance` and `src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:455` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:527— src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:527-537 | src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:1697-1707 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:538` calls `get`, `fromisoformat`, `isinstance` and `src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:1708` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) pydantic_ai_slim/pydantic_ai/agent/spec.py:250— pydantic_ai_slim/pydantic_ai/agent/spec.py:250-260 | pydantic_evals/pydantic_evals/dataset.py:918-939 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/localstack/_toolset.py:237— src/pydantic_ai_harness/pydantic_ai_harness/localstack/_toolset.py:237-247 | src/pydantic_ai_harness/pydantic_ai_harness/shell/_toolset.py:186-197 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) pydantic_ai_slim/pydantic_ai/durable_exec/_base.py:1324— pydantic_ai_slim/pydantic_ai/durable_exec/_base.py:1324-1336 | pydantic_ai_slim/pydantic_ai/durable_exec/_base.py:1596-1608 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) pydantic_ai_slim/pydantic_ai/durable_exec/_base.py:1335— pydantic_ai_slim/pydantic_ai/durable_exec/_base.py:1335-1347 | pydantic_ai_slim/pydantic_ai/durable_exec/_base.py:1430-1442 — both copies are in the same file, so extract the 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 `pydantic_ai_slim/pydantic_ai/durable_exec/_base.py:1335` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2187— pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2187-2199 | pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2205-2217 — both copies are in the same file, so extract the 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 `pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2187` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) pydantic_ai_slim/pydantic_ai/models/function.py:159— pydantic_ai_slim/pydantic_ai/models/function.py:159-171 | pydantic_ai_slim/pydantic_ai/models/function.py:200-212 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) pydantic_ai_slim/pydantic_ai/models/groq.py:733— pydantic_ai_slim/pydantic_ai/models/groq.py:733-745 | pydantic_ai_slim/pydantic_ai/models/openai.py:2724-2736 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (13 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_capability.py:322— src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_capability.py:322-334 | src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_capability.py:336-348 — both copies are in the same file, so extract the 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 `src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_capability.py:322` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:1407— src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:1407-1419 | src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:1776-1788 — both copies are in the same file, so extract the 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 `src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:1776` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/exa/_agent.py:497— src/pydantic_ai_harness/pydantic_ai_harness/exa/_agent.py:497-515 | src/pydantic_ai_harness/pydantic_ai_harness/stackone/_capability.py:130-142 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) .github/scripts/community_demand.py:180— .github/scripts/community_demand.py:180-186 | .github/scripts/issue_pr_attention_monitor.py:2164-2170 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 2) pydantic_ai_slim/pydantic_ai/images/openai.py:226— pydantic_ai_slim/pydantic_ai/images/openai.py:226-232 | pydantic_ai_slim/pydantic_ai/images/openai.py:241-247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) pydantic_ai_slim/pydantic_ai/models/decision.py:2296— pydantic_ai_slim/pydantic_ai/models/decision.py:2296-2302 | pydantic_ai_slim/pydantic_ai/models/openai_decisions.py:438-444 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) pydantic_ai_slim/pydantic_ai/profiles/google.py:514— pydantic_ai_slim/pydantic_ai/profiles/google.py:514-520 | pydantic_ai_slim/pydantic_ai/providers/openrouter.py:116-122 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) pydantic_evals/pydantic_evals/online.py:691— pydantic_evals/pydantic_evals/online.py:691-697 | pydantic_evals/pydantic_evals/online.py:766-772 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/media/_postgres.py:150— src/pydantic_ai_harness/pydantic_ai_harness/media/_postgres.py:150-156 | src/pydantic_ai_harness/pydantic_ai_harness/media/_postgres.py:172-178 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) src/pydantic_clai2/pydantic_clai2/cli/command_context.py:146— src/pydantic_clai2/pydantic_clai2/cli/command_context.py:146-152 | src/pydantic_clai2/pydantic_clai2/cli/command_context.py:251-257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/grain/_capability.py:104— src/pydantic_ai_harness/pydantic_ai_harness/grain/_capability.py:104-110 | src/pydantic_ai_harness/pydantic_ai_harness/logfire_mcp/_capability.py:88-94 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Low cohesion: TemporalAgent (LCOM4 8) pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:127— TemporalAgent's methods fall into 8 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 8 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: DBOSAgent (LCOM4 7) pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:97— DBOSAgent's methods fall into 7 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 7 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: Model (LCOM4 7) pydantic_ai_slim/pydantic_ai/models/__init__.py:753— Model's methods fall into 7 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 7 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: RealtimeModel (LCOM4 4) pydantic_ai_slim/pydantic_ai/realtime/model.py:226— RealtimeModel's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: SqliteMediaStore (LCOM4 4) src/pydantic_ai_harness/pydantic_ai_harness/media/_store.py:315— SqliteMediaStore's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: SqliteMemoryStore (LCOM4 4) src/pydantic_ai_harness/pydantic_ai_harness/memory/_sqlite.py:63— SqliteMemoryStore's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: PluginHost (LCOM4 4) src/pydantic_clai2/pydantic_clai2/plugins/__init__.py:900— PluginHost'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.
Duplicated block (10 lines × 2) pydantic_ai_slim/pydantic_ai/messages.py:7691— pydantic_ai_slim/pydantic_ai/messages.py:7691-7700 | pydantic_ai_slim/pydantic_ai/messages.py:7957-7966 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `pydantic_ai_slim/pydantic_ai/messages.py:7704` calls `UserError` and `pydantic_ai_slim/pydantic_ai/messages.py:7967` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) pydantic_ai_slim/pydantic_ai/models/groq.py:828— pydantic_ai_slim/pydantic_ai/models/groq.py:828-839 | pydantic_ai_slim/pydantic_ai/models/huggingface.py:600-609 — before extracting anything, compare `pydantic_ai_slim/pydantic_ai/models/groq.py` and `pydantic_ai_slim/pydantic_ai/models/huggingface.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/models/groq.py:828` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) pydantic_ai_slim/pydantic_ai/realtime/_session.py:514— pydantic_ai_slim/pydantic_ai/realtime/_session.py:514-523 | pydantic_ai_slim/pydantic_ai/realtime/openai_live.py:573-582 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) src/pydantic_clai2/pydantic_clai2/models/openrouter.py:55— src/pydantic_clai2/pydantic_clai2/models/openrouter.py:55-64 | src/pydantic_clai2/pydantic_clai2/models/vllm.py:103-112 — before extracting anything, compare `src/pydantic_clai2/pydantic_clai2/models/openrouter.py` and `src/pydantic_clai2/pydantic_clai2/models/vllm.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 2) src/pydantic_clai2/pydantic_clai2/models/openrouter.py:76— src/pydantic_clai2/pydantic_clai2/models/openrouter.py:76-85 | src/pydantic_clai2/pydantic_clai2/models/vllm.py:124-133 — before extracting anything, compare `src/pydantic_clai2/pydantic_clai2/models/openrouter.py` and `src/pydantic_clai2/pydantic_clai2/models/vllm.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/planning/_postgres.py:228— src/pydantic_ai_harness/pydantic_ai_harness/planning/_postgres.py:228-237 | src/pydantic_ai_harness/pydantic_ai_harness/planning/_store.py:296-305 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
X24 · Document value interpolated into markup unescaped· Untrusted text written into markup unescaped · ×6
Untrusted text written into markup unescaped REDACTED:111— `row.html||' '` 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 REDACTED:29— `html` 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 REDACTED:78— `highlight(code,'python')` 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 REDACTED:341— `highlight(cell(item.args).code.trim(),'python')` 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 REDACTED:374— `highlight(JSON.stringify(args,null,2),'json')` 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 src/pydantic_clai2/web-ui/src/markdown.ts:77— `escape(href)` 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.
AC4 · Keyboard semantics· Modal dialog does not manage focus · ×5
Modal dialog does not manage focus src/pydantic_clai2/web-ui/src/components/CommandMenu.tsx:22— This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus src/pydantic_clai2/web-ui/src/components/DialogLayer.tsx:52— This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus src/pydantic_clai2/web-ui/src/components/GitChip.tsx:144— This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus src/pydantic_clai2/web-ui/src/components/NewSessionDialog.tsx:164— This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus src/pydantic_clai2/web-ui/src/components/SettingsWindow.tsx:144— This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Change coupling: _agent.py ↔ _agent.py pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1— `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py` and `pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py` change together 100% of the time (19 of the 19 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 19 shared commits counted here, the most recent 3 are `1f034efd` Remove pre-release `Agent.connect()` and Responses WebSocket APIs (#1…; `f87fcea3` Keep default `run_id` and `conversation_id` stable when a durable run…; `a0cc92b7` Bound retained realtime audio like retained images with `retain_audio… — run `git show` on any of them.
Change coupling: headless.py ↔ session.py src/pydantic_clai2/pydantic_clai2/cli/headless.py:1— `src/pydantic_clai2/pydantic_clai2/cli/headless.py` and `src/pydantic_clai2/pydantic_clai2/runtime/session.py` 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 `5ab692a1` Ask before a `clai2` project file changes permissions, instructions o…; `1bfcb2b9` Run several live sessions in one `clai2` process with `LiveRuntimes`:… (at that commit the file was still `src/pydantic_clai2/pydantic_clai2/runtime/_session.py`); `98401628` Add `--session-id` and `--fork-session` to `clai2`, matching Claude C… (at that commit the file was still `src/pydantic_clai2/pydantic_clai2/runtime/_session.py`) — run `git show` on any of them.
Change coupling: _output.py ↔ _system_prompt.py pydantic_ai_slim/pydantic_ai/_output.py:1— `pydantic_ai_slim/pydantic_ai/_output.py` and `pydantic_ai_slim/pydantic_ai/_system_prompt.py` change together 57% of the time (13 of the 23 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 13 shared commits counted here, the most recent 3 are `30078501` Await callback results uniformly via a shared `await_maybe` helper (#…; `352acff8` Proper check if callable is async (#1972); `8ede1b55` Improve variance of classes (#726) (at that commit the file was still `pydantic_ai_slim/pydantic_ai/_result.py`) — run `git show` on any of them.
Change coupling: __init__.py ↔ groq.py pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:1— `pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py` and `pydantic_ai_slim/pydantic_ai/models/groq.py` change together 52% of the time (47 of the 91 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 47 shared commits counted here, the most recent 3 are `0e2df41d` Warn when a provider-specific thinking setting from a broader scope o… (at that commit the file was still `pydantic_ai_slim/pydantic_ai/models/anthropic.py`); `d585ba81` Add `ModelSettings['max_retries']` to set how many times the provider… (at that commit the file was still `pydantic_ai_slim/pydantic_ai/models/anthropic.py`); `86d8f658` Raise `ModelAPIError` when a 200 response from OpenAI Responses, Anth… (at that commit the file was still `pydantic_ai_slim/pydantic_ai/models/anthropic.py`) — run `git show` on any of them.
Change coupling: headless.py ↔ loader.py src/pydantic_clai2/pydantic_clai2/cli/headless.py:1— `src/pydantic_clai2/pydantic_clai2/cli/headless.py` and `src/pydantic_clai2/pydantic_clai2/plugins/loader.py` 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 `1bfcb2b9` Run several live sessions in one `clai2` process with `LiveRuntimes`:…; `ff1cee2d` Group `clai2` observability under session roots tagged with the Logfi…; `09a7d666` Keep `compaction` and a separate `SubAgents` off in `clai2` while `co… — run `git show` on any of them.
Duplicated block (15 lines × 2) pydantic_ai_slim/pydantic_ai/agent/__init__.py:4286— pydantic_ai_slim/pydantic_ai/agent/__init__.py:4286-4300 | pydantic_ai_slim/pydantic_ai/agent/__init__.py:4471-4485 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) pydantic_ai_slim/pydantic_ai/ui/_adapter.py:1310— pydantic_ai_slim/pydantic_ai/ui/_adapter.py:1310-1324 | pydantic_ai_slim/pydantic_ai/ui/_adapter.py:1456-1470 — both copies are in the same file, so extract the 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 `pydantic_ai_slim/pydantic_ai/ui/_adapter.py:1310` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) src/pydantic_clai2/pydantic_clai2/models/openrouter.py:98— src/pydantic_clai2/pydantic_clai2/models/openrouter.py:98-112 | src/pydantic_clai2/pydantic_clai2/models/vllm.py:148-162 — before extracting anything, compare `src/pydantic_clai2/pydantic_clai2/models/openrouter.py` and `src/pydantic_clai2/pydantic_clai2/models/vllm.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) pydantic_ai_slim/pydantic_ai/exceptions.py:105— pydantic_ai_slim/pydantic_ai/exceptions.py:105-119 | pydantic_evals/pydantic_evals/otel/_errors.py:21-40 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (18 lines × 2) pydantic_ai_slim/pydantic_ai/capabilities/capability.py:263— pydantic_ai_slim/pydantic_ai/capabilities/capability.py:263-280 | pydantic_ai_slim/pydantic_ai/capabilities/capability.py:359-376 — both copies are in the same file, so extract the 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 `pydantic_ai_slim/pydantic_ai/capabilities/capability.py:263` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) pydantic_ai_slim/pydantic_ai/mcp.py:288— pydantic_ai_slim/pydantic_ai/mcp.py:288-305 | pydantic_ai_slim/pydantic_ai/mcp.py:401-418 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_sliding_window_compaction.py:241— src/pydantic_ai_harness/pydantic_ai_harness/compaction/_sliding_window_compaction.py:241-258 | src/pydantic_ai_harness/pydantic_ai_harness/compaction/_summarizing_compaction.py:1023-1040 — 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 `src/pydantic_ai_harness/pydantic_ai_harness/compaction/_sliding_window_compaction.py:241` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_model.py:108— pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_model.py:108-123 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_model.py:139-154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `deps` to `Any | None = None` in one and `AgentDepsT` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (16 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_relevance_compaction.py:528— src/pydantic_ai_harness/pydantic_ai_harness/compaction/_relevance_compaction.py:528-543 | src/pydantic_ai_harness/pydantic_ai_harness/compaction/_sliding_window_compaction.py:216-231 — 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 `src/pydantic_ai_harness/pydantic_ai_harness/compaction/_relevance_compaction.py:528` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/daytona_sandbox/_capability.py:99— src/pydantic_ai_harness/pydantic_ai_harness/daytona_sandbox/_capability.py:99-114 | src/pydantic_ai_harness/pydantic_ai_harness/e2b_sandbox/_capability.py:94-109 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–13 lines × 2) pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_transports.py:102— pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_transports.py:102-112 | src/pydantic_ai_harness/pydantic_ai_harness/render/_transports.py:144-156 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/pydantic_ai_harness/pydantic_ai_harness/render/_transports.py:144` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11–13 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/boxlite_sandbox/_backend.py:370— src/pydantic_ai_harness/pydantic_ai_harness/boxlite_sandbox/_backend.py:370-380 | src/pydantic_ai_harness/pydantic_ai_harness/smol_sandbox/_backend.py:203-215 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11–13 lines × 2) scripts/upload_test_files.py:21— scripts/upload_test_files.py:21-31 | scripts/upload_test_files.py:54-66 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/upload_test_files.py:54` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) pydantic_ai_slim/pydantic_ai/models/huggingface.py:528— pydantic_ai_slim/pydantic_ai/models/huggingface.py:528-539 | pydantic_ai_slim/pydantic_ai/models/mistral.py:679-690 — 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 `pydantic_ai_slim/pydantic_ai/models/huggingface.py:528` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/boxlite_sandbox/_backend.py:226— src/pydantic_ai_harness/pydantic_ai_harness/boxlite_sandbox/_backend.py:226-237 | src/pydantic_ai_harness/pydantic_ai_harness/smol_sandbox/_backend.py:130-141 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (12 lines × 2) pydantic_ai_slim/pydantic_ai/embeddings/__init__.py:379— pydantic_ai_slim/pydantic_ai/embeddings/__init__.py:379-394 | pydantic_ai_slim/pydantic_ai/images/__init__.py:308-319 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Low contrast colour pair in CSS (3.7:1) src/pydantic_clai2/web-ui/src/styles.css:1637— `.send` sets color: #ffffff on background-color: #e520e9 — 3.7:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (3.7:1) src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.send` sets color: #ffffff on background-color: #e520e9 — 3.7:1, below the 4.5:1 WCAG AA minimum for normal text. This is a MINIFIED, build-generated sheet — editing the literal here is undone by the next vendor drop or rebuild, so override the rule in your own stylesheet (or fix it upstream / in the source the bundle is built from).
Low contrast colour pair in CSS (3.2:1) src/pydantic_clai2/web-ui/src/styles.css:3606— `.hero-icon` sets color: #e520e9 on background-color: #f1eee2 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (3.2:1) src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.hero-icon` sets color: #e520e9 on background-color: #f1eee2 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. This is a MINIFIED, build-generated sheet — editing the literal here is undone by the next vendor drop or rebuild, so override the rule in your own stylesheet (or fix it upstream / in the source the bundle is built from).
Low contrast colour pair in CSS (3.6:1) src/pydantic_clai2/web-ui/src/styles.css:4362— `.changes-count` sets color: #fdfcf6 on background-color: #e520e9 — 3.6:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (3.6:1) src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static/assets/index.css:1— `.changes-count` sets color: #fdfcf6 on background-color: #e520e9 — 3.6:1, below the 4.5:1 WCAG AA minimum for normal text. This is a MINIFIED, build-generated sheet — editing the literal here is undone by the next vendor drop or rebuild, so override the rule in your own stylesheet (or fix it upstream / in the source the bundle is built from).
Composer.Composer::onKeyDown (cognitive 39) src/pydantic_clai2/web-ui/src/components/Composer.tsx:288— Composer.Composer::onKeyDown has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 14, ternaries 2 (6 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (Composer.Composer, Composer.Composer::send) 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.
Composer.Composer::send (cognitive 17) src/pydantic_clai2/web-ui/src/components/Composer.tsx:216— Composer.Composer::send has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (5 pts), boolean chains 2, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (Composer.Composer, Composer.Composer::onKeyDown) 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.
Change-coupling hub: app.py → api_keys.py, sessions.py, field_menu.py, model_menu.py, status.py src/pydantic_clai2/pydantic_clai2/app.py— `src/pydantic_clai2/pydantic_clai2/app.py` changes together with 5 other files — `src/pydantic_clai2/pydantic_clai2/config/api_keys.py`, `src/pydantic_clai2/pydantic_clai2/runtime/sessions.py`, `src/pydantic_clai2/pydantic_clai2/ui/menus/field_menu.py`, `src/pydantic_clai2/pydantic_clai2/ui/menus/model_menu.py`, `src/pydantic_clai2/pydantic_clai2/ui/rendering/status.py` — none of which declares a dependency on it: one file is the hub of 5 separate couplings, not 5 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 5.
Change-coupling hub: service.py → api.ts, Sidebar.tsx, state.ts src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/service.py— `src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/service.py` changes together with 3 other files — `src/pydantic_clai2/web-ui/src/api.ts`, `src/pydantic_clai2/web-ui/src/components/Sidebar.tsx`, `src/pydantic_clai2/web-ui/src/state.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.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (4 members, 50+ identical tokens) pydantic_ai_slim/pydantic_ai/agent/abstract.py:790— pydantic_ai_slim/pydantic_ai/agent/abstract.py:790-882 | pydantic_ai_slim/pydantic_ai/agent/abstract.py:970-1241 | pydantic_ai_slim/pydantic_ai/agent/abstract.py:1325-1433 | pydantic_ai_slim/pydantic_ai/agent/abstract.py:1517-1630 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) src/pydantic_ai_harness/pydantic_ai_harness/boxd_sandbox/_capability.py:181— src/pydantic_ai_harness/pydantic_ai_harness/boxd_sandbox/_capability.py:181-191 | src/pydantic_ai_harness/pydantic_ai_harness/daytona_sandbox/_capability.py:146-156 | src/pydantic_ai_harness/pydantic_ai_harness/opensandbox_sandbox/_capability.py:187-197 | src/pydantic_ai_harness/pydantic_ai_harness/sprites_sandbox/_capability.py:126-136 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Duplicated block (34 lines × 2) pydantic_ai_slim/pydantic_ai/agent/abstract.py:2376— pydantic_ai_slim/pydantic_ai/agent/abstract.py:2376-2409 | pydantic_ai_slim/pydantic_ai/agent/abstract.py:2449-2482 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2) scripts/verify_vertex_gcs_all_types.py:30— scripts/verify_vertex_gcs_all_types.py:30-63 | scripts/verify_vertex_gcs_tool_result.py:26-61 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/verify_vertex_gcs_tool_result.py:26` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–23 lines × 2) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:1747— pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:1747-1769 | pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2132-2152 — both copies are in the same file, so extract the 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 `pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:1747` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `tools` to `revealed_tool_order) if tools and all(tool.get('defer_loading') is True for tool in` in one and `list[BetaToolUnionParam]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (21–23 lines × 2) pydantic_evals/pydantic_evals/otel/span_tree.py:374— pydantic_evals/pydantic_evals/otel/span_tree.py:374-396 | pydantic_evals/pydantic_evals/otel/span_tree.py:409-429 — both copies are in the same file, so extract the 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 `pydantic_evals/pydantic_evals/otel/span_tree.py:374` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (22 lines × 2) pydantic_ai_slim/pydantic_ai/models/groq.py:656— pydantic_ai_slim/pydantic_ai/models/groq.py:656-677 | pydantic_ai_slim/pydantic_ai/models/huggingface.py:441-462 — before extracting anything, compare `pydantic_ai_slim/pydantic_ai/models/groq.py` and `pydantic_ai_slim/pydantic_ai/models/huggingface.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2) pydantic_ai_slim/pydantic_ai/embeddings/__init__.py:188— pydantic_ai_slim/pydantic_ai/embeddings/__init__.py:188-209 | pydantic_ai_slim/pydantic_ai/images/__init__.py:165-187 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (19 lines × 3) pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:875— pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:875-893 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:756-774 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:864-882 — `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py` and `pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 150 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:875` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 3) pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1438— pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1438-1456 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:1344-1362 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:1478-1496 — `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py` and `pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 150 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (17 lines × 3) pydantic_ai_slim/pydantic_ai/agent/abstract.py:863— pydantic_ai_slim/pydantic_ai/agent/abstract.py:863-879 | pydantic_ai_slim/pydantic_ai/agent/abstract.py:1052-1068 | pydantic_ai_slim/pydantic_ai/agent/abstract.py:1414-1430 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 3) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:991— pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:991-1008 | pydantic_ai_slim/pydantic_ai/models/google.py:629-645 | pydantic_ai_slim/pydantic_ai/models/groq.py:226-243 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:991` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) pydantic_ai_slim/pydantic_ai/_output.py:620— pydantic_ai_slim/pydantic_ai/_output.py:620-636 | pydantic_ai_slim/pydantic_ai/_output.py:651-667 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pydantic_evals/pydantic_evals/_utils.py:124— pydantic_evals/pydantic_evals/_utils.py:124-140 | src/pydantic_ai_harness/pydantic_ai_harness/_workspace_provider.py:40-56 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 4) pydantic_ai_slim/pydantic_ai/agent/abstract.py:861— pydantic_ai_slim/pydantic_ai/agent/abstract.py:861-876 | pydantic_ai_slim/pydantic_ai/agent/abstract.py:1050-1065 | pydantic_ai_slim/pydantic_ai/agent/abstract.py:1412-1427 | pydantic_ai_slim/pydantic_ai/agent/abstract.py:1608-1623 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 4) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_clear_tool_results.py:175— src/pydantic_ai_harness/pydantic_ai_harness/compaction/_clear_tool_results.py:175-190 | src/pydantic_ai_harness/pydantic_ai_harness/compaction/_deduplicate_file_reads.py:148-163 | src/pydantic_ai_harness/pydantic_ai_harness/compaction/_relevance_compaction.py:325-340 | src/pydantic_ai_harness/pydantic_ai_harness/compaction/_sliding_window_compaction.py:253-268 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/pydantic_ai_harness/pydantic_ai_harness/compaction/_clear_tool_results.py:175` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–16 lines × 2) pydantic_ai_slim/pydantic_ai/conversation.py:29— pydantic_ai_slim/pydantic_ai/conversation.py:29-44 | pydantic_ai_slim/pydantic_ai/usage.py:102-114 — 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 `pydantic_ai_slim/pydantic_ai/conversation.py:29` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13–16 lines × 2) pydantic_evals/pydantic_evals/online.py:637— pydantic_evals/pydantic_evals/online.py:637-649 | pydantic_evals/pydantic_evals/online.py:789-804 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/youdotcom/_capability.py:237— src/pydantic_ai_harness/pydantic_ai_harness/youdotcom/_capability.py:237-250 | src/pydantic_ai_harness/pydantic_ai_harness/youdotcom/_research.py:400-413 — 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 `src/pydantic_ai_harness/pydantic_ai_harness/youdotcom/_capability.py:237` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) pydantic_ai_slim/pydantic_ai/_utils.py:1276— pydantic_ai_slim/pydantic_ai/_utils.py:1276-1289 | pydantic_evals/pydantic_evals/_utils.py:107-120 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12–13 lines × 2) pydantic_ai_slim/pydantic_ai/models/__init__.py:2284— pydantic_ai_slim/pydantic_ai/models/__init__.py:2284-2295 | pydantic_ai_slim/pydantic_ai/models/_continuation.py:613-625 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12–13 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_postgres.py:316— src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_postgres.py:316-328 | src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:1327-1338 — 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 `src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_postgres.py:316` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–10 lines × 2) pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:204— pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:204-212 | pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:259-268 — both copies are in the same file, so extract the 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 `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:259` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) pydantic_ai_slim/pydantic_ai/realtime/openai.py:1623— pydantic_ai_slim/pydantic_ai/realtime/openai.py:1623-1632 | pydantic_ai_slim/pydantic_ai/realtime/xai.py:837-845 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8–9 lines × 2) pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_dynamic_toolset.py:60— pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_dynamic_toolset.py:60-67 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_dynamic_toolset.py:70-78 — both copies are in the same file, so extract the 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 `pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_dynamic_toolset.py:70` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8–9 lines × 2) pydantic_ai_slim/pydantic_ai/realtime/_openai_protocol.py:1243— pydantic_ai_slim/pydantic_ai/realtime/_openai_protocol.py:1243-1251 | pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:1510-1517 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Off the main sequence: pydantic-graph — pydantic-graph: abstractness 0.08, instability 0.00, distance 0.92 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
Off the main sequence: pydantic-ai-slim — pydantic-ai-slim: abstractness 0.08, instability 0.20, distance 0.72 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
R10 · Code Duplication· Duplicated block with local edits (22 matched lines × 2 locations) · ×2
Duplicated block with local edits (22 matched lines × 2 locations) src/pydantic_clai2/web-ui/src/components/GitChip.tsx:116— src/pydantic_clai2/web-ui/src/components/GitChip.tsx:116 · src/pydantic_clai2/web-ui/src/components/NewSessionDialog.tsx:115 — the two spans are one implementation copied and then locally edited — 132 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 (22 matched lines × 2 locations) src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:204— src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:204 · src/pydantic_clai2/web-ui/src/components/SettingsForm.tsx:108 — the two spans are one implementation copied and then locally edited — 163 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 (8 lines × 2 locations) src/pydantic_clai2/web-ui/src/components/Composer.tsx:113— src/pydantic_clai2/web-ui/src/components/Composer.tsx:113 · src/pydantic_clai2/web-ui/src/components/WorkerView.tsx:113 — 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.
Duplicated block (8 lines × 2 locations) src/pydantic_clai2/web-ui/src/components/QueuePanel.tsx:74— src/pydantic_clai2/web-ui/src/components/QueuePanel.tsx:74 · src/pydantic_clai2/web-ui/src/components/Transcript.tsx:89 — 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.
Duplicated block (6 lines × 2 locations) REDACTED:104— REDACTED:104 · src/pydantic_clai2/web-ui/src/components/DialogLayer.tsx:146 — 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.
Duplicated block (6 lines × 2 locations) src/pydantic_clai2/web-ui/src/components/WorkerView.tsx:57— src/pydantic_clai2/web-ui/src/components/WorkerView.tsx:57 · src/pydantic_clai2/web-ui/src/components/WorkersTree.tsx:58 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
X2 · Cancellation propagation· Async function without AbortSignal · ×2
Async function without AbortSignal: call src/pydantic_clai2/web-ui/src/api.ts:62— `call` 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: retry src/pydantic_clai2/web-ui/src/api.ts:306— `retry` 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 })`.
AC3 · Page structure· Data table has no header cells · ×1
Data table has no header cells REDACTED:93— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
AC3 · Page structure· Heading level jumps from h1 to h3 · ×1
Heading level jumps from h1 to h3 src/pydantic_clai2/web-ui/src/components/SettingsWindow.tsx:191— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
AC7 · A11y enforcement· Accessibility enforcement below the top rung · ×1
Accessibility enforcement below the top rung src/pydantic_clai2/web-ui/package.json:19— No accessibility enforcement found — no a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 38 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
App.App (cyclomatic 230) src/pydantic_clai2/web-ui/src/App.tsx:85— App.App has cyclomatic complexity 230 (threshold 15). Of this number, 93 points are the body's own statements and 137 belong to 49 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.
OpenAIResponsesStreamedResponse._get_event_iterator (cyclomatic 145) pydantic_ai_slim/pydantic_ai/models/openai.py:6640— OpenAIResponsesStreamedResponse._get_event_iterator has cyclomatic complexity 145 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OpenAIResponsesModel._map_messages (cyclomatic 125) pydantic_ai_slim/pydantic_ai/models/openai.py:5447— OpenAIResponsesModel._map_messages has cyclomatic complexity 125 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Agent._prepare_run (cyclomatic 100) pydantic_ai_slim/pydantic_ai/agent/__init__.py:1650— Agent._prepare_run has cyclomatic complexity 100 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
web_fetch._convert_html (cyclomatic 97) pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py:322— web_fetch._convert_html has cyclomatic complexity 97 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VercelAIAdapter.load_messages (cyclomatic 92) pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py:384— VercelAIAdapter.load_messages has cyclomatic complexity 92 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BedrockConverseModel._map_messages (cyclomatic 87) pydantic_ai_slim/pydantic_ai/models/bedrock.py:1758— BedrockConverseModel._map_messages has cyclomatic complexity 87 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GeminiStreamedResponse._get_event_iterator (cyclomatic 74) pydantic_ai_slim/pydantic_ai/models/google.py:1740— GeminiStreamedResponse._get_event_iterator 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.
AnthropicStreamedResponse._get_event_iterator (cyclomatic 73) pydantic_ai_slim/pydantic_ai/models/anthropic/_streaming.py:94— AnthropicStreamedResponse._get_event_iterator 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.
AGUIAdapter.load_messages (cyclomatic 66) pydantic_ai_slim/pydantic_ai/ui/ag_ui/_adapter.py:560— AGUIAdapter.load_messages has cyclomatic complexity 66 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
agentic_workflow_guard.check_provider_health_monitor (cyclomatic 64) .github/scripts/agentic_workflow_guard.py:1149— agentic_workflow_guard.check_provider_health_monitor 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.
OpenAIResponsesModel._process_response (cyclomatic 52) pydantic_ai_slim/pydantic_ai/models/openai.py:4142— OpenAIResponsesModel._process_response 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.
_ExhaustiveProcessor._run_strategy (cyclomatic 49) pydantic_ai_slim/pydantic_ai/_tool_execution.py:1265— _ExhaustiveProcessor._run_strategy 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.
Agent.override (cyclomatic 48) pydantic_ai_slim/pydantic_ai/agent/__init__.py:2423— Agent.override has cyclomatic complexity 48 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UIEventStream.transform_stream (cyclomatic 48) pydantic_ai_slim/pydantic_ai/ui/_event_stream.py:216— UIEventStream.transform_stream has cyclomatic complexity 48 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
OpenAIRealtimeConnection._decode_frame (cyclomatic 47) pydantic_ai_slim/pydantic_ai/realtime/openai.py:1055— OpenAIRealtimeConnection._decode_frame 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.
SessionCore.apply (cyclomatic 44) pydantic_ai_slim/pydantic_ai/realtime/_core.py:591— SessionCore.apply 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.
_GraphIterator.iter_graph (cyclomatic 41) pydantic_graph/pydantic_graph/graph_builder.py:684— _GraphIterator.iter_graph 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.
state.reduce (cyclomatic 41) src/pydantic_clai2/web-ui/src/state.ts:376— state.reduce has cyclomatic complexity 41 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GitChip.Changes (cyclomatic 40) src/pydantic_clai2/web-ui/src/components/GitChip.tsx:194— GitChip.Changes has cyclomatic complexity 40 (threshold 15). Of this number, 28 points are the body's own statements and 12 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.
OutputSchema._build (cyclomatic 39) pydantic_ai_slim/pydantic_ai/_output.py:592— OutputSchema._build 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.
BedrockStreamedResponse._get_event_iterator (cyclomatic 39) pydantic_ai_slim/pydantic_ai/models/bedrock.py:2432— BedrockStreamedResponse._get_event_iterator 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.
Agent._resolve_realtime_session (cyclomatic 38) pydantic_ai_slim/pydantic_ai/agent/__init__.py:4023— Agent._resolve_realtime_session has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UIEventStream.handle_event (cyclomatic 38) pydantic_ai_slim/pydantic_ai/ui/_event_stream.py:445— UIEventStream.handle_event has cyclomatic complexity 38 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
SettingsForm.Editor (cyclomatic 38) src/pydantic_clai2/web-ui/src/components/SettingsForm.tsx:140— SettingsForm.Editor has cyclomatic complexity 38 (threshold 15). Of this number, 22 points are the body's own statements and 16 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.
AnthropicModel._process_response (cyclomatic 37) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2235— AnthropicModel._process_response 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.
OpenAIRealtimeConnection._handle_response_done (cyclomatic 36) pydantic_ai_slim/pydantic_ai/realtime/openai.py:1265— OpenAIRealtimeConnection._handle_response_done 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.
models.infer_model (cyclomatic 35) pydantic_ai_slim/pydantic_ai/models/__init__.py:2814— models.infer_model has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
OpenAIResponsesModel._build_responses_request_params (cyclomatic 35) pydantic_ai_slim/pydantic_ai/models/openai.py:4445— OpenAIResponsesModel._build_responses_request_params has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
OpenAIStreamedResponse._get_event_iterator (cyclomatic 35) pydantic_ai_slim/pydantic_ai/models/openai.py:6162— OpenAIStreamedResponse._get_event_iterator 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.
_openai_protocol.map_event (cyclomatic 35) pydantic_ai_slim/pydantic_ai/realtime/_openai_protocol.py:866— _openai_protocol.map_event 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.
Composer.Composer::onKeyDown (cyclomatic 35) src/pydantic_clai2/web-ui/src/components/Composer.tsx:288— Composer.Composer::onKeyDown has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Composer.Composer) 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.
NewSessionDialog.NewSessionDialog (cyclomatic 33) src/pydantic_clai2/web-ui/src/components/NewSessionDialog.tsx:50— NewSessionDialog.NewSessionDialog has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 11 of the 33 points are its own statements and the rest belongs to 11 function items inside it that branch (keys, a function literal at line 177, start, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
agent_provider_health._parse_zai_quota (cyclomatic 32) .github/scripts/agent_provider_health.py:420— agent_provider_health._parse_zai_quota 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.
agent_provider_health._monitor_workflow_outcome (cyclomatic 32) .github/scripts/agent_provider_health.py:936— agent_provider_health._monitor_workflow_outcome 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.
SystemOneModel.decide (cyclomatic 32) pydantic_ai_slim/pydantic_ai/models/system_one.py:143— SystemOneModel.decide 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.
CodeModeToolset._execute_code (cyclomatic 32) src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_toolset.py:1133— CodeModeToolset._execute_code 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.
Model.prepare_request (cyclomatic 31) pydantic_ai_slim/pydantic_ai/models/__init__.py:1554— Model.prepare_request 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.
OpenAIChatModel._map_messages (cyclomatic 31) pydantic_ai_slim/pydantic_ai/models/openai.py:2553— OpenAIChatModel._map_messages 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.
Sidebar.Sidebar::row (cyclomatic 31) src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:378— Sidebar.Sidebar::row has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Sidebar.Sidebar) 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.reduceChat (cyclomatic 30) src/pydantic_clai2/web-ui/src/state.ts:227— state.reduceChat has cyclomatic complexity 30 (threshold 15). Of this number, 25 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ToolCard.ToolCard (cyclomatic 30) REDACTED:262— ToolCard.ToolCard 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.
BedrockConverseModel._build_additional_model_request_fields (cyclomatic 29) pydantic_ai_slim/pydantic_ai/models/bedrock.py:1503— BedrockConverseModel._build_additional_model_request_fields 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.
AGUIAdapter._dump_request_parts (cyclomatic 29) pydantic_ai_slim/pydantic_ai/ui/ag_ui/_adapter.py:848— AGUIAdapter._dump_request_parts 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.
SubAgentToolset._run_delegation (cyclomatic 29) src/pydantic_ai_harness/pydantic_ai_harness/subagents/_toolset.py:1153— SubAgentToolset._run_delegation has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Sidebar.Sidebar (cyclomatic 29) src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:134— Sidebar.Sidebar 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 (Sidebar.Sidebar::row) 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.
ToolCard.summarize (cyclomatic 29) REDACTED:103— ToolCard.summarize 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.
agent_provider_health._check_command (cyclomatic 28) .github/scripts/agent_provider_health.py:1152— agent_provider_health._check_command 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.
Model.prepare_messages (cyclomatic 28) pydantic_ai_slim/pydantic_ai/models/__init__.py:1705— Model.prepare_messages 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.
OpenAILiveConnection.frames (cyclomatic 28) pydantic_ai_slim/pydantic_ai/realtime/openai_live.py:1299— OpenAILiveConnection.frames 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.
typecheck_changed.main (cyclomatic 28) scripts/typecheck_changed.py:191— typecheck_changed.main 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.
Memory.before_model_request (cyclomatic 28) src/pydantic_ai_harness/pydantic_ai_harness/memory/_capability.py:304— Memory.before_model_request has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModalSandboxBackend.run (cyclomatic 28) src/pydantic_ai_harness/pydantic_ai_harness/modal_sandbox/_backend.py:617— ModalSandboxBackend.run 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.
ModelRequestNode._stream (cyclomatic 27) pydantic_ai_slim/pydantic_ai/_agent_graph.py:2335— ModelRequestNode._stream has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
agent._run_lifecycle_hooks (cyclomatic 27) pydantic_ai_slim/pydantic_ai/agent/__init__.py:241— agent._run_lifecycle_hooks 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.
GroqStreamedResponse._get_event_iterator (cyclomatic 27) pydantic_ai_slim/pydantic_ai/models/groq.py:816— GroqStreamedResponse._get_event_iterator 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.
GoogleRealtimeConnection.frames (cyclomatic 27) pydantic_ai_slim/pydantic_ai/realtime/google.py:1932— GoogleRealtimeConnection.frames 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.
GoogleRealtimeConnection._map_message (cyclomatic 27) pydantic_ai_slim/pydantic_ai/realtime/google.py:2214— GoogleRealtimeConnection._map_message 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.
openai._map_usage (cyclomatic 27) pydantic_ai_slim/pydantic_ai/realtime/openai.py:292— openai._map_usage 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.
graph_builder._validate_graph_structure (cyclomatic 27) pydantic_graph/pydantic_graph/graph_builder.py:1787— graph_builder._validate_graph_structure 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.
Session.prompt (cyclomatic 27) src/pydantic_clai2/pydantic_clai2/runtime/session.py:934— Session.prompt 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.
stickToBottom.useStickToBottom (cyclomatic 27) src/pydantic_clai2/web-ui/src/stickToBottom.tsx:14— stickToBottom.useStickToBottom 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 8 function literals inside it that branch (lines 44, 76, 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.
_ContinuationStreamedResponse._get_event_iterator (cyclomatic 26) pydantic_ai_slim/pydantic_ai/models/_continuation.py:663— _ContinuationStreamedResponse._get_event_iterator 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.
DecisionModel.request (cyclomatic 26) pydantic_ai_slim/pydantic_ai/models/decision.py:672— DecisionModel.request 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.
GoogleModel._process_response (cyclomatic 26) pydantic_ai_slim/pydantic_ai/models/google.py:1321— GoogleModel._process_response 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.
XaiModel._map_user_prompt (cyclomatic 26) pydantic_ai_slim/pydantic_ai/models/xai.py:738— XaiModel._map_user_prompt 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.
SessionCore._record_response (cyclomatic 26) pydantic_ai_slim/pydantic_ai/realtime/_core.py:1191— SessionCore._record_response 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.
AGUIAdapter._dump_response_parts (cyclomatic 26) pydantic_ai_slim/pydantic_ai/ui/ag_ui/_adapter.py:1066— AGUIAdapter._dump_response_parts 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.
FileSystemToolset._search_files (cyclomatic 26) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:1225— FileSystemToolset._search_files has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MenuForm.Control (cyclomatic 26) src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:271— MenuForm.Control has cyclomatic complexity 26 (threshold 15). Of this number, 22 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
agent_provider_health._stage_from_attempt_jobs (cyclomatic 25) .github/scripts/agent_provider_health.py:879— agent_provider_health._stage_from_attempt_jobs 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.
UserPromptNode.run (cyclomatic 25) pydantic_ai_slim/pydantic_ai/_agent_graph.py:1106— UserPromptNode.run 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.
_deferred_capability_loader.load_capability (cyclomatic 25) pydantic_ai_slim/pydantic_ai/toolsets/_deferred_capability_loader.py:196— _deferred_capability_loader.load_capability 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.
SpritesSandboxBackend._run (cyclomatic 25) src/pydantic_ai_harness/pydantic_ai_harness/sprites_sandbox/_backend.py:632— SpritesSandboxBackend._run has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
app.chat (cyclomatic 25) src/pydantic_clai2/pydantic_clai2/app.py:162— app.chat 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.
cli.run (cyclomatic 25) REDACTED:34— cli.run 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.
cli._validate_args (cyclomatic 25) REDACTED:436— cli._validate_args 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.
QueuePanel.QueuePanel (cyclomatic 25) src/pydantic_clai2/web-ui/src/components/QueuePanel.tsx:20— QueuePanel.QueuePanel has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 6 of the 25 points are its own statements and the rest belongs to 7 function items inside it that branch (save, a function literal at line 95, 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.
DiffView.DiffView (cyclomatic 25) REDACTED:57— DiffView.DiffView has cyclomatic complexity 25 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CommandPalette.CommandPalette (cyclomatic 25) REDACTED:37— CommandPalette.CommandPalette 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 11 function items inside it that branch (keys, choose, a function literal at line 76, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ModelRequestNode._prepare_attempt (cyclomatic 24) pydantic_ai_slim/pydantic_ai/_agent_graph.py:3268— ModelRequestNode._prepare_attempt 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.
models.resolve_request_tools (cyclomatic 24) pydantic_ai_slim/pydantic_ai/models/__init__.py:3232— models.resolve_request_tools 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.
GoogleModel._map_messages (cyclomatic 24) pydantic_ai_slim/pydantic_ai/models/google.py:1434— GoogleModel._map_messages 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.
OpenAIChatModel._process_response (cyclomatic 24) pydantic_ai_slim/pydantic_ai/models/openai.py:2036— OpenAIChatModel._process_response 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.
EagerCoordinator.receive_args (cyclomatic 24) src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_eager.py:109— EagerCoordinator.receive_args 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.
_summarizing_compaction.format_transcript (cyclomatic 24) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_summarizing_compaction.py:236— _summarizing_compaction.format_transcript 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.
latest_versions_canary_report._test_failures (cyclomatic 23) .github/scripts/latest_versions_canary_report.py:266— latest_versions_canary_report._test_failures has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
review_gates.douwebot_approval (cyclomatic 23) .github/scripts/review_gates.py:139— review_gates.douwebot_approval 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.
ModelRequestNode._apply_before_model_request (cyclomatic 23) pydantic_ai_slim/pydantic_ai/_agent_graph.py:3057— ModelRequestNode._apply_before_model_request has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OpenAIImageGenerationModel.generate (cyclomatic 23) pydantic_ai_slim/pydantic_ai/images/openai.py:194— OpenAIImageGenerationModel.generate 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.
decision._questions (cyclomatic 23) pydantic_ai_slim/pydantic_ai/models/decision.py:2025— decision._questions 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.
OpenAIResponsesModel._get_native_tools (cyclomatic 23) pydantic_ai_slim/pydantic_ai/models/openai.py:5130— OpenAIResponsesModel._get_native_tools 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.
XaiModel._create_chat (cyclomatic 23) pydantic_ai_slim/pydantic_ai/models/xai.py:875— XaiModel._create_chat 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.
XaiStreamedResponse._get_event_iterator (cyclomatic 23) pydantic_ai_slim/pydantic_ai/models/xai.py:1277— XaiStreamedResponse._get_event_iterator 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.
AzureRealtimeModel._session_config (cyclomatic 23) pydantic_ai_slim/pydantic_ai/realtime/azure.py:810— AzureRealtimeModel._session_config has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
codex_sessions._agents (cyclomatic 23) src/pydantic_clai2/pydantic_clai2/runtime/codex_sessions.py:248— codex_sessions._agents 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.
Composer.Composer (cyclomatic 23) src/pydantic_clai2/web-ui/src/components/Composer.tsx:67— Composer.Composer 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 (Composer.Composer::onKeyDown) 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.
MenuForm.MenuRow (cyclomatic 23) src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:172— MenuForm.MenuRow 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.
PluginsPanel.PluginsPanel (cyclomatic 23) src/pydantic_clai2/web-ui/src/components/PluginsPanel.tsx:25— PluginsPanel.PluginsPanel 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 (a function literal at line 97, a function literal at line 45, a function literal at line 82, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
agent_provider_health._health_from_json (cyclomatic 22) .github/scripts/agent_provider_health.py:281— agent_provider_health._health_from_json has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
issue_pr_attention_monitor.census (cyclomatic 22) .github/scripts/issue_pr_attention_monitor.py:1637— issue_pr_attention_monitor.census 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.
weekly_ce_audit.validate_review (cyclomatic 22) .github/scripts/weekly_ce_audit.py:401— weekly_ce_audit.validate_review 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.
weekly_ce_audit.main (cyclomatic 22) .github/scripts/weekly_ce_audit.py:471— weekly_ce_audit.main has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_agent_graph.model_request (cyclomatic 22) pydantic_ai_slim/pydantic_ai/_agent_graph.py:1833— _agent_graph.model_request has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImageGeneration.__post_init__ (cyclomatic 22) pydantic_ai_slim/pydantic_ai/capabilities/image_generation.py:394— ImageGeneration.__post_init__ 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.
Instrumentation._run_tool_span (cyclomatic 22) pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py:636— Instrumentation._run_tool_span 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.
TemporalBoundOperation.__call__ (cyclomatic 22) pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_operation_backend.py:132— TemporalBoundOperation.__call__ 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.
MCPToolset.__init__ (cyclomatic 22) pydantic_ai_slim/pydantic_ai/mcp.py:945— MCPToolset.__init__ 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.
models._project_instruction_state (cyclomatic 22) pydantic_ai_slim/pydantic_ai/models/__init__.py:3991— models._project_instruction_state 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.
AnthropicModel._get_betas_and_extra_headers (cyclomatic 22) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:1860— AnthropicModel._get_betas_and_extra_headers 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.
_response.extract_usage_details (cyclomatic 22) pydantic_ai_slim/pydantic_ai/models/anthropic/_response.py:59— _response.extract_usage_details 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.
BedrockConverseModel._map_user_prompt (cyclomatic 22) pydantic_ai_slim/pydantic_ai/models/bedrock.py:2263— BedrockConverseModel._map_user_prompt 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.
google._locate_grounding_segment (cyclomatic 22) pydantic_ai_slim/pydantic_ai/models/google.py:2330— google._locate_grounding_segment 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.
MistralModel._map_messages (cyclomatic 22) pydantic_ai_slim/pydantic_ai/models/mistral.py:692— MistralModel._map_messages 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.
OpenAIResponsesModel._responses_create (cyclomatic 22) pydantic_ai_slim/pydantic_ai/models/openai.py:4700— OpenAIResponsesModel._responses_create 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.
RealtimeSession.__init__ (cyclomatic 22) pydantic_ai_slim/pydantic_ai/realtime/_session.py:681— RealtimeSession.__init__ 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.
AgentStream.validate_response_output (cyclomatic 22) pydantic_ai_slim/pydantic_ai/result.py:293— AgentStream.validate_response_output 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.
_matching.has_nested_quantifier (cyclomatic 22) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_matching.py:89— _matching.has_nested_quantifier 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.
FileSystemToolset._find_files (cyclomatic 22) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:1469— FileSystemToolset._find_files 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.
IPythonKernel._run_cell (cyclomatic 22) src/pydantic_ai_harness/pydantic_ai_harness/ipython_code_mode/_kernel.py:400— IPythonKernel._run_cell 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.
MemoryToolset.write_memory (cyclomatic 22) src/pydantic_ai_harness/pydantic_ai_harness/memory/_toolset.py:374— MemoryToolset.write_memory 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.
settings.controlFor (cyclomatic 22) src/pydantic_clai2/web-ui/src/settings.ts:52— settings.controlFor 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.
PluginsPanel.Detail (cyclomatic 22) src/pydantic_clai2/web-ui/src/components/PluginsPanel.tsx:157— PluginsPanel.Detail has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
agent_provider_health.parse_run_result (cyclomatic 21) .github/scripts/agent_provider_health.py:827— agent_provider_health.parse_run_result 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.
_ssrf.safe_download (cyclomatic 21) pydantic_ai_slim/pydantic_ai/_ssrf.py:639— _ssrf.safe_download has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_tool_choice.resolve_tool_choice (cyclomatic 21) pydantic_ai_slim/pydantic_ai/models/_tool_choice.py:12— _tool_choice.resolve_tool_choice 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.
MistralModel._map_user_prompt (cyclomatic 21) pydantic_ai_slim/pydantic_ai/models/mistral.py:760— MistralModel._map_user_prompt 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.
XaiModel._process_response (cyclomatic 21) pydantic_ai_slim/pydantic_ai/models/xai.py:1011— XaiModel._process_response 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.
InferredLifecycle._input_transcript (cyclomatic 21) pydantic_ai_slim/pydantic_ai/realtime/_inferred_lifecycle.py:660— InferredLifecycle._input_transcript 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.
_ripgrep.run_ripgrep (cyclomatic 21) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_ripgrep.py:69— _ripgrep.run_ripgrep 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.
LivePrompt._route (cyclomatic 21) src/pydantic_clai2/pydantic_clai2/ui/prompt/live_prompt.py:235— LivePrompt._route 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.
agent_provider_health._reconcile_recovery (cyclomatic 20) .github/scripts/agent_provider_health.py:1303— agent_provider_health._reconcile_recovery 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.
agentic_workflow_guard.check_compiled_runner_contract (cyclomatic 20) .github/scripts/agentic_workflow_guard.py:520— agentic_workflow_guard.check_compiled_runner_contract 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.
latest_versions_canary_report.reconcile (cyclomatic 20) .github/scripts/latest_versions_canary_report.py:414— latest_versions_canary_report.reconcile 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.
Agent._open_realtime_session (cyclomatic 20) pydantic_ai_slim/pydantic_ai/agent/__init__.py:4488— Agent._open_realtime_session has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AbstractAgent.run_stream (cyclomatic 20) pydantic_ai_slim/pydantic_ai/agent/abstract.py:943— AbstractAgent.run_stream 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.
Instrumentation.wrap_run (cyclomatic 20) pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py:264— Instrumentation.wrap_run has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
models._synthesize_tool_availability_delta_messages (cyclomatic 20) pydantic_ai_slim/pydantic_ai/models/__init__.py:4845— models._synthesize_tool_availability_delta_messages 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.
BedrockConverseModel._process_response (cyclomatic 20) pydantic_ai_slim/pydantic_ai/models/bedrock.py:1403— BedrockConverseModel._process_response 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.
function._estimate_usage (cyclomatic 20) pydantic_ai_slim/pydantic_ai/models/function.py:436— function._estimate_usage 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.
GoogleModel._build_content_and_config (cyclomatic 20) pydantic_ai_slim/pydantic_ai/models/google.py:1227— GoogleModel._build_content_and_config 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.
google._process_response_from_parts (cyclomatic 20) pydantic_ai_slim/pydantic_ai/models/google.py:2437— google._process_response_from_parts 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.
google._usage_metadata_as_usage (cyclomatic 20) pydantic_ai_slim/pydantic_ai/models/google.py:2618— google._usage_metadata_as_usage 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.
_EngineWalker.types (cyclomatic 20) scripts/durable_exec_contract.py:603— _EngineWalker.types 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.
FileSystemToolset._grep (cyclomatic 20) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:1681— FileSystemToolset._grep has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
codex_sessions._compacted (cyclomatic 20) src/pydantic_clai2/pydantic_clai2/runtime/codex_sessions.py:391— codex_sessions._compacted 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.
TaskRouter.observe (cyclomatic 20) src/pydantic_clai2/pydantic_clai2/runtime/tasks.py:233— TaskRouter.observe 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.
gh_aw_native_capture.main (cyclomatic 19) REDACTED:290— gh_aw_native_capture.main has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
issue_pr_attention_monitor._reconcile_item (cyclomatic 19) .github/scripts/issue_pr_attention_monitor.py:1114— issue_pr_attention_monitor._reconcile_item 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.
cli._safe_output_status (cyclomatic 19) .github/scripts/pydantic_ai_gh_aw_shim/cli.py:289— cli._safe_output_status 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.
RunContext.emit (cyclomatic 19) pydantic_ai_slim/pydantic_ai/_run_context.py:874— RunContext.emit 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.
_transports.restore_telemetry_mcp_url_ids (cyclomatic 19) pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_transports.py:282— _transports.restore_telemetry_mcp_url_ids 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.
_errors.api_error (cyclomatic 19) pydantic_ai_slim/pydantic_ai/models/anthropic/_errors.py:108— _errors.api_error has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_message_passes.drop_unpaired_native_tool_calls (cyclomatic 19) pydantic_ai_slim/pydantic_ai/models/anthropic/_message_passes.py:70— _message_passes.drop_unpaired_native_tool_calls 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.
BedrockConverseModel._messages_create (cyclomatic 19) pydantic_ai_slim/pydantic_ai/models/bedrock.py:1587— BedrockConverseModel._messages_create 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.
CohereModel._map_messages (cyclomatic 19) pydantic_ai_slim/pydantic_ai/models/cohere.py:442— CohereModel._map_messages 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.
GroqModel._completions_create (cyclomatic 19) pydantic_ai_slim/pydantic_ai/models/groq.py:426— GroqModel._completions_create 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.
MistralModel._get_python_type (cyclomatic 19) pydantic_ai_slim/pydantic_ai/models/mistral.py:564— MistralModel._get_python_type 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.
ElevenLabsAgentsRealtimeModel._sync_tools (cyclomatic 19) pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:1275— ElevenLabsAgentsRealtimeModel._sync_tools 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.
ElevenLabsAgentsRealtimeConnection._map_turn_event (cyclomatic 19) pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:2229— ElevenLabsAgentsRealtimeConnection._map_turn_event has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GoogleRealtimeConnection._map_server_content (cyclomatic 19) pydantic_ai_slim/pydantic_ai/realtime/google.py:2116— GoogleRealtimeConnection._map_server_content has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tool_manager._shape_mismatch (cyclomatic 19) pydantic_ai_slim/pydantic_ai/tool_manager.py:189— tool_manager._shape_mismatch 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.
_forward_compat.adapt_unsupported_items (cyclomatic 19) pydantic_ai_slim/pydantic_ai/ui/ag_ui/_forward_compat.py:131— _forward_compat.adapt_unsupported_items has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VercelAIAdapter.dump_messages (cyclomatic 19) pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py:1230— VercelAIAdapter.dump_messages 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.
SpeculationCoordinator.observe (cyclomatic 19) src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_speculation.py:479— SpeculationCoordinator.observe 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.
_command_search.run_posix_search (cyclomatic 19) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_command_search.py:32— _command_search.run_posix_search 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.
SpendLimits._accrue_response (cyclomatic 19) src/pydantic_ai_harness/pydantic_ai_harness/spend/_capability.py:376— SpendLimits._accrue_response has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Transcript.UserEntry (cyclomatic 19) src/pydantic_clai2/web-ui/src/components/Transcript.tsx:54— Transcript.UserEntry has cyclomatic complexity 19 (threshold 15). Of this number, 10 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MenuForm.MenuForm (cyclomatic 19) src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:29— MenuForm.MenuForm 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 7 function items inside it that branch (row, a function literal at line 70, edited, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
weekly_ce_audit.task_review (cyclomatic 18) .github/scripts/weekly_ce_audit.py:363— weekly_ce_audit.task_review has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_enqueue.deliver_asap_messages (cyclomatic 18) pydantic_ai_slim/pydantic_ai/_enqueue.py:411— _enqueue.deliver_asap_messages 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.
_ssrf._read_gzip_body (cyclomatic 18) pydantic_ai_slim/pydantic_ai/_ssrf.py:888— _ssrf._read_gzip_body 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.
_capability_operation.collect_capability_operations (cyclomatic 18) pydantic_ai_slim/pydantic_ai/durable_exec/_capability_operation.py:330— _capability_operation.collect_capability_operations 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.
models._render_system_prompt_contexts (cyclomatic 18) pydantic_ai_slim/pydantic_ai/models/__init__.py:4174— models._render_system_prompt_contexts 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.
models._legacy_fabricated_tool_search_reveals (cyclomatic 18) pydantic_ai_slim/pydantic_ai/models/__init__.py:4643— models._legacy_fabricated_tool_search_reveals 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.
AnthropicModel._add_native_tools (cyclomatic 18) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2517— AnthropicModel._add_native_tools 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.
AnthropicModel._map_model_response (cyclomatic 18) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:3140— AnthropicModel._map_model_response has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FunctionStreamedResponse._get_event_iterator (cyclomatic 18) pydantic_ai_slim/pydantic_ai/models/function.py:361— FunctionStreamedResponse._get_event_iterator 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.
google._process_part (cyclomatic 18) pydantic_ai_slim/pydantic_ai/models/google.py:2249— google._process_part 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.
InferredLifecycle._event (cyclomatic 18) pydantic_ai_slim/pydantic_ai/realtime/_inferred_lifecycle.py:435— InferredLifecycle._event 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.
tool_manager._drop_superseded_tools (cyclomatic 18) pydantic_ai_slim/pydantic_ai/tool_manager.py:102— tool_manager._drop_superseded_tools 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.
_adapter._take_new_turn (cyclomatic 18) pydantic_ai_slim/pydantic_ai/ui/_adapter.py:535— _adapter._take_new_turn 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.
VercelAIAdapter._dump_response_message (cyclomatic 18) pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py:941— VercelAIAdapter._dump_response_message 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.
MermaidGraph.render (cyclomatic 18) pydantic_graph/pydantic_graph/graph_builder.py:2268— MermaidGraph.render 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.
Coder.__init__ (cyclomatic 18) src/pydantic_ai_harness/pydantic_ai_harness/coder/_capability.py:172— Coder.__init__ 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.
SummarizingCompaction.compact (cyclomatic 18) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_summarizing_compaction.py:822— SummarizingCompaction.compact 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.
PydanticAIACPAgent._run_turn (cyclomatic 18) src/pydantic_ai_harness/pydantic_ai_harness/experimental/acp/_adapter.py:637— PydanticAIACPAgent._run_turn 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.
FileSystemToolset._walk (cyclomatic 18) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:672— FileSystemToolset._walk 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.
FileSystemToolset._command_search_files (cyclomatic 18) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:1318— FileSystemToolset._command_search_files 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.
DelegationTasks.delegate (cyclomatic 18) src/pydantic_ai_harness/pydantic_ai_harness/subagents/_tasks.py:351— DelegationTasks.delegate 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.
SubAgentToolset._delegate_controlled (cyclomatic 18) src/pydantic_ai_harness/pydantic_ai_harness/subagents/_toolset.py:779— SubAgentToolset._delegate_controlled 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.
headless.run_headless (cyclomatic 18) src/pydantic_clai2/pydantic_clai2/cli/headless.py:37— headless.run_headless has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
codex_sessions._item (cyclomatic 18) src/pydantic_clai2/pydantic_clai2/runtime/codex_sessions.py:450— codex_sessions._item 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.
check_api_compatibility.main (cyclomatic 17) .github/scripts/check_api_compatibility.py:105— check_api_compatibility.main has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
issue_pr_attention_monitor.main (cyclomatic 17) .github/scripts/issue_pr_attention_monitor.py:2160— issue_pr_attention_monitor.main 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.
shard_durations.main (cyclomatic 17) .github/scripts/shard_durations.py:248— shard_durations.main 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.
ModelResponsePartsManager.handle_thinking_delta (cyclomatic 17) pydantic_ai_slim/pydantic_ai/_parts_manager.py:256— ModelResponsePartsManager.handle_thinking_delta 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.
ModelResponsePartsManager.handle_tool_call_delta (cyclomatic 17) pydantic_ai_slim/pydantic_ai/_parts_manager.py:363— ModelResponsePartsManager.handle_tool_call_delta 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.
TemporalDurability._resolve_temporal_tool_config (cyclomatic 17) pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_durability.py:455— TemporalDurability._resolve_temporal_tool_config has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MCPToolset._call_tool_checked (cyclomatic 17) pydantic_ai_slim/pydantic_ai/mcp.py:1627— MCPToolset._call_tool_checked 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.
BatchedModel._check (cyclomatic 17) pydantic_ai_slim/pydantic_ai/models/_batch_model.py:776— BatchedModel._check 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.
_response.map_usage (cyclomatic 17) pydantic_ai_slim/pydantic_ai/models/anthropic/_response.py:172— _response.map_usage 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.
BedrockConverseModel.prepare_request (cyclomatic 17) pydantic_ai_slim/pydantic_ai/models/bedrock.py:1112— BedrockConverseModel.prepare_request 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.
google._content_model_response (cyclomatic 17) pydantic_ai_slim/pydantic_ai/models/google.py:2069— google._content_model_response 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.
GroqModel._map_messages (cyclomatic 17) pydantic_ai_slim/pydantic_ai/models/groq.py:644— GroqModel._map_messages 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.
HuggingFaceModel._map_messages (cyclomatic 17) pydantic_ai_slim/pydantic_ai/models/huggingface.py:429— HuggingFaceModel._map_messages 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.
openai._resolve_openai_thinking_effort (cyclomatic 17) pydantic_ai_slim/pydantic_ai/models/openai.py:819— openai._resolve_openai_thinking_effort 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.
openai._group_settled_portable_function_calls (cyclomatic 17) pydantic_ai_slim/pydantic_ai/models/openai.py:7722— openai._group_settled_portable_function_calls 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.
google.google_model_profile (cyclomatic 17) pydantic_ai_slim/pydantic_ai/profiles/google.py:240— google.google_model_profile 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.
RealtimeSession._publish_taps (cyclomatic 17) pydantic_ai_slim/pydantic_ai/realtime/_session.py:3331— RealtimeSession._publish_taps 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.
ElevenLabsAgentsRealtimeConnection._map_frame (cyclomatic 17) pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:2096— ElevenLabsAgentsRealtimeConnection._map_frame 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.
elevenlabs_agents._schemas_match (cyclomatic 17) pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:922— elevenlabs_agents._schemas_match 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.
OpenAIRealtimeConnection.frames (cyclomatic 17) pydantic_ai_slim/pydantic_ai/realtime/openai.py:939— OpenAIRealtimeConnection.frames 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.
CodeModeToolset.get_tools (cyclomatic 17) src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_toolset.py:980— CodeModeToolset.get_tools 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.
PydanticAIACPAgent._emit_event (cyclomatic 17) src/pydantic_ai_harness/pydantic_ai_harness/experimental/acp/_adapter.py:810— PydanticAIACPAgent._emit_event 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.
Tasks.rows (cyclomatic 17) src/pydantic_clai2/pydantic_clai2/runtime/tasks.py:458— Tasks.rows 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.
worktrees.offer_worktree_cleanup (cyclomatic 17) src/pydantic_clai2/pydantic_clai2/runtime/worktrees.py:229— worktrees.offer_worktree_cleanup 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.
DialogLayer.DialogBox (cyclomatic 17) src/pydantic_clai2/web-ui/src/components/DialogLayer.tsx:18— DialogLayer.DialogBox 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, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MontyPanel.CellView (cyclomatic 17) REDACTED:49— MontyPanel.CellView 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.
OrchestratorPane.OrchestratorPane (cyclomatic 17) src/pydantic_clai2/web-ui/src/components/OrchestratorPane.tsx:26— OrchestratorPane.OrchestratorPane has cyclomatic complexity 17 (threshold 15). Of this number, 15 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.
agent_provider_health._monitor_command (cyclomatic 16) .github/scripts/agent_provider_health.py:1233— agent_provider_health._monitor_command 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.
agentic_workflow_guard.check_provider_engine_config (cyclomatic 16) .github/scripts/agentic_workflow_guard.py:836— agentic_workflow_guard.check_provider_engine_config has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
issue_pr_attention_monitor._ensure_recipients (cyclomatic 16) .github/scripts/issue_pr_attention_monitor.py:715— issue_pr_attention_monitor._ensure_recipients has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
issue_pr_attention_monitor.apply_decisions (cyclomatic 16) .github/scripts/issue_pr_attention_monitor.py:777— issue_pr_attention_monitor.apply_decisions 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.
semantic_owner_router.main (cyclomatic 16) .github/scripts/semantic_owner_router.py:582— semantic_owner_router.main has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_agent_graph._prepare_request_parameters (cyclomatic 16) pydantic_ai_slim/pydantic_ai/_agent_graph.py:1518— _agent_graph._prepare_request_parameters 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.
_model_errors.google_status_category (cyclomatic 16) pydantic_ai_slim/pydantic_ai/_model_errors.py:203— _model_errors.google_status_category has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ObjectOutputProcessor.__init__ (cyclomatic 16) pydantic_ai_slim/pydantic_ai/_output.py:1017— ObjectOutputProcessor.__init__ 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.
_ToolCallProcessor._call_tools (cyclomatic 16) pydantic_ai_slim/pydantic_ai/_tool_execution.py:849— _ToolCallProcessor._call_tools 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.
WebFetchLocalTool.__call__ (cyclomatic 16) pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py:137— WebFetchLocalTool.__call__ has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CustomEvent.__init_subclass__ (cyclomatic 16) pydantic_ai_slim/pydantic_ai/messages.py:7711— CustomEvent.__init_subclass__ 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.
models._project_model_settings_deltas (cyclomatic 16) pydantic_ai_slim/pydantic_ai/models/__init__.py:4087— models._project_model_settings_deltas 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.
AnthropicModel._get_container (cyclomatic 16) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2015— AnthropicModel._get_container 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.
bedrock._map_api_errors (cyclomatic 16) pydantic_ai_slim/pydantic_ai/models/bedrock.py:206— bedrock._map_api_errors 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.
bedrock._effective_thinking_type (cyclomatic 16) pydantic_ai_slim/pydantic_ai/models/bedrock.py:2676— bedrock._effective_thinking_type 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.
_Speculation.about (cyclomatic 16) pydantic_ai_slim/pydantic_ai/models/decision.py:1397— _Speculation.about 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.
decision._answers (cyclomatic 16) pydantic_ai_slim/pydantic_ai/models/decision.py:1236— decision._answers 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.
GroqModel._map_user_prompt (cyclomatic 16) pydantic_ai_slim/pydantic_ai/models/groq.py:756— GroqModel._map_user_prompt 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.
mistral._map_content (cyclomatic 16) pydantic_ai_slim/pydantic_ai/models/mistral.py:1083— mistral._map_content 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.
openrouter._openrouter_settings_to_openai_settings (cyclomatic 16) pydantic_ai_slim/pydantic_ai/models/openrouter.py:750— openrouter._openrouter_settings_to_openai_settings 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.
XaiModel._map_response_parts (cyclomatic 16) pydantic_ai_slim/pydantic_ai/models/xai.py:523— XaiModel._map_response_parts 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.
XaiModel._get_tool_choice (cyclomatic 16) pydantic_ai_slim/pydantic_ai/models/xai.py:819— XaiModel._get_tool_choice 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.
SessionCore._command (cyclomatic 16) pydantic_ai_slim/pydantic_ai/realtime/_core.py:679— SessionCore._command 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.
SessionCore.still_owed (cyclomatic 16) pydantic_ai_slim/pydantic_ai/realtime/_core.py:1885— SessionCore.still_owed 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.
ElevenLabsAgentsRealtimeModel.connect (cyclomatic 16) pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:1520— ElevenLabsAgentsRealtimeModel.connect 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.
GoogleRealtimeModel._config (cyclomatic 16) pydantic_ai_slim/pydantic_ai/realtime/google.py:1324— GoogleRealtimeModel._config 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.
GoogleRealtimeConnection._send_tool_result (cyclomatic 16) pydantic_ai_slim/pydantic_ai/realtime/google.py:1832— GoogleRealtimeConnection._send_tool_result 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.
model.infer_realtime_model (cyclomatic 16) pydantic_ai_slim/pydantic_ai/realtime/model.py:592— model.infer_realtime_model 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.
OpenAIRealtimeConnection.send (cyclomatic 16) pydantic_ai_slim/pydantic_ai/realtime/openai.py:633— OpenAIRealtimeConnection.send 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.
OpenAIRealtimeModel._session_config (cyclomatic 16) pydantic_ai_slim/pydantic_ai/realtime/openai.py:1584— OpenAIRealtimeModel._session_config 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.
OpenAILiveModel._session_config (cyclomatic 16) pydantic_ai_slim/pydantic_ai/realtime/openai_live.py:2479— OpenAILiveModel._session_config 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.
UIEventStream.handle_part_start (cyclomatic 16) pydantic_ai_slim/pydantic_ai/ui/_event_stream.py:551— UIEventStream.handle_part_start has cyclomatic complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
api.create_api_app (cyclomatic 16) pydantic_ai_slim/pydantic_ai/ui/_web/api.py:104— api.create_api_app 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.
_adapter._convert_user_prompt_part (cyclomatic 16) pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py:1381— _adapter._convert_user_prompt_part 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.
GraphBuilder._edge_from_return_hint (cyclomatic 16) pydantic_graph/pydantic_graph/graph_builder.py:1676— GraphBuilder._edge_from_return_hint 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.
typecheck_changed._load_project (cyclomatic 16) scripts/typecheck_changed.py:462— typecheck_changed._load_project 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.
_types.check_response (cyclomatic 16) src/pydantic_ai_harness/pydantic_ai_harness/ask_user/_types.py:262— _types.check_response 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.
_toolset._resolve_resource_limits (cyclomatic 16) src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_toolset.py:332— _toolset._resolve_resource_limits 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.
RelevanceCompaction._rebuild (cyclomatic 16) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_relevance_compaction.py:463— RelevanceCompaction._rebuild 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.
E2BSandboxBackend.run (cyclomatic 16) src/pydantic_ai_harness/pydantic_ai_harness/e2b_sandbox/_backend.py:590— E2BSandboxBackend.run has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FileSystemToolset._read_file (cyclomatic 16) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:758— FileSystemToolset._read_file 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.
_walker._restore_external (cyclomatic 16) src/pydantic_ai_harness/pydantic_ai_harness/media/_walker.py:386— _walker._restore_external 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.
ModalSandboxBackend.__init__ (cyclomatic 16) src/pydantic_ai_harness/pydantic_ai_harness/modal_sandbox/_backend.py:239— ModalSandboxBackend.__init__ 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.
ModalSandboxBackend._create (cyclomatic 16) src/pydantic_ai_harness/pydantic_ai_harness/modal_sandbox/_backend.py:473— ModalSandboxBackend._create 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.
ShellToolset.__init__ (cyclomatic 16) src/pydantic_ai_harness/pydantic_ai_harness/shell/_toolset.py:70— ShellToolset.__init__ 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.
DelegationTasks.opened (cyclomatic 16) src/pydantic_ai_harness/pydantic_ai_harness/subagents/_tasks.py:247— DelegationTasks.opened 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.
SubAgentToolset.delegate_task (cyclomatic 16) src/pydantic_ai_harness/pydantic_ai_harness/subagents/_toolset.py:606— SubAgentToolset.delegate_task has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Updates.command (cyclomatic 16) src/pydantic_clai2/pydantic_clai2/cli/self_update.py:416— Updates.command 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.
ModelSettingsForm.to_model_settings (cyclomatic 16) src/pydantic_clai2/pydantic_clai2/models/model_settings.py:130— ModelSettingsForm.to_model_settings 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.
SessionPlugins._command (cyclomatic 16) src/pydantic_clai2/pydantic_clai2/plugins/loader.py:1047— SessionPlugins._command 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.
Tasks.deliver (cyclomatic 16) src/pydantic_clai2/pydantic_clai2/runtime/tasks.py:367— Tasks.deliver 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.
ToolCard.ToolDetails (cyclomatic 16) REDACTED:334— ToolCard.ToolDetails 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.
Repeated repair: pydantic_evals/pydantic_evals/otel/span_tree.py pydantic_evals/pydantic_evals/otel/span_tree.py:344— pydantic_evals/pydantic_evals/otel/span_tree.py 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 SpanNode._children_match at line 344), 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 all conditions in pruned span queries (#7499)”; “fix(evals): honor zero-valued `SpanQuery` maximums (#6934)”; “Fix incorrect `None` return value claim in `SpanNode.duration` docstring (#7369)”; “Fix `SpanQuery` `has_attributes` matching for JSON-serialized dict and list values (#5905)”. 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-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 01:27:04 +00:00' --until='2026-11-05 01:27:04 +00:00' --full-history --no-merges -- pydantic_evals/pydantic_evals/otel/span_tree.py`: 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.
TodoComment repeated across 21 files tests/test_tool_failed_wire.py:22— The identical TodoComment appears in 21 files (23 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 23 independent debts. Fix the systemic cause once rather than file-by-file. Text: "# pyright: ignore[reportDeprecated] # TODO(v3): remove RetryPromptPart". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
TodoComment repeated across 14 files tests/test_tool_failed_wire.py:116— The identical TodoComment appears in 14 files (19 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 19 independent debts. Fix the systemic cause once rather than file-by-file. Text: "# TODO(v3): remove `RetryPromptPart`". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
OpenAIResponsesModel._map_messages (cognitive 283) pydantic_ai_slim/pydantic_ai/models/openai.py:5447— OpenAIResponsesModel._map_messages has cognitive complexity 283 (threshold 15). Drivers by points: if/else 44 (207 pts), boolean chains 54, ternaries 4 (15 pts), loops 3 (7 pts) (nesting depth added 178). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the 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_fetch._convert_html (cognitive 267) pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py:322— web_fetch._convert_html has cognitive complexity 267 (threshold 15). Drivers by points: if/else 50 (176 pts), loops 12 (34 pts), boolean chains 30, ternaries 5 (27 pts) (nesting depth added 170). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
VercelAIAdapter.load_messages (cognitive 267) pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py:384— VercelAIAdapter.load_messages has cognitive complexity 267 (threshold 15). Drivers by points: if/else 37 (133 pts), ternaries 13 (78 pts), boolean chains 22, loops 6 (18 pts), error handling 3 (16 pts) (nesting depth added 186). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BedrockConverseModel._map_messages (cognitive 250) pydantic_ai_slim/pydantic_ai/models/bedrock.py:1758— BedrockConverseModel._map_messages has cognitive complexity 250 (threshold 15). Drivers by points: if/else 52 (181 pts), ternaries 5 (28 pts), boolean chains 19, loops 6 (15 pts), error handling 1 (7 pts) (nesting depth added 167). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
App.App (cognitive 228) src/pydantic_clai2/web-ui/src/App.tsx:85— App.App has cognitive complexity 228 (threshold 15). Drivers by points: ternaries 54 (84 pts), boolean chains 69, if/else 63 (69 pts), error handling 3, loops 3 (nesting depth added 36). Of this number, 84 points are the body's own statements and 144 belong to 49 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.
OpenAIResponsesStreamedResponse._get_event_iterator (cognitive 220) pydantic_ai_slim/pydantic_ai/models/openai.py:6640— OpenAIResponsesStreamedResponse._get_event_iterator has cognitive complexity 220 (threshold 15). Drivers by points: if/else 35 (100 pts), loops 22 (77 pts), ternaries 7 (23 pts), boolean chains 16, error handling 1 (4 pts) (nesting depth added 139). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_GraphIterator.iter_graph (cognitive 155) pydantic_graph/pydantic_graph/graph_builder.py:684— _GraphIterator.iter_graph has cognitive complexity 155 (threshold 15). Drivers by points: if/else 24 (99 pts), loops 13 (53 pts), boolean chains 2, error handling 1 (nesting depth added 115). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GeminiStreamedResponse._get_event_iterator (cognitive 153) pydantic_ai_slim/pydantic_ai/models/google.py:1740— GeminiStreamedResponse._get_event_iterator has cognitive complexity 153 (threshold 15). Drivers by points: if/else 33 (84 pts), loops 10 (27 pts), ternaries 5 (23 pts), boolean chains 18, error handling 1 (nesting depth added 86). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AGUIAdapter.load_messages (cognitive 148) pydantic_ai_slim/pydantic_ai/ui/ag_ui/_adapter.py:560— AGUIAdapter.load_messages has cognitive complexity 148 (threshold 15). Drivers by points: if/else 26 (81 pts), ternaries 13 (46 pts), boolean chains 11, loops 2 (5 pts), error handling 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 94). To reduce it, split the body into named stages: move each independent 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._prepare_run (cognitive 139) pydantic_ai_slim/pydantic_ai/agent/__init__.py:1650— Agent._prepare_run has cognitive complexity 139 (threshold 15). Drivers by points: if/else 48 (77 pts), ternaries 26 (35 pts), boolean chains 27 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnthropicStreamedResponse._get_event_iterator (cognitive 132) pydantic_ai_slim/pydantic_ai/models/anthropic/_streaming.py:94— AnthropicStreamedResponse._get_event_iterator has cognitive complexity 132 (threshold 15). Drivers by points: if/else 21 (68 pts), loops 12 (45 pts), boolean chains 11, ternaries 2 (8 pts) (nesting depth added 86). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UIEventStream.transform_stream (cognitive 101) pydantic_ai_slim/pydantic_ai/ui/_event_stream.py:216— UIEventStream.transform_stream has cognitive complexity 101 (threshold 15). Drivers by points: loops 18 (48 pts), if/else 13 (29 pts), ternaries 4 (11 pts), error handling 2 (5 pts), boolean chains 4, match/switch 1 (4 pts) (nesting depth added 59). 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.
BedrockStreamedResponse._get_event_iterator (cognitive 100) pydantic_ai_slim/pydantic_ai/models/bedrock.py:2432— BedrockStreamedResponse._get_event_iterator has cognitive complexity 100 (threshold 15). Drivers by points: if/else 17 (53 pts), loops 7 (28 pts), ternaries 3 (13 pts), boolean chains 4, match/switch 1 (2 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.
_ExhaustiveProcessor._run_strategy (cognitive 99) pydantic_ai_slim/pydantic_ai/_tool_execution.py:1265— _ExhaustiveProcessor._run_strategy has cognitive complexity 99 (threshold 15). Drivers by points: if/else 24 (59 pts), loops 13 (24 pts), boolean chains 8, error handling 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agentic_workflow_guard.check_provider_health_monitor (cognitive 81) .github/scripts/agentic_workflow_guard.py:1149— agentic_workflow_guard.check_provider_health_monitor has cognitive complexity 81 (threshold 15). Drivers by points: if/else 34 (48 pts), boolean chains 18, loops 8 (11 pts), ternaries 3 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAIResponsesModel._process_response (cognitive 73) pydantic_ai_slim/pydantic_ai/models/openai.py:4142— OpenAIResponsesModel._process_response has cognitive complexity 73 (threshold 15). Drivers by points: if/else 24 (57 pts), boolean chains 8, loops 2 (4 pts), 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.
XaiStreamedResponse._get_event_iterator (cognitive 71) pydantic_ai_slim/pydantic_ai/models/xai.py:1277— XaiStreamedResponse._get_event_iterator has cognitive complexity 71 (threshold 15). Drivers by points: if/else 10 (32 pts), loops 8 (24 pts), ternaries 2 (11 pts), boolean chains 4 (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.
GoogleRealtimeConnection.frames (cognitive 70) pydantic_ai_slim/pydantic_ai/realtime/google.py:1932— GoogleRealtimeConnection.frames has cognitive complexity 70 (threshold 15). Drivers by points: if/else 10 (37 pts), loops 5 (15 pts), ternaries 3 (9 pts), boolean chains 7, error handling 1 (2 pts) (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.
Agent.override (cognitive 69) pydantic_ai_slim/pydantic_ai/agent/__init__.py:2423— Agent.override has cognitive complexity 69 (threshold 15). Drivers by points: if/else 49 (56 pts), boolean chains 10, ternaries 2 (3 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
OpenAILiveConnection.frames (cognitive 63) pydantic_ai_slim/pydantic_ai/realtime/openai_live.py:1299— OpenAILiveConnection.frames has cognitive complexity 63 (threshold 15). Drivers by points: if/else 12 (34 pts), error handling 4 (13 pts), boolean chains 8, loops 2 (4 pts), ternaries 1 (4 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
latest_versions_canary_report._test_failures (cognitive 62) .github/scripts/latest_versions_canary_report.py:266— latest_versions_canary_report._test_failures has cognitive complexity 62 (threshold 15). Drivers by points: ternaries 7 (29 pts), if/else 8 (25 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GroqStreamedResponse._get_event_iterator (cognitive 59) pydantic_ai_slim/pydantic_ai/models/groq.py:816— GroqStreamedResponse._get_event_iterator has cognitive complexity 59 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 7 (19 pts), ternaries 2 (6 pts), boolean chains 3, error handling 2 (3 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.
AGUIAdapter._dump_request_parts (cognitive 59) pydantic_ai_slim/pydantic_ai/ui/ag_ui/_adapter.py:848— AGUIAdapter._dump_request_parts has cognitive complexity 59 (threshold 15). Drivers by points: if/else 15 (45 pts), ternaries 2 (6 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
OpenAIRealtimeConnection._decode_frame (cognitive 58) pydantic_ai_slim/pydantic_ai/realtime/openai.py:1055— OpenAIRealtimeConnection._decode_frame has cognitive complexity 58 (threshold 15). Drivers by points: if/else 20 (31 pts), boolean chains 16, ternaries 4 (7 pts), error handling 2 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graph_builder._validate_graph_structure (cognitive 58) pydantic_graph/pydantic_graph/graph_builder.py:1787— graph_builder._validate_graph_structure has cognitive complexity 58 (threshold 15). Drivers by points: if/else 14 (35 pts), loops 10 (21 pts), boolean chains 2 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BedrockConverseModel._process_response (cognitive 57) pydantic_ai_slim/pydantic_ai/models/bedrock.py:1403— BedrockConverseModel._process_response has cognitive complexity 57 (threshold 15). Drivers by points: if/else 10 (30 pts), ternaries 5 (25 pts), loops 1 (2 pts) (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
OutputSchema._build (cognitive 54) pydantic_ai_slim/pydantic_ai/_output.py:592— OutputSchema._build has cognitive complexity 54 (threshold 15). Drivers by points: if/else 33 (51 pts), boolean chains 2, 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.
OpenAIChatModel._map_messages (cognitive 54) pydantic_ai_slim/pydantic_ai/models/openai.py:2553— OpenAIChatModel._map_messages has cognitive complexity 54 (threshold 15). Drivers by points: if/else 17 (35 pts), boolean chains 8, loops 3 (7 pts), ternaries 2 (4 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.
agent_provider_health._stage_from_attempt_jobs (cognitive 53) .github/scripts/agent_provider_health.py:879— agent_provider_health._stage_from_attempt_jobs has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (41 pts), boolean chains 6, loops 2 (3 pts), 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.
SettingsForm.Editor (cognitive 53) src/pydantic_clai2/web-ui/src/components/SettingsForm.tsx:140— SettingsForm.Editor has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 14 (29 pts), if/else 5 (10 pts), boolean chains 9, error handling 2 (4 pts), match/switch 1 (nesting depth added 22). Of this number, 24 points are the body's own statements and 29 belong to 7 function items inside it that branch. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
AGUIAdapter._dump_response_parts (cognitive 52) pydantic_ai_slim/pydantic_ai/ui/ag_ui/_adapter.py:1066— AGUIAdapter._dump_response_parts has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (40 pts), ternaries 2 (8 pts), boolean chains 3, loops 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelRequestNode._stream (cognitive 50) pydantic_ai_slim/pydantic_ai/_agent_graph.py:2335— ModelRequestNode._stream has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (29 pts), error handling 9 (16 pts), boolean chains 5 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FunctionStreamedResponse._get_event_iterator (cognitive 50) pydantic_ai_slim/pydantic_ai/models/function.py:361— FunctionStreamedResponse._get_event_iterator has cognitive complexity 50 (threshold 15). Drivers by points: if/else 7 (27 pts), loops 5 (17 pts), ternaries 1 (5 pts), boolean chains 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.
agent_provider_health._monitor_workflow_outcome (cognitive 49) .github/scripts/agent_provider_health.py:936— agent_provider_health._monitor_workflow_outcome has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (31 pts), boolean chains 11, ternaries 4 (7 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelRequestNode._prepare_attempt (cognitive 49) pydantic_ai_slim/pydantic_ai/_agent_graph.py:3268— ModelRequestNode._prepare_attempt has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (30 pts), ternaries 5 (12 pts), boolean chains 7 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_agent_graph.model_request (cognitive 49) pydantic_ai_slim/pydantic_ai/_agent_graph.py:1833— _agent_graph.model_request has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (29 pts), error handling 4 (13 pts), boolean chains 6, loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_message_passes.drop_unpaired_native_tool_calls (cognitive 49) pydantic_ai_slim/pydantic_ai/models/anthropic/_message_passes.py:70— _message_passes.drop_unpaired_native_tool_calls has cognitive complexity 49 (threshold 15). Drivers by points: if/else 7 (27 pts), loops 6 (17 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.
OpenAIStreamedResponse._get_event_iterator (cognitive 49) pydantic_ai_slim/pydantic_ai/models/openai.py:6162— OpenAIStreamedResponse._get_event_iterator has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (31 pts), boolean chains 14, 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.
BedrockConverseModel._map_user_prompt (cognitive 46) pydantic_ai_slim/pydantic_ai/models/bedrock.py:2263— BedrockConverseModel._map_user_prompt has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (33 pts), ternaries 2 (5 pts), error handling 1 (4 pts), boolean chains 2, loops 1 (2 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.
OpenAIResponsesModel._get_native_tools (cognitive 46) pydantic_ai_slim/pydantic_ai/models/openai.py:5130— OpenAIResponsesModel._get_native_tools has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (35 pts), ternaries 2 (8 pts), boolean chains 2, loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Agent._resolve_realtime_session (cognitive 45) pydantic_ai_slim/pydantic_ai/agent/__init__.py:4023— Agent._resolve_realtime_session has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 12, ternaries 8, loops 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_ContinuationStreamedResponse._get_event_iterator (cognitive 45) pydantic_ai_slim/pydantic_ai/models/_continuation.py:663— _ContinuationStreamedResponse._get_event_iterator has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (32 pts), boolean chains 8, loops 2 (3 pts), error handling 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IPythonKernel._run_cell (cognitive 45) src/pydantic_ai_harness/pydantic_ai_harness/ipython_code_mode/_kernel.py:400— IPythonKernel._run_cell has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (38 pts), boolean chains 4, error handling 1, loops 1, ternaries 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
agent_provider_health._parse_zai_quota (cognitive 43) .github/scripts/agent_provider_health.py:420— agent_provider_health._parse_zai_quota has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (23 pts), ternaries 8 (11 pts), boolean chains 8, 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.
_ssrf.safe_download (cognitive 43) pydantic_ai_slim/pydantic_ai/_ssrf.py:639— _ssrf.safe_download has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (32 pts), error handling 2 (5 pts), ternaries 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
models._project_instruction_state (cognitive 43) pydantic_ai_slim/pydantic_ai/models/__init__.py:3991— models._project_instruction_state has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (28 pts), boolean chains 6, loops 3 (6 pts), ternaries 2 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
app.chat (cognitive 43) src/pydantic_clai2/pydantic_clai2/app.py:162— app.chat has cognitive complexity 43 (threshold 15). Drivers by points: if/else 9 (20 pts), ternaries 6 (12 pts), boolean chains 6, error handling 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.
UserPromptNode.run (cognitive 42) pydantic_ai_slim/pydantic_ai/_agent_graph.py:1106— UserPromptNode.run has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (36 pts), boolean chains 4, error handling 1, ternaries 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_transports.restore_telemetry_mcp_url_ids (cognitive 42) pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_transports.py:282— _transports.restore_telemetry_mcp_url_ids has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 4 (11 pts), boolean chains 3 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GoogleModel._map_messages (cognitive 42) pydantic_ai_slim/pydantic_ai/models/google.py:1434— GoogleModel._map_messages has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 4 (10 pts), boolean chains 3, ternaries 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MistralModel._map_user_prompt (cognitive 42) pydantic_ai_slim/pydantic_ai/models/mistral.py:760— MistralModel._map_user_prompt has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (36 pts), ternaries 1 (4 pts), loops 1 (2 pts) (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
codex_sessions._agents (cognitive 42) src/pydantic_clai2/pydantic_clai2/runtime/codex_sessions.py:248— codex_sessions._agents has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 3 (10 pts), boolean chains 7, loops 5 (7 pts), error handling 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CodeModeToolset._execute_code (cognitive 41) src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_toolset.py:1133— CodeModeToolset._execute_code has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (26 pts), error handling 7, boolean chains 5, ternaries 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ToolCard.summarize (cognitive 41) REDACTED:103— ToolCard.summarize has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 13 (31 pts), if/else 3 (5 pts), boolean chains 4, match/switch 1 (nesting depth added 20). 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, split the body into named stages: move each independent 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_provider_health._check_command (cognitive 40) .github/scripts/agent_provider_health.py:1152— agent_provider_health._check_command has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 13, ternaries 4 (9 pts), loops 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
models._synthesize_tool_availability_delta_messages (cognitive 40) pydantic_ai_slim/pydantic_ai/models/__init__.py:4845— models._synthesize_tool_availability_delta_messages has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 3 (7 pts), boolean chains 5, ternaries 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GitChip.Changes (cognitive 40) src/pydantic_clai2/web-ui/src/components/GitChip.tsx:194— GitChip.Changes has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 9 (16 pts), boolean chains 15, if/else 6 (8 pts), error handling 1 (nesting depth added 9). Of this number, 21 points are the body's own statements and 19 belong to 6 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelRequestNode._apply_before_model_request (cognitive 39) pydantic_ai_slim/pydantic_ai/_agent_graph.py:3057— ModelRequestNode._apply_before_model_request has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 5, loops 2 (5 pts), ternaries 2 (5 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MCPToolset.__init__ (cognitive 39) pydantic_ai_slim/pydantic_ai/mcp.py:945— MCPToolset.__init__ has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (30 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UIEventStream.handle_event (cognitive 39) pydantic_ai_slim/pydantic_ai/ui/_event_stream.py:445— UIEventStream.handle_event has cognitive complexity 39 (threshold 15). Drivers by points: loops 17 (35 pts), if/else 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
_forward_compat.adapt_unsupported_items (cognitive 39) pydantic_ai_slim/pydantic_ai/ui/ag_ui/_forward_compat.py:131— _forward_compat.adapt_unsupported_items has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 2 (5 pts), boolean chains 4, error handling 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
VercelAIAdapter.dump_messages (cognitive 39) pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py:1230— VercelAIAdapter.dump_messages has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 4 (8 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
typecheck_changed.main (cognitive 39) scripts/typecheck_changed.py:191— typecheck_changed.main has cognitive complexity 39 (threshold 15). Drivers by points: if/else 20 (29 pts), boolean chains 5, ternaries 3, error handling 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agent_provider_health.parse_run_result (cognitive 38) .github/scripts/agent_provider_health.py:827— agent_provider_health.parse_run_result has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 6, loops 2 (4 pts), ternaries 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.
review_gates.douwebot_approval (cognitive 38) .github/scripts/review_gates.py:139— review_gates.douwebot_approval has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 7, ternaries 3 (7 pts), loops 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.
agent._run_lifecycle_hooks (cognitive 38) pydantic_ai_slim/pydantic_ai/agent/__init__.py:241— agent._run_lifecycle_hooks has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (21 pts), error handling 4 (8 pts), boolean chains 6, ternaries 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
models._convert_speech_parts (cognitive 38) pydantic_ai_slim/pydantic_ai/models/__init__.py:3448— models._convert_speech_parts has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (30 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAIResponsesModel._responses_create (cognitive 38) pydantic_ai_slim/pydantic_ai/models/openai.py:4700— OpenAIResponsesModel._responses_create has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 5, error handling 2 (3 pts), ternaries 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.
GoogleRealtimeConnection._map_message (cognitive 38) pydantic_ai_slim/pydantic_ai/realtime/google.py:2214— GoogleRealtimeConnection._map_message has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 10, ternaries 2 (6 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAIRealtimeConnection._handle_response_done (cognitive 38) pydantic_ai_slim/pydantic_ai/realtime/openai.py:1265— OpenAIRealtimeConnection._handle_response_done has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 18, if/else 12 (15 pts), ternaries 4, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
FileSystemToolset._walk (cognitive 38) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:672— FileSystemToolset._walk has cognitive complexity 38 (threshold 15). Drivers by points: if/else 5 (14 pts), error handling 4 (12 pts), loops 3 (7 pts), boolean chains 5 (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.
NewSessionDialog.NewSessionDialog (cognitive 38) src/pydantic_clai2/web-ui/src/components/NewSessionDialog.tsx:50— NewSessionDialog.NewSessionDialog has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 9 (13 pts), boolean chains 11, error handling 1 (nesting depth added 8). Most of this is not in the body itself: 12 of the 38 points are its own statements and the rest belongs to 11 function items inside it that branch (keys, a function literal at line 177, start, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
check_api_compatibility.main (cognitive 37) .github/scripts/check_api_compatibility.py:105— check_api_compatibility.main has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 3 (4 pts), ternaries 1 (4 pts), boolean chains 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelResponsePartsManager.handle_tool_call_delta (cognitive 37) pydantic_ai_slim/pydantic_ai/_parts_manager.py:363— ModelResponsePartsManager.handle_tool_call_delta has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 2, error handling 1 (2 pts), ternaries 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.
models._render_system_prompt_contexts (cognitive 37) pydantic_ai_slim/pydantic_ai/models/__init__.py:4174— models._render_system_prompt_contexts has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 4 (9 pts), ternaries 2 (5 pts), boolean chains 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SystemOneModel.decide (cognitive 37) pydantic_ai_slim/pydantic_ai/models/system_one.py:143— SystemOneModel.decide has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 10, error handling 4 (5 pts), ternaries 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.
RealtimeSession._publish_taps (cognitive 37) pydantic_ai_slim/pydantic_ai/realtime/_session.py:3331— RealtimeSession._publish_taps has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 3 (10 pts), boolean chains 4 (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.
_matching.has_nested_quantifier (cognitive 37) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_matching.py:89— _matching.has_nested_quantifier has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (23 pts), boolean chains 6, loops 2 (4 pts), ternaries 1 (4 pts) (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
state.reduce (cognitive 37) src/pydantic_clai2/web-ui/src/state.ts:376— state.reduce has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 5 (11 pts), boolean chains 9, match/switch 1 (nesting depth added 14). Of this number, 34 points are the body's own statements and 3 belong to 2 function items inside it that branch. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
OpenAIResponsesModel._build_responses_request_params (cognitive 36) pydantic_ai_slim/pydantic_ai/models/openai.py:4445— OpenAIResponsesModel._build_responses_request_params has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 17, if/else 13 (15 pts), ternaries 3 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
FileSystemToolset._search_files (cognitive 36) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:1225— FileSystemToolset._search_files has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 5, error handling 3 (5 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.
XaiModel._process_response (cognitive 35) pydantic_ai_slim/pydantic_ai/models/xai.py:1011— XaiModel._process_response has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 4 (10 pts), boolean chains 8, loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_summarizing_compaction.format_transcript (cognitive 35) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_summarizing_compaction.py:236— _summarizing_compaction.format_transcript has cognitive complexity 35 (threshold 15). Drivers by points: if/else 4 (11 pts), ternaries 2 (10 pts), boolean chains 7, loops 3 (7 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DelegationTasks.opened (cognitive 35) src/pydantic_ai_harness/pydantic_ai_harness/subagents/_tasks.py:247— DelegationTasks.opened has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 5 (9 pts), ternaries 1 (4 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.
weekly_ce_audit.main (cognitive 34) .github/scripts/weekly_ce_audit.py:471— weekly_ce_audit.main has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 5, loops 1 (2 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.
ModelResponsePartsManager.handle_thinking_delta (cognitive 34) pydantic_ai_slim/pydantic_ai/_parts_manager.py:256— ModelResponsePartsManager.handle_thinking_delta has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (23 pts), ternaries 2 (6 pts), boolean chains 5 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Instrumentation._run_tool_span (cognitive 34) pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py:636— Instrumentation._run_tool_span has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 6 (8 pts), ternaries 3 (8 pts), boolean chains 5 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model.prepare_request (cognitive 34) pydantic_ai_slim/pydantic_ai/models/__init__.py:1554— Model.prepare_request has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 13, ternaries 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Model.prepare_messages (cognitive 34) pydantic_ai_slim/pydantic_ai/models/__init__.py:1705— Model.prepare_messages has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 8, ternaries 5 (7 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.
CohereModel._map_messages (cognitive 34) pydantic_ai_slim/pydantic_ai/models/cohere.py:442— CohereModel._map_messages has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MistralModel._get_python_type (cognitive 34) pydantic_ai_slim/pydantic_ai/models/mistral.py:564— MistralModel._get_python_type has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 3 (12 pts), boolean chains 3 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
EagerCoordinator.receive_args (cognitive 34) src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_eager.py:109— EagerCoordinator.receive_args has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 11, 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.
Memory.before_model_request (cognitive 34) src/pydantic_ai_harness/pydantic_ai_harness/memory/_capability.py:304— Memory.before_model_request has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 10, ternaries 5 (8 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.
SpritesSandboxBackend._run (cognitive 34) src/pydantic_ai_harness/pydantic_ai_harness/sprites_sandbox/_backend.py:632— SpritesSandboxBackend._run has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 9, error handling 3 (4 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SubAgentToolset._run_delegation (cognitive 34) src/pydantic_ai_harness/pydantic_ai_harness/subagents/_toolset.py:1153— SubAgentToolset._run_delegation has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 11 (14 pts), if/else 10 (12 pts), boolean chains 7, error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Sidebar.Sidebar (cognitive 34) src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:134— Sidebar.Sidebar has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 51, if/else 35 (47 pts), ternaries 33 (47 pts), error handling 2, loops 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Sidebar.Sidebar::row) 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.
MenuForm.Control (cognitive 34) src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:271— MenuForm.Control has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 14 (25 pts), boolean chains 6, if/else 3 (nesting depth added 11). Of this number, 28 points are the body's own statements and 6 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_ToolCallProcessor._collect_deferred_calls (cognitive 33) pydantic_ai_slim/pydantic_ai/_tool_execution.py:1068— _ToolCallProcessor._collect_deferred_calls has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (9 pts), error handling 2 (7 pts), ternaries 1 (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.
MCPToolset.__aenter__ (cognitive 33) pydantic_ai_slim/pydantic_ai/mcp.py:1370— MCPToolset.__aenter__ has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (25 pts), ternaries 2 (6 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.
_tool_choice.resolve_tool_choice (cognitive 33) pydantic_ai_slim/pydantic_ai/models/_tool_choice.py:12— _tool_choice.resolve_tool_choice has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (23 pts), ternaries 3 (8 pts), boolean chains 2 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SpendLimits._accrue_response (cognitive 33) src/pydantic_ai_harness/pydantic_ai_harness/spend/_capability.py:376— SpendLimits._accrue_response has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 3 (10 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
codex_sessions._compacted (cognitive 33) src/pydantic_clai2/pydantic_clai2/runtime/codex_sessions.py:391— codex_sessions._compacted has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 4 (10 pts), boolean chains 5, loops 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.prompt (cognitive 33) src/pydantic_clai2/pydantic_clai2/runtime/session.py:934— Session.prompt has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 8 (10 pts), boolean chains 7, error handling 3 (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.
_mcp.map_from_pai_messages (cognitive 32) pydantic_ai_slim/pydantic_ai/_mcp.py:110— _mcp.map_from_pai_messages has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 3 (9 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_ToolCallProcessor._call_tools (cognitive 32) pydantic_ai_slim/pydantic_ai/_tool_execution.py:849— _ToolCallProcessor._call_tools has cognitive complexity 32 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 6 (10 pts), ternaries 1 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AbstractAgent.run_stream (cognitive 32) pydantic_ai_slim/pydantic_ai/agent/abstract.py:943— AbstractAgent.run_stream has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 3 (7 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.
OpenAIImageGenerationModel.generate (cognitive 32) pydantic_ai_slim/pydantic_ai/images/openai.py:194— OpenAIImageGenerationModel.generate has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 7 (13 pts), boolean chains 10, if/else 3 (4 pts), match/switch 1 (3 pts), error handling 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.
models._project_model_settings_deltas (cognitive 32) pydantic_ai_slim/pydantic_ai/models/__init__.py:4087— models._project_model_settings_deltas has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 3 (6 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnthropicModel._process_response (cognitive 32) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2235— AnthropicModel._process_response has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (22 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.
MistralModel._map_messages (cognitive 32) pydantic_ai_slim/pydantic_ai/models/mistral.py:692— MistralModel._map_messages has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 4 (8 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.
SessionCore.apply (cognitive 32) pydantic_ai_slim/pydantic_ai/realtime/_core.py:591— SessionCore.apply has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 4, loops 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAIRealtimeConnection.frames (cognitive 32) pydantic_ai_slim/pydantic_ai/realtime/openai.py:939— OpenAIRealtimeConnection.frames has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 2 (5 pts), ternaries 2 (5 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_shared.rebuild_with_cleared (cognitive 32) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_shared.py:1098— _shared.rebuild_with_cleared has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 3 (10 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PydanticAIACPAgent._run_turn (cognitive 32) src/pydantic_ai_harness/pydantic_ai_harness/experimental/acp/_adapter.py:637— PydanticAIACPAgent._run_turn has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (6 pts), error handling 4 (5 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModalSandboxBackend.run (cognitive 32) src/pydantic_ai_harness/pydantic_ai_harness/modal_sandbox/_backend.py:617— ModalSandboxBackend.run has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 7, ternaries 7, error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
agent_provider_health._reconcile_recovery (cognitive 31) .github/scripts/agent_provider_health.py:1303— agent_provider_health._reconcile_recovery has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (21 pts), ternaries 4 (7 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.
shard_durations.main (cognitive 31) .github/scripts/shard_durations.py:248— shard_durations.main has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (6 pts), ternaries 2 (5 pts), error handling 1 (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.
AnthropicModel._add_native_tools (cognitive 31) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2517— AnthropicModel._add_native_tools has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (29 pts), boolean chains 1, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MistralStreamedResponse._get_event_iterator (cognitive 31) pydantic_ai_slim/pydantic_ai/models/mistral.py:858— MistralStreamedResponse._get_event_iterator has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 5 (12 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAIChatModel._process_response (cognitive 31) pydantic_ai_slim/pydantic_ai/models/openai.py:2036— OpenAIChatModel._process_response has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 6, ternaries 1 (4 pts), loops 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.
XaiModel._map_user_prompt (cognitive 31) pydantic_ai_slim/pydantic_ai/models/xai.py:738— XaiModel._map_user_prompt has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 5, ternaries 1 (3 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SessionCore._record_response (cognitive 31) pydantic_ai_slim/pydantic_ai/realtime/_core.py:1191— SessionCore._record_response has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 9, loops 4 (5 pts), ternaries 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ElevenLabsAgentsRealtimeConnection._map_turn_event (cognitive 31) pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:2229— ElevenLabsAgentsRealtimeConnection._map_turn_event has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (23 pts), ternaries 2 (6 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryToolset.write_memory (cognitive 31) src/pydantic_ai_harness/pydantic_ai_harness/memory/_toolset.py:374— MemoryToolset.write_memory has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 4 (6 pts), error handling 4 (5 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.
_capability_operation.collect_capability_operations (cognitive 30) pydantic_ai_slim/pydantic_ai/durable_exec/_capability_operation.py:330— _capability_operation.collect_capability_operations has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 3 (6 pts), loops 4 (5 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnthropicModel._messages_use_anthropic_uploaded_file (cognitive 30) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:1946— AnthropicModel._messages_use_anthropic_uploaded_file has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 4 (11 pts), boolean chains 3 (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.
_response.extract_usage_details (cognitive 30) pydantic_ai_slim/pydantic_ai/models/anthropic/_response.py:59— _response.extract_usage_details has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GroqModel._map_user_prompt (cognitive 30) pydantic_ai_slim/pydantic_ai/models/groq.py:756— GroqModel._map_user_prompt has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (24 pts), ternaries 1 (4 pts), loops 1 (2 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_shared._is_safe_cutoff (cognitive 30) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_shared.py:738— _shared._is_safe_cutoff has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 4 (8 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.
weekly_ce_audit.task_review (cognitive 29) .github/scripts/weekly_ce_audit.py:363— weekly_ce_audit.task_review has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 6, 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.
_ssrf._read_gzip_body (cognitive 29) pydantic_ai_slim/pydantic_ai/_ssrf.py:888— _ssrf._read_gzip_body has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, error handling 2 (4 pts), loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MCPToolset._call_tool_checked (cognitive 29) pydantic_ai_slim/pydantic_ai/mcp.py:1627— MCPToolset._call_tool_checked has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (22 pts), error handling 3, boolean chains 2, loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
decision._questions (cognitive 29) pydantic_ai_slim/pydantic_ai/models/decision.py:2025— decision._questions has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 7, 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.
google._locate_grounding_segment (cognitive 29) pydantic_ai_slim/pydantic_ai/models/google.py:2330— google._locate_grounding_segment has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 8, 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.
tool_manager._drop_superseded_tools (cognitive 29) pydantic_ai_slim/pydantic_ai/tool_manager.py:102— tool_manager._drop_superseded_tools has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 5 (8 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.
_deferred_capability_loader.load_capability (cognitive 29) pydantic_ai_slim/pydantic_ai/toolsets/_deferred_capability_loader.py:196— _deferred_capability_loader.load_capability has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 8, 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.
_helpers.is_provider_valid (cognitive 29) src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_helpers.py:20— _helpers.is_provider_valid has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.run (cognitive 29) REDACTED:34— cli.run has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 5 (7 pts), boolean chains 5, error handling 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DiffView.DiffView (cognitive 29) REDACTED:57— DiffView.DiffView has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 9, ternaries 4 (7 pts), loops 2 (3 pts) (nesting depth added 7). Of this number, 19 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settings.controlFor (cognitive 29) src/pydantic_clai2/web-ui/src/settings.ts:52— settings.controlFor has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 3 (7 pts), boolean chains 3, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
issue_pr_attention_monitor._override_scan (cognitive 28) .github/scripts/issue_pr_attention_monitor.py:1861— issue_pr_attention_monitor._override_scan has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_enqueue.deliver_asap_messages (cognitive 28) pydantic_ai_slim/pydantic_ai/_enqueue.py:411— _enqueue.deliver_asap_messages has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 5 (8 pts), boolean chains 3, ternaries 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.
ProcessEventStream.wrap_run_event_stream (cognitive 28) pydantic_ai_slim/pydantic_ai/capabilities/process_event_stream.py:100— ProcessEventStream.wrap_run_event_stream has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (17 pts), error handling 4 (7 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
models.resolve_request_tools (cognitive 28) pydantic_ai_slim/pydantic_ai/models/__init__.py:3232— models.resolve_request_tools has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 8, 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.
BedrockConverseModel._build_additional_model_request_fields (cognitive 28) pydantic_ai_slim/pydantic_ai/models/bedrock.py:1503— BedrockConverseModel._build_additional_model_request_fields has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 14, if/else 9 (14 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.
DecisionModel.request (cognitive 28) pydantic_ai_slim/pydantic_ai/models/decision.py:672— DecisionModel.request has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 10, 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
decision._map_turn (cognitive 28) pydantic_ai_slim/pydantic_ai/models/decision.py:2437— decision._map_turn has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 4 (11 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GoogleModel._process_response (cognitive 28) pydantic_ai_slim/pydantic_ai/models/google.py:1321— GoogleModel._process_response has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 9, 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.
XaiModel._get_tool_choice (cognitive 28) pydantic_ai_slim/pydantic_ai/models/xai.py:819— XaiModel._get_tool_choice has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 5, 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.
RealtimeSession._core_events (cognitive 28) pydantic_ai_slim/pydantic_ai/realtime/_session.py:3269— RealtimeSession._core_events has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (7 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
google._seed_request_parts (cognitive 28) pydantic_ai_slim/pydantic_ai/realtime/google.py:651— google._seed_request_parts has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (23 pts), ternaries 1 (4 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_types.check_response (cognitive 28) src/pydantic_ai_harness/pydantic_ai_harness/ask_user/_types.py:262— _types.check_response has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (24 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli._validate_args (cognitive 28) REDACTED:436— cli._validate_args has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 9, error handling 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Tasks.rows (cognitive 28) src/pydantic_clai2/pydantic_clai2/runtime/tasks.py:458— Tasks.rows has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 5 (10 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.
Sidebar.Sidebar::row (cognitive 28) src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:378— Sidebar.Sidebar::row has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 12 (16 pts), boolean chains 12 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Sidebar.Sidebar) 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.
ImageGeneration.__post_init__ (cognitive 27) pydantic_ai_slim/pydantic_ai/capabilities/image_generation.py:394— ImageGeneration.__post_init__ has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (22 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.
Instrumentation.wrap_run (cognitive 27) pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py:264— Instrumentation.wrap_run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 7, 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.
models._legacy_fabricated_tool_search_reveals (cognitive 27) pydantic_ai_slim/pydantic_ai/models/__init__.py:4643— models._legacy_fabricated_tool_search_reveals has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 5, loops 2, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CohereModel._map_user_message (cognitive 27) pydantic_ai_slim/pydantic_ai/models/cohere.py:521— CohereModel._map_user_message has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 1 (6 pts), loops 2 (5 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_utils.without_media (cognitive 27) pydantic_ai_slim/pydantic_ai/realtime/_utils.py:476— _utils.without_media has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), ternaries 3 (4 pts), boolean chains 2, 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.
AzureRealtimeModel._session_config (cognitive 27) pydantic_ai_slim/pydantic_ai/realtime/azure.py:810— AzureRealtimeModel._session_config has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 4 (7 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
openai._map_usage (cognitive 27) pydantic_ai_slim/pydantic_ai/realtime/openai.py:292— openai._map_usage has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 12, boolean chains 11, if/else 2 (3 pts), 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.
_adapter._take_new_turn (cognitive 27) pydantic_ai_slim/pydantic_ai/ui/_adapter.py:535— _adapter._take_new_turn has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 2 (3 pts), boolean chains 1, 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.
check_cassettes._collect_vcr_tests_from_file (cognitive 27) scripts/check_cassettes.py:56— check_cassettes._collect_vcr_tests_from_file has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 2 (4 pts), boolean chains 2, 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.
_relevance_compaction._split_steps (cognitive 27) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_relevance_compaction.py:627— _relevance_compaction._split_steps has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 5 (11 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.
stickToBottom.useStickToBottom (cognitive 27) src/pydantic_clai2/web-ui/src/stickToBottom.tsx:14— stickToBottom.useStickToBottom has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 11, loops 1, ternaries 1 (nesting depth added 1). None of this is in the body itself: all 27 points belong to 8 function literals inside it that branch (lines 44, 76, 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.
CommandPalette.CommandPalette (cognitive 27) REDACTED:37— CommandPalette.CommandPalette has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 10, ternaries 6 (9 pts), if/else 8 (nesting depth added 3). Most of this is not in the body itself: 3 of the 27 points are its own statements and the rest belongs to 11 function items inside it that branch (keys, choose, a function literal at line 76, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
agentic_workflow_guard.check_compiled_runner_contract (cognitive 26) .github/scripts/agentic_workflow_guard.py:520— agentic_workflow_guard.check_compiled_runner_contract has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (6 pts), boolean chains 5, 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.
cli._safe_output_status (cognitive 26) .github/scripts/pydantic_ai_gh_aw_shim/cli.py:289— cli._safe_output_status has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, ternaries 2 (4 pts), error handling 1 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
weekly_ce_audit.inventory (cognitive 26) .github/scripts/weekly_ce_audit.py:89— weekly_ce_audit.inventory has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 2 (8 pts), loops 3 (4 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.
ModelRequestNode._open_stream (cognitive 26) pydantic_ai_slim/pydantic_ai/_agent_graph.py:3421— ModelRequestNode._open_stream has cognitive complexity 26 (threshold 15). Drivers by points: error handling 5 (12 pts), if/else 4 (11 pts), boolean chains 2, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_mcp.map_from_mcp_params (cognitive 26) pydantic_ai_slim/pydantic_ai/_mcp.py:26— _mcp.map_from_mcp_params has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (7 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.
ObjectOutputProcessor.__init__ (cognitive 26) pydantic_ai_slim/pydantic_ai/_output.py:1017— ObjectOutputProcessor.__init__ has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HuggingFaceStreamedResponse._get_event_iterator (cognitive 26) pydantic_ai_slim/pydantic_ai/models/huggingface.py:593— HuggingFaceStreamedResponse._get_event_iterator has cognitive complexity 26 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 4 (7 pts), ternaries 2 (6 pts), boolean chains 2, 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.
mistral._map_api_errors (cognitive 26) pydantic_ai_slim/pydantic_ai/models/mistral.py:131— mistral._map_api_errors has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 6 (18 pts), error handling 4 (6 pts), if/else 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.
openai._group_settled_portable_function_calls (cognitive 26) pydantic_ai_slim/pydantic_ai/models/openai.py:7722— openai._group_settled_portable_function_calls has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 4 (5 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentStream.validate_response_output (cognitive 26) pydantic_ai_slim/pydantic_ai/result.py:293— AgentStream.validate_response_output has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 6, loops 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.
tool_manager._shape_mismatch (cognitive 26) pydantic_ai_slim/pydantic_ai/tool_manager.py:189— tool_manager._shape_mismatch has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, ternaries 3 (5 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.
api.create_api_app (cognitive 26) pydantic_ai_slim/pydantic_ai/ui/_web/api.py:104— api.create_api_app has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 3 (5 pts), boolean chains 3, 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.
agentic_workflow_guard.check_logfire_wiring (cognitive 25) .github/scripts/agentic_workflow_guard.py:787— agentic_workflow_guard.check_logfire_wiring has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
issue_pr_attention_monitor.reconcile (cognitive 25) .github/scripts/issue_pr_attention_monitor.py:1359— issue_pr_attention_monitor.reconcile has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 2 (4 pts), boolean chains 3, loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_agent_graph._prepare_request_parameters (cognitive 25) pydantic_ai_slim/pydantic_ai/_agent_graph.py:1518— _agent_graph._prepare_request_parameters has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 3, loops 2 (3 pts), 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.
UnionOutputProcessor.validate (cognitive 25) pydantic_ai_slim/pydantic_ai/_output.py:1353— UnionOutputProcessor.validate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (7 pts), ternaries 1 (5 pts), error handling 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
abstract._combine_duplicate_capabilities (cognitive 25) pydantic_ai_slim/pydantic_ai/capabilities/abstract.py:1726— abstract._combine_duplicate_capabilities has cognitive complexity 25 (threshold 15). Drivers by points: loops 8 (15 pts), if/else 5 (9 pts), boolean chains 1 (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
models._note_context_lookalikes (cognitive 25) pydantic_ai_slim/pydantic_ai/models/__init__.py:4258— models._note_context_lookalikes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 2 (4 pts), boolean chains 3, ternaries 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnthropicModel._tool_choice_declarations (cognitive 25) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2633— AnthropicModel._tool_choice_declarations has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 3 (7 pts), boolean chains 2 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BedrockConverseModel._messages_create (cognitive 25) pydantic_ai_slim/pydantic_ai/models/bedrock.py:1587— BedrockConverseModel._messages_create has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 3, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
google._process_response_from_parts (cognitive 25) pydantic_ai_slim/pydantic_ai/models/google.py:2437— google._process_response_from_parts 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.
MistralStreamedResponse._validate_required_json_schema (cognitive 25) pydantic_ai_slim/pydantic_ai/models/mistral.py:981— MistralStreamedResponse._validate_required_json_schema has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (4 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.
_openai_protocol.map_event (cognitive 25) pydantic_ai_slim/pydantic_ai/realtime/_openai_protocol.py:866— _openai_protocol.map_event has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 22, 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.
VercelAIAdapter._dump_response_message (cognitive 25) pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py:941— VercelAIAdapter._dump_response_message has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_EngineWalker.record_projections (cognitive 25) scripts/durable_exec_contract.py:706— _EngineWalker.record_projections has cognitive complexity 25 (threshold 15). Drivers by points: loops 4 (13 pts), if/else 3 (9 pts), ternaries 1 (3 pts) (nesting depth added 17). 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.
_shared.split_legacy_memory (cognitive 25) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_shared.py:918— _shared.split_legacy_memory has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 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.
_command_search.run_posix_search (cognitive 25) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_command_search.py:32— _command_search.run_posix_search has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 6, 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.
_ripgrep.run_ripgrep (cognitive 25) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_ripgrep.py:69— _ripgrep.run_ripgrep has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 7, 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.
FileSystemToolset._find_files (cognitive 25) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:1469— FileSystemToolset._find_files has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 8, ternaries 4 (5 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.
FileSystemToolset._grep (cognitive 25) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:1681— FileSystemToolset._grep has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (18 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
SessionRuntime._read_loop (cognitive 25) src/pydantic_clai2/pydantic_clai2/runtime/session_runtime.py:1283— SessionRuntime._read_loop has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 4 (8 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ToolCard.ToolCard (cognitive 25) REDACTED:262— ToolCard.ToolCard has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 16, ternaries 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
issue_pr_attention_monitor.apply_decisions (cognitive 24) .github/scripts/issue_pr_attention_monitor.py:777— issue_pr_attention_monitor.apply_decisions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, 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.
TemporalDurability._resolve_temporal_tool_config (cognitive 24) pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_durability.py:455— TemporalDurability._resolve_temporal_tool_config has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 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.
models._announce_tool_availability_delta_messages (cognitive 24) pydantic_ai_slim/pydantic_ai/models/__init__.py:4770— models._announce_tool_availability_delta_messages has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (15 pts), ternaries 2 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_google_batch.batch_results (cognitive 24) pydantic_ai_slim/pydantic_ai/models/_google_batch.py:219— _google_batch.batch_results has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 3 (9 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.
AnthropicModel._map_model_response (cognitive 24) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:3140— AnthropicModel._map_model_response has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (20 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bedrock._map_api_errors (cognitive 24) pydantic_ai_slim/pydantic_ai/models/bedrock.py:206— bedrock._map_api_errors has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 5, ternaries 2 (5 pts), error handling 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bedrock._effective_thinking_type (cognitive 24) pydantic_ai_slim/pydantic_ai/models/bedrock.py:2676— bedrock._effective_thinking_type has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 6, 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.
decision._answers (cognitive 24) pydantic_ai_slim/pydantic_ai/models/decision.py:1236— decision._answers has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 5, 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.
GroqModel._map_messages (cognitive 24) pydantic_ai_slim/pydantic_ai/models/groq.py:644— GroqModel._map_messages has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (7 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HuggingFaceModel._map_messages (cognitive 24) pydantic_ai_slim/pydantic_ai/models/huggingface.py:429— HuggingFaceModel._map_messages has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (7 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferredLifecycle._input_transcript (cognitive 24) pydantic_ai_slim/pydantic_ai/realtime/_inferred_lifecycle.py:660— InferredLifecycle._input_transcript has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 11 (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.
_openai_protocol._seed_request_items (cognitive 24) pydantic_ai_slim/pydantic_ai/realtime/_openai_protocol.py:573— _openai_protocol._seed_request_items has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ElevenLabsAgentsRealtimeModel._sync_tools (cognitive 24) pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:1275— ElevenLabsAgentsRealtimeModel._sync_tools has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4, boolean chains 3, error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GoogleRealtimeConnection._send_tool_result (cognitive 24) pydantic_ai_slim/pydantic_ai/realtime/google.py:1832— GoogleRealtimeConnection._send_tool_result has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, error handling 1 (2 pts), 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.
_tool_search._discovered_tool_names_in_order (cognitive 24) pydantic_ai_slim/pydantic_ai/toolsets/_tool_search.py:235— _tool_search._discovered_tool_names_in_order has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (7 pts), error handling 1 (5 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_GraphIterator._handle_decision (cognitive 24) pydantic_graph/pydantic_graph/graph_builder.py:945— _GraphIterator._handle_decision has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (18 pts), error handling 1 (4 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FileSystemToolset._list_directory (cognitive 24) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:1148— FileSystemToolset._list_directory has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 2 (4 pts), error handling 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_walker._restore_external (cognitive 24) src/pydantic_ai_harness/pydantic_ai_harness/media/_walker.py:386— _walker._restore_external has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (16 pts), ternaries 2 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_capability._latest_plan (cognitive 24) src/pydantic_ai_harness/pydantic_ai_harness/planning/_capability.py:338— _capability._latest_plan has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 3 (7 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.
reloading._reload_plan (cognitive 24) src/pydantic_clai2/pydantic_clai2/runtime/reloading.py:155— reloading._reload_plan has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 5 (9 pts), boolean chains 2, ternaries 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.
agentic_workflow_guard.check_provider_health_agent_start (cognitive 23) .github/scripts/agentic_workflow_guard.py:1098— agentic_workflow_guard.check_provider_health_agent_start has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 4 (8 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.
issue_pr_attention_monitor._mark_assigned_reminders (cognitive 23) .github/scripts/issue_pr_attention_monitor.py:1303— issue_pr_attention_monitor._mark_assigned_reminders has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), error handling 2 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
issue_pr_attention_monitor.census (cognitive 23) .github/scripts/issue_pr_attention_monitor.py:1637— issue_pr_attention_monitor.census has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 8, boolean chains 7, if/else 4 (6 pts), loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
weekly_ce_audit.reconcile (cognitive 23) .github/scripts/weekly_ce_audit.py:175— weekly_ce_audit.reconcile has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OutputToolset.build (cognitive 23) pydantic_ai_slim/pydantic_ai/_output.py:1646— OutputToolset.build has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelResponsePartsManager.handle_text_delta (cognitive 23) pydantic_ai_slim/pydantic_ai/_parts_manager.py:153— ModelResponsePartsManager.handle_text_delta has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_ToolCallProcessor._resolve_deferred_calls (cognitive 23) pydantic_ai_slim/pydantic_ai/_tool_execution.py:1106— _ToolCallProcessor._resolve_deferred_calls has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts), error handling 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.
_ordering._add_relative_edges (cognitive 23) pydantic_ai_slim/pydantic_ai/capabilities/_ordering.py:106— _ordering._add_relative_edges has cognitive complexity 23 (threshold 15). Drivers by points: loops 5 (11 pts), if/else 3 (10 pts), boolean chains 2 (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
WebFetchLocalTool.__call__ (cognitive 23) pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py:137— WebFetchLocalTool.__call__ has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 4 (9 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
models._drop_request_scoped_prompts_no_user_message_clears (cognitive 23) pydantic_ai_slim/pydantic_ai/models/__init__.py:3648— models._drop_request_scoped_prompts_no_user_message_clears has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
models._order_tool_results_by_call (cognitive 23) pydantic_ai_slim/pydantic_ai/models/__init__.py:4350— models._order_tool_results_by_call has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (8 pts), boolean chains 2, 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.
AnthropicModel._map_user_prompt (cognitive 23) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:3750— AnthropicModel._map_user_prompt has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 1 (4 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.
BedrockConverseModel._tool_choice_declarations (cognitive 23) pydantic_ai_slim/pydantic_ai/models/bedrock.py:1721— BedrockConverseModel._tool_choice_declarations has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 2 (5 pts), boolean chains 2 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FallbackModel.request_stream (cognitive 23) pydantic_ai_slim/pydantic_ai/models/fallback.py:353— FallbackModel.request_stream has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), error handling 3 (5 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GoogleModel._build_content_and_config (cognitive 23) pydantic_ai_slim/pydantic_ai/models/google.py:1227— GoogleModel._build_content_and_config has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 4, boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
google._usage_metadata_as_usage (cognitive 23) pydantic_ai_slim/pydantic_ai/models/google.py:2618— google._usage_metadata_as_usage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 9, loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ElevenLabsAgentsRealtimeConnection.frames (cognitive 23) pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:1900— ElevenLabsAgentsRealtimeConnection.frames has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 3 (6 pts), ternaries 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ElevenLabsAgentsRealtimeConnection._map_frame (cognitive 23) pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:2096— ElevenLabsAgentsRealtimeConnection._map_frame has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
durable_exec_contract._collect_body_members (cognitive 23) scripts/durable_exec_contract.py:431— durable_exec_contract._collect_body_members has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 1 (5 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
E2BSandboxBackend.run (cognitive 23) src/pydantic_ai_harness/pydantic_ai_harness/e2b_sandbox/_backend.py:590— E2BSandboxBackend.run has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 5 (8 pts), error handling 3 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_toolset.validate_hierarchy (cognitive 23) src/pydantic_ai_harness/pydantic_ai_harness/planning/_toolset.py:245— _toolset.validate_hierarchy has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 5 (7 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
headless.run_headless (cognitive 23) src/pydantic_clai2/pydantic_clai2/cli/headless.py:37— headless.run_headless has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 4, ternaries 2, error handling 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.
check_api_compatibility._literal_members (cognitive 22) .github/scripts/check_api_compatibility.py:294— check_api_compatibility._literal_members has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gh_aw_native_capture.main (cognitive 22) REDACTED:290— gh_aw_native_capture.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (8 pts), loops 6 (7 pts), ternaries 2 (4 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.
weekly_ce_audit.validate_review (cognitive 22) .github/scripts/weekly_ce_audit.py:401— weekly_ce_audit.validate_review has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 8 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RunContext.emit (cognitive 22) pydantic_ai_slim/pydantic_ai/_run_context.py:874— RunContext.emit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 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.
AbstractAgent._infer_name (cognitive 22) pydantic_ai_slim/pydantic_ai/agent/abstract.py:2056— AbstractAgent._infer_name has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (7 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
models.infer_model (cognitive 22) pydantic_ai_slim/pydantic_ai/models/__init__.py:2814— models.infer_model has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (20 pts), error handling 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnthropicModel._get_betas_and_extra_headers (cognitive 22) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:1860— AnthropicModel._get_betas_and_extra_headers has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (16 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.
_errors.api_error (cognitive 22) pydantic_ai_slim/pydantic_ai/models/anthropic/_errors.py:108— _errors.api_error has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 7, ternaries 5 (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.
_Speculation.about (cognitive 22) pydantic_ai_slim/pydantic_ai/models/decision.py:1397— _Speculation.about has cognitive complexity 22 (threshold 15). Drivers by points: loops 4 (7 pts), if/else 4 (6 pts), boolean chains 5, error handling 1 (3 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.
decision._map_messages (cognitive 22) pydantic_ai_slim/pydantic_ai/models/decision.py:2388— decision._map_messages has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (4 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MistralStreamedResponse._try_get_output_tool_from_text (cognitive 22) pydantic_ai_slim/pydantic_ai/models/mistral.py:943— MistralStreamedResponse._try_get_output_tool_from_text has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 2 (8 pts), loops 1 (2 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.
XaiModel._create_chat (cognitive 22) pydantic_ai_slim/pydantic_ai/models/xai.py:875— XaiModel._create_chat has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (15 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.
RealtimeSession.send (cognitive 22) pydantic_ai_slim/pydantic_ai/realtime/_session.py:1785— RealtimeSession.send has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (6 pts), ternaries 1 (4 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.
GraphBuilder._edge_from_return_hint (cognitive 22) pydantic_graph/pydantic_graph/graph_builder.py:1676— GraphBuilder._edge_from_return_hint has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 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.
MermaidGraph.render (cognitive 22) pydantic_graph/pydantic_graph/graph_builder.py:2268— MermaidGraph.render has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (4 pts), boolean chains 3, 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.
durable_exec_contract.touched_entries (cognitive 22) scripts/durable_exec_contract.py:905— durable_exec_contract.touched_entries has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, loops 2 (3 pts), 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.
_shared._include_tool_dependencies (cognitive 22) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_shared.py:800— _shared._include_tool_dependencies has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (8 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.
_shared.iter_tool_pairs (cognitive 22) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_shared.py:1022— _shared.iter_tool_pairs has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileStore._list_paths (cognitive 22) src/pydantic_ai_harness/pydantic_ai_harness/memory/_file.py:362— FileStore._list_paths has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 4, loops 2 (3 pts), error handling 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.
ShellToolset._cwd_for (cognitive 22) src/pydantic_ai_harness/pydantic_ai_harness/shell/_toolset.py:216— ShellToolset._cwd_for has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 3 (6 pts), boolean chains 3, 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.
SpendLimits.__post_init__ (cognitive 22) src/pydantic_ai_harness/pydantic_ai_harness/spend/_capability.py:168— SpendLimits.__post_init__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DelegationTasks.delegate (cognitive 22) src/pydantic_ai_harness/pydantic_ai_harness/subagents/_tasks.py:351— DelegationTasks.delegate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 4, error handling 2, 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.
_capability._render_lines (cognitive 22) src/pydantic_ai_harness/pydantic_ai_harness/trajectory_judge/_capability.py:506— _capability._render_lines has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (13 pts), ternaries 1 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
codex_sessions.header (cognitive 22) src/pydantic_clai2/pydantic_clai2/runtime/codex_sessions.py:149— codex_sessions.header has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 5, 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.
QueuePanel.QueuePanel (cognitive 22) src/pydantic_clai2/web-ui/src/components/QueuePanel.tsx:20— QueuePanel.QueuePanel has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, if/else 8 (9 pts), error handling 2, ternaries 2 (nesting depth added 1). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to 7 function items inside it that branch (save, a function literal at line 95, steer, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
PluginsPanel.PluginsPanel (cognitive 22) src/pydantic_clai2/web-ui/src/components/PluginsPanel.tsx:25— PluginsPanel.PluginsPanel has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 9 (12 pts), boolean chains 6, error handling 3, if/else 1 (nesting depth added 3). Most of this is not in the body itself: 5 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 97, a function literal at line 45, act, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
OrchestratorPane.OrchestratorPane (cognitive 22) src/pydantic_clai2/web-ui/src/components/OrchestratorPane.tsx:26— OrchestratorPane.OrchestratorPane has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7 (14 pts), boolean chains 7, error handling 1 (nesting depth added 7). Of this number, 20 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agentic_workflow_guard.check_provider_engine_config (cognitive 21) .github/scripts/agentic_workflow_guard.py:836— agentic_workflow_guard.check_provider_engine_config has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, loops 4 (5 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
semantic_owner_router.main (cognitive 21) .github/scripts/semantic_owner_router.py:582— semantic_owner_router.main has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, ternaries 2 (3 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.
AnthropicModel._get_container (cognitive 21) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2015— AnthropicModel._get_container has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (15 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.
_citations.fetched_pages_from_history (cognitive 21) pydantic_ai_slim/pydantic_ai/models/anthropic/_citations.py:134— _citations.fetched_pages_from_history has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (11 pts), error handling 1 (5 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
function._estimate_usage (cognitive 21) pydantic_ai_slim/pydantic_ai/models/function.py:436— function._estimate_usage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GoogleModel._build_image_config (cognitive 21) pydantic_ai_slim/pydantic_ai/models/google.py:944— GoogleModel._build_image_config has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (21 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.
GoogleModel._get_tool_config (cognitive 21) pydantic_ai_slim/pydantic_ai/models/google.py:1021— GoogleModel._get_tool_config has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (18 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.
groq._map_api_errors (cognitive 21) pydantic_ai_slim/pydantic_ai/models/groq.py:106— groq._map_api_errors has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 3 (7 pts), error handling 4, 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.
OpenAIResponsesModel._map_user_prompt (cognitive 21) pydantic_ai_slim/pydantic_ai/models/openai.py:6011— OpenAIResponsesModel._map_user_prompt has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), ternaries 1 (4 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SessionCore._tool_rounds_over (cognitive 21) pydantic_ai_slim/pydantic_ai/realtime/_core.py:1129— SessionCore._tool_rounds_over has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferredLifecycle._speech_ended (cognitive 21) pydantic_ai_slim/pydantic_ai/realtime/_inferred_lifecycle.py:636— InferredLifecycle._speech_ended has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 5 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RealtimeSession.__init__ (cognitive 21) pydantic_ai_slim/pydantic_ai/realtime/_session.py:681— RealtimeSession.__init__ has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10, boolean chains 6, if/else 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GoogleRealtimeConnection._map_server_content (cognitive 21) pydantic_ai_slim/pydantic_ai/realtime/google.py:2116— GoogleRealtimeConnection._map_server_content has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model.infer_realtime_model (cognitive 21) pydantic_ai_slim/pydantic_ai/realtime/model.py:592— model.infer_realtime_model has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 2 (4 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.
_types._check_note (cognitive 21) src/pydantic_ai_harness/pydantic_ai_harness/ask_user/_types.py:208— _types._check_note has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 1 (3 pts), error handling 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SummarizingCompaction.compact (cognitive 21) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_summarizing_compaction.py:822— SummarizingCompaction.compact has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 6 (7 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
SmolSandboxBackend._exec (cognitive 21) src/pydantic_ai_harness/pydantic_ai_harness/smol_sandbox/_backend.py:392— SmolSandboxBackend._exec has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SpendLimits._price_of (cognitive 21) src/pydantic_ai_harness/pydantic_ai_harness/spend/_capability.py:760— SpendLimits._price_of has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, error handling 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InMemoryStepStore.save_snapshot (cognitive 21) src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:252— InMemoryStepStore.save_snapshot 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.
SubAgentToolset._delegate_controlled (cognitive 21) src/pydantic_ai_harness/pydantic_ai_harness/subagents/_toolset.py:779— SubAgentToolset._delegate_controlled has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 6, 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.
codex_sessions._item (cognitive 21) src/pydantic_clai2/pydantic_clai2/runtime/codex_sessions.py:450— codex_sessions._item has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (10 pts), boolean chains 5, if/else 2 (4 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Composer.Composer (cognitive 21) src/pydantic_clai2/web-ui/src/components/Composer.tsx:67— Composer.Composer has cognitive complexity 21 (threshold 15). Drivers by points: if/else 47 (63 pts), boolean chains 43, ternaries 18 (29 pts), error handling 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: 2 other methods here (Composer.Composer::send, Composer.Composer::onKeyDown) 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.
MenuForm.MenuForm (cognitive 21) src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:29— MenuForm.MenuForm has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 4 (5 pts), boolean chains 3, error handling 2 (nesting depth added 3). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 70, run, row, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
PluginsPanel.Detail (cognitive 21) src/pydantic_clai2/web-ui/src/components/PluginsPanel.tsx:157— PluginsPanel.Detail has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, ternaries 4 (10 pts) (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
agent_provider_health._health_from_json (cognitive 20) .github/scripts/agent_provider_health.py:281— agent_provider_health._health_from_json has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, ternaries 7, if/else 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
agentic_workflow_guard.check_provider_health_wiring (cognitive 20) .github/scripts/agentic_workflow_guard.py:899— agentic_workflow_guard.check_provider_health_wiring has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
issue_pr_attention_monitor._reconcile_item (cognitive 20) .github/scripts/issue_pr_attention_monitor.py:1114— issue_pr_attention_monitor._reconcile_item has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 3, boolean chains 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
latest_versions_canary_report.reconcile (cognitive 20) .github/scripts/latest_versions_canary_report.py:414— latest_versions_canary_report.reconcile has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, loops 3, 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.
cli._superseded_read_calls (cognitive 20) .github/scripts/pydantic_ai_gh_aw_shim/cli.py:699— cli._superseded_read_calls has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
review_gates.reconcile_reviews (cognitive 20) .github/scripts/review_gates.py:205— review_gates.reconcile_reviews has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (4 pts), ternaries 2 (4 pts), boolean chains 2, 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.
_tool_execution._prune_duplicate_tool_reveals (cognitive 20) pydantic_ai_slim/pydantic_ai/_tool_execution.py:271— _tool_execution._prune_duplicate_tool_reveals has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_capability_operation.call_declaration (cognitive 20) pydantic_ai_slim/pydantic_ai/durable_exec/_capability_operation.py:514— _capability_operation.call_declaration has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (19 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.
_response.map_usage (cognitive 20) pydantic_ai_slim/pydantic_ai/models/anthropic/_response.py:172— _response.map_usage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, loops 2, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
google._map_citations (cognitive 20) pydantic_ai_slim/pydantic_ai/models/google.py:2386— google._map_citations has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, ternaries 2 (5 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mistral._map_content (cognitive 20) pydantic_ai_slim/pydantic_ai/models/mistral.py:1083— mistral._map_content has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (6 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openai._resolve_openai_thinking_effort (cognitive 20) pydantic_ai_slim/pydantic_ai/models/openai.py:819— openai._resolve_openai_thinking_effort has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, 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.
openrouter._map_openrouter_usage_provider_details (cognitive 20) pydantic_ai_slim/pydantic_ai/models/openrouter.py:700— openrouter._map_openrouter_usage_provider_details has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (20 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.
openrouter._openrouter_settings_to_openai_settings (cognitive 20) pydantic_ai_slim/pydantic_ai/models/openrouter.py:750— openrouter._openrouter_settings_to_openai_settings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3, 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.
xai._map_citations (cognitive 20) pydantic_ai_slim/pydantic_ai/models/xai.py:1662— xai._map_citations has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (9 pts), ternaries 2 (5 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RealtimeSession._send_frame (cognitive 20) pydantic_ai_slim/pydantic_ai/realtime/_session.py:2313— RealtimeSession._send_frame has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 pts), ternaries 2 (4 pts), boolean chains 1, 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.
_adapter._input_content_to_user_content (cognitive 20) pydantic_ai_slim/pydantic_ai/ui/ag_ui/_adapter.py:233— _adapter._input_content_to_user_content has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 1 (4 pts), ternaries 1 (3 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_adapter._convert_user_prompt_part (cognitive 20) pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py:1381— _adapter._convert_user_prompt_part has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 1 (4 pts), ternaries 1 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_shared._message_segments (cognitive 20) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_shared.py:86— _shared._message_segments has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 3 (7 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileSystemToolset._command_search_files (cognitive 20) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:1318— FileSystemToolset._command_search_files has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 4 (5 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ModalSandboxBackend._create (cognitive 20) src/pydantic_ai_harness/pydantic_ai_harness/modal_sandbox/_backend.py:473— ModalSandboxBackend._create has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 3 (4 pts), boolean chains 3, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PromptInjectionDefender.after_tool_execute (cognitive 20) src/pydantic_ai_harness/pydantic_ai_harness/prompt_injection_defender/_capability.py:201— PromptInjectionDefender.after_tool_execute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), 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.
ShellToolset.__init__ (cognitive 20) src/pydantic_ai_harness/pydantic_ai_harness/shell/_toolset.py:70— ShellToolset.__init__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, 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.
_loader._libraries (cognitive 20) src/pydantic_ai_harness/pydantic_ai_harness/skills/_loader.py:295— _loader._libraries has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FolderMenu.edit (cognitive 20) src/pydantic_clai2/pydantic_clai2/builtin_plugins/coder_folders.py:285— FolderMenu.edit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 5 (8 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agentic_workflow_guard._strip_boolean_wrappers (cognitive 19) .github/scripts/agentic_workflow_guard.py:139— agentic_workflow_guard._strip_boolean_wrappers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (13 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Agent._open_realtime_session (cognitive 19) pydantic_ai_slim/pydantic_ai/agent/__init__.py:4488— Agent._open_realtime_session has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 7, ternaries 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
_PreparedAgentRun.open (cognitive 19) pydantic_ai_slim/pydantic_ai/agent/__init__.py:4917— _PreparedAgentRun.open has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
BatchedModel._check (cognitive 19) pydantic_ai_slim/pydantic_ai/models/_batch_model.py:776— BatchedModel._check has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, error handling 3 (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.
AnthropicModel._apply_message_cache_control (cognitive 19) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:3578— AnthropicModel._apply_message_cache_control has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenRouterModel._move_leading_cache_controls (cognitive 19) pydantic_ai_slim/pydantic_ai/models/openrouter.py:1002— OpenRouterModel._move_leading_cache_controls has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 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.
XaiModel._map_response_parts (cognitive 19) pydantic_ai_slim/pydantic_ai/models/xai.py:523— XaiModel._map_response_parts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
XaiStreamedResponse._collect_reasoning_events (cognitive 19) pydantic_ai_slim/pydantic_ai/models/xai.py:1173— XaiStreamedResponse._collect_reasoning_events has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (4 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.
SessionCore.still_owed (cognitive 19) pydantic_ai_slim/pydantic_ai/realtime/_core.py:1885— SessionCore.still_owed 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.
RealtimeSession._pump (cognitive 19) pydantic_ai_slim/pydantic_ai/realtime/_session.py:3127— RealtimeSession._pump has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, error handling 1, 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.
GoogleRealtimeModel._realtime_input_config (cognitive 19) pydantic_ai_slim/pydantic_ai/realtime/google.py:1237— GoogleRealtimeModel._realtime_input_config has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 5 (9 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.
FunctionToolset.get_tools (cognitive 19) pydantic_ai_slim/pydantic_ai/toolsets/function.py:769— FunctionToolset.get_tools has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check_cassettes.main (cognitive 19) scripts/check_cassettes.py:152— check_cassettes.main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_EngineWalker.types (cognitive 19) scripts/durable_exec_contract.py:603— _EngineWalker.types has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (6 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SpeculationCoordinator.observe (cognitive 19) src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_speculation.py:479— SpeculationCoordinator.observe has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_speculation._text_literal_calls (cognitive 19) src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_speculation.py:352— _speculation._text_literal_calls has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CodeModeToolset.get_tools (cognitive 19) src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_toolset.py:980— CodeModeToolset.get_tools has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3 (5 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ClampOversizedMessages.compact (cognitive 19) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_clamp_oversized_messages.py:137— ClampOversizedMessages.compact has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RelevanceCompaction._truncated (cognitive 19) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_relevance_compaction.py:443— RelevanceCompaction._truncated has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (9 pts), ternaries 1 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RelevanceCompaction._rebuild (cognitive 19) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_relevance_compaction.py:463— RelevanceCompaction._rebuild has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, 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.
_shared.find_token_cutoff (cognitive 19) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_shared.py:825— _shared.find_token_cutoff has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 3 (4 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.
WarnNearLimits.__post_init__ (cognitive 19) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_warn_near_limits.py:111— WarnNearLimits.__post_init__ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 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.
ToolGuardrail.wrap_tool_execute (cognitive 19) src/pydantic_ai_harness/pydantic_ai_harness/guardrails/_tool_guardrail.py:447— ToolGuardrail.wrap_tool_execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 4, 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.
reloading.reload_clai (cognitive 19) src/pydantic_clai2/pydantic_clai2/runtime/reloading.py:191— reloading.reload_clai has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 5 (7 pts), boolean chains 3, 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.
rewind.rewind_points (cognitive 19) src/pydantic_clai2/pydantic_clai2/runtime/rewind.py:32— rewind.rewind_points has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 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.
MenuForm.MenuRow (cognitive 19) src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:172— MenuForm.MenuRow has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, 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.
ChangesPanel.ChangesPanel (cognitive 19) src/pydantic_clai2/web-ui/src/components/ChangesPanel.tsx:92— ChangesPanel.ChangesPanel has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (17 pts), boolean chains 2 (nesting depth added 10). 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, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
issue_pr_attention_monitor.main (cognitive 18) .github/scripts/issue_pr_attention_monitor.py:2160— issue_pr_attention_monitor.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 1 (3 pts), loops 2, boolean chains 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.
_ordering._add_position_edges (cognitive 18) pydantic_ai_slim/pydantic_ai/capabilities/_ordering.py:85— _ordering._add_position_edges has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
messages._append_request (cognitive 18) pydantic_ai_slim/pydantic_ai/messages.py:5715— messages._append_request has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, ternaries 3 (7 pts), if/else 3 (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.
models._move_request_scoped_prompts_to_tail (cognitive 18) pydantic_ai_slim/pydantic_ai/models/__init__.py:3707— models._move_request_scoped_prompts_to_tail has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, 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.
models._without_voice_tags (cognitive 18) pydantic_ai_slim/pydantic_ai/models/__init__.py:3905— models._without_voice_tags has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (7 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
decision._answer_attribute (cognitive 18) pydantic_ai_slim/pydantic_ai/models/decision.py:1131— decision._answer_attribute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FallbackModel.request (cognitive 18) pydantic_ai_slim/pydantic_ai/models/fallback.py:230— FallbackModel.request has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 2 (3 pts), 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.
google._content_model_response (cognitive 18) pydantic_ai_slim/pydantic_ai/models/google.py:2069— google._content_model_response has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAIChatModel._get_tool_choice (cognitive 18) pydantic_ai_slim/pydantic_ai/models/openai.py:2242— OpenAIChatModel._get_tool_choice has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAIResponsesModel._get_previous_response_id_and_new_messages (cognitive 18) pydantic_ai_slim/pydantic_ai/models/openai.py:5342— OpenAIResponsesModel._get_previous_response_id_and_new_messages has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openai._map_usage (cognitive 18) pydantic_ai_slim/pydantic_ai/models/openai.py:7630— openai._map_usage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (18 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.
elevenlabs_agents._schemas_match (cognitive 18) pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:922— elevenlabs_agents._schemas_match has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 7, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
openai._map_transcription_usage (cognitive 18) pydantic_ai_slim/pydantic_ai/realtime/openai.py:370— openai._map_transcription_usage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 3 (5 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAILiveConnection._send_input (cognitive 18) pydantic_ai_slim/pydantic_ai/realtime/openai_live.py:1000— OpenAILiveConnection._send_input has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 2 (4 pts), 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.
VercelAIAdapter._dump_request_message (cognitive 18) pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py:873— VercelAIAdapter._dump_request_message has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (7 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Coder.__init__ (cognitive 18) src/pydantic_ai_harness/pydantic_ai_harness/coder/_capability.py:172— Coder.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 7, boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
_toolset._format_request_part (cognitive 18) src/pydantic_ai_harness/pydantic_ai_harness/conversation_search/_toolset.py:205— _toolset._format_request_part has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (18 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.
_content.prompt_blocks_to_user_content (cognitive 18) src/pydantic_ai_harness/pydantic_ai_harness/experimental/acp/_content.py:26— _content.prompt_blocks_to_user_content has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, 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.
_capability._latest_snapshot (cognitive 18) src/pydantic_ai_harness/pydantic_ai_harness/memory/_capability.py:536— _capability._latest_snapshot has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PlanningToolset.write_plan (cognitive 18) src/pydantic_ai_harness/pydantic_ai_harness/planning/_toolset.py:592— PlanningToolset.write_plan has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Budget.__post_init__ (cognitive 18) src/pydantic_ai_harness/pydantic_ai_harness/spend/_budget.py:124— Budget.__post_init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SystemReminders._collect_dynamic (cognitive 18) src/pydantic_ai_harness/pydantic_ai_harness/system_reminders/_capability.py:347— SystemReminders._collect_dynamic has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 1 (3 pts), ternaries 1 (3 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.
SessionNamer.run (cognitive 18) src/pydantic_clai2/pydantic_clai2/runtime/session_naming.py:129— SessionNamer.run has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (8 pts), if/else 2 (7 pts), error handling 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
worktrees.offer_worktree_cleanup (cognitive 18) src/pydantic_clai2/pydantic_clai2/runtime/worktrees.py:229— worktrees.offer_worktree_cleanup has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 4 (5 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.
model_menu.add_model (cognitive 18) src/pydantic_clai2/pydantic_clai2/ui/menus/model_menu.py:408— model_menu.add_model has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GitHubClient.open_incidents (cognitive 17) .github/scripts/agent_provider_health.py:555— GitHubClient.open_incidents has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agentic_workflow_guard.check_prompt_paths (cognitive 17) .github/scripts/agentic_workflow_guard.py:372— agentic_workflow_guard.check_prompt_paths has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agentic_workflow_guard.check_lock_regenerated (cognitive 17) .github/scripts/agentic_workflow_guard.py:722— agentic_workflow_guard.check_lock_regenerated has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (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.
ci_duration.main (cognitive 17) .github/scripts/ci_duration.py:176— ci_duration.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
feature_digest.build_snapshot (cognitive 17) .github/scripts/feature_digest.py:131— feature_digest.build_snapshot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (6 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.
issue_pr_attention_monitor._weekly_items (cognitive 17) .github/scripts/issue_pr_attention_monitor.py:1756— issue_pr_attention_monitor._weekly_items 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.
latest_versions_canary_report.collect (cognitive 17) .github/scripts/latest_versions_canary_report.py:205— latest_versions_canary_report.collect has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, if/else 2 (4 pts), loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
shared.attach_context (cognitive 17) .github/scripts/pydantic_ai_gh_aw_shim/shared.py:93— shared.attach_context has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 2 (4 pts), loops 2 (3 pts), boolean chains 2, 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.
weekly_ce_audit.validate_edits (cognitive 17) .github/scripts/weekly_ce_audit.py:215— weekly_ce_audit.validate_edits has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UserPromptNode._handle_deferred_tool_results (cognitive 17) pydantic_ai_slim/pydantic_ai/_agent_graph.py:1224— UserPromptNode._handle_deferred_tool_results has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 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.
_griffe.doc_descriptions (cognitive 17) pydantic_ai_slim/pydantic_ai/_griffe.py:22— _griffe.doc_descriptions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 2 (4 pts), ternaries 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.
_instructions.session_instruction_update (cognitive 17) pydantic_ai_slim/pydantic_ai/_instructions.py:929— _instructions.session_instruction_update has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, ternaries 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_pending_messages.drain_pending_messages_at_end (cognitive 17) pydantic_ai_slim/pydantic_ai/capabilities/_pending_messages.py:71— _pending_messages.drain_pending_messages_at_end has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 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.
BaseDurabilityCapability._invoke_capability_operation (cognitive 17) pydantic_ai_slim/pydantic_ai/durable_exec/_base.py:725— BaseDurabilityCapability._invoke_capability_operation has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3 (5 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
models.download_item (cognitive 17) pydantic_ai_slim/pydantic_ai/models/__init__.py:3039— models.download_item has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
BedrockConverseModel.prepare_request (cognitive 17) pydantic_ai_slim/pydantic_ai/models/bedrock.py:1112— BedrockConverseModel.prepare_request has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 6, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
GroqModel._completions_create (cognitive 17) pydantic_ai_slim/pydantic_ai/models/groq.py:426— GroqModel._completions_create has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 7, 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.
HuggingFaceModel._map_user_prompt (cognitive 17) pydantic_ai_slim/pydantic_ai/models/huggingface.py:542— HuggingFaceModel._map_user_prompt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 1 (4 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_ResponsesWebSocketState.reserve (cognitive 17) pydantic_ai_slim/pydantic_ai/models/openai.py:3239— _ResponsesWebSocketState.reserve has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAIResponsesModel._get_responses_tool_choice (cognitive 17) pydantic_ai_slim/pydantic_ai/models/openai.py:5061— OpenAIResponsesModel._get_responses_tool_choice has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (5 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
XaiStreamedResponse._handle_server_side_tool_call (cognitive 17) pydantic_ai_slim/pydantic_ai/models/xai.py:1212— XaiStreamedResponse._handle_server_side_tool_call has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_utils.seed_user_content (cognitive 17) pydantic_ai_slim/pydantic_ai/realtime/_utils.py:248— _utils.seed_user_content has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 1, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ElevenLabsAgentsRealtimeModel.connect (cognitive 17) pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:1520— ElevenLabsAgentsRealtimeModel.connect has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GoogleRealtimeModel.connect (cognitive 17) pydantic_ai_slim/pydantic_ai/realtime/google.py:1404— GoogleRealtimeModel.connect has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), error handling 5, ternaries 3 (4 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
google._seed_response_parts (cognitive 17) pydantic_ai_slim/pydantic_ai/realtime/google.py:740— google._seed_response_parts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (16 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.
OpenAILiveConnection._map_event (cognitive 17) pydantic_ai_slim/pydantic_ai/realtime/openai_live.py:1758— OpenAILiveConnection._map_event has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
MontyExecutor._handle_function (cognitive 17) src/pydantic_ai_harness/pydantic_ai_harness/_monty_exec.py:317— MontyExecutor._handle_function has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 pts), error handling 2 (3 pts), match/switch 1 (3 pts), boolean chains 2, 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.
EagerCoordinator.scan (cognitive 17) src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_eager.py:193— EagerCoordinator.scan has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, 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.
_backend._translate (cognitive 17) src/pydantic_ai_harness/pydantic_ai_harness/daytona_sandbox/_backend.py:142— _backend._translate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_agent.agent_run_result (cognitive 17) src/pydantic_ai_harness/pydantic_ai_harness/exa/_agent.py:115— _agent.agent_run_result has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (6 pts), boolean chains 4, ternaries 3 (4 pts), error handling 1 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_tool_return_text._detect_text_run (cognitive 17) src/pydantic_ai_harness/pydantic_ai_harness/guardrails/_tool_return_text.py:61— _tool_return_text._detect_text_run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_command_runner._run (cognitive 17) src/pydantic_ai_harness/pydantic_ai_harness/render_sandbox/_command_runner.py:146— _command_runner._run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 3 (5 pts), ternaries 2 (4 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.
SubAgents._build_roster (cognitive 17) src/pydantic_ai_harness/pydantic_ai_harness/subagents/_capability.py:359— SubAgents._build_roster has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, loops 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.
_WorkerLink.receive (cognitive 17) src/pydantic_ai_harness/pydantic_ai_harness/subagents/_worker.py:103— _WorkerLink.receive has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 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.
SubAgentWorker._attempts (cognitive 17) src/pydantic_ai_harness/pydantic_ai_harness/subagents/_worker.py:275— SubAgentWorker._attempts has cognitive complexity 17 (threshold 15). Drivers by points: error handling 4 (8 pts), if/else 4 (8 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SystemReminders.before_model_request (cognitive 17) src/pydantic_ai_harness/pydantic_ai_harness/system_reminders/_capability.py:284— SystemReminders.before_model_request has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (10 pts), if/else 3 (6 pts), boolean chains 1 (nesting depth added 10). 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.
LivePrompt.frame (cognitive 17) src/pydantic_clai2/pydantic_clai2/ui/prompt/live_prompt.py:543— LivePrompt.frame has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (7 pts), if/else 4 (5 pts), boolean chains 4, 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.
state.reduceChat (cognitive 17) src/pydantic_clai2/web-ui/src/state.ts:227— state.reduceChat has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (14 pts), boolean chains 2, match/switch 1 (nesting depth added 8). 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 256, 261). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Transcript.UserEntry (cognitive 17) src/pydantic_clai2/web-ui/src/components/Transcript.tsx:54— Transcript.UserEntry has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (6 pts), ternaries 3 (nesting depth added 1). 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 (send, a function literal at line 90, setDraft). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SettingsForm.SettingsForm (cognitive 17) src/pydantic_clai2/web-ui/src/components/SettingsForm.tsx:16— SettingsForm.SettingsForm has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (10 pts), if/else 3 (5 pts), boolean chains 1, error handling 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 4 function literals inside it that branch (lines 34, 68, 40, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
DialogLayer.Choose (cognitive 17) src/pydantic_clai2/web-ui/src/components/DialogLayer.tsx:113— DialogLayer.Choose has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, ternaries 4 (6 pts), if/else 4 (5 pts) (nesting depth added 3). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 5 function items inside it that branch (keys, a function literal at line 176, a function literal at line 126, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
DialogLayer.TextAnswer (cognitive 17) src/pydantic_clai2/web-ui/src/components/DialogLayer.tsx:202— DialogLayer.TextAnswer has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 5, if/else 1 (2 pts) (nesting depth added 4). Of this number, 13 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agent_provider_health._json_values (cognitive 16) .github/scripts/agent_provider_health.py:800— agent_provider_health._json_values has cognitive complexity 16 (threshold 15). Drivers by points: error handling 2 (6 pts), if/else 3 (4 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agentic_workflow_guard._split_boolean_operator (cognitive 16) .github/scripts/agentic_workflow_guard.py:165— agentic_workflow_guard._split_boolean_operator has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agentic_workflow_guard.check_dangling_needs (cognitive 16) .github/scripts/agentic_workflow_guard.py:324— agentic_workflow_guard.check_dangling_needs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ci_duration.collect_baselines (cognitive 16) .github/scripts/ci_duration.py:271— ci_duration.collect_baselines has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 2 (3 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.
community_demand.build_snapshot (cognitive 16) .github/scripts/community_demand.py:79— community_demand.build_snapshot has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 2 (4 pts), loops 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.
community_demand.apply_verdicts (cognitive 16) .github/scripts/community_demand.py:131— community_demand.apply_verdicts has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
issue_pr_attention_monitor._gate_entry_time (cognitive 16) .github/scripts/issue_pr_attention_monitor.py:1609— issue_pr_attention_monitor._gate_entry_time has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 3, 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.
_cli.run_chat (cognitive 16) pydantic_ai_slim/pydantic_ai/_cli/__init__.py:453— _cli.run_chat has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 3, error handling 1 (2 pts), 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.
web.run_web_command (cognitive 16) pydantic_ai_slim/pydantic_ai/_cli/web.py:12— web.run_web_command has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, error handling 3, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Agent._build_toolset_list (cognitive 16) pydantic_ai_slim/pydantic_ai/agent/__init__.py:3957— Agent._build_toolset_list has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (4 pts), boolean chains 2, 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.
agent._validate_capability_ids (cognitive 16) pydantic_ai_slim/pydantic_ai/agent/__init__.py:5379— agent._validate_capability_ids has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TemporalBoundOperation.__call__ (cognitive 16) pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_operation_backend.py:132— TemporalBoundOperation.__call__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
XaiImageGenerationModel._map_input_images (cognitive 16) pydantic_ai_slim/pydantic_ai/images/xai.py:216— XaiImageGenerationModel._map_input_images has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model._warn_if_thinking_overridden (cognitive 16) pydantic_ai_slim/pydantic_ai/models/__init__.py:1522— Model._warn_if_thinking_overridden has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 4, ternaries 1 (3 pts), 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.
Model.profile (cognitive 16) pydantic_ai_slim/pydantic_ai/models/__init__.py:2020— Model.profile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 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.
_openai_batch.batch_results (cognitive 16) pydantic_ai_slim/pydantic_ai/models/_openai_batch.py:219— _openai_batch.batch_results has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (6 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.
_openai_batch.batch_decode (cognitive 16) pydantic_ai_slim/pydantic_ai/models/_openai_batch.py:255— _openai_batch.batch_decode has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 3 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ResponsesWebSocket.connect (cognitive 16) pydantic_ai_slim/pydantic_ai/models/_openai_responses_websocket.py:110— ResponsesWebSocket.connect has cognitive complexity 16 (threshold 15). Drivers by points: error handling 5 (6 pts), ternaries 3 (6 pts), if/else 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.
BedrockConverseModel._map_file_to_content_block (cognitive 16) pydantic_ai_slim/pydantic_ai/models/bedrock.py:2215— BedrockConverseModel._map_file_to_content_block has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bedrock._add_anthropic_thinking_fields (cognitive 16) pydantic_ai_slim/pydantic_ai/models/bedrock.py:2639— bedrock._add_anthropic_thinking_fields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 1 (nesting depth added 8). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cohere._map_cohere_usage (cognitive 16) pydantic_ai_slim/pydantic_ai/models/cohere.py:569— cohere._map_cohere_usage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
decision._route_question (cognitive 16) pydantic_ai_slim/pydantic_ai/models/decision.py:2201— decision._route_question has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), boolean chains 5, ternaries 2 (4 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
google._process_part (cognitive 16) pydantic_ai_slim/pydantic_ai/models/google.py:2249— google._process_part has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 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.
OpenAIResponsesModel._translate_thinking (cognitive 16) pydantic_ai_slim/pydantic_ai/models/openai.py:5002— OpenAIResponsesModel._translate_thinking has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
OpenAIResponsesModel._prompt_cache_comparison_response_id (cognitive 16) pydantic_ai_slim/pydantic_ai/models/openai.py:5279— OpenAIResponsesModel._prompt_cache_comparison_response_id has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAIStreamedResponse._map_text_delta (cognitive 16) pydantic_ai_slim/pydantic_ai/models/openai.py:6371— OpenAIStreamedResponse._map_text_delta has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenRouterModel._get_tool_choice (cognitive 16) pydantic_ai_slim/pydantic_ai/models/openrouter.py:1275— OpenRouterModel._get_tool_choice has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 1 (2 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.
openrouter._move_trailing_cache_control (cognitive 16) pydantic_ai_slim/pydantic_ai/models/openrouter.py:253— openrouter._move_trailing_cache_control has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
google.google_model_profile (cognitive 16) pydantic_ai_slim/pydantic_ai/profiles/google.py:240— google.google_model_profile has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 4, 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.
azure._map_voice_live_event (cognitive 16) pydantic_ai_slim/pydantic_ai/realtime/azure.py:495— azure._map_voice_live_event has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 4 (5 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.
GoogleRealtimeModel._config (cognitive 16) pydantic_ai_slim/pydantic_ai/realtime/google.py:1324— GoogleRealtimeModel._config has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 2, loops 1 (2 pts), 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.
OpenAIRealtimeModel._session_config (cognitive 16) pydantic_ai_slim/pydantic_ai/realtime/openai.py:1584— OpenAIRealtimeModel._session_config has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 2, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
OpenAILiveConnection._end_session (cognitive 16) pydantic_ai_slim/pydantic_ai/realtime/openai_live.py:1242— OpenAILiveConnection._end_session has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 4 (6 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAILiveConnection._attempt_reattach (cognitive 16) pydantic_ai_slim/pydantic_ai/realtime/openai_live.py:1458— OpenAILiveConnection._attempt_reattach has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 3 (6 pts), error handling 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.
OpenAILiveModel._session_config (cognitive 16) pydantic_ai_slim/pydantic_ai/realtime/openai_live.py:2479— OpenAILiveModel._session_config has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (14 pts), loops 1, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ToolManager._resolve_single_deferred (cognitive 16) pydantic_ai_slim/pydantic_ai/tool_manager.py:1473— ToolManager._resolve_single_deferred has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), 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.
tool_manager._check_tool_kinds (cognitive 16) pydantic_ai_slim/pydantic_ai/tool_manager.py:69— tool_manager._check_tool_kinds has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_instruction_collection.flatten_instruction_contributions (cognitive 16) pydantic_ai_slim/pydantic_ai/toolsets/_instruction_collection.py:101— _instruction_collection.flatten_instruction_contributions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graph_builder._collect_dominating_forks (cognitive 16) pydantic_graph/pydantic_graph/graph_builder.py:1978— graph_builder._collect_dominating_forks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 4 (8 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graph_builder.build_mermaid_graph (cognitive 16) pydantic_graph/pydantic_graph/graph_builder.py:2204— graph_builder.build_mermaid_graph has cognitive complexity 16 (threshold 15). Drivers by points: loops 5 (8 pts), if/else 3 (5 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.
check_cassettes.get_all_cassettes (cognitive 16) scripts/check_cassettes.py:118— check_cassettes.get_all_cassettes has cognitive complexity 16 (threshold 15). Drivers by points: loops 3 (7 pts), if/else 2 (5 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.
_toolset.ask_user_result (cognitive 16) src/pydantic_ai_harness/pydantic_ai_harness/ask_user/_toolset.py:45— _toolset.ask_user_result has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 3 (6 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BoxLiteSandboxBackend._acquire (cognitive 16) src/pydantic_ai_harness/pydantic_ai_harness/boxlite_sandbox/_backend.py:489— BoxLiteSandboxBackend._acquire has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 3 (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.
BubblewrapWorkspace._compute_login_path_mounts (cognitive 16) src/pydantic_ai_harness/pydantic_ai_harness/bubblewrap_sandbox/_workspace.py:360— BubblewrapWorkspace._compute_login_path_mounts has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 3, loops 2 (3 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.
_toolset._resolve_resource_limits (cognitive 16) src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_toolset.py:332— _toolset._resolve_resource_limits has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 6, 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.
PydanticAIACPAgent._emit_event (cognitive 16) src/pydantic_ai_harness/pydantic_ai_harness/experimental/acp/_adapter.py:810— PydanticAIACPAgent._emit_event has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_matching._skip_insignificant (cognitive 16) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_matching.py:67— _matching._skip_insignificant has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 2 (7 pts), loops 2 (4 pts), if/else 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileSystemToolset._read_file (cognitive 16) src/pydantic_ai_harness/pydantic_ai_harness/filesystem/_toolset.py:758— FileSystemToolset._read_file has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, error handling 2, 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.
ModalSandboxBackend.__init__ (cognitive 16) src/pydantic_ai_harness/pydantic_ai_harness/modal_sandbox/_backend.py:239— ModalSandboxBackend.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 6, 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.
_inventory._scan_skills (cognitive 16) src/pydantic_ai_harness/pydantic_ai_harness/repo_context/_inventory.py:67— _inventory._scan_skills has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (3 pts), error handling 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.
FileStepStore._sync_save_snapshot (cognitive 16) src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:695— FileStepStore._sync_save_snapshot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 1 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SubAgents._render_instructions (cognitive 16) src/pydantic_ai_harness/pydantic_ai_harness/subagents/_capability.py:683— SubAgents._render_instructions has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (6 pts), if/else 5, boolean chains 4, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
TaskTelemetry.decision (cognitive 16) src/pydantic_ai_harness/pydantic_ai_harness/subagents/_control.py:94— TaskTelemetry.decision has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_capability._first_user_text (cognitive 16) src/pydantic_ai_harness/pydantic_ai_harness/system_reminders/_capability.py:643— _capability._first_user_text has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (11 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.
CoderPlugin.get_capabilities (cognitive 16) src/pydantic_clai2/pydantic_clai2/builtin_plugins/coder.py:434— CoderPlugin.get_capabilities has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, ternaries 3 (5 pts), if/else 3 (4 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SettingsSource.edit_services (cognitive 16) src/pydantic_clai2/pydantic_clai2/builtin_plugins/google_workspace.py:183— SettingsSource.edit_services has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 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.
Updates.command (cognitive 16) src/pydantic_clai2/pydantic_clai2/cli/self_update.py:416— Updates.command has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, ternaries 5 (6 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.
errors.error_message (cognitive 16) src/pydantic_clai2/pydantic_clai2/errors.py:9— errors.error_message has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SessionPlugins.entries (cognitive 16) src/pydantic_clai2/pydantic_clai2/plugins/loader.py:302— SessionPlugins.entries has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 3 (4 pts), loops 3, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TaskRouter.observe (cognitive 16) src/pydantic_clai2/pydantic_clai2/runtime/tasks.py:233— TaskRouter.observe has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
custom_params.edit_custom_params (cognitive 16) src/pydantic_clai2/pydantic_clai2/ui/menus/custom_params.py:20— custom_params.edit_custom_params has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PromptSurface.transcript_key (cognitive 16) src/pydantic_clai2/pydantic_clai2/ui/prompt/prompt_surface.py:206— PromptSurface.transcript_key has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 3 (6 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
command_syntax.command_segments (cognitive 16) src/pydantic_clai2/pydantic_clai2/ui/rendering/command_syntax.py:88— command_syntax.command_segments has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (4 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.
QuestionCard.QuestionCard (cognitive 16) src/pydantic_clai2/web-ui/src/components/QuestionCard.tsx:17— QuestionCard.QuestionCard has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (8 pts), boolean chains 4, if/else 3, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 6 function items inside it that branch (submit, a function literal at line 68, a function literal at line 32, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ClassTooLong: App src/pydantic_clai2/web-ui/src/App.tsx:1— ClassTooLong — 705 significant lines (blank, comment-only and punctuation-only lines excluded), 3 methods. The bar is 400 significant lines; this is 305 over it, 1.76× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication· Members sharing a duplicated core (15 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (15 members, 50+ identical tokens) pydantic_ai_slim/pydantic_ai/agent/abstract.py:568— pydantic_ai_slim/pydantic_ai/agent/abstract.py:568-703 | pydantic_ai_slim/pydantic_ai/agent/wrapper.py:227-353 | pydantic_ai_slim/pydantic_ai/agent/wrapper.py:424-450 | pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:823-903 | pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1153-1287 | pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1364-1395 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:704-784 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:868-974 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:1060-1194 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:1270-1301 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:812-892 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:976-1082 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:1167-1315 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:1391-1422 | pydantic_ai_slim/pydantic_ai/ui/_adapter.py:1134-1246 — These 15 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 15 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 15 times.
D4 · Code Duplication· Members sharing a duplicated core (14 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (14 members, 50+ identical tokens) pydantic_ai_slim/pydantic_ai/agent/__init__.py:1294— pydantic_ai_slim/pydantic_ai/agent/__init__.py:1294-1327 | pydantic_ai_slim/pydantic_ai/agent/__init__.py:1507-1648 | pydantic_ai_slim/pydantic_ai/agent/__init__.py:3125-3219 | pydantic_ai_slim/pydantic_ai/agent/__init__.py:3292-3385 | pydantic_ai_slim/pydantic_ai/capabilities/image_generation.py:637-672 | pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:481-562 | pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:649-735 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:339-430 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:517-616 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:644-724 | pydantic_ai_slim/pydantic_ai/toolsets/function.py:241-342 | pydantic_ai_slim/pydantic_ai/toolsets/function.py:415-518 | pydantic_evals/pydantic_evals/reporting/__init__.py:442-473 | src/pydantic_ai_harness/pydantic_ai_harness/memory/_capability.py:497-528 — These 14 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 14 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 14 times.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (5 members, 50+ identical tokens) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_clear_tool_results.py:163— src/pydantic_ai_harness/pydantic_ai_harness/compaction/_clear_tool_results.py:163-190 | src/pydantic_ai_harness/pydantic_ai_harness/compaction/_deduplicate_file_reads.py:131-163 | src/pydantic_ai_harness/pydantic_ai_harness/compaction/_relevance_compaction.py:317-340 | src/pydantic_ai_harness/pydantic_ai_harness/compaction/_sliding_window_compaction.py:241-268 | src/pydantic_ai_harness/pydantic_ai_harness/compaction/_summarizing_compaction.py:1023-1050 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Duplicated block (32–41 lines × 2) pydantic_ai_slim/pydantic_ai/profiles/anthropic.py:365— pydantic_ai_slim/pydantic_ai/profiles/anthropic.py:365-396 | pydantic_ai_slim/pydantic_ai/profiles/anthropic.py:526-566 — both copies are in the same file, so extract the 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 `pydantic_ai_slim/pydantic_ai/profiles/anthropic.py:365` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (30 lines × 2) pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:945— pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:945-974 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:1053-1082 — `pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py` and `pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 159 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (25–27 lines × 2) pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:229— pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:229-253 | pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:285-311 — both copies are in the same file, so extract the 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 `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:229` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27 lines × 2) pydantic_evals/pydantic_evals/online.py:699— pydantic_evals/pydantic_evals/online.py:699-725 | pydantic_evals/pydantic_evals/online.py:774-800 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20–27 lines × 2) scripts/verify_vertex_gcs_tool_result.py:45— scripts/verify_vertex_gcs_tool_result.py:45-64 | scripts/verify_vertex_gcs_tool_result.py:67-93 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/verify_vertex_gcs_tool_result.py:45` 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 (26 lines × 2) pydantic_ai_slim/pydantic_ai/providers/moonshotai.py:146— pydantic_ai_slim/pydantic_ai/providers/moonshotai.py:146-171 | pydantic_ai_slim/pydantic_ai/providers/zai.py:82-107 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (24–25 lines × 3) pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1315— pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1315-1339 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:1222-1245 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:1343-1366 — `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py` and `pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 150 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (20–25 lines × 2) pydantic_ai_slim/pydantic_ai/messages.py:4680— pydantic_ai_slim/pydantic_ai/messages.py:4680-4704 | pydantic_ai_slim/pydantic_ai/messages.py:4777-4796 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21–24 lines × 2) pydantic_ai_slim/pydantic_ai/embeddings/instrumented.py:99— pydantic_ai_slim/pydantic_ai/embeddings/instrumented.py:99-122 | pydantic_ai_slim/pydantic_ai/images/instrumented.py:101-121 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/embeddings/instrumented.py:99` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19–24 lines × 2) pydantic_ai_slim/pydantic_ai/models/groq.py:869— pydantic_ai_slim/pydantic_ai/models/groq.py:869-892 | pydantic_ai_slim/pydantic_ai/models/huggingface.py:613-631 — before extracting anything, compare `pydantic_ai_slim/pydantic_ai/models/groq.py` and `pydantic_ai_slim/pydantic_ai/models/huggingface.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/models/groq.py:869` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1265— pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1265-1285 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:1171-1191 — `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py` and `pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 150 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1265` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) pydantic_ai_slim/pydantic_ai/providers/crusoe.py:100— pydantic_ai_slim/pydantic_ai/providers/crusoe.py:100-118 | pydantic_ai_slim/pydantic_ai/providers/meta.py:82-100 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (18 lines × 4) pydantic_ai_slim/pydantic_ai/agent/__init__.py:3202— pydantic_ai_slim/pydantic_ai/agent/__init__.py:3202-3219 | pydantic_ai_slim/pydantic_ai/agent/__init__.py:3368-3385 | pydantic_ai_slim/pydantic_ai/toolsets/function.py:325-342 | pydantic_ai_slim/pydantic_ai/toolsets/function.py:501-518 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/agent/__init__.py:3202` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `func_` to `ToolFuncContext[AgentDepsT, ToolParams]` in one and `ToolFuncPlain[ToolParams]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (18 lines × 3) pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1371— pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1371-1388 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:1277-1294 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:1398-1415 — `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py` and `pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 150 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1371` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–18 lines × 2) pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:1731— pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:1731-1742 | pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2113-2130 — both copies are in the same file, so extract the 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 `pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:2113` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–18 lines × 2) pydantic_ai_slim/pydantic_ai/models/bedrock.py:1851— pydantic_ai_slim/pydantic_ai/models/bedrock.py:1851-1868 | pydantic_ai_slim/pydantic_ai/models/bedrock.py:2296-2310 — both copies are in the same file, so extract the 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 `pydantic_ai_slim/pydantic_ai/models/bedrock.py:1851` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (16–17 lines × 2) pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_function_toolset.py:26— pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_function_toolset.py:26-41 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_mcp_toolset.py:41-57 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_function_toolset.py:26` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `wrapped` to `FunctionToolset[AgentDepsT]` in one and `MCPToolset[AgentDepsT]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (15–16 lines × 2) pydantic_evals/pydantic_evals/reporting/__init__.py:1128— pydantic_evals/pydantic_evals/reporting/__init__.py:1128-1143 | pydantic_evals/pydantic_evals/reporting/__init__.py:1234-1248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 14) pydantic_ai_slim/pydantic_ai/agent/__init__.py:1312— pydantic_ai_slim/pydantic_ai/agent/__init__.py:1312-1326 | pydantic_ai_slim/pydantic_ai/agent/__init__.py:1632-1646 | pydantic_ai_slim/pydantic_ai/agent/__init__.py:3202-3216 | pydantic_ai_slim/pydantic_ai/agent/__init__.py:3368-3382 | pydantic_ai_slim/pydantic_ai/capabilities/image_generation.py:658-672 | pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:548-562 | pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:721-735 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:407-425 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:592-610 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:710-724 | pydantic_ai_slim/pydantic_ai/toolsets/function.py:325-339 | pydantic_ai_slim/pydantic_ai/toolsets/function.py:501-515 | pydantic_evals/pydantic_evals/reporting/__init__.py:458-472 | src/pydantic_ai_harness/pydantic_ai_harness/memory/_capability.py:514-528 — `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py` and `pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 150 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/agent/__init__.py:1312` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 13) pydantic_ai_slim/pydantic_ai/agent/abstract.py:640— pydantic_ai_slim/pydantic_ai/agent/abstract.py:640-654 | pydantic_ai_slim/pydantic_ai/agent/wrapper.py:338-352 | pydantic_ai_slim/pydantic_ai/agent/wrapper.py:435-449 | pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:888-902 | pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1380-1394 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:769-783 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:957-971 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:1286-1300 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:877-891 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:1065-1079 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:1300-1314 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:1407-1421 | pydantic_ai_slim/pydantic_ai/ui/_adapter.py:1228-1242 — `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py` and `pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 150 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/agent/abstract.py:640` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 3) pydantic_ai_slim/pydantic_ai/mcp.py:294— pydantic_ai_slim/pydantic_ai/mcp.py:294-308 | pydantic_ai_slim/pydantic_ai/mcp.py:334-348 | pydantic_ai_slim/pydantic_ai/mcp.py:407-421 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/mcp.py:294` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_mongo.py:349— src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_mongo.py:349-363 | src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_postgres.py:451-464 — 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 `src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_mongo.py:349` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 3) pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1265— pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1265-1278 | pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py:1171-1184 | pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_agent.py:1293-1306 — `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py` and `pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_agent.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 150 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_agent.py:1265` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–14 lines × 2) pydantic_ai_slim/pydantic_ai/_agent_graph.py:2963— pydantic_ai_slim/pydantic_ai/_agent_graph.py:2963-2974 | pydantic_ai_slim/pydantic_ai/_agent_graph.py:3031-3044 — both copies are in the same file, so extract the 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 `pydantic_ai_slim/pydantic_ai/_agent_graph.py:2963` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `pydantic_ai_slim/pydantic_ai/_agent_graph.py:3052` calls `_set_resumed_history` and `pydantic_ai_slim/pydantic_ai/_agent_graph.py:2977` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 3) pydantic_ai_slim/pydantic_ai/agent/abstract.py:2397— pydantic_ai_slim/pydantic_ai/agent/abstract.py:2397-2408 | pydantic_ai_slim/pydantic_ai/agent/abstract.py:2470-2481 | pydantic_ai_slim/pydantic_ai/agent/abstract.py:2544-2555 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 4) src/pydantic_ai_harness/pydantic_ai_harness/boxd_sandbox/_capability.py:181— src/pydantic_ai_harness/pydantic_ai_harness/boxd_sandbox/_capability.py:181-191 | src/pydantic_ai_harness/pydantic_ai_harness/daytona_sandbox/_capability.py:146-156 | src/pydantic_ai_harness/pydantic_ai_harness/opensandbox_sandbox/_capability.py:187-197 | src/pydantic_ai_harness/pydantic_ai_harness/sprites_sandbox/_capability.py:126-136 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 3) src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_mongo.py:354— src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_mongo.py:354-363 | src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_postgres.py:455-464 | src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_store.py:1438-1447 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/_mongo.py:354` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6–9 lines × 2) pydantic_ai_slim/pydantic_ai/realtime/_openai_protocol.py:1120— pydantic_ai_slim/pydantic_ai/realtime/_openai_protocol.py:1120-1125 | pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:1002-1010 — 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 `pydantic_ai_slim/pydantic_ai/realtime/elevenlabs_agents.py:1002` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (4–8 lines × 3) src/pydantic_ai_harness/pydantic_ai_harness/compaction/_clear_tool_results.py:120— src/pydantic_ai_harness/pydantic_ai_harness/compaction/_clear_tool_results.py:120-123 | src/pydantic_ai_harness/pydantic_ai_harness/compaction/_sliding_window_compaction.py:132-139 | src/pydantic_ai_harness/pydantic_ai_harness/compaction/_summarizing_compaction.py:786-793 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/pydantic_ai_harness/pydantic_ai_harness/compaction/_sliding_window_compaction.py:132` calls `ValueError` and `src/pydantic_ai_harness/pydantic_ai_harness/compaction/_clear_tool_results.py:120` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 3) .github/scripts/community_demand.py:160— .github/scripts/community_demand.py:160-166 | .github/scripts/issue_pr_attention_monitor.py:821-827 | .github/scripts/issue_pr_attention_monitor.py:2143-2149 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6–7 lines × 2) .github/scripts/community_demand.py:138— .github/scripts/community_demand.py:138-143 | .github/scripts/issue_pr_attention_monitor.py:788-794 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `client` to `attention.GitHubClient` in one and `GitHubClient` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `.github/scripts/issue_pr_attention_monitor.py:795` calls `item_labels` and `.github/scripts/community_demand.py:144` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (24 lines × 2) src/pydantic_ai_harness/pydantic_ai_harness/notion/_capability.py:57— src/pydantic_ai_harness/pydantic_ai_harness/notion/_capability.py:57-80 | src/pydantic_ai_harness/pydantic_ai_harness/slack/_capability.py:55-78 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (21 lines × 6) pydantic_ai_slim/pydantic_ai/embeddings/cohere.py:145— pydantic_ai_slim/pydantic_ai/embeddings/cohere.py:145-165 | pydantic_ai_slim/pydantic_ai/embeddings/google.py:206-228 | pydantic_ai_slim/pydantic_ai/embeddings/openai.py:80-103 | pydantic_ai_slim/pydantic_ai/embeddings/voyageai.py:112-132 | pydantic_ai_slim/pydantic_ai/images/google.py:152-175 | pydantic_ai_slim/pydantic_ai/images/xai.py:126-147 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/embeddings/cohere.py:145` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 4) pydantic_ai_slim/pydantic_ai/models/cohere.py:212— pydantic_ai_slim/pydantic_ai/models/cohere.py:212-229 | pydantic_ai_slim/pydantic_ai/models/huggingface.py:205-219 | pydantic_ai_slim/pydantic_ai/models/typesafe.py:152-164 | pydantic_ai_slim/pydantic_ai/models/xai.py:397-411 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pydantic_ai_slim/pydantic_ai/models/cohere.py:212` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 5) pydantic_ai_slim/pydantic_ai/providers/deepseek.py:121— pydantic_ai_slim/pydantic_ai/providers/deepseek.py:121-131 | pydantic_ai_slim/pydantic_ai/providers/fireworks.py:102-112 | pydantic_ai_slim/pydantic_ai/providers/nebius.py:94-104 | pydantic_ai_slim/pydantic_ai/providers/ovhcloud.py:85-95 | pydantic_ai_slim/pydantic_ai/providers/together.py:94-104 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once.
Duplicated block (32 lines × 2) pydantic_ai_slim/pydantic_ai/embeddings/__init__.py:236— pydantic_ai_slim/pydantic_ai/embeddings/__init__.py:236-267 | pydantic_ai_slim/pydantic_ai/images/__init__.py:214-245 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `model` to `EmbeddingModel | KnownEmbeddingModelName | str | _utils.Unset = _utils.UNSET` in one and `ImageGenerationModel | KnownImageGenerationModelName | str | _utils.Unset = _utils.UNSET` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6 lines × 3) src/pydantic_ai_harness/pydantic_ai_harness/day_ai/_capability.py:113— src/pydantic_ai_harness/pydantic_ai_harness/day_ai/_capability.py:113-118 | src/pydantic_ai_harness/pydantic_ai_harness/ordinal/_capability.py:99-104 | src/pydantic_ai_harness/pydantic_ai_harness/pylon/_capability.py:115-120 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Outbound HTTP without resilience src/pydantic_ai_harness/pydantic_ai_harness/media/_s3.py:263— `httpx.AsyncClient(` 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.
R10 · Code Duplication· Duplicated block with local edits (31 matched lines × 2 locations) · ×1
Duplicated block with local edits (31 matched lines × 2 locations) REDACTED:108— REDACTED:108 · src/pydantic_clai2/web-ui/src/components/WorkerView.tsx:115 — the two spans are one implementation copied and then locally edited — 174 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 (21 lines × 2 locations) src/pydantic_clai2/web-ui/src/components/NewSessionDialog.tsx:249— src/pydantic_clai2/web-ui/src/components/NewSessionDialog.tsx:249 · src/pydantic_clai2/web-ui/src/components/NewSessionDialog.tsx:293 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (15 lines × 2 locations) src/pydantic_clai2/web-ui/src/components/Composer.tsx:166— src/pydantic_clai2/web-ui/src/components/Composer.tsx:166 · src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:251 — 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.
Duplicated block (12 lines × 2 locations) src/pydantic_clai2/web-ui/src/components/icons.tsx:105— src/pydantic_clai2/web-ui/src/components/icons.tsx:105 · src/pydantic_clai2/web-ui/src/components/icons.tsx:166 — 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 (11 matched lines × 2 locations) · ×1
Duplicated block with local edits (11 matched lines × 2 locations) src/pydantic_clai2/web-ui/src/components/PluginsPanel.tsx:43— src/pydantic_clai2/web-ui/src/components/PluginsPanel.tsx:43 · src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:221 — the two spans are one implementation copied and then locally edited — 54 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 (10 matched lines × 2 locations) · ×1
Duplicated block with local edits (10 matched lines × 2 locations) REDACTED:86— REDACTED:86 · src/pydantic_clai2/web-ui/src/components/SettingsWindow.tsx:97 — the two spans are one implementation copied and then locally edited — 71 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 (9 lines × 2 locations) src/pydantic_clai2/web-ui/src/components/McpSection.tsx:45— src/pydantic_clai2/web-ui/src/components/McpSection.tsx:45 · src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:62 — 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.
Complex function App (cyclomatic 115, cognitive 94) src/pydantic_clai2/web-ui/src/App.tsx:85— App has cyclomatic complexity 115 and cognitive complexity 94; 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 reduce (cyclomatic 40, cognitive 38) src/pydantic_clai2/web-ui/src/state.ts:376— reduce has cyclomatic complexity 40 and cognitive complexity 38; 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 onKeyDown (cyclomatic 37, cognitive 45) src/pydantic_clai2/web-ui/src/components/Composer.tsx:288— onKeyDown has cyclomatic complexity 37 and cognitive complexity 45; 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 onKey (cyclomatic 36, cognitive 28) src/pydantic_clai2/web-ui/src/App.tsx:577— onKey has cyclomatic complexity 36 and cognitive complexity 28; 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 Sidebar (cyclomatic 33, cognitive 33) src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:134— Sidebar has cyclomatic complexity 33 and cognitive complexity 33; 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 row (cyclomatic 32, cognitive 30) src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:378— row has cyclomatic complexity 32 and cognitive complexity 30; 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 ToolCard (cyclomatic 32, cognitive 28) REDACTED:262— ToolCard has cyclomatic complexity 32 and cognitive complexity 28; 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 Changes (cyclomatic 30, cognitive 23) src/pydantic_clai2/web-ui/src/components/GitChip.tsx:194— Changes has cyclomatic complexity 30 and cognitive complexity 23; 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 summarize (cyclomatic 29, cognitive 39) REDACTED:103— summarize has cyclomatic complexity 29 and cognitive complexity 39; 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 MenuRow (cyclomatic 24, cognitive 21) src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:172— MenuRow has cyclomatic complexity 24 and cognitive complexity 21; 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 controlFor (cyclomatic 23, cognitive 30) src/pydantic_clai2/web-ui/src/settings.ts:52— controlFor has cyclomatic complexity 23 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity· Complex function Control (cyclomatic 22, cognitive 27) · ×1
Complex function Control (cyclomatic 22, cognitive 27) src/pydantic_clai2/web-ui/src/components/MenuForm.tsx:271— Control has cyclomatic complexity 22 and cognitive complexity 27; 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 Editor (cyclomatic 22, cognitive 25) src/pydantic_clai2/web-ui/src/components/SettingsForm.tsx:140— Editor has cyclomatic complexity 22 and cognitive complexity 25; 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 Detail (cyclomatic 22, cognitive 15) src/pydantic_clai2/web-ui/src/components/PluginsPanel.tsx:157— Detail has cyclomatic complexity 22 and cognitive complexity 15; 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 Composer (cyclomatic 21, cognitive 17) src/pydantic_clai2/web-ui/src/components/Composer.tsx:67— Composer has cyclomatic complexity 21 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 19, cognitive 25) src/pydantic_clai2/web-ui/src/App.tsx:506— (anonymous) has cyclomatic complexity 19 and cognitive complexity 25; 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 DiffView (cyclomatic 18, cognitive 20) REDACTED:57— DiffView has cyclomatic complexity 18 and cognitive complexity 20; 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 EntryView (cyclomatic 16, cognitive 20) src/pydantic_clai2/web-ui/src/components/Transcript.tsx:144— EntryView has cyclomatic complexity 16 and cognitive complexity 20; 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 CellView (cyclomatic 16, cognitive 15) REDACTED:49— CellView has cyclomatic complexity 16 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files· src/pydantic_clai2/web-ui/src/App.tsx · ×1
src/pydantic_clai2/web-ui/src/App.tsx: 935 lines of code src/pydantic_clai2/web-ui/src/App.tsx:1— src/pydantic_clai2/web-ui/src/App.tsx has 935 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· src/pydantic_clai2/web-ui/src/components/Sidebar.tsx · ×1
src/pydantic_clai2/web-ui/src/components/Sidebar.tsx: 663 lines of code src/pydantic_clai2/web-ui/src/components/Sidebar.tsx:1— src/pydantic_clai2/web-ui/src/components/Sidebar.tsx has 663 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· src/pydantic_clai2/web-ui/src/components/Composer.tsx · ×1
src/pydantic_clai2/web-ui/src/components/Composer.tsx: 499 lines of code src/pydantic_clai2/web-ui/src/components/Composer.tsx:1— src/pydantic_clai2/web-ui/src/components/Composer.tsx has 499 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· src/pydantic_clai2/web-ui/src/components/GitChip.tsx · ×1
src/pydantic_clai2/web-ui/src/components/GitChip.tsx: 477 lines of code src/pydantic_clai2/web-ui/src/components/GitChip.tsx:1— src/pydantic_clai2/web-ui/src/components/GitChip.tsx has 477 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· src/pydantic_clai2/web-ui/src/state.ts · ×1
src/pydantic_clai2/web-ui/src/state.ts: 452 lines of code src/pydantic_clai2/web-ui/src/state.ts:1— src/pydantic_clai2/web-ui/src/state.ts has 452 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R4 · Test Coverage· No test reaches this file · ×1
No test reaches this file src/pydantic_clai2/web-ui/src/main.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
X1 · Async correctness· Task from `loop.create_task` is not kept · ×1
Task from `loop.create_task` is not kept pydantic_ai_slim/pydantic_ai/_sync_stream.py:161— The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
Duplicated predicate src/pydantic_clai2/web-ui/src/components/QueuePanel.tsx:42— `error instanceof ApiError && error.status === 404` appears character-identically in 2 files — src/pydantic_clai2/web-ui/src/components/QueuePanel.tsx, src/pydantic_clai2/web-ui/src/components/Sidebar.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 src/pydantic_clai2/web-ui/src/components/Composer.tsx:169— `event instanceof KeyboardEvent && event.key !== 'Escape'` appears character-identically in 2 files — src/pydantic_clai2/web-ui/src/components/Composer.tsx, src/pydantic_clai2/web-ui/src/components/Sidebar.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 REDACTED:88— `event.key !== 'Escape' || document.querySelector('.dialog-overlay')` appears character-identically in 2 files — REDACTED, src/pydantic_clai2/web-ui/src/components/SettingsWindow.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 REDACTED:105— `event.key === 'ArrowDown' || event.key === 'ArrowUp'` appears character-identically in 4 files — REDACTED, src/pydantic_clai2/web-ui/src/components/Composer.tsx, src/pydantic_clai2/web-ui/src/components/DialogLayer.tsx, src/pydantic_clai2/web-ui/src/components/NewSessionDialog.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 src/pydantic_clai2/web-ui/src/components/Composer.tsx:332— `event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing` appears character-identically in 5 files — src/pydantic_clai2/web-ui/src/components/Composer.tsx, REDACTED, src/pydantic_clai2/web-ui/src/components/QueuePanel.tsx, src/pydantic_clai2/web-ui/src/components/Transcript.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 src/pydantic_clai2/web-ui/src/components/CommandMenu.tsx:21— `event.target === event.currentTarget && onClose()` appears character-identically in 4 files — src/pydantic_clai2/web-ui/src/components/CommandMenu.tsx, REDACTED, src/pydantic_clai2/web-ui/src/components/GitChip.tsx, src/pydantic_clai2/web-ui/src/components/NewSessionDialog.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 src/pydantic_clai2/web-ui/src/components/SettingsForm.tsx:248— `value && typeof value === 'object' && !Array.isArray(value)` appears character-identically in 2 files — src/pydantic_clai2/web-ui/src/components/SettingsForm.tsx, 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 pydantic_ai_slim/pydantic_ai/profiles/google.py:578— `'oneOf' in schema and 'type' not in schema` appears character-identically in 2 files — pydantic_ai_slim/pydantic_ai/profiles/google.py, pydantic_ai_slim/pydantic_ai/providers/openrouter.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_model.py:109— `DBOS.workflow_id is not None and DBOS.step_id is None` appears character-identically in 2 files — pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_model.py, pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_utils.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pydantic_ai_slim/pydantic_ai/providers/bedrock.py:836— `api_key or os.getenv('AWS_BEARER_TOKEN_BEDROCK')` appears character-identically in 2 files — pydantic_ai_slim/pydantic_ai/providers/bedrock.py, pydantic_ai_slim/pydantic_ai/providers/bedrock_mantle.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py:3846— `baseline is not None and isinstance(model_request_parameters.thinking, str)` appears character-identically in 2 files — pydantic_ai_slim/pydantic_ai/models/anthropic/__init__.py, pydantic_ai_slim/pydantic_ai/models/openai.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pydantic_ai_slim/pydantic_ai/_agent_graph.py:1442— `capability is not None and capability.defer_loading is True` appears character-identically in 2 files — pydantic_ai_slim/pydantic_ai/_agent_graph.py, pydantic_ai_slim/pydantic_ai/toolsets/_capability_owned.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pydantic_ai_slim/pydantic_ai/models/bedrock.py:240— `category or _model_errors.http_status_category(status_code, message)` appears character-identically in 2 files — pydantic_ai_slim/pydantic_ai/models/bedrock.py, pydantic_ai_slim/pydantic_ai/models/google.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pydantic_ai_slim/pydantic_ai/_model_errors.py:345— `current is not None and id(current) not in seen` appears character-identically in 2 files — pydantic_ai_slim/pydantic_ai/_model_errors.py, src/pydantic_clai2/pydantic_clai2/errors.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/naming.py:126— `entry.title_source == 'fallback' or entry.revision - entry.named_revision >= 16` appears character-identically in 2 files — src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/naming.py, src/pydantic_clai2/pydantic_clai2/runtime/session_naming.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/pydantic_ai_harness/pydantic_ai_harness/spend/_redis.py:430— `entry.token is None or self.dedup_retain is None` appears character-identically in 2 files — src/pydantic_ai_harness/pydantic_ai_harness/spend/_redis.py, src/pydantic_ai_harness/pydantic_ai_harness/spend/_store.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pydantic_ai_slim/pydantic_ai/realtime/_core.py:794— `event.item_id is not None and event.item_id in self._replayed_items` appears character-identically in 2 files — pydantic_ai_slim/pydantic_ai/realtime/_core.py, pydantic_ai_slim/pydantic_ai/realtime/_inferred_lifecycle.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pydantic_ai_slim/pydantic_ai/_run_context.py:969— `event.tool_call_id is None and self.tool_call_id is not None` appears character-identically in 2 files — pydantic_ai_slim/pydantic_ai/_run_context.py, src/pydantic_ai_harness/pydantic_ai_harness/render/_compat.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pydantic_ai_slim/pydantic_ai/_utils.py:1286— `event_loop is None or event_loop.is_closed()` appears character-identically in 3 files — pydantic_ai_slim/pydantic_ai/_utils.py, pydantic_evals/pydantic_evals/_utils.py, pydantic_graph/pydantic_graph/_utils.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/pydantic_ai_harness/pydantic_ai_harness/compaction/_compact_on_request.py:228— `focus is not None and isinstance(strategy, SupportsFocus)` appears character-identically in 2 files — src/pydantic_ai_harness/pydantic_ai_harness/compaction/_compact_on_request.py, src/pydantic_ai_harness/pydantic_ai_harness/compaction/_manual.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/naming.py:48— `info.field_name == 'title' and not cleaned` appears character-identically in 2 files — src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/naming.py, src/pydantic_clai2/pydantic_clai2/runtime/session_naming.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/menu_forms.py:15— `info.settings_model is None or info.settings is None` appears character-identically in 2 files — src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/menu_forms.py, src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/service.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/pydantic_ai_harness/pydantic_ai_harness/compaction/_relevance_compaction.py:669— `is_pinned(part) or is_receipt_part(part) or is_harness_data(part)` appears character-identically in 2 files — src/pydantic_ai_harness/pydantic_ai_harness/compaction/_relevance_compaction.py, src/pydantic_ai_harness/pydantic_ai_harness/compaction/_shared.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pydantic_ai_slim/pydantic_ai/models/anthropic/_cache_control.py:114— `is_str_dict(block) and block.get('cache_control')` appears character-identically in 2 files — pydantic_ai_slim/pydantic_ai/models/anthropic/_cache_control.py, pydantic_ai_slim/pydantic_ai/models/openrouter.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pydantic_ai_slim/pydantic_ai/durable_exec/_toolset.py:399— `is_str_dict(value) and value.get('kind') == 'tool-return'` appears character-identically in 2 files — pydantic_ai_slim/pydantic_ai/durable_exec/_toolset.py, src/pydantic_ai_harness/pydantic_ai_harness/absurd/_operation_backend.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Silent fallback default on parse failure pydantic_ai_slim/pydantic_ai/_utils.py:1357— `enum_member_docstrings` returns `{}` when `(OSError, TypeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure pydantic_ai_slim/pydantic_ai/capabilities/file_understanding.py:260— `_str_dict` returns `{}` when `ValidationError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure pydantic_ai_slim/pydantic_ai/models/openai.py:3575— `_websocket_unsupported_reason` returns `'install `pydantic-ai-slim[openai-realtime]` to use Responses WebSockets.'` when `ImportError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure pydantic_ai_slim/pydantic_ai/ui/ag_ui/_adapter.py:284— `_enqueued_messages` returns `[]` when `ValidationError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py:1642— `_enqueued_ui_messages` returns `[]` when `ValidationError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure scripts/typecheck_changed.py:388— `_imports_of` returns `[]` when `(SyntaxError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure REDACTED:27— `takes_context` returns `False` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_capability.py:475— `_announced_names` returns `[]` when `ValidationError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_capability.py:505— `_extract_discovered_names` returns `[]` when `ValidationError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_streaming.py:103— `closed_statements` returns `[]` when `(SyntaxError, ValueError, RecursionError, MemoryError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/service.py:355— `_theme_name` returns `'default'` when `KeyError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/sidebar.py:124— `completions` returns `[]` when `(OSError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/workspace_tools.py:108— `_picked` returns `{}` when `ValidationError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_clai2/pydantic_clai2/builtin_plugins/workspaces/__init__.py:189— `check` (in `add`) returns `'Start with a lowercase letter; then lowercase letters, digits, and hyphens.'` when `ValidationError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_clai2/pydantic_clai2/config/settings_store.py:473— `_saved_declaration` returns `{}` when `ValidationError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_clai2/pydantic_clai2/logfire_oauth.py:104— `_load_all` returns `{}` when `(UserError, ValidationError, UnicodeDecodeError, KeyringError, OSError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_clai2/pydantic_clai2/mcp/command.py:128— `complete` returns `()` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_clai2/pydantic_clai2/mcp/form.py:104— `name_problem` returns `'Start with a letter; then letters, digits, or hyphens (max 64)'` when `ValidationError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_clai2/pydantic_clai2/mcp/form.py:245— `target` returns `''` when `ValidationError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_clai2/pydantic_clai2/mcp/form.py:266— `target_problem` returns `'Enter an http:// or https:// URL'` when `ValidationError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_clai2/pydantic_clai2/mcp/tokens.py:59— `_load` returns `{}` when `(UserError, ValidationError, UnicodeDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_clai2/pydantic_clai2/plugins/describe.py:32— `_docstring` returns `''` when `(OSError, SyntaxError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/pydantic_clai2/pydantic_clai2/ui/prompt/image_input.py:67— `pasted_paths` returns `[]` when `(OSError, ValueError, RuntimeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch pydantic_ai_slim/pydantic_ai/_utils.py:905— `include_field` (in `dataclasses_no_defaults_repr`) swallows every exception into `return True` — 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 pydantic_ai_slim/pydantic_ai/ui/ag_ui/_utils.py:150— `detect_ag_ui_version` swallows every exception into `return '0.1.10'` — 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 src/pydantic_ai_harness/pydantic_ai_harness/youdotcom/_toolset.py:178— `_harness_version` swallows every exception into `return 'unknown'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch src/pydantic_clai2/pydantic_clai2/plugins/__init__.py:1113— `complete` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch REDACTED:28— `parseArgs` 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 src/pydantic_clai2/web-ui/src/components/SettingsForm.tsx:293— `Editor` 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 REDACTED:44— `callSubject` 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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 27 significant file(s) lose their only recent owner: pydantic_ai_slim/pydantic_ai/realtime/_session.py, pydantic_ai_slim/pydantic_ai/realtime/openai_live.py, pydantic_ai_slim/pydantic_ai/realtime/google.py, pydantic_ai_slim/pydantic_ai/realtime/openai.py, pydantic_ai_slim/pydantic_ai/realtime/_openai_protocol.py, pydantic_ai_slim/pydantic_ai/realtime/xai.py, pydantic_ai_slim/pydantic_ai/realtime/azure.py, pydantic_ai_slim/pydantic_ai/realtime/model.py (+19 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 18 significant file(s) lose their only recent owner: src/pydantic_ai_harness/pydantic_ai_harness/browser_use/_capability.py, src/pydantic_clai2/pydantic_clai2/builtin_plugins/ordinal.py, src/pydantic_clai2/pydantic_clai2/mcp/command.py, src/pydantic_clai2/pydantic_clai2/builtin_plugins/grain.py, src/pydantic_clai2/pydantic_clai2/mcp/tokens.py, src/pydantic_clai2/pydantic_clai2/builtin_plugins/day_ai.py, src/pydantic_clai2/pydantic_clai2/mcp/store.py, src/pydantic_ai_harness/pydantic_ai_harness/step_persistence/naming.py (+10 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 4 significant file(s) lose their only recent owner: pydantic_ai_slim/pydantic_ai/native_tools/_tool_search.py, src/pydantic_ai_harness/scripts/gh_aw_engine_version.py, pydantic_ai_slim/pydantic_ai/models/anthropic/_containers.py, pydantic_ai_slim/pydantic_ai/ui/ag_ui/_thinking_0_11.py. Pair on, review, or document these before any departure.
Hand-rolled JSON/XML parsing via regex src/pydantic_clai2/web-ui/src/code.ts:39— 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 src/pydantic_clai2/web-ui/src/code.ts: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 pydantic_ai_slim/pydantic_ai/common_tools/web_fetch.py:61— 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 Python code already uses a real parser in the same package; use it here too.
Orphaned file pydantic_ai_slim/pydantic_ai/models/ollama.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 pydantic_ai_slim/pydantic_ai/_uuid.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.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 1 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 (50 single-owned of 858 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; 858 of the 1114 production source files in this repository met that bar). They are 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: pydantic_ai_slim/pydantic_ai/providers/_github_copilot_oauth.py.
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 — 4 of 8 project(s) overshoot their size bounds, lowering Project Cohesion to 0.4/10. The most over is `pydantic_ai_slim` (167703 LoC, 1645 module-visible types across 24 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 2 of 858 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; 858 of the 1114 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: pydantic_ai_slim/pydantic_ai/models/ollama.py, pydantic_ai_slim/pydantic_ai/_uuid.py. 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.
M2 · Architecture documentation· ADRs not easily discoverable · ×1
ADRs not easily discoverable — 1 ADR-shaped document(s) detected by content — `.agents/skills/branch-context/pr-decisions.template.md`. They are not under a conventional ADR folder (docs/adr/) and are not named NNNN-title.md, and this check found them by their decision signature rather than by where they live — so a reader who does not already know these paths has no route to them. Detected by content signature only: records kept outside the repository, or written without a Status/Decision/Consequences shape, are not visible to this check and are not counted here.
README/code drift CONTRIBUTING.md:227— CONTRIBUTING.md links to `install.md#slim-install`, but `install.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
Logging is not universal — Only 2/4 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `clai`, `pydantic_ai_slim`.
No SAST .github/workflows/benchmark.yml:8— No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 2174675 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.
P3 · Security & performance tooling· Dependabot does not watch pip · ×1
Dependabot does not watch pip REDACTED:1— `REDACTED` schedules updates, but no `package-ecosystem` entry covers `pip`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list.
Unused export 'SparkIcon' src/pydantic_clai2/web-ui/src/components/icons.tsx:124— Nothing imports this binding — it is safe to review for removal.
X2 · Cancellation propagation· Not all async functions that make a request accept an AbortSignal · ×1
Not all async functions that make a request accept an AbortSignal — Only 0/2 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
X7 · Silent fallback defaults· Pending state with no failure state · ×1
Pending state with no failure state REDACTED:137— The view draws `Loading commands…` under `commands === null`, but `commands` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Dependency hygiene PARTLY measured — Python dependencies read, no exact pin to grade for currency — This repository's Python dependencies were read: 4 shipped distribution(s) across 7 manifest(s) (12 development or optional declaration(s) excluded, because a consumer does not install them). Whether any of them is behind its current release is the dependency-CURRENCY question, and no declaration here carries an EXACT pin to ask it about — every one is a floor or a range, which installs the newest release it admits and therefore cannot be behind one. That is a healthy declaration style, NOT a defect and NOT a gap in this analyzer; there is simply no currency question to answer. This is NOT a finding that these dependencies are current or healthy. Lockfiles are deliberately not read (poetry.lock, REDACTED, Pipfile.lock, pdm.lock): the four disagree about dev/optional membership, and misreading one would charge a test-only package a consumer never receives. Known CVEs in the same dependency graph are a separate question, reported under D30.
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.
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
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 15 file(s) — `pydantic_ai_slim/pydantic_ai/_mcp_apps.py`, `pydantic_ai_slim/pydantic_ai/_sync_stream.py`, `pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_operation_backend.py`, `pydantic_ai_slim/pydantic_ai/models/openai.py`, `pydantic_ai_slim/pydantic_ai/ui/_event_stream.py`, … (+10 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a1aa85-4d5e-784a-9fb1-721a98739d0d · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 44 · Warnings: 1429 · Recommendations: 77 · Info: 1 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 05-11-2026 @ 07:03 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.