Public report of zhayujie/CowAgent, published 25 October 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.10.5). Watchdog signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 25 October 2026, 05:25 UTC · Survey ID cd_a31d4407eeea4516b07eec6045ec0f2f
zhayujie/CowAgent
Measured 25 October 2026, 04:45 UTC, at code version d2a72a3
A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.
Test reliability is not measured: No runner for the .tsx half of a polyglot repository.
CAI scoreAt riskDown 1 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: 133,792 lines of product code in 2 projects, tests not counted · Estimated rebuild effort: about 1.1 person-years · Weakest lens: Production Readiness, 31
Findings by how serious they are
184 critical1916 serious188 minor
12 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
25 October 2026, 04:45 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds Watchdog. It is open to any tool that
implements it, and today Watchdog is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. Watchdog works it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
79of 82 dimensions measured by tools. The other 3 are advisory notes from an AI model, which explain the code but don't count towards the score.
2267of 2288 findings point to an exact file and line, so you can open each one in the code. The other 21 concern the repository as a whole, such as missing documentation.
82dimensions across 7 lenses, read from 133,792 lines of product code in 2 projects.
zhayujie/CowAgent scores 37 out of 100, but it is rated At risk while a critical security finding is open; the score itself is unchanged. Watchdog judged it as a template, sample or demo, meant to be read or copied, so the dimensions about building, releasing and running a product don't apply, and its lenses are rated against a lower bar. The score itself is worked out as for any repository.
The weakest lens counts most in the score, and here that is Production Readiness, which scores 31 and is rated Weak. Its Security & performance tooling dimension scores 0 out of 10, and until that reaches 4, Production Readiness can't be rated higher than Adequate. The first actions are to resolve the 1 Leaked secret finding(s) in REDACTED Scanning and to resolve the 1 Banned license finding(s) in License Compliance, and if Production Readiness rose to 70, the score would rise from 37 to about 43.
184 findings are critical: 80 in Static Analysis (SAST), 40 in Forms & labels, 29 in Keyboard semantics, 25 in Dependency Vulnerabilities, four in Secrets (history), one in Change Coupling, one in Dependency Hygiene, one in IaC & Container Security, one in License Compliance, one in REDACTED Scanning and one in Test Reliability.
Watchdog couldn't measure 12 dimensions in this code, among them Code Coverage, Internal API Consistency and Navigability, so they are left out of the score. The product code is 133,792 lines, which would take an estimated 1.1 person-years, around €170,000, to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Production Readiness rose from 31 to 70, the lowest score rated Strong, the score would rise from 37 to about 43.
Code composition: what the lines of code are
Product code 69%Tests 31%
New since the last survey: 271 findings
These 271 critical or serious findings weren't in the previous survey, on 11 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
Watchdog compares every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 524 findings
These 524 critical or serious findings were in the previous survey, on 11 October 2026, and are gone from this one. The first 100 are listed here.
Code Duplication · Duplicated block with local edits (9 matched lines × 2 locations) channel/web/static/js/views/menu-editor.js
Rebuild cost: about €170,000 · Estimate
Cost to rebuild
€55,000 to €280,000, for 915 to 2,902 hours of work, about 1.1 person-years for 1 to 3 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 37. 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: 133,792 lines of product code
How the estimate is made: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 1 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED.
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €170,000 to build again, about 1.1 person-years of work. Its weakest lens is Production Readiness, at 31 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 1 Leaked secret finding(s) in REDACTED Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 5 points for low effort, because it clears the 1 REDACTED Scanning findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.8 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 6% to 13% on every change. The history of the code shows how much it changes: about 273,398 lines over the last 90 days, which is about 1,108,781 lines a year. At that pace, the extra work comes to an estimated 154.9 to 929.4 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change; 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: 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.
404 modules, with 228 dependencies between them. Every module uses only modules listed above it, so there are no loops.
The table shows the 40 modules with the most connections; 364 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.
agent.skills.manager uses agent.skills.types, so a change to agent.skills.types can break agent.skills.manager, while a change to agent.skills.manager can't break agent.skills.types.
Position
Below the diagonal: agent.skills.manager uses a module listed above it, which is the healthy direction.
agent.tools.browser.browser_tool uses agent.tools.base_tool, so a change to agent.tools.base_tool can break agent.tools.browser.browser_tool, while a change to agent.tools.browser.browser_tool can't break agent.tools.base_tool.
Position
Below the diagonal: agent.tools.browser.browser_tool uses a module listed above it, which is the healthy direction.
agent.tools.scheduler.scheduler_tool uses agent.tools.base_tool, so a change to agent.tools.base_tool can break agent.tools.scheduler.scheduler_tool, while a change to agent.tools.scheduler.scheduler_tool can't break agent.tools.base_tool.
Position
Below the diagonal: agent.tools.scheduler.scheduler_tool uses a module listed above it, which is the healthy direction.
agent.tools.scheduler.scheduler_tool uses bridge.context, so a change to bridge.context can break agent.tools.scheduler.scheduler_tool, while a change to agent.tools.scheduler.scheduler_tool can't break bridge.context.
Position
Below the diagonal: agent.tools.scheduler.scheduler_tool uses a module listed above it, which is the healthy direction.
channel.chat_channel uses bridge.context, so a change to bridge.context can break channel.chat_channel, while a change to channel.chat_channel can't break bridge.context.
Position
Below the diagonal: channel.chat_channel uses a module listed above it, which is the healthy direction.
channel.chat_channel uses bridge.reply, so a change to bridge.reply can break channel.chat_channel, while a change to channel.chat_channel can't break bridge.reply.
Position
Below the diagonal: channel.chat_channel uses a module listed above it, which is the healthy direction.
desktop.src.renderer.src.types uses desktop.src.main.python-manager, so a change to desktop.src.main.python-manager can break desktop.src.renderer.src.types, while a change to desktop.src.renderer.src.types can't break desktop.src.main.python-manager.
Position
Below the diagonal: desktop.src.renderer.src.types uses a module listed above it, which is the healthy direction.
models.baidu.baidu_wenxin_session uses models.session_manager, so a change to models.session_manager can break models.baidu.baidu_wenxin_session, while a change to models.baidu.baidu_wenxin_session can't break models.session_manager.
Position
Below the diagonal: models.baidu.baidu_wenxin_session uses a module listed above it, which is the healthy direction.
models.chatgpt.chat_gpt_session uses models.session_manager, so a change to models.session_manager can break models.chatgpt.chat_gpt_session, while a change to models.chatgpt.chat_gpt_session can't break models.session_manager.
Position
Below the diagonal: models.chatgpt.chat_gpt_session uses a module listed above it, which is the healthy direction.
models.openai_compatible_bot uses models.openai.openai_http_client, so a change to models.openai.openai_http_client can break models.openai_compatible_bot, while a change to models.openai_compatible_bot can't break models.openai.openai_http_client.
Position
Below the diagonal: models.openai_compatible_bot uses a module listed above it, which is the healthy direction.
desktop.src.renderer.src.lib uses desktop.src.renderer.src.types, so a change to desktop.src.renderer.src.types can break desktop.src.renderer.src.lib, while a change to desktop.src.renderer.src.lib can't break desktop.src.renderer.src.types.
Position
Below the diagonal: desktop.src.renderer.src.lib uses a module listed above it, which is the healthy direction.
desktop.src.renderer.src.pages uses desktop.src.renderer.src.types, so a change to desktop.src.renderer.src.types can break desktop.src.renderer.src.pages, while a change to desktop.src.renderer.src.pages can't break desktop.src.renderer.src.types.
Position
Below the diagonal: desktop.src.renderer.src.pages uses a module listed above it, which is the healthy direction.
desktop.src.renderer.src.store uses desktop.src.renderer.src.types, so a change to desktop.src.renderer.src.types can break desktop.src.renderer.src.store, while a change to desktop.src.renderer.src.store can't break desktop.src.renderer.src.types.
Position
Below the diagonal: desktop.src.renderer.src.store uses a module listed above it, which is the healthy direction.
models.chatgpt.chat_gpt_bot uses models.openai.openai_http_client, so a change to models.openai.openai_http_client can break models.chatgpt.chat_gpt_bot, while a change to models.chatgpt.chat_gpt_bot can't break models.openai.openai_http_client.
Position
Below the diagonal: models.chatgpt.chat_gpt_bot uses a module listed above it, which is the healthy direction.
models.chatgpt.chat_gpt_bot uses models.bot, so a change to models.bot can break models.chatgpt.chat_gpt_bot, while a change to models.chatgpt.chat_gpt_bot can't break models.bot.
Position
Below the diagonal: models.chatgpt.chat_gpt_bot uses a module listed above it, which is the healthy direction.
models.chatgpt.chat_gpt_bot uses models.chatgpt.chat_gpt_session, so a change to models.chatgpt.chat_gpt_session can break models.chatgpt.chat_gpt_bot, while a change to models.chatgpt.chat_gpt_bot can't break models.chatgpt.chat_gpt_session.
Position
Below the diagonal: models.chatgpt.chat_gpt_bot uses a module listed above it, which is the healthy direction.
models.chatgpt.chat_gpt_bot uses models.openai_compatible_bot, so a change to models.openai_compatible_bot can break models.chatgpt.chat_gpt_bot, while a change to models.chatgpt.chat_gpt_bot can't break models.openai_compatible_bot.
Position
Below the diagonal: models.chatgpt.chat_gpt_bot uses a module listed above it, which is the healthy direction.
models.gemini.google_gemini_bot uses bridge.context, so a change to bridge.context can break models.gemini.google_gemini_bot, while a change to models.gemini.google_gemini_bot can't break bridge.context.
Position
Below the diagonal: models.gemini.google_gemini_bot uses a module listed above it, which is the healthy direction.
models.gemini.google_gemini_bot uses bridge.reply, so a change to bridge.reply can break models.gemini.google_gemini_bot, while a change to models.gemini.google_gemini_bot can't break bridge.reply.
Position
Below the diagonal: models.gemini.google_gemini_bot uses a module listed above it, which is the healthy direction.
models.gemini.google_gemini_bot uses models.bot, so a change to models.bot can break models.gemini.google_gemini_bot, while a change to models.gemini.google_gemini_bot can't break models.bot.
Position
Below the diagonal: models.gemini.google_gemini_bot uses a module listed above it, which is the healthy direction.
models.linkai.link_ai_bot uses bridge.context, so a change to bridge.context can break models.linkai.link_ai_bot, while a change to models.linkai.link_ai_bot can't break bridge.context.
Position
Below the diagonal: models.linkai.link_ai_bot uses a module listed above it, which is the healthy direction.
models.linkai.link_ai_bot uses bridge.reply, so a change to bridge.reply can break models.linkai.link_ai_bot, while a change to models.linkai.link_ai_bot can't break bridge.reply.
Position
Below the diagonal: models.linkai.link_ai_bot uses a module listed above it, which is the healthy direction.
models.linkai.link_ai_bot uses models.session_manager, so a change to models.session_manager can break models.linkai.link_ai_bot, while a change to models.linkai.link_ai_bot can't break models.session_manager.
Position
Below the diagonal: models.linkai.link_ai_bot uses a module listed above it, which is the healthy direction.
models.linkai.link_ai_bot uses models.bot, so a change to models.bot can break models.linkai.link_ai_bot, while a change to models.linkai.link_ai_bot can't break models.bot.
Position
Below the diagonal: models.linkai.link_ai_bot uses a module listed above it, which is the healthy direction.
models.linkai.link_ai_bot uses models.chatgpt.chat_gpt_session, so a change to models.chatgpt.chat_gpt_session can break models.linkai.link_ai_bot, while a change to models.linkai.link_ai_bot can't break models.chatgpt.chat_gpt_session.
Position
Below the diagonal: models.linkai.link_ai_bot uses a module listed above it, which is the healthy direction.
models.linkai.link_ai_bot uses models.openai_compatible_bot, so a change to models.openai_compatible_bot can break models.linkai.link_ai_bot, while a change to models.linkai.link_ai_bot can't break models.openai_compatible_bot.
Position
Below the diagonal: models.linkai.link_ai_bot uses a module listed above it, which is the healthy direction.
models.minimax.minimax_bot uses bridge.context, so a change to bridge.context can break models.minimax.minimax_bot, while a change to models.minimax.minimax_bot can't break bridge.context.
Position
Below the diagonal: models.minimax.minimax_bot uses a module listed above it, which is the healthy direction.
models.minimax.minimax_bot uses bridge.reply, so a change to bridge.reply can break models.minimax.minimax_bot, while a change to models.minimax.minimax_bot can't break bridge.reply.
Position
Below the diagonal: models.minimax.minimax_bot uses a module listed above it, which is the healthy direction.
models.minimax.minimax_bot uses models.bot, so a change to models.bot can break models.minimax.minimax_bot, while a change to models.minimax.minimax_bot can't break models.bot.
Position
Below the diagonal: models.minimax.minimax_bot uses a module listed above it, which is the healthy direction.
models.openai.open_ai_bot uses models.openai.openai_http_client, so a change to models.openai.openai_http_client can break models.openai.open_ai_bot, while a change to models.openai.open_ai_bot can't break models.openai.openai_http_client.
Position
Below the diagonal: models.openai.open_ai_bot uses a module listed above it, which is the healthy direction.
models.openai.open_ai_bot uses models.bot, so a change to models.bot can break models.openai.open_ai_bot, while a change to models.openai.open_ai_bot can't break models.bot.
Position
Below the diagonal: models.openai.open_ai_bot uses a module listed above it, which is the healthy direction.
models.openai.open_ai_bot uses models.openai_compatible_bot, so a change to models.openai_compatible_bot can break models.openai.open_ai_bot, while a change to models.openai.open_ai_bot can't break models.openai_compatible_bot.
Position
Below the diagonal: models.openai.open_ai_bot uses a module listed above it, which is the healthy direction.
models.xunfei.xunfei_spark_bot uses bridge.context, so a change to bridge.context can break models.xunfei.xunfei_spark_bot, while a change to models.xunfei.xunfei_spark_bot can't break bridge.context.
Position
Below the diagonal: models.xunfei.xunfei_spark_bot uses a module listed above it, which is the healthy direction.
models.xunfei.xunfei_spark_bot uses bridge.reply, so a change to bridge.reply can break models.xunfei.xunfei_spark_bot, while a change to models.xunfei.xunfei_spark_bot can't break bridge.reply.
Position
Below the diagonal: models.xunfei.xunfei_spark_bot uses a module listed above it, which is the healthy direction.
models.xunfei.xunfei_spark_bot uses models.bot, so a change to models.bot can break models.xunfei.xunfei_spark_bot, while a change to models.xunfei.xunfei_spark_bot can't break models.bot.
Position
Below the diagonal: models.xunfei.xunfei_spark_bot uses a module listed above it, which is the healthy direction.
models.zhipuai.zhipuai_bot uses models.bot, so a change to models.bot can break models.zhipuai.zhipuai_bot, while a change to models.zhipuai.zhipuai_bot can't break models.bot.
Position
Below the diagonal: models.zhipuai.zhipuai_bot uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 36% · Weak · gated by D1, D2, R3, X4 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
117
High / Critical
A03:2025 — Software Supply Chain Failures
39
High / Critical
A02:2025 — Security Misconfiguration
9
High / Critical
A07:2025 — Authentication Failures
6
High / Critical
Roadmap
Immediately resolve the leaked secret in REDACTED and the banned license violation to address critical compliance and security risks. Integrate a SAST step into the CI pipeline to automatically block security regressions before they are merged. Finally, document the disaster recovery procedures with clear RTO and RPO targets, and expand test coverage to include currently unreached production modules.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 1 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED.
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
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.
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 — 184
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 — 1916
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 — 188
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 12
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 79 of 82 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 3 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 82 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, 2267 of 2288 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: test source is present (.py, .mjs, .cjs) but the built-in coverage collector has no runner for this repository's ecosystem — so this suite was never executed by it. Not scored — this is a gap in the analyzer's language coverage, not a defect in the repo. To have real coverage read, produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`, or lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`) 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`, or lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`) 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.
D10 Test Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 21 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 617 test source file(s) (.py) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT SCORED: this repository's production source includes .tsx, and the built-in reliability runner cannot re-run the .tsx test suite(s) — so reliability was not measured for the repository as a whole. The Python (repository root, 615 test files): measured (1 flaky) suite(s) did re-run, and came back with 1 flaky across 1 measured tier(s) — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — test reliability is excluded from the score rather than counted.
D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its Python distribution dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 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 (desktop/package.json), 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.
D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `channel/web/tools/check-load-order.mjs` produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
AC2 Forms & labels — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 64 further occurrence(s) are not listed individually; the score already reflects all 104.
AC4 Keyboard semantics — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 13 further occurrence(s) are not listed individually; the score already reflects all 53.
AC6 Visual & motion safety — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 36 further occurrence(s) are not listed individually; the score already reflects all 76.
AX1 Captive dependencies — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in app.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.
AXR1 Runtime accessibility — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DockerCompose (REDACTED). compose up failed (exit 18 — an image could not be pulled) — chatgpt-on-wechat Pulling chatgpt-on-wechat Error Get "https://registry-1.docker.io/v2/": Forbidden Error response from daemon: Get "https://registry-1.docker.io/v2/": Forbidden; the earlier `compose pull` step reported: chatgpt-on-wechat Pulling chatgpt-on-wechat Error Get "https://registry-1.docker.io/v2/": Forbidden Error response from daemon: Get "https://registry-1.docker.io/v2/": Forbidden; the runtime sandbox reaches registries only through the in-fence pull-through mirror, so an image the mirror does not carry cannot be fetched — this is a limit of our sandbox, not of your stack; runtime evidence skipped.
C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'sqlite3' is imported (agent/memory/vector_backend.py:7), 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'sqlite3' is imported (agent/memory/vector_backend.py:7), 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'sqlite3' is imported (agent/memory/vector_backend.py:7), 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 113 further occurrence(s) are not listed individually; the score already reflects all 153.
R10 Code Duplication — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 115 further occurrence(s) are not listed individually; the score already reflects all 155.
R3 Large Files — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 1 further occurrence(s) are not listed individually; the score already reflects all 41.
R4 Test Coverage — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 83 further occurrence(s) are not listed individually; the score already reflects all 123.
S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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.
X24 Document value interpolated into markup unescaped — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 259 further occurrence(s) are not listed individually; the score already reflects all 299.
X3 Exception handling — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 448 further occurrence(s) are not listed individually; the score already reflects all 488.
X4 Structured logging — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 247 further occurrence(s) are not listed individually; the score already reflects all 287.
X7 Silent fallback defaults — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 10 further occurrence(s) are not listed individually; the score already reflects all 50.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (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.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
The LLM boundary
LLM-set scores this run (3): D19, D21, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.
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.
433 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was send.startSSE::processSSEItem at 133. A further 4 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 bot_factory.create_bot at 20 — they are counted neither in the figure above nor in this dimension's score. 2 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: models/bot_factory.py (bot_factory.create_bot at 20), voice/factory.py (factory.create_voice at 19). 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.
+ 366 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 23 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with send.startSSE::processSSEItem (cyclomatic 133), startSSE::processSSEItem (cyclomatic 133), chatStore.useChatStore.attachStream (cyclomatic 112). — 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 23 together lifts Cyclomatic Complexity from 2.0 to about 4.0/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 579 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 38 bodies over 60 down to 60 or less in Cognitive Complexity — start with Godcmd.on_handle_context (cognitive 232), startSSE::processSSEItem (cognitive 217), AgentStreamExecutor._call_llm_stream (cognitive 206). — 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 38 together lifts Cognitive Complexity from 2.0 to about 3.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes6.4 / 10Adequate✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
Resolve the 70 FileTooLong finding(s) in God Classes — start with service.py (2), i18n.js, models.js. — One of this dimension's main actionable groups (70 warning-level).
Resolve the 33 FunctionTooLong finding(s) in God Classes — start with TasksPage.tsx (2), send.js, MenuEditor.tsx. — One of this dimension's main actionable groups (33 warning-level).
Resolve the 13 TooManyMethods finding(s) in God Classes — start with client.ts, cow_cli.py, cloud_client.py. — One of this dimension's main actionable groups (13 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.
235 duplicated block group(s) detected. A further 28 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. Measured on part of this repository only: .tsx (15% of production source) was not exposed to THIS dimension's token comparison and is not in this count; duplication there is measured by R10 Code Duplication, the frontend lens's card running the same clone algorithm over the JS/TS token stream.
+ 146 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 14 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with wechatmp_channel.py (2), agent_initializer.py, scheduler.py. — One of this dimension's main actionable groups (14 warning-level).
Resolve the 11 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with REDACTED (2), REDACTED, discord_channel.py. — One of this dimension's main actionable groups (11 warning-level).
Resolve the 9 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with feishu_channel.py, REDACTED, skill.py. — One of this dimension's main actionable groups (9 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 · Coupling10.0 / 10Exemplary✓ 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.
2 production modules (npm+Python), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 0 module(s) off the main sequence.
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 1 Low cohesion finding(s) in Cohesion (LCOM4) — start with cloud_client.py. — One of this dimension's main actionable groups (1 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.
3722 test methods: 3722 unit, 0 integration, 0 BDD, 0 e2e. The JavaScript/TypeScript suite contributes 21 `it`/`test` case(s) across 3 test file(s) declaring at least one; its tier split is read from package names and paths only. The Python suite contributes 3701 test function(s) across 614 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
0 skipped, 0 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 21 tests. Measured on the JavaScript/TypeScript suite only — at least 617 test source file(s) (.py) went unread, so its test quality is unmeasured and is not in these counts.
What it measures: Whether dependencies are current, secure, and not bloated.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.
1 outdated, 0 yanked pinned Python distributions. 1 of 36 shipped distributions were graded against pypi.org (0 not published there, 35 declared without an exact pin, which installs the newest release the declaration admits and so cannot be behind one). Only EXACT pins are graded for currency: a floor or a range already installs the newest release it admits, so reporting one would report this repository for being current. Whether a deliberate upper cap has itself gone stale is a different and weaker question, and is not asked. Whether any distribution is UNMAINTAINED is not graded — PyPI publishes no maintenance status, and release age does not stand in for one. Lockfiles are not read (poetry.lock, uv.lock, Pipfile.lock, pdm.lock), so a lock-resolved install is outside this verdict. Known CVEs in this dependency graph are D30's question.
Outdated: websocket-client
What to do
Enforce Dependency Hygiene in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
Resolve the 1 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Enforce REDACTED Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
1 of 112 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 36 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (76 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. 8 of them publish no licence on PyPI this pass can read; that is missing data, not a violation, and none of them is charged. ★ COVERAGE OF THIS VERDICT: it grades this repository's Python distribution dependencies and nothing else. The repository also declares package.json, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.
Banned license: python-telegram-bot
What to do
Resolve the 1 Banned license finding(s) in License Compliance. — One of this dimension's main actionable groups (1 issue-level).
Enforce License Compliance in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d14_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Top hotspots: REDACTED (57×94=5358); bridge/agent_bridge.py (57×82=4674); desktop/src/renderer/src/pages/settings/BasicSettings.tsx (25×136=3400) Repeated repair below the complexity floor: REDACTED (12 of 18 changes were fixes); agent/memory/storage.py (10 of 15 changes were fixes); common/utils.py (9 of 17 changes were fixes)
Hotspot: REDACTED · ×133REDACTED:1573
Repeated repair: REDACTED · ×52REDACTED:616
What to do
Resolve the 133 Hotspot finding(s) in Churn × Complexity Hotspots — start with service.py (3), REDACTED (2), backup.py (2). — One of this dimension's main actionable groups (133 warning-level).
Resolve the 52 Repeated repair finding(s) in Churn × Complexity Hotspots — start with utils.py (2), REDACTED, storage.py. — One of this dimension's main actionable groups (52 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.0 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
32 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is desktop/src/renderer/src/pages/TasksPage.tsx. Counted over 324 of the 468 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
Further sole-owners (lower concentration)
What to do
Resolve the 1 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
6 deducted task-comment markers across 133792 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
Resolve the 6 TodoComment finding(s) in Explicit Debt — start with init_skill.py (2), dingtalk_channel.py, wechatmp_channel.py. — One of this dimension's main actionable groups (6 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: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.
This repository is a comprehensive software suite with strong documentation: the root README gives an overview and links to release, license, docs, WeChat/WeCom, Trendshift, and multilingual versions; desktop/, docs/, plugins/, skills/, channel/wechatcom/, and channel/wechatmp/ directories each have their own focused READMEs covering installation, architecture, usage, contribution, and the specific channels they implement. The document outline for each directory is visible in its body (e.g., '## 插件化初衷' under plugins/README.md), so every listed section exists and must not be flagged as missing. The only unflagged element is an internal jargon focus; no such terms appear in any document, so it does not fall into the forbidden category. A comprehensive documentation set for the CowAgent project and its plugins: the repository's READMEs describe the project (CowAgent as a super AI assistant) and the docs/ja/README, docs/zh/README, and several plugin directories. The main strengths are clear, well-organized architecture/design documents (one full architecture/doc file plus an outline for each of the 23 READMEs), and detailed plugin documentation covering purpose, configuration, usage examples, and a clipped but complete list of features for each plugin. There is no single document that lacks overview/installation/usage/contribution guidance; all four are present in the READMEs. This repository's README is a well-illustrated overview of CowAgent as an open-source super AI assistant that actively thinks and plans tasks, operates computers and external resources, creates and executes Skills, builds knowledge bases with long-term memory, constructs multi-agent teams, and evolves autonomously. It includes release badges, links to the Chinese documentation site, a Discord invite, and a Trendshift repository badge. The README is clipped mid-documentation outline (far-right) before any installation/usage/contribution guidance or architecture docs appear.
What to do
Improve Documentation Quality — currently 8.4/10. — This repository is a comprehensive software suite with strong documentation: the root README gives an overview and links to release, license, docs, WeChat/WeCom, Trendshift, and multilingual versions; desktop/, docs/, plugins/, skills/, channel/wechatcom/, and channel/wechatmp/ directories each have their own focused READMEs covering installation, architecture, usage, contribution, and the specific channels they implement. The document outline for each directory is visible in its body (e.g., '## 插件化初衷' under plugins/README.md), so every listed section exists and must not be flagged as missing. The only unflagged element is an internal jargon focus; no such terms appear in any document, so it does not fall into the forbidden category. A comprehensive documentation set for the CowAgent project and its plugins: the repository's READMEs describe the project (CowAgent as a super AI assistant) and the docs/ja/README, docs/zh/README, and several plugin directories. The main strengths are clear, well-organized architecture/design documents (one full architecture/doc file plus an outline for each of the 23 READMEs), and detailed plugin documentation covering purpose, configuration, usage examples, and a clipped but complete list of features for each plugin. There is no single document that lacks overview/installation/usage/contribution guidance; all four are present in the READMEs. This repository's README is a well-illustrated overview of CowAgent as an open-source super AI assistant that actively thinks and plans tasks, operates computers and external resources, creates and executes Skills, builds knowledge bases with long-term memory, constructs multi-agent teams, and evolves autonomously. It includes release badges, links to the Chinese documentation site, a Discord invite, and a Trendshift repository badge. The README is clipped mid-documentation outline (far-right) before any installation/usage/contribution guidance or architecture docs appear.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.
2 of 2 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: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
4 finding(s): 0 critical, 4 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
What to do
Resolve the 4 REDACTED finding(s) in Secrets (history) — start with REDACTED (2), REDACTED, REDACTED. — One of this dimension's main actionable groups (4 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
117 finding(s): 0 critical, 80 high, 35 medium, 2 low. 48 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 2 file(s) — `channel/web/tools/check-load-order.mjs`, `REDACTED` (line 145, line 219, line 220) — 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 3 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 20 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 8 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED, REDACTED. — One of this dimension's main actionable groups (8 issue-level).
Resolve the 7 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (7 issue-level).
No action in Static Analysis (SAST) — all 48 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (48 issue-level, 0 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.
Resolve the 22 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (22). — One of this dimension's main actionable groups (22 issue-level).
Resolve the 2 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
Resolve the 1 High vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 1 High IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 5 Medium IaC finding(s) in IaC & Container Security — start with REDACTED.latest (4), REDACTED. — One of this dimension's main actionable groups (5 warning-level).
Resolve the 3 Low IaC finding(s) in IaC & Container Security — start with REDACTED.latest (3). — One of this dimension's main actionable groups (3 recommendation-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
10 of 324 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is skills/skill-creator/scripts/init_skill.py. Counted over 324 of the 468 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 1 Boundary-crossing change coupling finding(s) in Change Coupling — start with web_channel.py. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 13 Change coupling finding(s) in Change Coupling — start with preload.ts (2), dungeon.py, edit.py. — One of this dimension's main actionable groups (13 warning-level).
Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with doubao_bot.py. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
Resolve the 3 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (3 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 36 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
✓ On the Gold path — maintain.
Detailed fixes: d44_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives5.4 / 10Adequate✓ Tool-verified
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation). (×3) — channel/web/static/js/workspace.js:332, REDACTED:135, desktop/src/renderer/src/components/MessageBubble.tsx:267
What to do
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Do you agree with this assessment?
AC2 · Forms & labels4.9 / 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 <i> 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. — channel/web/static/js/chat/workspace-selector.js:224
This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×20) — channel/web/static/js/views/agents.js:335, channel/web/static/js/views/agents.js:339, channel/web/static/js/views/agents.js:349, …
This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×2) — channel/web/static/js/views/agents.js:340, channel/web/static/js/views/sessions.js:857
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. (×11) — channel/web/static/js/views/agents.js:344, channel/web/static/js/views/channels.js:276, channel/web/static/js/views/channels.js:285, …
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). (×6) — channel/web/static/js/views/models.js:550, channel/web/static/js/views/models.js:1286, REDACTED:1947, …
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Do you agree with this assessment?
AC3 · Page structure6.7 / 10Strong✓ Tool-verified
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. — channel/web/chat.html:2
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. This document's body is only the mount point <div id="root">, so there is no content here to wrap — render the <main> from the component mounted into it. — desktop/src/renderer/index.html:2
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler. (×6) — channel/web/static/js/chat/render.js:332, channel/web/static/js/chat/send.js:415, channel/web/static/js/chat/send.js:542, …
The repo's own CSS styles .composer-menu-item with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. (×2) — channel/web/static/js/views/agents.js:1198, channel/web/static/js/views/agents.js:1217
The repo's own CSS styles .cfg-dropdown-item with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. — channel/web/static/js/views/channels.js:232
The repo's own CSS styles .cfg-dropdown-selected with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. (×9) — channel/web/static/js/views/channels.js:502, channel/web/static/js/views/models.js:447, channel/web/static/js/views/models.js:454, …
The repo's own CSS styles .file-card-btn with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. — channel/web/static/js/workspace.js:674
The repo's own CSS styles .crumb with `cursor: pointer`, so this <span> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. (×2) — channel/web/static/js/workspace.js:975, channel/web/static/js/workspace.js:980
An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action. (×9) — channel/web/templates/layout/sidebar.html:30, channel/web/templates/layout/sidebar.html:45, channel/web/templates/layout/sidebar.html:50, …
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) — channel/web/templates/modals/menu-editor.html:3, desktop/src/renderer/src/components/Lightbox.tsx:45
This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus. (×3) — desktop/src/renderer/src/components/ChatTimeline.tsx:334, desktop/src/renderer/src/components/ChatTimeline.tsx:350, desktop/src/renderer/src/components/ContextUsagePopover.tsx:286
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler. (×4) — desktop/src/renderer/src/components/FileCard.tsx:80, desktop/src/renderer/src/components/FileCard.tsx:99, desktop/src/renderer/src/components/FileCard.tsx:104, …
This <g> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus. — desktop/src/renderer/src/components/KnowledgeGraph.tsx:384
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.
<input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×13) — channel/web/static/js/views/channels.js:276, channel/web/static/js/views/channels.js:285, channel/web/static/js/views/models.js:985, …
This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade. (×8) — channel/web/static/js/views/models.js:744, channel/web/static/js/views/models.js:779, REDACTED:278, …
<button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). — REDACTED:1282
<textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×6) — desktop/src/renderer/src/components/DocEditor.tsx:179, desktop/src/renderer/src/components/FileEditor.tsx:84, desktop/src/renderer/src/pages/AgentsPage.tsx:472, …
`.art-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) — desktop/src/renderer/src/index.css:710, channel/web/static/css/artifacts.css:95
`.art-card` 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) — desktop/src/renderer/src/index.css:766, channel/web/static/css/artifacts.css:147
`.art-name-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) — desktop/src/renderer/src/index.css:1122, channel/web/static/css/artifacts.css:576
`.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. — channel/web/static/css/chat.css:79
`.cfg-dropdown` 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. — channel/web/static/css/components.css:192
`.me-art-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. — channel/web/static/css/menu.css:300
`.session-title-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. — channel/web/static/css/sessions.css:511
`.workspace-preview-content .ws-editor` 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. — channel/web/static/css/workspace.css:292
`textarea.doc-editor` 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. — channel/web/static/css/workspace.css:319
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.
Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.
Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.
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 124 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
What to do
Enforce accessibility in the toolchain: add 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.
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.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the repo is organised deliberately — src/test separation and consistent project naming.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
What to do
Group production code under src/ (or split deliberately, e.g. backend/ + frontend/) so production and tooling code aren't mixed at the root.
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
docs/channels/index.mdx links to `/channels/weixin`, but `channels/weixin` 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. — docs/channels/index.mdx:14
docs/channels/index.mdx links to `/channels/web`, but `channels/web` 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. — docs/channels/index.mdx:15
docs/channels/index.mdx links to `/channels/feishu`, but `channels/feishu` 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. — docs/channels/index.mdx:16
docs/channels/index.mdx links to `/channels/dingtalk`, but `channels/dingtalk` 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. — docs/channels/index.mdx:17
docs/channels/index.mdx links to `/channels/wecom-bot`, but `channels/wecom-bot` 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. — docs/channels/index.mdx:18
docs/channels/index.mdx links to `/channels/qq`, but `channels/qq` 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. — docs/channels/index.mdx:19
docs/channels/index.mdx links to `/channels/wecom`, but `channels/wecom` 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. — docs/channels/index.mdx:20
docs/channels/index.mdx links to `/channels/wechatmp`, but `channels/wechatmp` 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. — docs/channels/index.mdx:21
docs/channels/index.mdx links to `/channels/wechat-kf`, but `channels/wechat-kf` 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. — docs/channels/index.mdx:22
docs/channels/index.mdx links to `/channels/telegram`, but `channels/telegram` 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. — docs/channels/index.mdx:23
docs/channels/index.mdx links to `/channels/slack`, but `channels/slack` 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. — docs/channels/index.mdx:24
docs/channels/index.mdx links to `/channels/discord`, but `channels/discord` 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. — docs/channels/index.mdx:25
docs/channels/index.mdx links to `/models/index`, but `models/index` 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. — docs/channels/index.mdx:31
docs/channels/web.mdx links to `/extensions/chat-api`, but `extensions/chat-api` 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. — docs/channels/web.mdx:28
docs/channels/web.mdx links to `/intro/architecture#project-workspace`, but `intro/architecture` 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. — docs/channels/web.mdx:119
docs/channels/web.mdx links to `/extensions/custom-menu`, but `extensions/custom-menu` 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. — docs/channels/web.mdx:135
docs/cli/process.mdx links to `/tools/browser`, but `tools/browser` 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. — docs/cli/process.mdx:98
docs/extensions/agent-mail.mdx names `.env`, but no file or folder `.env` exists. 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. — docs/extensions/agent-mail.mdx:21
docs/extensions/chat-api.mdx links to `/channels/web`, but `channels/web` 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. — docs/extensions/chat-api.mdx:42
docs/guide/desktop.mdx links to `/guide/quick-start`, but `guide/quick-start` 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. — docs/guide/desktop.mdx:40
docs/guide/manual-install.mdx links to `/models/index`, but `models/index` 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. — docs/guide/manual-install.mdx:59
docs/guide/quick-start.mdx links to `/cli/index`, but `cli/index` 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. — docs/guide/quick-start.mdx:54
docs/intro/architecture.mdx links to `/multi-agent/team`, but `multi-agent/team` 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. — docs/intro/architecture.mdx:75
docs/intro/features.mdx links to `/memory`, but `memory` 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. — docs/intro/features.mdx:24
docs/intro/features.mdx links to `/memory/deep-dream`, but `memory/deep-dream` 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. — docs/intro/features.mdx:24
docs/intro/features.mdx links to `/memory/self-evolution`, but `memory/self-evolution` 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. — docs/intro/features.mdx:24
docs/intro/features.mdx links to `/knowledge`, but `knowledge` 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. — docs/intro/features.mdx:41
docs/intro/features.mdx links to `/skills/install`, but `skills/install` 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. — docs/intro/features.mdx:126
docs/intro/features.mdx links to `/multi-agent/team`, but `multi-agent/team` 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. — docs/intro/features.mdx:161
docs/intro/features.mdx links to `/tools/delegate`, but `tools/delegate` 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. — docs/intro/features.mdx:161
docs/intro/features.mdx links to `/multi-agent/subagent`, but `multi-agent/subagent` 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. — docs/intro/features.mdx:161
docs/memory/deep-dream.mdx names `MEMORY.md`, but no file or folder `MEMORY.md` exists. 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. — docs/memory/deep-dream.mdx:29
docs/memory/index.mdx links to `/memory/deep-dream`, but `memory/deep-dream` 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. — docs/memory/index.mdx:30
docs/memory/index.mdx names `MEMORY.md`, but no file or folder `MEMORY.md` exists. 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. — docs/memory/index.mdx:57
docs/memory/self-evolution.mdx links to `/memory/deep-dream`, but `memory/deep-dream` 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. — docs/memory/self-evolution.mdx:16
docs/models/index.mdx links to `/models/claude`, but `models/claude` 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. — docs/models/index.mdx:15
docs/models/index.mdx links to `/models/glm`, but `models/glm` 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. — docs/models/index.mdx:19
docs/models/index.mdx links to `/models/qwen`, but `models/qwen` 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. — docs/models/index.mdx:20
docs/models/index.mdx links to `/models/kimi`, but `models/kimi` 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. — docs/models/index.mdx:21
docs/models/index.mdx links to `/models/custom`, but `models/custom` 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. — docs/models/index.mdx:26
What to do
Reconcile the README with reality: docs/channels/index.mdx links to `/channels/weixin`, but `channels/weixin` does not exist; docs/channels/index.mdx links to `/channels/web`, but `channels/web` does not exist; docs/channels/index.mdx links to `/channels/feishu`, but `channels/feishu` does not exist; docs/channels/index.mdx links to `/channels/dingtalk`, but `channels/dingtalk` does not exist; docs/channels/index.mdx links to `/channels/wecom-bot`, but `channels/wecom-bot` 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 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 · Observability6.5 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Only 1/2 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `desktop`.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Add OpenTelemetry tracing/metrics (opentelemetry-sdk) so requests are traceable across the system, not just health-probable.
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 72772 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
What to do
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
Deployment is orchestrated by compose, but no service declares a `healthcheck:` and nothing pins a previous image to fall back to — the runtime can tell that the container is up, not that it is serving, so a bad release is harder to detect and reverse.
What to do
Add a `healthcheck:` to the served compose service — probing the endpoint it already answers on where it has one — with `depends_on: condition: service_healthy` on whatever waits for it, and keep the deployed image tag immutable and recorded so rolling back is re-pointing at the previous tag rather than rebuilding.
Do you agree with this assessment?
P5 · DR & Backup4.0 / 10Adequate✓ Tool-verified
Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.
Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.
What to do
Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
No persistence guard on critical data stores — use Docker named volumes (or your orchestrator's persistent-volume equivalent) so the data store can't be wiped by a container recreate (or, in cloud, set purge-protection / soft-delete / prevent_destroy).
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
`fs.mkdirSync` in `downloadIco` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — desktop/src/main/app-icon.ts:133
`fs.writeFileSync` in `downloadIco` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — desktop/src/main/app-icon.ts:134
`fs.existsSync` in `writeIcoFromCachedPng` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — desktop/src/main/app-icon.ts:246
`fs.mkdirSync` in `writeIcoFromCachedPng` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — desktop/src/main/app-icon.ts:250
`fs.writeFileSync` in `writeIcoFromCachedPng` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — desktop/src/main/app-icon.ts:251
`fs.readFileSync` in `recordShortcutName` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — desktop/src/main/app-icon.ts:535
`fs.mkdirSync` in `start` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:767
`fs.existsSync` in `start` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:776
What to do
TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
Do you agree with this assessment?
R1 · Type Safety6.9 / 10Strong✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
111 typed · 51 plain JS — the untyped files are channel/web/static/js/boot.js, channel/web/static/js/chat/composer-input.js, channel/web/static/js/chat/context-usage.js, channel/web/static/js/chat/message-actions.js, channel/web/static/js/chat/new-chat.js, channel/web/static/js/chat/render.js (+45 more).
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.
20 duplicated blocks under desktop/src/renderer/src/ have copies in at least two of the sibling directories components, layout, pages — 11 of them are reported below, and 9 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 20 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 20 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 20 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — desktop/src/renderer/src/components/ChannelTeamSelect.tsx:38
16 duplicated blocks under the repository root have copies in at least two of the sibling directories channel, desktop — 15 of them are reported below, and 1 is counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 16 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 16 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 16 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — REDACTED:1450
8 duplicated blocks under channel/web/static/js/ have copies in at least two of the sibling directories chat, core, views — 5 of them are reported below, and 3 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 8 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 8 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 8 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — channel/web/static/js/core/confirm.js:35
channel/web/static/js/doc-editor.js:189 · channel/web/static/js/workspace.js:532 — the two spans are one implementation copied and then locally edited — 456 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. — channel/web/static/js/doc-editor.js:189
channel/web/static/js/views/channels-feishu.js:69 · channel/web/static/js/views/channels-wecom.js:90 — the two spans are one implementation copied and then locally edited — 383 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. — channel/web/static/js/views/channels-feishu.js:69
channel/web/static/js/views/channels-feishu.js:12 · channel/web/static/js/views/channels-wecom.js:34 — the two spans are one implementation copied and then locally edited — 288 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. — channel/web/static/js/views/channels-feishu.js:12
channel/web/static/js/views/models-custom-provider.js:129 · channel/web/static/js/views/models.js:2770 — the two spans are one implementation copied and then locally edited — 217 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. — channel/web/static/js/views/models-custom-provider.js:129
desktop/src/renderer/src/components/DocEditor.tsx:156 · desktop/src/renderer/src/components/FileEditor.tsx:61 — 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. — desktop/src/renderer/src/components/DocEditor.tsx:156
channel/web/static/js/chat/send.js:65 · channel/web/static/js/chat/send.js:171 — 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. — channel/web/static/js/chat/send.js:65
channel/web/static/js/views/models.js:941 · channel/web/static/js/views/models.js:1120 — the two spans are one implementation copied and then locally edited — 229 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — channel/web/static/js/views/models.js:941
REDACTED:1450 · desktop/src/renderer/src/pages/skills/frontmatter.ts:33 — the two spans are one implementation copied and then locally edited — 341 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:1450
channel/web/static/js/core/notify.js:88 · channel/web/static/js/core/notify.js:252 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — channel/web/static/js/core/notify.js:88
desktop/src/renderer/src/components/ChannelTeamSelect.tsx:38 · desktop/src/renderer/src/pages/ChannelsPage.tsx:318 — 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. — desktop/src/renderer/src/components/ChannelTeamSelect.tsx:38
REDACTED:411 · desktop/src/renderer/src/pages/skills/mcpConfig.ts:56 — the two spans are one implementation copied and then locally edited — 193 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:411
channel/web/static/js/chat/composer-input.js:366 · channel/web/static/js/chat/new-chat.js:188 — 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. — channel/web/static/js/chat/composer-input.js:366
channel/web/static/js/chat/render.js:21 · desktop/src/renderer/src/lib/fileKind.ts:152 — the two spans are one implementation copied and then locally edited — 182 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. — channel/web/static/js/chat/render.js:21
channel/web/static/js/core/confirm.js:35 · channel/web/static/js/views/channels.js:362 — the two spans are one implementation copied and then locally edited — 144 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. — channel/web/static/js/core/confirm.js:35
channel/web/static/js/chat/message-actions.js:50 · channel/web/static/js/chat/send.js:59 · channel/web/static/js/chat/send.js:163 — 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. — channel/web/static/js/chat/message-actions.js:50
channel/web/static/js/views/artifacts.js:340 · desktop/src/renderer/src/pages/artifacts/format.ts:8 — the two spans are one implementation copied and then locally edited — 216 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. — channel/web/static/js/views/artifacts.js:340
desktop/src/renderer/src/components/ContextUsageDonut.tsx:56 · desktop/src/renderer/src/components/ContextUsageDonut.tsx:125 — 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. — desktop/src/renderer/src/components/ContextUsageDonut.tsx:56
channel/web/static/js/chat/context-usage.js:39 · channel/web/static/js/chat/context-usage.js:128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — channel/web/static/js/chat/context-usage.js:39
channel/web/static/js/chat/state.js:213 · channel/web/static/js/chat/state.js:369 — 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. — channel/web/static/js/chat/state.js:213
channel/web/static/js/views/tasks.js:70 · desktop/src/renderer/src/pages/TasksPage.tsx:342 — the two spans are one implementation copied and then locally edited — 101 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. — channel/web/static/js/views/tasks.js:70
desktop/src/main/app-icon.ts:83 · desktop/src/main/http-relay.ts:61 — the two spans are one implementation copied and then locally edited — 78 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. — desktop/src/main/app-icon.ts:83
desktop/src/renderer/src/pages/KnowledgePage.tsx:1077 · desktop/src/renderer/src/pages/MemoryPage.tsx:314 — 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. — desktop/src/renderer/src/pages/KnowledgePage.tsx:1077
REDACTED:962 · desktop/src/renderer/src/pages/skills/SkillAddModal.tsx:102 — the two spans are one implementation copied and then locally edited — 144 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:962
desktop/src/renderer/src/components/ContextUsagePopover.tsx:165 · desktop/src/renderer/src/layout/NavRail.tsx:121 — the two spans are one implementation copied and then locally edited — 69 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. — desktop/src/renderer/src/components/ContextUsagePopover.tsx:165
desktop/src/renderer/src/pages/KnowledgePage.tsx:248 · desktop/src/renderer/src/pages/MemoryPage.tsx:75 — 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. — desktop/src/renderer/src/pages/KnowledgePage.tsx:248
desktop/src/renderer/src/pages/KnowledgePage.tsx:718 · desktop/src/renderer/src/pages/MemoryPage.tsx:204 — the 2 copies are spread across 2 files, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases. — desktop/src/renderer/src/pages/KnowledgePage.tsx:718
desktop/src/renderer/src/pages/TasksPage.tsx:213 · desktop/src/renderer/src/pages/TasksPage.tsx:451 — 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. — desktop/src/renderer/src/pages/TasksPage.tsx:213
desktop/src/renderer/src/pages/settings/BasicSettings.tsx:485 · desktop/src/renderer/src/pages/settings/CapabilityCard.tsx:193 — 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. — desktop/src/renderer/src/pages/settings/BasicSettings.tsx:485
desktop/src/renderer/src/pages/settings/ModelsTab.tsx:1137 · desktop/src/renderer/src/pages/settings/ModelsTab.tsx:1205 — 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. — desktop/src/renderer/src/pages/settings/ModelsTab.tsx:1137
desktop/src/renderer/src/store/docEditorStore.ts:291 · desktop/src/renderer/src/store/workspaceStore.ts:334 — 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. — desktop/src/renderer/src/store/docEditorStore.ts:291
channel/web/static/js/core/markdown.js:230 · channel/web/static/js/core/markdown.js:248 — 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. — channel/web/static/js/core/markdown.js:230
channel/web/static/js/views/models.js:613 · channel/web/static/js/views/models.js:1921 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — channel/web/static/js/views/models.js:613
channel/web/static/js/views/models.js:1030 · channel/web/static/js/views/models.js:1176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — channel/web/static/js/views/models.js:1030
channel/web/static/js/views/models.js:2416 · channel/web/static/js/views/models.js:2469 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — channel/web/static/js/views/models.js:2416
REDACTED:560 · desktop/src/renderer/src/pages/skills/McpEditorModal.tsx:188 — the two spans are one implementation copied and then locally edited — 125 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:560
desktop/src/renderer/src/pages/AgentsPage.tsx:178 · desktop/src/renderer/src/pages/settings/ChatApiCard.tsx:47 — 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. — desktop/src/renderer/src/pages/AgentsPage.tsx:178
desktop/src/renderer/src/pages/TasksPage.tsx:1133 · desktop/src/renderer/src/pages/TasksPage.tsx:1287 — 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. — desktop/src/renderer/src/pages/TasksPage.tsx:1133
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
processSSEItem has cyclomatic complexity 133 and cognitive complexity 217; 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. — channel/web/static/js/chat/send.js:401
saveTaskEdit has cyclomatic complexity 62 and cognitive complexity 96; 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. — channel/web/static/js/views/tasks-modal.js:463
onmessage has cyclomatic complexity 56 and cognitive complexity 56; 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. — desktop/src/renderer/src/store/chatStore.ts:453
MessageBubble has cyclomatic complexity 49 and cognitive complexity 42; 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. — desktop/src/renderer/src/components/MessageBubble.tsx:74
renderCapabilityBody has cyclomatic complexity 44 and cognitive complexity 48; 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. — channel/web/static/js/views/models.js:1233
BasicSettings has cyclomatic complexity 43 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 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. — desktop/src/renderer/src/pages/settings/BasicSettings.tsx:37
createBotMessageEl has cyclomatic complexity 41 and cognitive complexity 37; 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. — channel/web/static/js/chat/render.js:445
SkillsPage has cyclomatic complexity 38 and cognitive complexity 34; 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. — desktop/src/renderer/src/pages/SkillsPage.tsx:380
ChannelCard has cyclomatic complexity 38 and cognitive complexity 31; 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. — desktop/src/renderer/src/pages/ChannelsPage.tsx:541
SkillAddModal has cyclomatic complexity 35 and cognitive complexity 36; 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. — desktop/src/renderer/src/pages/skills/SkillAddModal.tsx:144
openSearchKeyModal has cyclomatic complexity 35 and cognitive complexity 35; 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. — channel/web/static/js/views/models.js:941
(anonymous) has cyclomatic complexity 33 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. — channel/web/static/js/chat/composer-input.js:271
RunDetailModal has cyclomatic complexity 33 and cognitive complexity 24; 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. — desktop/src/renderer/src/pages/TasksPage.tsx:581
ArtifactPreview has cyclomatic complexity 31 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. — desktop/src/renderer/src/pages/artifacts/ArtifactPreview.tsx:112
App has cyclomatic complexity 31 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. — desktop/src/renderer/src/App.tsx:41
(anonymous) has cyclomatic complexity 29 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. — channel/web/static/js/chat/render.js:797
KnowledgePage has cyclomatic complexity 28 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 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. — desktop/src/renderer/src/pages/KnowledgePage.tsx:243
ChatInput has cyclomatic complexity 28 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 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. — desktop/src/renderer/src/components/ChatInput.tsx:60
WorkspacePanel has cyclomatic complexity 28 and cognitive complexity 22; 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. — desktop/src/renderer/src/components/WorkspacePanel.tsx:51
initConfigView has cyclomatic complexity 27 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 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. — channel/web/static/js/views/config.js:155
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files0.0 / 10Critical✓ 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.
channel/web/static/js/views/models.js has 2616 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/views/models.js:1
channel/web/static/js/core/i18n.js has 2362 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/core/i18n.js:1
desktop/src/renderer/src/i18n.ts has 2016 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/i18n.ts:1
REDACTED has 1872 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
channel/web/static/js/views/agents.js has 1334 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/views/agents.js:1
desktop/src/renderer/src/api/client.ts has 1263 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/api/client.ts:1
desktop/src/renderer/src/pages/TasksPage.tsx has 1254 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/pages/TasksPage.tsx:1
channel/web/static/js/workspace.js has 1236 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/workspace.js:1
desktop/src/renderer/src/types.ts has 1217 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/types.ts:1
desktop/src/renderer/src/pages/settings/ModelsTab.tsx has 1167 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/pages/settings/ModelsTab.tsx:1
desktop/src/renderer/src/pages/KnowledgePage.tsx has 1121 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/pages/KnowledgePage.tsx:1
channel/web/static/js/views/artifacts.js has 1018 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/views/artifacts.js:1
channel/web/static/js/chat/send.js has 1012 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/chat/send.js:1
channel/web/static/js/views/knowledge.js has 1002 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/views/knowledge.js:1
desktop/src/renderer/src/store/chatStore.ts has 983 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/store/chatStore.ts:1
desktop/src/renderer/src/pages/SkillsPage.tsx has 961 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/pages/SkillsPage.tsx:1
desktop/src/renderer/src/pages/AgentsPage.tsx has 959 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/pages/AgentsPage.tsx:1
REDACTED has 958 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
desktop/src/renderer/src/components/ChatInput.tsx has 933 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/components/ChatInput.tsx:1
channel/web/static/js/chat/render.js has 916 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/chat/render.js:1
channel/web/static/js/chat/state.js has 893 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/chat/state.js:1
desktop/src/renderer/src/pages/ChannelsPage.tsx has 819 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/pages/ChannelsPage.tsx:1
channel/web/static/js/views/sessions.js has 817 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/views/sessions.js:1
desktop/src/main/index.ts has 778 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/main/index.ts:1
desktop/src/renderer/src/components/MenuEditor.tsx has 728 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/components/MenuEditor.tsx:1
channel/web/static/js/views/config.js has 727 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/views/config.js:1
channel/web/static/js/views/tasks-modal.js has 692 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/views/tasks-modal.js:1
desktop/src/renderer/src/pages/settings/BasicSettings.tsx has 684 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/pages/settings/BasicSettings.tsx:1
desktop/src/renderer/src/layout/SessionList.tsx has 653 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/layout/SessionList.tsx:1
desktop/src/renderer/src/pages/skills/SkillAddModal.tsx has 630 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/pages/skills/SkillAddModal.tsx:1
channel/web/static/js/views/channels.js has 584 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/views/channels.js:1
desktop/src/renderer/src/pages/ChatPage.tsx has 579 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/pages/ChatPage.tsx:1
desktop/src/main/app-icon.ts has 568 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/main/app-icon.ts:1
channel/web/static/js/core/markdown.js has 532 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/core/markdown.js:1
desktop/src/renderer/src/pages/skills/McpEditorModal.tsx has 493 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/pages/skills/McpEditorModal.tsx:1
channel/web/static/js/views/tasks.js has 492 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/views/tasks.js:1
desktop/src/renderer/src/layout/NavRail.tsx has 463 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/layout/NavRail.tsx:1
channel/web/static/js/views/menu-editor.js has 453 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — channel/web/static/js/views/menu-editor.js:1
desktop/src/renderer/src/pages/settings/ModelCatalogEditor.tsx has 430 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/pages/settings/ModelCatalogEditor.tsx:1
desktop/src/renderer/src/store/workspaceStore.ts has 429 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/renderer/src/store/workspaceStore.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 Coverage2.1 / 10Weak✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×40) — channel/web/static/js/views/models.js:1, channel/web/static/js/views/agents.js:1, desktop/src/renderer/src/pages/settings/ModelsTab.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.4 / 10Exemplary✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Unreachable from the 48 application, 5 tooling and 3 test entry point(s) detected in this repo. Gate removals on `npm run dev:main` — an undetected custom entry would make these reachable.
no import path from any entry point (48 application, 5 tooling, 3 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×4) — desktop/src/main/preload.ts, REDACTED, desktop/electron-builder.js, …
Nothing imports this binding — it is safe to review for removal. (×6) — desktop/src/renderer/src/pages/settings/ChatFallbackCard.tsx:341, desktop/src/renderer/src/pages/settings/ModelCatalogEditor.tsx:457, desktop/src/renderer/src/store/agentStore.ts:254, …
Nothing in its class calls or references this private method — no member access, no string key, no decorator, and no test reaches it by name. A private member cannot be called from outside its class, so this is the whole search: remove it, or call it where it was meant to be used. — REDACTED:413
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.
Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.
Imported but not declared in any reachable package.json — installs work only by hoisting accident. — desktop/tests/chat-scroll.test.mjs:3
What to do
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X13 · Undrained process stream5.9 / 10Adequate✓ Tool-verified
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.
`spawn` pipes `stderr` here — it is given no `stdio` option, or `'pipe'` — but nothing in this scope ever reads `child.stderr`, while `child.stdout` is read and the child's end is awaited. Node holds an unread pipe's output only up to its buffer: once the child writes more than that to stderr (measured on Linux: about 128 KB — the 64 KB pipe plus Node's 64 KB read-ahead — and less elsewhere), the child blocks on the write, never exits, and the `close`/`exit` this code waits for never fires. Nothing fails loudly: the promise never settles, the request never returns, and the stuck child holds its resources until something kills it. Consume both streams (`child.stderr.on('data', …)`, or `child.stderr.resume()` to discard it), or stop piping the one you do not want — `stdio: ['pipe', 'pipe', 'inherit']` or `'ignore'` in that slot. — REDACTED:571
What to do
Each finding names the span that makes the branch dead and the span it is dead because of. Confirm from the two, then delete the dead arm or fix the predicate that was meant to be reachable.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.
Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document3.5 / 10Weak✓ Tool-verified
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.
`deep_merge_dicts` is public and takes `base: dict` from its caller, and it calls itself at line 8 (`deep_merge_dicts`) with a piece of `base` — and nowhere in `deep_merge_dicts` 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 `deep_merge_dicts` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — cli/config_json.py:8
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 1/29 async functions that make a cancellable request (fetch, axios, ky, ofetch) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
`wsApi` 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 })`. — channel/web/static/js/workspace.js:103
`wsRenderPreview` 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 })`. — channel/web/static/js/workspace.js:307
`savePreviewEdit` 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 })`. — channel/web/static/js/workspace.js:573
`refreshWorkspaceSelector` 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 })`. — channel/web/static/js/chat/workspace-selector.js:31
`_fpBrowse` 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 })`. — channel/web/static/js/chat/workspace-selector.js:179
`_wsSelApply` 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 })`. — channel/web/static/js/chat/workspace-selector.js:264
`upload` 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 })`. — channel/web/static/js/chat/state.js:239
`handleFileSelect` 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 })`. — channel/web/static/js/chat/state.js:860
`handleFolderSelect` 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 })`. — channel/web/static/js/chat/state.js:914
`refreshSessionSettings` 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 })`. — channel/web/static/js/chat/session-settings.js:45
`_applySessionSettings` 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 })`. — channel/web/static/js/chat/session-settings.js:262
`regenerateResponse` 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 })`. — channel/web/static/js/chat/send.js:6
`postJson` 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 })`. — REDACTED:77
`uploadSkillFiles` 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 })`. — REDACTED:987
`skillReadContent` 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 })`. — REDACTED:1376
`skillWriteContent` 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 })`. — REDACTED:1386
`skillListFiles` 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 })`. — REDACTED:1398
`postSkillCreate` 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 })`. — REDACTED:2008
`knowledgeReadDoc` 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 })`. — channel/web/static/js/views/knowledge.js:74
`knowledgeWriteDoc` 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 })`. — channel/web/static/js/views/knowledge.js:87
`_refreshKnowledgeTree` 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 })`. — channel/web/static/js/views/knowledge.js:114
`dispatchKnowledgeAction` 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 })`. — channel/web/static/js/views/knowledge.js:322
`importKnowledgeDocuments` 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 })`. — channel/web/static/js/views/knowledge.js:591
`docReadFile` 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 })`. — channel/web/static/js/views/doc-viewers.js:17
`docWriteFile` 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 })`. — channel/web/static/js/views/doc-viewers.js:25
`setAgentKnowledgeMode` 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 })`. — channel/web/static/js/views/agents.js:471
`request` 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 })`. — desktop/src/renderer/src/api/client.ts:162
`postFormData` 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 })`. — desktop/src/renderer/src/api/client.ts:188
What to do
Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
`debug` at line 597 is called with an argument built by `json.dumps(data, ensure_ascii = False)` (line 597), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — models/gemini/google_gemini_bot.py:597
`debug` at line 680 is called with an argument built by `list(current_tool_calls.values())` (line 680), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — models/modelscope/modelscope_bot.py:680
What to do
In Python, put the construction behind the logger's own check (`if logger.isEnabledFor(logging.DEBUG):`), or pass the collection itself with a `%s` placeholder (`logger.debug("Items %s", items)`) so the logging module renders it only when the record is emitted. The placeholder alone is not the fix when the argument is still built first: it defers the formatting, not a `json.dumps`, a `join` or a comprehension in the argument, and an f-string defers nothing at all.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped4.4 / 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.
`i` is text this program did not author, and it is written into a quoted attribute value through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/composer-input.js:198
`_ctxFmtTokens(b[l.key]||0)` is text this program did not author, and it is written into the text of an element through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/context-usage.js:71
`usedLine` is text this program did not author, and it is written into the text of an element through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/context-usage.js:86
`t('ctx_compacted_divider').replace('{before}',data.before||0).replace('{after}',data.after||0)` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/context-usage.js:372
`formatTime(timestamp)` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×4) — channel/web/static/js/chat/message-actions.js:90, channel/web/static/js/chat/render.js:97, channel/web/static/js/chat/render.js:528, …
`escapeHtml(agent.id)` is text this program did not author, and it is written into a script or style context through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. A script or style context needs its own escaping (or a JSON serialiser that escapes `<`); better, pass the value through a data attribute. (×2) — channel/web/static/js/chat/new-chat.js:15, channel/web/static/js/chat/new-chat.js:76
`appConfig.title||'CowAgent'` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/new-chat.js:128
`t('welcome_subtitle')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/new-chat.js:129
`t('example_sys_title')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/new-chat.js:136
`t('example_sys_text')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/new-chat.js:138
`t('example_task_title')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/new-chat.js:145
`t('example_task_text')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/new-chat.js:147
`t('example_code_title')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/new-chat.js:154
`t('example_code_text')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/new-chat.js:156
`t('example_knowledge_title')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/new-chat.js:163
`t('example_knowledge_text')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/new-chat.js:165
`t('example_skill_title')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/new-chat.js:172
`t('example_skill_text')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/new-chat.js:174
`t('example_web_title')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/new-chat.js:181
`t('example_web_text')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/new-chat.js:183
`openable` is text this program did not author, and it is written into an unquoted attribute through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML text encoding does not help in an unquoted attribute — whitespace ends it; quote the attribute and encode the value. — channel/web/static/js/chat/render.js:78
`t('edit_message')` is text this program did not author, and it is written into a quoted attribute value through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/render.js:91
`t('delete_message_title')` is text this program did not author, and it is written into a quoted attribute value through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/render.js:94
`build()` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/render.js:137
`t('thinking_duration')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/render.js:209
`body` is text this program did not author, and it is written into an unquoted attribute through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML text encoding does not help in an unquoted attribute — whitespace ends it; quote the attribute and encode the value. — channel/web/static/js/chat/render.js:337
`t('evolution_badge')` is text this program did not author, and it is written into the text of an element through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/render.js:495
`t('speak_msg')` is text this program did not author, and it is written into a quoted attribute value through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×2) — channel/web/static/js/chat/render.js:532, channel/web/static/js/chat/send.js:333
`t('regenerate_response')` is text this program did not author, and it is written into a quoted attribute value through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/render.js:536
`audioUrl` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — channel/web/static/js/chat/render.js:629
`t('context_cleared')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×2) — channel/web/static/js/chat/render.js:846, channel/web/static/js/chat/render.js:896
`t('regenerate_response')` is text this program did not author, and it is written into a quoted attribute value through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/send.js:336
`t('thinking_in_progress')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/send.js:417
`details.join('')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — channel/web/static/js/chat/send.js:547
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. (×17) — app.py:269, app.py:532, app.py:610, …
`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. (×23) — app.py:401, app.py:513, agent/admin.py:293, …
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.
`warning` at line 96 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:96
`info` at line 113 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — app.py:113
`info` at line 121 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — app.py:121
`warning` at line 217 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:217
`error` at line 232 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — app.py:232
`debug` at line 289 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — app.py:289
`error` at line 295 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — app.py:295
`warning` at line 325 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:325
`info` at line 329 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — app.py:329
`warning` at line 336 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:336
`info` at line 341 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — app.py:341
`warning` at line 344 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:344
`info` at line 359 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — app.py:359
`warning` at line 362 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:362
`warning` at line 364 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:364
`info` at line 382 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — app.py:382
`info` at line 387 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — app.py:387
`info` at line 420 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — app.py:420
`info` at line 424 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — app.py:424
`info` at line 427 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — app.py:427
`warning` at line 435 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:435
`info` at line 437 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — app.py:437
`info` at line 439 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — app.py:439
`debug` at line 478 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — app.py:478
`warning` at line 483 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:483
`debug` at line 522 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — app.py:522
`warning` at line 556 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:556
`warning` at line 565 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:565
`warning` at line 581 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:581
`error` at line 604 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — app.py:604
`warning` at line 625 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:625
`warning` at line 645 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:645
`warning` at line 652 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:652
`warning` at line 669 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:669
`warning` at line 698 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:698
`warning` at line 705 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:705
`warning` at line 738 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:738
`info` at line 740 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — app.py:740
`warning` at line 745 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:745
`warning` at line 784 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — app.py:784
Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
~0.6 `!` null assertions per 1k TypeScript source lines — 22 assertion(s) across the 35446 source line(s) of the 108 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: desktop/src/renderer/src/components/KnowledgeGraph.tsx (7), desktop/src/renderer/src/components/ContextUsagePopover.tsx (3), desktop/src/renderer/src/layout/SessionList.tsx (3). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
What to do
The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 3 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X6 Hand-rolled structured-format parsing — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 3 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' (agent/memory/vector_backend.py:7) 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' (agent/memory/vector_backend.py:7) 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' (agent/memory/vector_backend.py:7) 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.
Not included — 44 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
AX8 Test isolation — no test/production split to check
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — compose up failed (exit 18 — an image could not be pulled) — chatgpt-on-wechat Pulling chatgpt-on-wechat Error Get "https://registry-1.docker.io/v2/": Forbidden Error response from daemon: Get "https://registry-1.docker.io/v2/": Forbidden; the earlier `compose pull` step reported: chatgpt-on-wechat Pulling chatgpt-on-wechat Error Get "https://registry-1.docker.io/v2/": Forbidden Error response from daemon: Get "https://registry-1.docker.io/v2/": Forbidden; the runtime sandbox reaches registries only through the in-fence pull-through mirror, so an image the mirror does not carry cannot be fetched — this is a limit of our sandbox, not of your stack; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
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.
C2 Access Controls — No access-control surface detected in the analyzed source — this repository registers no route and starts no server another machine can reach (no Flask/FastAPI/Starlette route, Django urlpatterns or class-based view, Tornado handler). Access control is therefore N/A here — a library or command-line tool is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
D11 Test Reliability — Test reliability not scored — polyglot repository, one half has no runner
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.
D20 ADR Quality — N/A — this repo declares itself a template / kata / sample / demo; a formal ADR log is deferred to a real application built from it.
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+ projects each declaring an entity of their own. Aggregate roots were found in only one source directory (models), 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"]`.
D24 Comment Value — No inline comments to assess — comment value is not applicable here.
D25 ADR Conformance — no ADRs to check
D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.py), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D32 Data Compliance (PII/GDPR) — 1 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
DM1 Domain Modelling — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 2 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 35 value object(s)
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 — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript, Python source, so there is no service whose uptime a failing dependency could take down
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
PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for a pytest-benchmark or pytest-codspeed dependency with tests taking the `benchmark` fixture, an asv.conf.json with its `time_`/`mem_`/`peakmem_` benchmarks, or a pyperf Runner, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
PF2 Allocation hygiene — Not applicable: Python and TypeScript/JavaScript 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.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
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.
AC2 · Forms & labels· <label> that labels no control · ×20
<label> that labels no control channel/web/static/js/views/agents.js:335— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/static/js/views/agents.js:339— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/static/js/views/agents.js:349— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/static/js/views/channels.js:293— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/static/js/views/models.js:557— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/static/js/views/models.js:567— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/static/js/views/models.js:654— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/static/js/views/models.js:984— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/static/js/views/models.js:1140— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/static/js/views/models.js:1143— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/static/js/views/models.js:1243— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/static/js/views/models.js:1258— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/static/js/views/models.js:1285— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/static/js/views/models.js:1328— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/static/js/views/models.js:1457— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/templates/modals/mcp-editor.html:25— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/templates/modals/mcp-editor.html:30— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/templates/modals/mcp-editor.html:43— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/templates/modals/mcp-editor.html:47— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control channel/web/templates/modals/mcp-editor.html:51— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
AC4 · Keyboard semantics· Clickable element isn't keyboard-operable · ×15
Clickable element isn't keyboard-operable channel/web/static/js/views/agents.js:1198— The repo's own CSS styles .composer-menu-item with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable channel/web/static/js/views/agents.js:1217— The repo's own CSS styles .composer-menu-item with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable channel/web/static/js/views/channels.js:232— The repo's own CSS styles .cfg-dropdown-item with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable channel/web/static/js/views/channels.js:502— The repo's own CSS styles .cfg-dropdown-selected with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable channel/web/static/js/views/models.js:447— The repo's own CSS styles .cfg-dropdown-selected with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable channel/web/static/js/views/models.js:454— The repo's own CSS styles .cfg-dropdown-selected with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable channel/web/static/js/views/models.js:656— The repo's own CSS styles .cfg-dropdown-selected with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable channel/web/static/js/views/models.js:1245— The repo's own CSS styles .cfg-dropdown-selected with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable channel/web/static/js/views/models.js:1260— The repo's own CSS styles .cfg-dropdown-selected with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable channel/web/static/js/views/models.js:1330— The repo's own CSS styles .cfg-dropdown-selected with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable channel/web/static/js/views/models.js:1459— The repo's own CSS styles .cfg-dropdown-selected with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable channel/web/static/js/workspace.js:674— The repo's own CSS styles .file-card-btn with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable channel/web/static/js/workspace.js:975— The repo's own CSS styles .crumb with `cursor: pointer`, so this <span> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable channel/web/static/js/workspace.js:980— The repo's own CSS styles .crumb with `cursor: pointer`, so this <span> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable channel/web/templates/modals/mcp-editor.html:32— The repo's own CSS styles .cfg-dropdown-selected with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
AC2 · Forms & labels· <input> without a programmatic label · ×11
<input> without a programmatic label channel/web/static/js/views/agents.js:340— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label channel/web/static/js/views/channels.js:276— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label channel/web/static/js/views/channels.js:285— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label channel/web/static/js/views/menu-editor.js:113— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label channel/web/static/js/views/models.js:985— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label channel/web/static/js/views/models.js:1141— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label channel/web/static/js/views/models.js:1144— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label channel/web/static/js/views/models.js:2284— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label channel/web/static/js/views/sessions.js:857— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label channel/web/templates/modals/mcp-editor.html:26— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label channel/web/templates/modals/mcp-editor.html:44— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
AC4 · Keyboard semantics· Click handler on a non-interactive <div> · ×7
Click handler on a non-interactive <div> channel/web/static/js/chat/render.js:332— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> channel/web/static/js/chat/send.js:415— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> channel/web/static/js/chat/send.js:542— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> channel/web/static/js/chat/send.js:567— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> channel/web/static/js/chat/workspace-selector.js:221— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/src/renderer/src/components/FileCard.tsx:80— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> desktop/src/renderer/src/components/FileTree.tsx:160— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC2 · Forms & labels· <button> with no accessible text · ×6
<button> with no accessible text channel/web/static/js/views/models.js:550— 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 channel/web/static/js/views/models.js:1286— 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 REDACTED:1947— 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 channel/web/templates/layout/header.html:4— 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 channel/web/templates/layout/header.html:10— 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 channel/web/templates/layout/header.html:72— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
AC4 · Keyboard semantics· Hover-only interaction on <div> · ×3
Hover-only interaction on <div> desktop/src/renderer/src/components/ChatTimeline.tsx:334— This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus.
Hover-only interaction on <div> desktop/src/renderer/src/components/ChatTimeline.tsx:350— This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus.
Hover-only interaction on <div> desktop/src/renderer/src/components/ContextUsagePopover.tsx:286— This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus.
AC2 · Forms & labels· <textarea> without a programmatic label · ×2
<textarea> without a programmatic label channel/web/static/js/views/agents.js:344— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label channel/web/templates/modals/mcp-editor.html:48— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
AC4 · Keyboard semantics· Click handler on a non-interactive <span> · ×2
Click handler on a non-interactive <span> desktop/src/renderer/src/components/FileCard.tsx:99— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <span> desktop/src/renderer/src/components/FileCard.tsx:104— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC2 · Forms & labels· Custom control with no accessible name on <i> · ×1
Custom control with no accessible name on <i> channel/web/static/js/chat/workspace-selector.js:224— This <i> 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.
AC4 · Keyboard semantics· Click handler on a non-interactive <i> · ×1
Click handler on a non-interactive <i> channel/web/static/js/chat/workspace-selector.js:224— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
AC4 · Keyboard semantics· Hover-only interaction on <g> · ×1
Hover-only interaction on <g> desktop/src/renderer/src/components/KnowledgeGraph.tsx:384— This <g> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus.
Banned license: python-telegram-bot — `python-telegram-bot` 22.8 is published on PyPI under `LGPL-3.0-only`, which this policy bans, and it is in the SHIPPED closure of this repository — so it is installed by everything that depends on this repository, not just by its test environment. A distribution offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package, or record an accepted exception.
Boundary-crossing change coupling: web_channel.py ↔ bot_factory.py channel/web/web_channel.py:1— `channel/web/web_channel.py` (context channel) and `models/bot_factory.py` (context models) sit in DIFFERENT parts of the tree yet change together 70% of the time (7 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `1940d628` refactor(custom): id-based routing, single source of truth, security …; `bccce2d7` feat(models): support xiaomi mimo; `3830f767` feat: add custom model provider — run `git show` on any of them.
Unlisted import 'esbuild' desktop/tests/chat-scroll.test.mjs:3— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Hotspot: REDACTED REDACTED:1573— REDACTED changed 57 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 94 in AgentStreamExecutor._call_llm_stream at line 1573. 33 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: bridge/agent_bridge.py bridge/agent_bridge.py:1510— bridge/agent_bridge.py changed 57 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 82 in AgentBridge.agent_reply at line 1510. 28 of those changes were fix/bug commits, and the other 29 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- bridge/agent_bridge.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: desktop/src/renderer/src/pages/settings/BasicSettings.tsx desktop/src/renderer/src/pages/settings/BasicSettings.tsx:37— desktop/src/renderer/src/pages/settings/BasicSettings.tsx changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 136 in BasicSettings.BasicSettings at line 37. 8 of those changes were fix/bug commits, and the other 17 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- desktop/src/renderer/src/pages/settings/BasicSettings.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: desktop/src/renderer/src/components/ChatInput.tsx desktop/src/renderer/src/components/ChatInput.tsx:60— desktop/src/renderer/src/components/ChatInput.tsx changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 143 in ChatInput.ChatInput at line 60. 8 of those changes were fix/bug commits, and the other 12 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- desktop/src/renderer/src/components/ChatInput.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: channel/web/static/js/chat/send.js channel/web/static/js/chat/send.js:211— channel/web/static/js/chat/send.js changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 217 in send.startSSE at line 211. 7 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- channel/web/static/js/chat/send.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: desktop/src/renderer/src/store/chatStore.ts desktop/src/renderer/src/store/chatStore.ts:339— desktop/src/renderer/src/store/chatStore.ts changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 112 in chatStore.useChatStore.attachStream at line 339. 6 of those changes were fix/bug commits, and the other 13 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- desktop/src/renderer/src/store/chatStore.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: agent/memory/conversation_store.py agent/memory/conversation_store.py:422— agent/memory/conversation_store.py changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 58 in conversation_store._group_into_display_turns at line 422. 20 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- agent/memory/conversation_store.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: desktop/src/renderer/src/pages/ChatPage.tsx desktop/src/renderer/src/pages/ChatPage.tsx:78— desktop/src/renderer/src/pages/ChatPage.tsx changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 99 in ChatPage.ChatPage at line 78. 4 of those changes were fix/bug commits, and the other 15 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- desktop/src/renderer/src/pages/ChatPage.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: agent/tools/bash/bash.py agent/tools/bash/bash.py:121— agent/tools/bash/bash.py changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 60 in Bash.execute at line 121. 15 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- agent/tools/bash/bash.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: common/cloud_client.py common/cloud_client.py:369— common/cloud_client.py changed 39 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in CloudClient.on_config at line 369. 20 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- common/cloud_client.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: desktop/src/renderer/src/pages/SkillsPage.tsx desktop/src/renderer/src/pages/SkillsPage.tsx:380— desktop/src/renderer/src/pages/SkillsPage.tsx changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 84 in SkillsPage.SkillsPage at line 380. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- desktop/src/renderer/src/pages/SkillsPage.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: agent/chat/service.py agent/chat/service.py:30— agent/chat/service.py changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in ChatService.run at line 30. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- agent/chat/service.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: channel/feishu/feishu_channel.py channel/feishu/feishu_channel.py:704— channel/feishu/feishu_channel.py changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in FeiShuChanel._handle_message_event at line 704. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- channel/feishu/feishu_channel.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: channel/dingtalk/dingtalk_channel.py channel/dingtalk/dingtalk_channel.py:871— channel/dingtalk/dingtalk_channel.py changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 49 in DingTalkChanel.send at line 871. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- channel/dingtalk/dingtalk_channel.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: REDACTED REDACTED:319— REDACTED changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in MemoryManager.sync at line 319. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: REDACTED REDACTED:550— REDACTED changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in config.load_config at line 550. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: bridge/agent_initializer.py bridge/agent_initializer.py:963— bridge/agent_initializer.py changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in AgentInitializer._load_tools at line 963. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- bridge/agent_initializer.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: channel/chat_channel.py channel/chat_channel.py:46— channel/chat_channel.py changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in ChatChannel._compose_context at line 46. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- channel/chat_channel.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: cli/commands/skill.py cli/commands/skill.py:1264— cli/commands/skill.py changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 45 in skill._install_hub at line 1264. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- cli/commands/skill.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: desktop/src/main/index.ts desktop/src/main/index.ts:538— desktop/src/main/index.ts changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in index.setupIPC at line 538. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- desktop/src/main/index.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: desktop/src/renderer/src/App.tsx desktop/src/renderer/src/App.tsx:41— desktop/src/renderer/src/App.tsx changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 61 in App.App at line 41. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- desktop/src/renderer/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: channel/web/static/js/chat/render.js channel/web/static/js/chat/render.js:782— channel/web/static/js/chat/render.js changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 69 in render.loadHistory at line 782. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- channel/web/static/js/chat/render.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: agent/tools/web_search/web_search.py agent/tools/web_search/web_search.py:709— agent/tools/web_search/web_search.py changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in WebSearch._search_anysearch at line 709. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- agent/tools/web_search/web_search.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: desktop/src/renderer/src/pages/ChannelsPage.tsx desktop/src/renderer/src/pages/ChannelsPage.tsx:541— desktop/src/renderer/src/pages/ChannelsPage.tsx changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in ChannelsPage.ChannelCard at line 541. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- desktop/src/renderer/src/pages/ChannelsPage.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: desktop/src/renderer/src/layout/NavRail.tsx desktop/src/renderer/src/layout/NavRail.tsx:62— desktop/src/renderer/src/layout/NavRail.tsx changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in NavRail.NavRail at line 62. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- desktop/src/renderer/src/layout/NavRail.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.
FileTooLong: core/i18n.js channel/web/static/js/core/i18n.js— FileTooLong — 2254 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units), about 93% of them inside a single declaration: I18N (8-2100). The bar is 500 significant lines; this is 1754 over it, 4.51× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: views/models.js channel/web/static/js/views/models.js— FileTooLong — 1891 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 1391 over it, 3.78× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: api/models.py channel/web/api/models.py— FileTooLong — 1836 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1336 over it, 3.67× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1767 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1267 over it, 3.53× 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: memory/conversation_store.py agent/memory/conversation_store.py— FileTooLong — 1608 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1108 over it, 3.22× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: feishu/feishu_channel.py channel/feishu/feishu_channel.py— FileTooLong — 1594 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1094 over it, 3.19× 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: bridge/agent_bridge.py bridge/agent_bridge.py— FileTooLong — 1500 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1000 over it, 3.00× 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: cow_cli/cow_cli.py plugins/cow_cli/cow_cli.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: common/cloud_client.py common/cloud_client.py— FileTooLong — 1421 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 921 over it, 2.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: REDACTED REDACTED— FileTooLong — 1420 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 920 over it, 2.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: commands/skill.py cli/commands/skill.py— FileTooLong — 1274 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 774 over it, 2.55× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: core/channel.py channel/web/core/channel.py— FileTooLong — 1194 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 694 over it, 2.39× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1160 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 660 over it, 2.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: pages/TasksPage.tsx desktop/src/renderer/src/pages/TasksPage.tsx— FileTooLong — 1043 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 543 over it, 2.09× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: settings/ModelsTab.tsx desktop/src/renderer/src/pages/settings/ModelsTab.tsx— FileTooLong — 982 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 482 over it, 1.96× 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/generate.py skills/image-generation/scripts/generate.py— FileTooLong — 955 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 455 over it, 1.91× 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: views/agents.js channel/web/static/js/views/agents.js— FileTooLong — 932 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 432 over it, 1.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: pages/KnowledgePage.tsx desktop/src/renderer/src/pages/KnowledgePage.tsx— FileTooLong — 906 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 406 over it, 1.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: api/channels.py channel/web/api/channels.py— FileTooLong — 904 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 404 over it, 1.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: bridge/agent_initializer.py bridge/agent_initializer.py— FileTooLong — 873 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 373 over it, 1.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: js/workspace.js channel/web/static/js/workspace.js— FileTooLong — 861 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 361 over it, 1.72× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: browser/browser_service.py agent/tools/browser/browser_service.py— FileTooLong — 854 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 354 over it, 1.71× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: weixin/weixin_channel.py channel/weixin/weixin_channel.py— FileTooLong — 838 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 338 over it, 1.68× 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: dingtalk/dingtalk_channel.py channel/dingtalk/dingtalk_channel.py— FileTooLong — 830 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 330 over it, 1.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: REDACTED REDACTED— FileTooLong — 828 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 328 over it, 1.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.
Repeated repair: REDACTED REDACTED:616— REDACTED changed 18 times in last 90 days and 12 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 _common._read_uploaded_file_bytes at line 616), 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(web): serve artifacts from registered agent workspaces”; “fix: share the @mention boundary across matcher, stripping, web and desktop”; “fix(team): treat sentence-ending punctuation as an @mention boundary”; “fix: keep the test suite out of the real home directory”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: agent/memory/storage.py agent/memory/storage.py:342— agent/memory/storage.py changed 15 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is MemoryStorage._init_db at line 342), 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: replace the legacy FTS triggers without forcing a full rebuild”; “fix: synchronize external-content search indexes”; “fix(memory): preserve Unicode words in keyword searches”; “fix(memory): fall back to LIKE search when FTS5 returns nothing”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- agent/memory/storage.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.
Repeated repair: common/utils.py common/utils.py:94— common/utils.py changed 17 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is utils.expand_path at line 94), 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(images): preserve EXIF display orientation during compression”; “fix(common): reject UTF-8 split budgets that cannot make progress”; “fix(logs): preserve lines between replay and live tail”; “fix(files): preserve suffixes of local attachment names”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- common/utils.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.
Repeated repair: voice/openai/openai_voice.py voice/openai/openai_voice.py:27— voice/openai/openai_voice.py changed 9 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is OpenaiVoice.voiceToText at line 27), 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(voice): reject non-string transcription payloads”; “fix(voice): normalize OpenAI audio endpoint trailing slashes”; “fix: trim repeated comments around the bounded downloads”; “fix(voice): bound every TTS/download path through one shared helper”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- voice/openai/openai_voice.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.
Repeated repair: agent/tools/scheduler/task_store.py agent/tools/scheduler/task_store.py:82— agent/tools/scheduler/task_store.py changed 12 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is TaskStore.load_tasks at line 82), 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(scheduler): preserve unrecoverable stores when adding tasks”; “fix(scheduler): retain valid backup when primary repair fails”; “fix(scheduler): allow task stores in the current directory”; “fix(scheduler): recover a missing primary from the retained backup”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- agent/tools/scheduler/task_store.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.
Repeated repair: agent/chat/session_service.py agent/chat/session_service.py:141— agent/chat/session_service.py changed 11 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is session_service._assemble_optimize_prompt at line 141), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: make session title generation survive model failures and session switches”; “fix: share media temp-file helpers and trim verbose comments”; “fix: read the team roster before the delete drops it, and fan out from the web too”; “fix: keep the cross-agent session listing uncapped”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- agent/chat/session_service.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.
Repeated repair: REDACTED REDACTED:399— REDACTED changed 8 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is weixin_api.upload_media_to_cdn at line 399), 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: improve weixin QR login reliability”; “fix(weixin): close rejected CDN media responses”; “fix(weixin): keep the plaintext when the last byte decrypts to zero”; “fix: trim the weixin timeout comments”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: cli/utils.py cli/utils.py:119— cli/utils.py changed 9 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is utils._skill_hub_setting at line 119), 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: run chat skill commands on the current agent's own skills”; “fix(cli): ignore JSON configuration with a non-object root”; “fix(cli): share canonical duplicate configuration parsing”; “fix: keep the test suite out of the real home directory”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- cli/utils.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.
Repeated repair: REDACTED REDACTED:232— REDACTED changed 8 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is Markdown.Markdown at line 232), 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: render agent-embedded images for non-default agents on web and desktop”; “fix(desktop): align inset colors, dropdown flip and table overflow with the web console”; “fix: restore leading slash in knowledge doc image path resolution”; “fix: display local-path and knowledge-doc images; add desktop image lightbox”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: common/office_text.py common/office_text.py:20— common/office_text.py changed 7 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is office_text._iter_docx_blocks at line 20), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: preserve inline Word content control values”; “fix: retain block content controls in Word document extraction”; “fix: read merged Word table cells once”; “fix(documents): read cells beyond stale Excel dimensions”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- common/office_text.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.
Repeated repair: common/media_download.py common/media_download.py:110— common/media_download.py changed 7 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is media_download._open at line 110), 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: share media temp-file helpers and trim verbose comments”; “fix: guard Feishu image URLs through the shared download and the SSRF switch”; “fix: guard DingTalk reply media through the shared download and the SSRF switch”; “fix: guard reply media through the shared download and the SSRF switch”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- common/media_download.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.
Repeated repair: cli/commands/process.py cli/commands/process.py:113— cli/commands/process.py changed 9 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is process.start at line 113), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: keep the channel list annotation compatible with Python 3.7”; “fix(cli): preserve stdin for mixed terminal channels”; “fix: report permission errors from cow stop instead of claiming success”; “fix(cli): detach standard input when starting the background service”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- cli/commands/process.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.
Repeated repair: plugins/plugin_manager.py plugins/plugin_manager.py:181— plugins/plugin_manager.py changed 9 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is PluginManager.scan_plugins at line 181), 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(plugins): decide what counts as a new plugin by name, not by class”; “fix(plugins): keep a plugin's configuration when reloading it”; “fix: trim redundant comments after batch-4 merges”; “fix(plugins): do not register the same listener twice when a plugin is re-enabled”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- plugins/plugin_manager.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.
Repeated repair: models/model_catalog.py models/model_catalog.py:67— models/model_catalog.py changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is model_catalog.normalize_entry at line 67), 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(models): detach capability lists returned by catalog readers”; “fix(models): serialize catalog edits and cache publication”; “fix(models): recover malformed catalog provider fields independently”; “fix: fold the capability case fix into one line and the catalog tests”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- models/model_catalog.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.
Repeated repair: voice/linkai/linkai_voice.py voice/linkai/linkai_voice.py:23— voice/linkai/linkai_voice.py changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is LinkAIVoice.voiceToText at line 23), 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: trim repeated comments around the bounded downloads”; “fix(voice): bound every TTS/download path through one shared helper”; “fix(linkai_voice): return an ERROR reply on ASR/TTS failure instead of None”; “fix(voice): synthesize TTS into the routed Agent's tmp dir, not a CWD tmp/”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- voice/linkai/linkai_voice.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.
Repeated repair: channel/file_cache.py channel/file_cache.py:25— channel/file_cache.py changed 6 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is FileCache.add at line 25), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: retain concurrently cached first attachments”; “fix: back FileCache with ExpiredDict”; “fix(channel): sweep expired file-cache batches on write”; “fix(channel): start a fresh attachment batch after cache expiry”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- channel/file_cache.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.
Repeated repair: agent/tools/utils/url_safety.py agent/tools/utils/url_safety.py:69— agent/tools/utils/url_safety.py changed 6 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is url_safety.validate_url_safe at line 69), 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: guard DingTalk reply media through the shared download and the SSRF switch”; “fix: guard reply media through the shared download and the SSRF switch”; “fix(dingtalk): check the address before fetching reply media”; “fix(wecom-bot): check the address before fetching reply media”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- agent/tools/utils/url_safety.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.
Repeated repair: agent/skills/manager.py agent/skills/manager.py:211— agent/skills/manager.py changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is SkillManager._sync_skills_config at line 211), 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: simplify enabled-state rollback in set_skill_enabled”; “fix(skills): report failed enable/disable and restore the previous choice”; “fix(skills): preserve runtime choices in BOM configs”; “fix(skills): isolate malformed persisted config entries”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- agent/skills/manager.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.
Repeated repair: agent/subagent/templates.py agent/subagent/templates.py:170— agent/subagent/templates.py changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is templates.load_templates at line 170), 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(subagent): report a non-string type instead of crashing, and survive an unlistable templates dir”; “fix: narrow subagent delegation and wrap up before timeout”; “fix(subagent): skip undecodable user templates”; “fix: keep the date in the system prompt and rename the time tool”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- agent/subagent/templates.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.
Repeated repair: agent/memory/chunker.py agent/memory/chunker.py:38— agent/memory/chunker.py changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is TextChunker.chunk_text at line 38), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: give hard-split line pieces a distinct chunk id”; “fix: trim redundant comments after batch-4 merges”; “fix(memory): keep line chunks within their character budget”; “fix(memory): index markdown preface text and stop duplicating skipped-level sections”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- agent/memory/chunker.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.
Repeated repair: agent/tools/browser/browser_tool.py agent/tools/browser/browser_tool.py:199— agent/tools/browser/browser_tool.py changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is BrowserTool._check_memory_budget at line 199), 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: mention snapshot scoping in the browser selector description”; “fix(browser): require explicit text before filling inputs”; “fix(browser): accept explicitly empty option values”; “fix(browser): read scroll distance from amount, not the timeout field”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- agent/tools/browser/browser_tool.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.
Repeated repair: agent/prompt/workspace.py agent/prompt/workspace.py:112— agent/prompt/workspace.py changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is workspace.load_context_files at line 112), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(agent): avoid overwriting profiles during concurrent initialization”; “fix(agent): keep onboarding pending for empty profile files”; “fix: detect onboarding completion by placeholders instead of exact template match”; “fix(prompt): keep MEMORY.md's newest entries when trimming it to the byte cap”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- agent/prompt/workspace.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.
Repeated repair: voice/custom/custom_voice.py voice/custom/custom_voice.py:67— voice/custom/custom_voice.py changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is CustomVoice.voiceToText at line 67), 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(voice): reject non-string transcription payloads”; “fix: trim repeated comments around the bounded downloads”; “fix(voice): bound every TTS/download path through one shared helper”; “fix(voice): bound every outbound request so a stalled provider cannot hang the turn”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- voice/custom/custom_voice.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.
Repeated repair: common/atomic_write.py common/atomic_write.py:37— common/atomic_write.py changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is atomic_write._replace at line 37), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: encode fallback writes before truncating existing files”; “fix(tools): refuse special-file targets before reading or replacing them”; “fix: stage atomic writes with the target's own mode”; “fix(storage): keep atomic staging files private while writing”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- common/atomic_write.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.
Repeated repair: REDACTED REDACTED:69— REDACTED changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is ali_api.speech_to_text_aliyun at line 69), 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: use unique tts output filenames for the remaining voice vendors”; “fix(voice): fetch the Aliyun NLS token over https”; “fix: trim repeated comments around the bounded downloads”; “fix(voice): bound every TTS/download path through one shared helper”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 10:44:27 +08:00' --until='2026-10-25 10:44:27 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
+ 27 more in this group — see findings.md.
R4 · Test Coverage· No test reaches this file · ×40
No test reaches this file channel/web/static/js/views/models.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file channel/web/static/js/views/agents.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/src/renderer/src/pages/settings/ModelsTab.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/src/renderer/src/pages/KnowledgePage.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file channel/web/static/js/views/artifacts.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file channel/web/static/js/views/knowledge.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file REDACTED:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/src/renderer/src/pages/AgentsPage.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/src/renderer/src/pages/SkillsPage.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/src/renderer/src/components/ChatInput.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file channel/web/static/js/views/sessions.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/src/renderer/src/pages/ChannelsPage.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/src/main/index.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file channel/web/static/js/views/config.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/src/renderer/src/components/MenuEditor.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file channel/web/static/js/views/tasks-modal.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/src/renderer/src/layout/SessionList.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/src/renderer/src/pages/skills/SkillAddModal.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file channel/web/static/js/views/channels.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/src/renderer/src/pages/ChatPage.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/src/main/app-icon.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file channel/web/static/js/core/markdown.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file channel/web/static/js/views/tasks.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/src/renderer/src/pages/skills/McpEditorModal.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/src/renderer/src/layout/NavRail.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.
+ 15 more in this group — see findings.md.
X24 · Document value interpolated into markup unescaped· Untrusted text written into markup unescaped · ×40
Untrusted text written into markup unescaped channel/web/static/js/chat/composer-input.js:198— `i` is text this program did not author, and it is written into a quoted attribute value through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/context-usage.js:71— `_ctxFmtTokens(b[l.key]||0)` is text this program did not author, and it is written into the text of an element through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/context-usage.js:86— `usedLine` is text this program did not author, and it is written into the text of an element through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/context-usage.js:372— `t('ctx_compacted_divider').replace('{before}',data.before||0).replace('{after}',data.after||0)` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/message-actions.js:90— `formatTime(timestamp)` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:15— `escapeHtml(agent.id)` is text this program did not author, and it is written into a script or style context through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. A script or style context needs its own escaping (or a JSON serialiser that escapes `<`); better, pass the value through a data attribute.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:76— `escapeHtml(agent.id)` is text this program did not author, and it is written into a script or style context through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. A script or style context needs its own escaping (or a JSON serialiser that escapes `<`); better, pass the value through a data attribute.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:128— `appConfig.title||'CowAgent'` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:129— `t('welcome_subtitle')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:136— `t('example_sys_title')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:138— `t('example_sys_text')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:145— `t('example_task_title')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:147— `t('example_task_text')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:154— `t('example_code_title')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:156— `t('example_code_text')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:163— `t('example_knowledge_title')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:165— `t('example_knowledge_text')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:172— `t('example_skill_title')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:174— `t('example_skill_text')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:181— `t('example_web_title')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/new-chat.js:183— `t('example_web_text')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/render.js:78— `openable` is text this program did not author, and it is written into an unquoted attribute through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML text encoding does not help in an unquoted attribute — whitespace ends it; quote the attribute and encode the value.
Untrusted text written into markup unescaped channel/web/static/js/chat/render.js:91— `t('edit_message')` is text this program did not author, and it is written into a quoted attribute value through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/render.js:94— `t('delete_message_title')` is text this program did not author, and it is written into a quoted attribute value through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped channel/web/static/js/chat/render.js:97— `formatTime(timestamp)` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
FunctionTooLong: send.startSSE channel/web/static/js/chat/send.js:211— FunctionTooLong — startSSE runs 559 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 459 over it, 5.59× 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: MenuEditor.EditorDialog desktop/src/renderer/src/components/MenuEditor.tsx:130— FunctionTooLong — EditorDialog runs 458 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 358 over it, 4.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: SkillAddModal.SkillAddModal desktop/src/renderer/src/pages/skills/SkillAddModal.tsx:144— FunctionTooLong — SkillAddModal runs 349 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 249 over it, 3.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ArtifactsPage.ArtifactsPage desktop/src/renderer/src/pages/ArtifactsPage.tsx:72— FunctionTooLong — ArtifactsPage runs 296 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 196 over it, 2.96× 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: McpEditorModal.McpEditorModal desktop/src/renderer/src/pages/skills/McpEditorModal.tsx:81— FunctionTooLong — McpEditorModal runs 284 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 184 over it, 2.84× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: KnowledgeGraph.KnowledgeGraph desktop/src/renderer/src/components/KnowledgeGraph.tsx:42— FunctionTooLong — KnowledgeGraph runs 282 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 182 over it, 2.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ModelCatalogEditor.ModelCatalogEditor desktop/src/renderer/src/pages/settings/ModelCatalogEditor.tsx:133— FunctionTooLong — ModelCatalogEditor runs 271 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 171 over it, 2.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ContextUsagePopover.ContextUsagePopover desktop/src/renderer/src/components/ContextUsagePopover.tsx:45— FunctionTooLong — ContextUsagePopover runs 266 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 166 over it, 2.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: QrScanPanel.QrScanPanel desktop/src/renderer/src/components/QrScanPanel.tsx:32— FunctionTooLong — QrScanPanel runs 215 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 115 over it, 2.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: OnboardingWizard.OnboardingWizard desktop/src/renderer/src/components/OnboardingWizard.tsx:26— FunctionTooLong — OnboardingWizard runs 212 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 112 over it, 2.12× 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: TasksPage.TasksPage desktop/src/renderer/src/pages/TasksPage.tsx:85— FunctionTooLong — TasksPage runs 212 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 112 over it, 2.12× 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: MemoryPage.MemoryPage desktop/src/renderer/src/pages/MemoryPage.tsx:66— FunctionTooLong — MemoryPage runs 192 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 92 over it, 1.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: WorkspaceSelector.WorkspaceSelector desktop/src/renderer/src/components/WorkspaceSelector.tsx:23— FunctionTooLong — WorkspaceSelector runs 190 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 90 over it, 1.90× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: tasks-modal.saveTaskEdit channel/web/static/js/views/tasks-modal.js:463— FunctionTooLong — saveTaskEdit runs 186 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 86 over it, 1.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: WorkspacePanel.WorkspacePanel desktop/src/renderer/src/components/WorkspacePanel.tsx:51— FunctionTooLong — WorkspacePanel runs 176 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 76 over it, 1.76× 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: artifactStore.useArtifactStore desktop/src/renderer/src/store/artifactStore.ts:129— FunctionTooLong — useArtifactStore runs 173 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 73 over it, 1.73× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ChannelsPage.ChannelsPage desktop/src/renderer/src/pages/ChannelsPage.tsx:79— FunctionTooLong — ChannelsPage runs 164 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 64 over it, 1.64× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: doc-editor.createDocEditor channel/web/static/js/doc-editor.js:73— FunctionTooLong — createDocEditor runs 153 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 53 over it, 1.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: FileTree.FileTree desktop/src/renderer/src/components/FileTree.tsx:12— FunctionTooLong — FileTree runs 148 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 48 over it, 1.48× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: models.renderCapabilityBody channel/web/static/js/views/models.js:1233— FunctionTooLong — renderCapabilityBody runs 144 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 44 over it, 1.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: TasksPage.RunDetailModal desktop/src/renderer/src/pages/TasksPage.tsx:581— FunctionTooLong — RunDetailModal 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: CapabilityCard.CapabilityCard desktop/src/renderer/src/pages/settings/CapabilityCard.tsx:32— FunctionTooLong — CapabilityCard runs 141 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 41 over it, 1.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ArtifactPreview.ArtifactPreview desktop/src/renderer/src/pages/artifacts/ArtifactPreview.tsx:112— FunctionTooLong — ArtifactPreview runs 131 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 31 over it, 1.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: knowledge.renderKnowledgeGraph channel/web/static/js/views/knowledge.js:916— FunctionTooLong — renderKnowledgeGraph runs 128 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 28 over it, 1.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: docEditorStore.createDocEditorStore desktop/src/renderer/src/store/docEditorStore.ts:134— FunctionTooLong — createDocEditorStore runs 123 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 23 over it, 1.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
+ 8 more in this group — see findings.md.
X2 · Cancellation propagation· Async function without AbortSignal · ×28
Async function without AbortSignal: wsApi channel/web/static/js/workspace.js:103— `wsApi` 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: wsRenderPreview channel/web/static/js/workspace.js:307— `wsRenderPreview` 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: savePreviewEdit channel/web/static/js/workspace.js:573— `savePreviewEdit` 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: refreshWorkspaceSelector channel/web/static/js/chat/workspace-selector.js:31— `refreshWorkspaceSelector` 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: _fpBrowse channel/web/static/js/chat/workspace-selector.js:179— `_fpBrowse` 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: _wsSelApply channel/web/static/js/chat/workspace-selector.js:264— `_wsSelApply` 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: upload channel/web/static/js/chat/state.js:239— `upload` 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: handleFileSelect channel/web/static/js/chat/state.js:860— `handleFileSelect` 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: handleFolderSelect channel/web/static/js/chat/state.js:914— `handleFolderSelect` 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: refreshSessionSettings channel/web/static/js/chat/session-settings.js:45— `refreshSessionSettings` 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: _applySessionSettings channel/web/static/js/chat/session-settings.js:262— `_applySessionSettings` 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: regenerateResponse channel/web/static/js/chat/send.js:6— `regenerateResponse` 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: postJson REDACTED:77— `postJson` 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: uploadSkillFiles REDACTED:987— `uploadSkillFiles` 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: skillReadContent REDACTED:1376— `skillReadContent` 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: skillWriteContent REDACTED:1386— `skillWriteContent` 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: skillListFiles REDACTED:1398— `skillListFiles` 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: postSkillCreate REDACTED:2008— `postSkillCreate` 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: knowledgeReadDoc channel/web/static/js/views/knowledge.js:74— `knowledgeReadDoc` 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: knowledgeWriteDoc channel/web/static/js/views/knowledge.js:87— `knowledgeWriteDoc` 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: _refreshKnowledgeTree channel/web/static/js/views/knowledge.js:114— `_refreshKnowledgeTree` 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: dispatchKnowledgeAction channel/web/static/js/views/knowledge.js:322— `dispatchKnowledgeAction` 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: importKnowledgeDocuments channel/web/static/js/views/knowledge.js:591— `importKnowledgeDocuments` 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: docReadFile channel/web/static/js/views/doc-viewers.js:17— `docReadFile` 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: docWriteFile channel/web/static/js/views/doc-viewers.js:25— `docWriteFile` 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 })`.
Swallowed exception (caught, then discarded) app.py:401— `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) app.py:513— `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) agent/admin.py:293— `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) agent/chat/session_service.py:460— `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) agent/chat/service.py:570— `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) agent/chat/service.py:602— `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) agent/chat/service.py:700— `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) agent/chat/service.py:749— `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) agent/chat/service.py:806— `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) agent/evolution/trigger.py:54— `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) agent/evolution/prompts.py:155— `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) agent/evolution/REDACTED:62— `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) agent/evolution/REDACTED:68— `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) agent/knowledge/service.py:309— `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) REDACTED:166— `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) agent/memory/storage.py:573— `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) agent/memory/storage.py:1109— `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) agent/memory/conversation_store.py:326— `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) agent/memory/conversation_store.py:414— `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) agent/memory/conversation_store.py:473— `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) agent/memory/conversation_store.py:479— `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) agent/memory/conversation_store.py:729— `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) agent/memory/conversation_store.py:757— `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.
Focus outline removed inline channel/web/static/js/views/channels.js:276— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline channel/web/static/js/views/channels.js:285— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline channel/web/static/js/views/models.js:985— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline channel/web/static/js/views/models.js:2284— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline REDACTED:1282— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/components/DocEditor.tsx:179— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/components/FileEditor.tsx:84— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/components/FileTree.tsx:91— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/components/LoginGate.tsx:48— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/components/MenuEditor.tsx:728— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/layout/SessionList.tsx:482— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/pages/AgentsPage.tsx:472— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/pages/AgentsPage.tsx:974— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/pages/ChannelsPage.tsx:862— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/pages/KnowledgePage.tsx:669— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/pages/KnowledgePage.tsx:923— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/pages/KnowledgePage.tsx:949— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/pages/KnowledgePage.tsx:967— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/pages/TasksPage.tsx:1060— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/renderer/src/pages/settings/primitives.tsx:285— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Swallowed exception (empty catch) app.py:269— 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) app.py:532— 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) app.py:610— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) agent/chat/session_service.py:331— 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) agent/chat/service.py:450— 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) agent/chat/service.py:598— 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) agent/chat/service.py:830— 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) agent/chat/service.py:843— 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) agent/chat/service.py:858— 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) agent/evolution/trigger.py:74— 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) agent/evolution/trigger.py:88— 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) agent/evolution/executor.py:588— 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) agent/knowledge/service.py:216— 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) agent/knowledge/service.py:677— 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) agent/knowledge/service.py:771— 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:527— 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:586— 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 (7 lines × 2) bridge/agent_initializer.py:1131— bridge/agent_initializer.py:1131-1137 | models/linkai/link_ai_bot.py:603-609 — 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) channel/web/api/scheduler.py:163— channel/web/api/scheduler.py:163-169 | channel/web/api/scheduler.py:193-199 — both copies are in the same file, so extract the 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 (7 lines × 2) channel/web/api/skills.py:653— channel/web/api/skills.py:653-659 | channel/web/api/workspace.py:299-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.
Duplicated block (7 lines × 2) channel/web/api/workspace.py:349— channel/web/api/workspace.py:349-355 | channel/web/api/workspace.py:385-391 — both copies are in the same file, so extract the 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, `channel/web/api/workspace.py:392` calls `get`, `strip` and `channel/web/api/workspace.py:356` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) channel/wechat_kf/wechat_kf_message.py:77— channel/wechat_kf/wechat_kf_message.py:77-83 | channel/wechat_kf/wechat_kf_message.py:93-100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) channel/wechatmp/wechatmp_channel.py:227— channel/wechatmp/wechatmp_channel.py:227-233 | channel/wechatmp/wechatmp_channel.py:354-360 — both copies are in the same file, so extract the 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 `channel/wechatmp/wechatmp_channel.py:227` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) channel/wechatmp/wechatmp_channel.py:260— channel/wechatmp/wechatmp_channel.py:260-266 | channel/wechatmp/wechatmp_channel.py:384-390 — both copies are in the same file, so extract the 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 `channel/wechatmp/wechatmp_channel.py:260` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) cli/commands/knowledge.py:45— cli/commands/knowledge.py:45-51 | plugins/cow_cli/cow_cli.py:1917-1923 — 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) cli/commands/skill.py:879— cli/commands/skill.py:879-885 | cli/commands/skill.py:930-936 — both copies are in the same file, so extract the block into 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) models/chatgpt/chat_gpt_bot.py:52— models/chatgpt/chat_gpt_bot.py:52-58 | models/openai/open_ai_bot.py:30-36 — 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 `models/chatgpt/chat_gpt_bot.py:52` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) plugins/plugin_manager.py:398— plugins/plugin_manager.py:398-404 | plugins/plugin_manager.py:433-439 — both copies are in the same file, so extract the 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 (7 lines × 2) voice/zhipuai/zhipuai_voice.py:44— voice/zhipuai/zhipuai_voice.py:44-50 | voice/zhipuai/zhipuai_voice.py:82-88 — both copies are in the same file, so extract the 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 (7 lines × 2) agent/workspace/project_store.py:88— agent/workspace/project_store.py:88-96 | agent/workspace/session_prefs.py:74-80 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `agent/workspace/project_store.py:99` calls `_normalize`, `realpath`, `expand_path` and `agent/workspace/session_prefs.py:83` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) plugins/linkai/midjourney.py:204— plugins/linkai/midjourney.py:204-210 | plugins/linkai/midjourney.py:242-248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
TooManyMethods: ApiClient desktop/src/renderer/src/api/client.ts:73— TooManyMethods — 119 methods. The bar is 30 methods; this is 89 over it, 3.97× 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: CowCliPlugin plugins/cow_cli/cow_cli.py:82— TooManyMethods — 67 methods. The bar is 30 methods; this is 37 over it, 2.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: CloudClient common/cloud_client.py:228— 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: ConversationStore agent/memory/conversation_store.py:636— TooManyMethods — 54 methods. The bar is 30 methods; this is 24 over it, 1.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: AgentStreamExecutor REDACTED:242— TooManyMethods — 54 methods. The bar is 30 methods; this is 24 over it, 1.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: AgentBridge bridge/agent_bridge.py:587— 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: ModelsHandler channel/web/api/models.py:305— 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: BrowserService agent/tools/browser/browser_service.py:414— TooManyMethods — 50 methods. The bar is 30 methods; this is 20 over it, 1.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MemoryStorage agent/memory/storage.py:131— TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WecomBotChannel REDACTED:141— TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WeixinChannel channel/weixin/weixin_channel.py:165— TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: QQChannel REDACTED:97— 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: PythonBackend REDACTED:80— TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Change coupling: preload.ts ↔ types.ts desktop/src/main/preload.ts:1— `desktop/src/main/preload.ts` and `desktop/src/renderer/src/types.ts` change together 91% of the time (20 of the 22 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 20 shared commits counted here, the most recent 3 are `95dcc717` feat(desktop): request mic access on first use and add extension poin…; `c875fdcb` feat(desktop): support extra query params on the update feed; `d6a2ea7e` feat(desktop): align scheduler UI, run records, and single-source not… — run `git show` on any of them.
Change coupling: dungeon.py ↔ role.py plugins/dungeon/dungeon.py:1— `plugins/dungeon/dungeon.py` and `plugins/role/role.py` change together 87% of the time (13 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `4fa90e74` fix: compare the feishu callback token with constant_time_equals; `1c93c994` fix(plugins): do not let a blank message raise inside the role and du…; `419a3e51` feat: make plugin compatible with LINKAI in most cases — run `git show` on any of them.
Change coupling: edit.py ↔ write.py agent/tools/edit/edit.py:1— `agent/tools/edit/edit.py` and `agent/tools/write/write.py` change together 73% of the time (8 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `046214c3` chore(edit,write): drop the two unused bindings the lint gate flags; `ff0d4a73` fix(edit,write): write through a sibling file so a failed write keeps…; `e2d284c7` fix: share the memory index dirty check, and cover MEMORY.md — run `git show` on any of them.
Change coupling: preload.ts ↔ i18n.ts desktop/src/main/preload.ts:1— `desktop/src/main/preload.ts` and `desktop/src/renderer/src/i18n.ts` change together 59% of the time (13 of the 22 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 13 shared commits counted here, the most recent 3 are `95dcc717` feat(desktop): request mic access on first use and add extension poin…; `d6a2ea7e` feat(desktop): align scheduler UI, run records, and single-source not…; `1c318b82` fix(desktop): import attachments by local path to stop intermittent u… — run `git show` on any of them.
Change coupling: index.ts ↔ types.ts desktop/src/main/index.ts:1— `desktop/src/main/index.ts` and `desktop/src/renderer/src/types.ts` change together 57% of the time (20 of the 35 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) 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 20 shared commits counted here, the most recent 3 are `95dcc717` feat(desktop): request mic access on first use and add extension poin…; `c875fdcb` feat(desktop): support extra query params on the update feed; `d6a2ea7e` feat(desktop): align scheduler UI, run records, and single-source not… — run `git show` on any of them.
Change coupling: MessageBubble.tsx ↔ chatStore.ts desktop/src/renderer/src/components/MessageBubble.tsx:1— `desktop/src/renderer/src/components/MessageBubble.tsx` and `desktop/src/renderer/src/store/chatStore.ts` change together 57% of the time (8 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `78fdaffb` feat: let a suggestion card send a message with a separate display text; `1ab74c4f` fix: show per-reply usage as a hover icon and sync it to desktop; `fdca9431` feat: show stopped and interrupted replies in the desktop client — run `git show` on any of them.
Change coupling: banwords.py ↔ godcmd.py plugins/banwords/banwords.py:1— `plugins/banwords/banwords.py` and `plugins/godcmd/godcmd.py` change together 55% of the time (11 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `9340abe5` refactor: share one atomic file write helper across stores; `abc44006` fix(plugins): write the repaired plugin config through a sibling file; `198247c1` fix(plugins): keep a plugin running when its config cannot be written… — run `git show` on any of them.
Change coupling: web_channel.py ↔ client.ts channel/web/web_channel.py:1— `channel/web/web_channel.py` and `desktop/src/renderer/src/api/client.ts` change together 53% of the time (17 of the 32 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) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 17 shared commits counted here, the most recent 3 are `389c14d4` feat: reach every file of a skill, in the viewer and when creating one; `404ba329` feat: create a skill from the console, by form or by upload; `cdf4b80f` feat: add MCP and skill configuration in the web and desktop consoles — run `git show` on any of them.
Change coupling: chat_gpt_bot.py ↔ REDACTED models/chatgpt/chat_gpt_bot.py:1— `models/chatgpt/chat_gpt_bot.py` and `models/openai/open_ai_bot.py` change together 53% of the time (17 of the 32 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 17 shared commits counted here, the most recent 3 are `7fe71635` feat: add open_ai_api_type to route OpenAI requests via Responses API; `8752f0cc` refactor(openai): drop SDK dependency and switch to native HTTP client; `d5d0b947` fix: complete openai_compat migration across all model bots — run `git show` on any of them.
Change coupling: deepseek_bot.py ↔ moonshot_bot.py models/deepseek/deepseek_bot.py:1— `models/deepseek/deepseek_bot.py` and `models/moonshot/moonshot_bot.py` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `081fbafc` fix(minimax): close streaming responses on every exit; `bf7381a7` fix: share one failure-body reader across the reply_text bots; `3b571d97` fix(models): answer a refused call instead of re-sending it — run `git show` on any of them.
Change coupling: MessageSteps.tsx ↔ chatStore.ts desktop/src/renderer/src/components/MessageSteps.tsx:1— `desktop/src/renderer/src/components/MessageSteps.tsx` and `desktop/src/renderer/src/store/chatStore.ts` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `fdca9431` feat: show stopped and interrupted replies in the desktop client; `984eafed` feat(desktop): show a delegated teammate's reply in its own bubble; `4024eac5` feat(mcp): show tool retrieval diagnostics in clients — run `git show` on any of them.
Change coupling: slack_channel.py ↔ telegram_channel.py channel/slack/slack_channel.py:1— `channel/slack/slack_channel.py` and `channel/telegram/telegram_channel.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 `7a342d02` refactor: reuse shared download and atomic write helpers in new chann…; `865557e2` feat(channels): extend multi-instance + team support to dingtalk, qq,…; `4abf2519` feat(channels): run multiple channel instances, each bound to its own… — run `git show` on any of them.
Change coupling: builder.py ↔ templates.py agent/prompt/builder.py:1— `agent/prompt/builder.py` and `agent/subagent/templates.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 `f2b6767a` fix: narrow subagent delegation and wrap up before timeout; `7f64d5de` fix: keep the date in the system prompt and rename the time tool; `563b5520` feat(subagent): improve delegation prompt and allow memory reads in s… — run `git show` on any of them.
AC6 · Visual & motion safety· Focus outline removed in CSS without a · ×12
Focus outline removed in CSS without a :focus replacement desktop/src/renderer/src/index.css:710— `.art-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 desktop/src/renderer/src/index.css:766— `.art-card` 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 desktop/src/renderer/src/index.css:1122— `.art-name-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 channel/web/static/css/artifacts.css:95— `.art-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 channel/web/static/css/artifacts.css:147— `.art-card` 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 channel/web/static/css/artifacts.css:576— `.art-name-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 channel/web/static/css/chat.css:79— `.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 channel/web/static/css/components.css:192— `.cfg-dropdown` 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 channel/web/static/css/menu.css:300— `.me-art-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 channel/web/static/css/sessions.css:511— `.session-title-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 channel/web/static/css/workspace.css:292— `.workspace-preview-content .ws-editor` 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 channel/web/static/css/workspace.css:319— `textarea.doc-editor` 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.
Duplicated block (9 lines × 2) REDACTED:245— REDACTED:245-253 | REDACTED:266-274 — both copies are in the same file, so extract the 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 (9 lines × 2) channel/discord/discord_channel.py:242— channel/discord/discord_channel.py:242-250 | channel/slack/slack_channel.py:259-267 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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) channel/web/api/artifacts.py:187— channel/web/api/artifacts.py:187-195 | channel/web/api/artifacts.py:237-245 — both copies are in the same file, so extract the block into 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) channel/web/api/sessions.py:1013— channel/web/api/sessions.py:1013-1021 | channel/web/api/sessions.py:1092-1100 — both copies are in the same file, so extract the 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) channel/web/api/skills.py:632— channel/web/api/skills.py:632-640 | channel/web/api/workspace.py:273-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 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) channel/wechatmp/wechatmp_channel.py:242— channel/wechatmp/wechatmp_channel.py:242-250 | channel/wechatmp/wechatmp_channel.py:368-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 `channel/wechatmp/wechatmp_channel.py:242` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) REDACTED:443— REDACTED:443-451 | REDACTED:735-743 — both copies are in the same file, so extract the 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 `REDACTED:443` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) REDACTED:452— REDACTED:452-460 | REDACTED:746-754 — both copies are in the same file, so extract the 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 `REDACTED:452` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:744` calls `_push_stream` and `REDACTED:451` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) cli/commands/skill.py:553— cli/commands/skill.py:553-561 | cli/commands/skill.py:1667-1675 — both copies are in the same file, so extract the block into 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) models/linkai/link_ai_bot.py:236— models/linkai/link_ai_bot.py:236-244 | models/linkai/link_ai_bot.py:364-372 — both copies are in the same file, so extract the 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 `models/linkai/link_ai_bot.py:236` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) models/zhipuai/zhipuai_bot.py:138— models/zhipuai/zhipuai_bot.py:138-146 | models/zhipuai/zhipuai_bot.py:148-156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
AC4 · Keyboard semantics· Anchor without href · ×9
Anchor without href channel/web/templates/layout/sidebar.html:30— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href channel/web/templates/layout/sidebar.html:45— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href channel/web/templates/layout/sidebar.html:50— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href channel/web/templates/layout/sidebar.html:55— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href channel/web/templates/layout/sidebar.html:60— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href channel/web/templates/layout/sidebar.html:65— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href channel/web/templates/layout/sidebar.html:70— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href channel/web/templates/layout/sidebar.html:75— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href channel/web/templates/layout/sidebar.html:90— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Duplicated block (8 lines × 2) channel/feishu/feishu_channel.py:114— channel/feishu/feishu_channel.py:114-121 | channel/weixin/weixin_channel.py:469-476 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) REDACTED:335— REDACTED:335-343 | REDACTED:268-275 — 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 `REDACTED:335` 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) cli/commands/skill.py:1707— cli/commands/skill.py:1707-1714 | plugins/cow_cli/cow_cli.py:1327-1334 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) models/linkai/link_ai_bot.py:206— models/linkai/link_ai_bot.py:206-213 | models/linkai/link_ai_bot.py:349-356 — both copies are in the same file, so extract the block into 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) plugins/linkai/linkai.py:140— plugins/linkai/linkai.py:140-147 | plugins/linkai/linkai.py:175-182 — both copies are in the same file, so extract the 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 (8 lines × 2) voice/dashscope/dashscope_voice.py:68— voice/dashscope/dashscope_voice.py:68-75 | voice/zhipuai/zhipuai_voice.py:71-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) agent/chat/service.py:694— agent/chat/service.py:694-701 | bridge/agent_bridge.py:979-987 — 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 (8 lines × 2) agent/workspace/project_store.py:152— agent/workspace/project_store.py:152-163 | agent/workspace/session_prefs.py:159-166 — 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 (8 lines × 2) channel/discord/discord_channel.py:156— channel/discord/discord_channel.py:156-163 | channel/telegram/telegram_channel.py:247-254 — `channel/discord/discord_channel.py` and `channel/telegram/telegram_channel.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 12 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (5 lines × 2) agent/chat/service.py:836— agent/chat/service.py:836-840 | bridge/agent_bridge.py:1839-1843 — 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) agent/tools/web_search/web_search.py:473— agent/tools/web_search/web_search.py:473-477 | agent/tools/web_search/web_search.py:585-589 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) channel/chat_channel.py:801— channel/chat_channel.py:801-805 | channel/chat_channel.py:812-816 — both copies are in the same file, so extract the block into 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) channel/web/api/models.py:2279— channel/web/api/models.py:2279-2283 | channel/web/api/models.py:2502-2506 — both copies are in the same file, so extract the block into 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) cli/commands/skill.py:545— cli/commands/skill.py:545-549 | cli/commands/skill.py:1659-1663 — both copies are in the same file, so extract the block into 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) skills/image-generation/scripts/generate.py:471— skills/image-generation/scripts/generate.py:471-475 | skills/image-generation/scripts/generate.py:1021-1025 — both copies are in the same file, so extract the 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, `skills/image-generation/scripts/generate.py:469` calls `_apply_attribution_headers` and `skills/image-generation/scripts/generate.py:1019` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 2) channel/slack/slack_channel.py:380— channel/slack/slack_channel.py:380-384 | channel/telegram/telegram_channel.py:508-512 — 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) channel/web/api/artifacts.py:226— channel/web/api/artifacts.py:226-230 | channel/web/api/scheduler.py:173-177 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `channel/web/api/scheduler.py:183` calls `row` and `channel/web/api/artifacts.py:236` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 2) channel/web/api/files.py:86— channel/web/api/files.py:86-90 | channel/web/core/channel.py:763-767 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (17 lines × 2) agent/chat/service.py:491— agent/chat/service.py:491-507 | agent/protocol/agent.py:874-890 — 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 (17 lines × 2) REDACTED:288— REDACTED:288-304 | REDACTED:421-437 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) agent/tools/scheduler/integration.py:885— agent/tools/scheduler/integration.py:885-901 | agent/tools/scheduler/integration.py:1164-1180 — both copies are in the same file, so extract the 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 (17 lines × 2) channel/dingtalk/dingtalk_channel.py:405— channel/dingtalk/dingtalk_channel.py:405-421 | channel/dingtalk/dingtalk_channel.py:611-629 — both copies are in the same file, so extract the 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 `robot_code` to `str = None` in one and `str` 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 (17 lines × 2) channel/wechatmp/active_reply.py:24— channel/wechatmp/active_reply.py:24-40 | channel/wechatmp/passive_reply.py:28-44 — before extracting anything, compare `channel/wechatmp/active_reply.py` and `channel/wechatmp/passive_reply.py` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `channel/wechatmp/passive_reply.py:27` calls `time` and `channel/wechatmp/active_reply.py:23` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) channel/wechatmp/wechatmp_channel.py:202— channel/wechatmp/wechatmp_channel.py:202-218 | channel/wechatmp/wechatmp_channel.py:330-346 — both copies are in the same file, so extract the 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 `channel/wechatmp/wechatmp_channel.py:202` 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 (17 lines × 2) models/deepseek/deepseek_bot.py:180— models/deepseek/deepseek_bot.py:180-196 | models/mimo/mimo_bot.py:175-191 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) voice/dashscope/dashscope_voice.py:33— voice/dashscope/dashscope_voice.py:33-49 | voice/zhipuai/zhipuai_voice.py:31-47 — 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 (6 lines × 2) agent/memory/service.py:82— agent/memory/service.py:82-87 | agent/memory/service.py:99-104 — both copies are in the same file, so extract the block into 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) agent/tools/read/read.py:112— agent/tools/read/read.py:112-117 | agent/tools/send/send.py:39-44 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) channel/wechatcom/wechatcomapp_channel.py:159— channel/wechatcom/wechatcomapp_channel.py:159-164 | channel/wechatcom/wechatcomapp_channel.py:182-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) models/dashscope/dashscope_bot.py:150— models/dashscope/dashscope_bot.py:150-160 | models/dashscope/dashscope_bot.py:380-385 — both copies are in the same file, so extract the 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 `models/dashscope/dashscope_bot.py:380` 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 (6 lines × 2) plugins/godcmd/godcmd.py:146— plugins/godcmd/godcmd.py:146-151 | plugins/godcmd/godcmd.py:165-170 — both copies are in the same file, so extract the block into 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) skills/image-generation/scripts/generate.py:277— skills/image-generation/scripts/generate.py:277-282 | skills/image-generation/scripts/generate.py:473-478 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) agent/tools/web_fetch/web_fetch.py:58— agent/tools/web_fetch/web_fetch.py:58-63 | agent/tools/web_search/web_search.py:82-88 — 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) channel/terminal/terminal_channel.py:187— channel/terminal/terminal_channel.py:187-192 | REDACTED:714-719 — 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 what the matched lines are: every one of them assigns one field to another, so the block is a hand-written mapper between two data shapes rather than behaviour with a helper inside it. Extracting one shared function only works if both sites map the SAME pair of types in the same direction — check that first, because inverse or differently-typed mappers have no single function they can both call. Where they do not, the moves that exist are a generated or reflective mapper, a common embedded/base type the fields live on once, or accepting the run and covering it with a test that fails when a field is added to one side only.
Sync-over-async blocking desktop/src/main/app-icon.ts:133— `fs.mkdirSync` in `downloadIco` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking desktop/src/main/app-icon.ts:134— `fs.writeFileSync` in `downloadIco` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking desktop/src/main/app-icon.ts:246— `fs.existsSync` in `writeIcoFromCachedPng` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking desktop/src/main/app-icon.ts:250— `fs.mkdirSync` in `writeIcoFromCachedPng` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking desktop/src/main/app-icon.ts:251— `fs.writeFileSync` in `writeIcoFromCachedPng` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking desktop/src/main/app-icon.ts:535— `fs.readFileSync` in `recordShortcutName` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:767— `fs.mkdirSync` in `start` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:776— `fs.existsSync` in `start` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Duplicated block (11 lines × 2) agent/evolution/executor.py:110— agent/evolution/executor.py:110-120 | REDACTED:879-889 — 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) agent/tools/browser/browser_service.py:1305— agent/tools/browser/browser_service.py:1305-1315 | agent/tools/browser/browser_service.py:1324-1334 — both copies are in the same file, so extract the 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) agent/tools/edit/edit.py:94— agent/tools/edit/edit.py:94-105 | agent/tools/send/send.py:67-77 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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, `agent/tools/send/send.py:63` calls `lower`, `startswith`, `_build_url_result` and `agent/tools/edit/edit.py:91` 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) channel/discord/discord_channel.py:277— channel/discord/discord_channel.py:277-287 | channel/slack/slack_channel.py:296-306 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 2) REDACTED:232— REDACTED:232-242 | REDACTED:247-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. 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, `REDACTED:229` calls `_read_media` and `REDACTED:246` 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) REDACTED:605— REDACTED:605-615 | channel/wechatcom/wechatcomapp_channel.py:266-276 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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) channel/wechatmp/wechatmp_channel.py:373— channel/wechatmp/wechatmp_channel.py:373-383 | channel/wechatmp/wechatmp_channel.py:387-397 — both copies are in the same file, so extract the 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.
TodoComment channel/dingtalk/dingtalk_channel.py:979— # TODO: 获取实际视频时长 — 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 channel/wechatmp/wechatmp_channel.py:190— # todo check media_id — 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 plugins/tool/tool.py:74— # todo: 有些工具必须要api-key,需要修改config文件,所以这里没有实现query增删tool的功能 — 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 skills/skill-creator/scripts/init_skill.py:57— ## [TODO: Replace with the first main section based on chosen structure] — 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 skills/skill-creator/scripts/init_skill.py:119— # TODO: Add actual script logic here — 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 voice/pytts/pytts_voice.py:39— # TODO: check if this is work on win32 — 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.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×6
Members sharing a duplicated core (4 members, 50+ identical tokens) channel/feishu/feishu_channel.py:403— channel/feishu/feishu_channel.py:403-417 | REDACTED:115-127 | channel/wechatcom/wechatcomapp_channel.py:74-89 | channel/wechatmp/wechatmp_channel.py:134-147 — 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) channel/web/api/knowledge.py:42— channel/web/api/knowledge.py:42-62 | channel/web/api/skills.py:578-591 | channel/web/api/skills.py:611-626 | channel/web/api/workspace.py:349-378 — 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) channel/web/api/models.py:2314— channel/web/api/models.py:2314-2367 | channel/web/api/models.py:2370-2390 | channel/web/api/models.py:2479-2508 | channel/web/api/models.py:2633-2664 — 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) models/dashscope/dashscope_bot.py:233— models/dashscope/dashscope_bot.py:233-349 | models/linkai/link_ai_bot.py:568-689 | models/openai_compatible_bot.py:71-197 | models/zhipuai/zhipuai_bot.py:207-309 — 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) models/deepseek/deepseek_bot.py:683— models/deepseek/deepseek_bot.py:683-720 | models/doubao/doubao_bot.py:156-194 | models/minimax/minimax_bot.py:192-235 | models/moonshot/moonshot_bot.py:198-233 — 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) plugins/banwords/lib/WordsSearch.py:166— plugins/banwords/lib/WordsSearch.py:166-184 | plugins/banwords/lib/WordsSearch.py:187-208 | plugins/banwords/lib/WordsSearch.py:212-227 | plugins/banwords/lib/WordsSearch.py:230-250 — 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 (13 lines × 2) agent/chat/service.py:763— agent/chat/service.py:763-775 | bridge/agent_bridge.py:1010-1022 — 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) agent/tools/mcp/mcp_oauth.py:159— agent/tools/mcp/mcp_oauth.py:159-171 | agent/tools/mcp/mcp_oauth.py:176-188 — both copies are in the same file, so extract the 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 (13 lines × 2) agent/tools/tool_manager.py:182— agent/tools/tool_manager.py:182-194 | agent/tools/tool_manager.py:245-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/tools/tool_manager.py:181` calls `debug` and `agent/tools/tool_manager.py:244` 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 (13 lines × 2) agent/tools/utils/truncate.py:154— agent/tools/utils/truncate.py:154-166 | agent/tools/utils/truncate.py:243-255 — both copies are in the same file, so extract the 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 `agent/tools/utils/truncate.py:154` 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 (13 lines × 2) channel/web/api/channels.py:435— channel/web/api/channels.py:435-447 | channel/web/api/channels.py:502-514 — both copies are in the same file, so extract the 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 after the matched lines, `channel/web/api/channels.py:448` calls `get` and `channel/web/api/channels.py:515` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) channel/weixin/weixin_channel.py:1060— channel/weixin/weixin_channel.py:1060-1072 | channel/weixin/weixin_channel.py:1108-1120 — both copies are in the same file, so extract the 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 `channel/weixin/weixin_channel.py:1060` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) app.py:736— app.py:736-745 | app.py:782-791 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) channel/feishu/feishu_channel.py:1878— channel/feishu/feishu_channel.py:1878-1887 | channel/feishu/feishu_channel.py:2146-2155 — both copies are in the same file, so extract the 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 (10 lines × 2) models/linkai/link_ai_bot.py:587— models/linkai/link_ai_bot.py:587-596 | models/openai_compatible_bot.py:102-111 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) skills/image-generation/scripts/generate.py:571— skills/image-generation/scripts/generate.py:571-580 | skills/image-generation/scripts/generate.py:1016-1025 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) voice/custom/custom_voice.py:68— voice/custom/custom_voice.py:68-77 | voice/custom/custom_voice.py:102-111 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `voice/custom/custom_voice.py:78` calls `open` and `voice/custom/custom_voice.py:112` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) voice/custom/custom_voice.py:132— voice/custom/custom_voice.py:132-141 | voice/linkai/linkai_voice.py:92-101 — 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 (14 lines × 2 locations) desktop/src/renderer/src/pages/KnowledgePage.tsx:248— desktop/src/renderer/src/pages/KnowledgePage.tsx:248 · desktop/src/renderer/src/pages/MemoryPage.tsx:75 — 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 (14 lines × 2 locations) desktop/src/renderer/src/pages/KnowledgePage.tsx:718— desktop/src/renderer/src/pages/KnowledgePage.tsx:718 · desktop/src/renderer/src/pages/MemoryPage.tsx:204 — the 2 copies are spread across 2 files, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases.
Duplicated block (14 lines × 2 locations) desktop/src/renderer/src/pages/TasksPage.tsx:213— desktop/src/renderer/src/pages/TasksPage.tsx:213 · desktop/src/renderer/src/pages/TasksPage.tsx:451 — 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.
Duplicated block (14 lines × 2 locations) desktop/src/renderer/src/pages/settings/BasicSettings.tsx:485— desktop/src/renderer/src/pages/settings/BasicSettings.tsx:485 · desktop/src/renderer/src/pages/settings/CapabilityCard.tsx:193 — 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.
Duplicated block (14 lines × 2 locations) desktop/src/renderer/src/pages/settings/ModelsTab.tsx:1137— desktop/src/renderer/src/pages/settings/ModelsTab.tsx:1137 · desktop/src/renderer/src/pages/settings/ModelsTab.tsx:1205 — 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 (14 lines × 2 locations) desktop/src/renderer/src/store/docEditorStore.ts:291— desktop/src/renderer/src/store/docEditorStore.ts:291 · desktop/src/renderer/src/store/workspaceStore.ts:334 — 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 (13 lines × 2 locations) channel/web/static/js/core/markdown.js:230— channel/web/static/js/core/markdown.js:230 · channel/web/static/js/core/markdown.js:248 — 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.
Duplicated block (13 lines × 2 locations) channel/web/static/js/views/models.js:613— channel/web/static/js/views/models.js:613 · channel/web/static/js/views/models.js:1921 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2 locations) channel/web/static/js/views/models.js:1030— channel/web/static/js/views/models.js:1030 · channel/web/static/js/views/models.js:1176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2 locations) channel/web/static/js/views/models.js:2416— channel/web/static/js/views/models.js:2416 · channel/web/static/js/views/models.js:2469 — both copies are in the same file, so extract the block into 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 locations) desktop/src/renderer/src/pages/AgentsPage.tsx:178— desktop/src/renderer/src/pages/AgentsPage.tsx:178 · desktop/src/renderer/src/pages/settings/ChatApiCard.tsx:47 — 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 (13 lines × 2 locations) desktop/src/renderer/src/pages/TasksPage.tsx:1133— desktop/src/renderer/src/pages/TasksPage.tsx:1133 · desktop/src/renderer/src/pages/TasksPage.tsx:1287 — 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 (12 lines × 2) agent/memory/conversation_store.py:1474— agent/memory/conversation_store.py:1474-1485 | agent/memory/conversation_store.py:1521-1532 — both copies are in the same file, so extract the 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 (12 lines × 2) REDACTED:2678— REDACTED:2678-2689 | REDACTED:2919-2930 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) agent/tools/bash/background.py:210— agent/tools/bash/background.py:210-221 | agent/tools/bash/bash.py:536-547 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) channel/dingtalk/dingtalk_channel.py:954— channel/dingtalk/dingtalk_channel.py:954-965 | channel/feishu/feishu_channel.py:955-966 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (12 lines × 2) channel/wechatmp/wechatmp_channel.py:342— channel/wechatmp/wechatmp_channel.py:342-353 | channel/wechatmp/wechatmp_channel.py:356-367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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–8 lines × 2) channel/feishu/feishu_channel.py:1897— channel/feishu/feishu_channel.py:1897-1903 | channel/feishu/feishu_channel.py:1932-1939 — both copies are in the same file, so extract the 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 `channel/feishu/feishu_channel.py:1897` 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 (7–8 lines × 2) channel/feishu/feishu_channel.py:1935— channel/feishu/feishu_channel.py:1935-1941 | channel/feishu/feishu_channel.py:2229-2236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `channel/feishu/feishu_channel.py:1935` 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 (7–8 lines × 2) REDACTED:243— REDACTED:243-250 | channel/wechatcom/wechatcomapp_channel.py:179-185 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `channel/wechatcom/wechatcomapp_channel.py:186` calls `info`, `format`, `fsize` and `REDACTED:251` 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 (7–8 lines × 2) channel/wechatcom/wechatcomapp_channel.py:171— channel/wechatcom/wechatcomapp_channel.py:171-178 | channel/wechatcom/wechatcomapp_channel.py:188-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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–8 lines × 2) cli/commands/skill.py:1557— cli/commands/skill.py:1557-1564 | cli/commands/skill.py:1580-1586 — both copies are in the same file, so extract the 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.
Low contrast Tailwind colour pair (4.3:1) channel/web/static/js/views/models.js:744— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.3:1) REDACTED:278— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.3:1) desktop/src/renderer/src/components/StatusScreen.tsx:96— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.3:1) desktop/src/renderer/src/components/StatusScreen.tsx:105— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (2.3:1) channel/web/static/js/views/models.js:779— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (2.3:1) channel/web/static/js/views/tasks.js:191— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (2.3:1) channel/web/static/js/views/tasks.js:204— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (2.3:1) channel/web/static/js/views/tasks.js:462— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
ClassTooLong: ChatInput desktop/src/renderer/src/components/ChatInput.tsx:1— ClassTooLong — 688 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 288 over it, 1.72× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ApiClient desktop/src/renderer/src/api/client.ts:73— ClassTooLong — 676 significant lines (blank, comment-only and punctuation-only lines excluded), 119 methods. The bar is 400 significant lines; this is 276 over it, 1.69× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: BasicSettings desktop/src/renderer/src/pages/settings/BasicSettings.tsx:1— ClassTooLong — 535 significant lines (blank, comment-only and punctuation-only lines excluded), 3 methods. The bar is 400 significant lines; this is 135 over it, 1.34× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PythonBackend REDACTED:80— ClassTooLong — 473 significant lines (blank, comment-only and punctuation-only lines excluded), 34 methods. The bar is 400 significant lines; this is 73 over it, 1.18× 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 (15 lines × 2) agent/tools/browser/browser_tool.py:173— agent/tools/browser/browser_tool.py:173-187 | agent/tools/utils/url_safety.py:83-97 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/tools/utils/url_safety.py:80` calls `_ssrf_protection_enabled` and `agent/tools/browser/browser_tool.py:171` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 2) channel/discord/discord_channel.py:90— channel/discord/discord_channel.py:90-104 | channel/telegram/telegram_channel.py:110-124 — `channel/discord/discord_channel.py` and `channel/telegram/telegram_channel.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 12 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (15 lines × 2) channel/wechatcom/wechatcomapp_message.py:21— channel/wechatcom/wechatcomapp_message.py:21-35 | channel/wechatmp/wechatmp_message.py:25-39 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (15 lines × 2) channel/wechatmp/passive_reply.py:203— channel/wechatmp/passive_reply.py:203-217 | channel/wechatmp/passive_reply.py:219-233 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) agent/memory/conversation_store.py:262— agent/memory/conversation_store.py:262-271 | agent/protocol/message_utils.py:281-290 | bridge/agent_initializer.py:701-710 — 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.
Duplicated block (10 lines × 3) agent/tools/scheduler/integration.py:905— agent/tools/scheduler/integration.py:905-914 | agent/tools/scheduler/integration.py:998-1007 | agent/tools/scheduler/integration.py:1184-1193 — 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 `agent/tools/scheduler/integration.py:905` 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 × 3) channel/discord/discord_channel.py:280— channel/discord/discord_channel.py:280-289 | channel/slack/slack_channel.py:299-308 | channel/telegram/telegram_channel.py:265-274 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `channel/telegram/telegram_channel.py:264` calls `_compute_session_id` and `channel/discord/discord_channel.py:279` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 3) models/deepseek/deepseek_session.py:48— models/deepseek/deepseek_session.py:48-57 | models/mimo/mimo_session.py:48-57 | models/qianfan/qianfan_session.py:48-57 — `models/deepseek/deepseek_session.py` and `models/mimo/mimo_session.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 4 separate duplicated blocks between them, totalling at least 57 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.
AC1 · Text alternatives· <video> without a captions track · ×3
<video> without a captions track channel/web/static/js/workspace.js:332— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
<video> without a captions track REDACTED:135— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
<video> without a captions track desktop/src/renderer/src/components/MessageBubble.tsx:267— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
startSSE::processSSEItem (cognitive 217) channel/web/static/js/chat/send.js:401— startSSE::processSSEItem has cognitive complexity 217 (threshold 15). Drivers by points: if/else 75 (143 pts), boolean chains 42, ternaries 11 (28 pts), loops 1 (4 pts) (nesting depth added 88). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
startSSE::connect::onmessage (cognitive 26) channel/web/static/js/chat/send.js:892— startSSE::connect::onmessage has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 7, 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.
startSSE::connect::onerror (cognitive 16) channel/web/static/js/chat/send.js:961— startSSE::connect::onerror has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Duplicated block (14 lines × 3) models/baidu/baidu_wenxin.py:36— models/baidu/baidu_wenxin.py:36-49 | models/claudeapi/claude_api_bot.py:178-191 | models/openai/open_ai_bot.py:71-84 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `models/claudeapi/claude_api_bot.py:192` calls `info` and `models/baidu/baidu_wenxin.py:50` 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 (14 lines × 3) models/deepseek/deepseek_bot.py:154— models/deepseek/deepseek_bot.py:154-167 | models/mimo/mimo_bot.py:147-160 | models/qianfan/qianfan_bot.py:114-127 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 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 `models/deepseek/deepseek_bot.py:154` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 3) models/doubao/doubao_bot.py:63— models/doubao/doubao_bot.py:63-76 | models/minimax/minimax_bot.py:72-85 | models/moonshot/moonshot_bot.py:103-116 — `models/doubao/doubao_bot.py` and `models/minimax/minimax_bot.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 20 separate duplicated blocks between them, totalling at least 336 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 (14 lines × 2) agent/chat/service.py:629— agent/chat/service.py:629-642 | bridge/agent_bridge.py:939-952 — 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 `agent/chat/service.py:629` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) models/modelscope/modelscope_bot.py:391— models/modelscope/modelscope_bot.py:391-404 | models/modelscope/modelscope_bot.py:434-447 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) plugins/cow_cli/cow_cli.py:1188— plugins/cow_cli/cow_cli.py:1188-1201 | plugins/cow_cli/cow_cli.py:1234-1247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 3) agent/tools/web_search/web_search.py:403— agent/tools/web_search/web_search.py:403-411 | agent/tools/web_search/web_search.py:668-676 | agent/tools/web_search/web_search.py:1022-1030 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 3) REDACTED:1100— REDACTED:1100-1109 | REDACTED:1128-1137 | REDACTED:1156-1164 — 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 `REDACTED:1100` 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 (9 lines × 3) channel/weixin/weixin_channel.py:1065— channel/weixin/weixin_channel.py:1065-1073 | channel/weixin/weixin_channel.py:1090-1098 | channel/weixin/weixin_channel.py:1113-1121 — 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 `channel/weixin/weixin_channel.py:1065` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `channel/weixin/weixin_channel.py:1088` calls `basename` and `channel/weixin/weixin_channel.py:1063` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 4) channel/feishu/feishu_channel.py:410— channel/feishu/feishu_channel.py:410-417 | REDACTED:120-127 | channel/wechatcom/wechatcomapp_channel.py:82-89 | channel/wechatmp/wechatmp_channel.py:140-147 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `channel/wechatcom/wechatcomapp_channel.py:79` calls `info` and `REDACTED:119` 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 × 4) channel/wechatmp/wechatmp_channel.py:344— channel/wechatmp/wechatmp_channel.py:344-351 | channel/wechatmp/wechatmp_channel.py:358-365 | channel/wechatmp/wechatmp_channel.py:374-381 | channel/wechatmp/wechatmp_channel.py:388-395 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `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 × 4) models/dashscope/dashscope_bot.py:260— models/dashscope/dashscope_bot.py:260-267 | models/linkai/link_ai_bot.py:591-598 | models/openai_compatible_bot.py:106-113 | models/zhipuai/zhipuai_bot.py:234-241 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
Duplicated block (5 lines × 3) app.py:40— app.py:40-44 | channel/web/api/channels.py:194-198 | common/cloud_client.py:1088-1092 — 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.
Duplicated block (5 lines × 3) channel/web/api/scheduler.py:611— channel/web/api/scheduler.py:611-617 | channel/web/api/skills.py:634-638 | channel/web/api/workspace.py:275-279 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `channel/web/api/scheduler.py:618` calls `isinstance`, `get`, `dumps` and `channel/web/api/skills.py:639` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 3) models/doubao/doubao_bot.py:175— models/doubao/doubao_bot.py:175-179 | models/minimax/minimax_bot.py:216-220 | models/moonshot/moonshot_bot.py:214-218 — `models/doubao/doubao_bot.py` and `models/minimax/minimax_bot.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 20 separate duplicated blocks between them, totalling at least 336 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 `models/doubao/doubao_bot.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. 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 locations) channel/web/static/js/chat/context-usage.js:39— channel/web/static/js/chat/context-usage.js:39 · channel/web/static/js/chat/context-usage.js:128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2 locations) channel/web/static/js/chat/state.js:213— channel/web/static/js/chat/state.js:213 · channel/web/static/js/chat/state.js:369 — 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.
Duplicated block (15 lines × 2 locations) desktop/src/renderer/src/pages/KnowledgePage.tsx:1077— desktop/src/renderer/src/pages/KnowledgePage.tsx:1077 · desktop/src/renderer/src/pages/MemoryPage.tsx:314 — 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.
AC3 · Page structure· Page without a main landmark · ×2
Page without a main landmark channel/web/chat.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark desktop/src/renderer/index.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. This document's body is only the mount point <div id="root">, so there is no content here to wrap — render the <main> from the component mounted into it.
AC4 · Keyboard semantics· Modal dialog does not manage focus · ×2
Modal dialog does not manage focus channel/web/templates/modals/menu-editor.html:3— 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 desktop/src/renderer/src/components/Lightbox.tsx:45— 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.
MenuEditor.EditorDialog::renderItem (cognitive 25) desktop/src/renderer/src/components/MenuEditor.tsx:393— MenuEditor.EditorDialog::renderItem has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 9 (13 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 (MenuEditor.EditorDialog::validated) 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.
MenuEditor.EditorDialog::validated (cognitive 20) desktop/src/renderer/src/components/MenuEditor.tsx:337— MenuEditor.EditorDialog::validated has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (12 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (MenuEditor.EditorDialog::renderItem) 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.
Near-duplicate member pair (37 shared lines) channel/discord/discord_channel.py:170— channel/discord/discord_channel.py:170-274 | channel/slack/slack_channel.py:197-293 — These two members are variants of one another: 37 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (37 shared lines) agent/tools/scheduler/integration.py:926— agent/tools/scheduler/integration.py:926-1007 | agent/tools/scheduler/integration.py:1013-1086 — These two members are variants of one another: 37 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Duplicated block (42 lines × 2) agent/memory/storage.py:968— agent/memory/storage.py:968-1009 | agent/memory/storage.py:1268-1309 — both copies are in the same file, so extract the 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 (42 lines × 2) bridge/agent_bridge.py:2010— bridge/agent_bridge.py:2010-2051 | bridge/agent_initializer.py:1219-1260 — 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 (39–40 lines × 2) channel/dingtalk/dingtalk_channel.py:533— channel/dingtalk/dingtalk_channel.py:533-572 | channel/dingtalk/dingtalk_channel.py:1160-1198 — both copies are in the same file, so extract the 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 (39–40 lines × 2) models/doubao/doubao_bot.py:520— models/doubao/doubao_bot.py:520-558 | models/moonshot/moonshot_bot.py:577-616 — `models/doubao/doubao_bot.py` and `models/moonshot/moonshot_bot.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 30 separate duplicated blocks between them, totalling at least 606 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 `models/doubao/doubao_bot.py:520` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `models/moonshot/moonshot_bot.py:617` calls `get` and `models/doubao/doubao_bot.py:560` 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 (33 lines × 2) models/doubao/doubao_bot.py:108— models/doubao/doubao_bot.py:108-140 | models/moonshot/moonshot_bot.py:150-182 — `models/doubao/doubao_bot.py` and `models/moonshot/moonshot_bot.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 30 separate duplicated blocks between them, totalling at least 606 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (33 lines × 2) models/doubao/doubao_bot.py:483— models/doubao/doubao_bot.py:483-515 | models/moonshot/moonshot_bot.py:540-572 — `models/doubao/doubao_bot.py` and `models/moonshot/moonshot_bot.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 30 separate duplicated blocks between them, totalling at least 606 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (26–27 lines × 2) agent/tools/send/send.py:92— agent/tools/send/send.py:92-118 | agent/tools/send/send.py:145-170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26–27 lines × 2) models/doubao/doubao_bot.py:367— models/doubao/doubao_bot.py:367-392 | models/minimax/minimax_bot.py:656-682 — `models/doubao/doubao_bot.py` and `models/minimax/minimax_bot.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 20 separate duplicated blocks between them, totalling at least 336 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (27 lines × 2) channel/feishu/feishu_channel.py:1301— channel/feishu/feishu_channel.py:1301-1327 | channel/feishu/feishu_channel.py:1705-1731 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (27 lines × 2) channel/feishu/feishu_channel.py:1338— channel/feishu/feishu_channel.py:1338-1364 | channel/feishu/feishu_channel.py:1729-1755 — both copies are in the same file, so extract the 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 (22–23 lines × 5) models/deepseek/deepseek_bot.py:425— models/deepseek/deepseek_bot.py:425-446 | models/doubao/doubao_bot.py:395-416 | models/mimo/mimo_bot.py:415-436 | models/minimax/minimax_bot.py:694-716 | models/moonshot/moonshot_bot.py:447-468 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `models/doubao/doubao_bot.py:391` calls `get` and `models/deepseek/deepseek_bot.py:423` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (22–23 lines × 5) models/deepseek/deepseek_bot.py:490— models/deepseek/deepseek_bot.py:490-511 | models/doubao/doubao_bot.py:454-476 | models/mimo/mimo_bot.py:479-500 | models/minimax/minimax_bot.py:504-526 | models/moonshot/moonshot_bot.py:511-533 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 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 (23 lines × 2) models/claudeapi/claude_api_bot.py:193— models/claudeapi/claude_api_bot.py:193-215 | models/openai/open_ai_bot.py:85-107 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `models/claudeapi/claude_api_bot.py:192` calls `info` and `models/openai/open_ai_bot.py:84` 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 (23 lines × 2) models/deepseek/deepseek_bot.py:198— models/deepseek/deepseek_bot.py:198-220 | models/mimo/mimo_bot.py:197-219 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19–21 lines × 2) agent/tools/vision/vision.py:390— agent/tools/vision/vision.py:390-408 | agent/tools/vision/vision.py:451-471 — both copies are in the same file, so extract the 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 (19–21 lines × 2) channel/wechatmp/active_reply.py:58— channel/wechatmp/active_reply.py:58-76 | channel/wechatmp/passive_reply.py:252-272 — before extracting anything, compare `channel/wechatmp/active_reply.py` and `channel/wechatmp/passive_reply.py` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 `channel/wechatmp/passive_reply.py:252` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 3) agent/tools/scheduler/integration.py:986— agent/tools/scheduler/integration.py:986-1004 | agent/tools/scheduler/integration.py:1067-1085 | agent/tools/scheduler/integration.py:1172-1190 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/tools/scheduler/integration.py:1170` calls `get` and `agent/tools/scheduler/integration.py:985` 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 (19 lines × 3) channel/discord/discord_channel.py:220— channel/discord/discord_channel.py:220-238 | channel/slack/slack_channel.py:237-255 | channel/telegram/telegram_channel.py:346-364 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `channel/discord/discord_channel.py:240` calls `strip`, `lower`, `_do_cancel` and `channel/telegram/telegram_channel.py:365` 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 (18 lines × 2) channel/dingtalk/dingtalk_channel.py:692— channel/dingtalk/dingtalk_channel.py:692-709 | channel/dingtalk/dingtalk_channel.py:768-785 — both copies are in the same file, so extract the block into 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) models/deepseek/deepseek_bot.py:139— models/deepseek/deepseek_bot.py:139-156 | models/mimo/mimo_bot.py:132-149 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 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 `models/deepseek/deepseek_bot.py:139` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16–17 lines × 3) models/deepseek/deepseek_bot.py:188— models/deepseek/deepseek_bot.py:188-204 | models/doubao/doubao_bot.py:113-128 | models/moonshot/moonshot_bot.py:155-170 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 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 `models/deepseek/deepseek_bot.py:188` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `models/doubao/doubao_bot.py:129` calls `warn` and `models/deepseek/deepseek_bot.py:205` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16–17 lines × 3) models/doubao/doubao_bot.py:300— models/doubao/doubao_bot.py:300-315 | models/minimax/minimax_bot.py:557-573 | models/modelscope/modelscope_bot.py:195-210 — `models/doubao/doubao_bot.py` and `models/minimax/minimax_bot.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 20 separate duplicated blocks between them, totalling at least 336 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13–14 lines × 2) agent/tools/scheduler/integration.py:838— agent/tools/scheduler/integration.py:838-851 | agent/tools/scheduler/integration.py:1118-1130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) models/chatgpt/chat_gpt_bot.py:169— models/chatgpt/chat_gpt_bot.py:169-182 | models/zhipuai/zhipuai_bot.py:93-105 — 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 × 3) channel/discord/discord_channel.py:244— channel/discord/discord_channel.py:244-250 | channel/slack/slack_channel.py:261-267 | channel/telegram/telegram_channel.py:365-371 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `channel/discord/discord_channel.py:240` calls `strip`, `lower`, `_do_cancel` and `channel/telegram/telegram_channel.py:364` 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) channel/web/core/channel.py:1690— channel/web/core/channel.py:1690-1696 | channel/wechatcom/wechatcomapp_channel.py:92-98 | channel/wechatmp/wechatmp_channel.py:150-156 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (22 lines × 2 locations) channel/web/static/js/core/notify.js:88— channel/web/static/js/core/notify.js:88 · channel/web/static/js/core/notify.js:252 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2 locations) desktop/src/renderer/src/components/ChannelTeamSelect.tsx:38— desktop/src/renderer/src/components/ChannelTeamSelect.tsx:38 · desktop/src/renderer/src/pages/ChannelsPage.tsx:318 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (18 matched lines × 2 locations) · ×2
Duplicated block with local edits (18 matched lines × 2 locations) channel/web/static/js/chat/render.js:21— channel/web/static/js/chat/render.js:21 · desktop/src/renderer/src/lib/fileKind.ts:152 — the two spans are one implementation copied and then locally edited — 182 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 (18 matched lines × 2 locations) channel/web/static/js/core/confirm.js:35— channel/web/static/js/core/confirm.js:35 · channel/web/static/js/views/channels.js:362 — the two spans are one implementation copied and then locally edited — 144 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 (15 matched lines × 2 locations) · ×2
Duplicated block with local edits (15 matched lines × 2 locations) channel/web/static/js/views/tasks.js:70— channel/web/static/js/views/tasks.js:70 · desktop/src/renderer/src/pages/TasksPage.tsx:342 — the two spans are one implementation copied and then locally edited — 101 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 (15 matched lines × 2 locations) desktop/src/main/app-icon.ts:83— desktop/src/main/app-icon.ts:83 · desktop/src/main/http-relay.ts:61 — the two spans are one implementation copied and then locally edited — 78 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 (14 matched lines × 2 locations) · ×2
Duplicated block with local edits (14 matched lines × 2 locations) REDACTED:962— REDACTED:962 · desktop/src/renderer/src/pages/skills/SkillAddModal.tsx:102 — the two spans are one implementation copied and then locally edited — 144 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 (14 matched lines × 2 locations) desktop/src/renderer/src/components/ContextUsagePopover.tsx:165— desktop/src/renderer/src/components/ContextUsagePopover.tsx:165 · desktop/src/renderer/src/layout/NavRail.tsx:121 — the two spans are one implementation copied and then locally edited — 69 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.
AC7 · A11y enforcement· Accessibility enforcement below the top rung · ×1
Accessibility enforcement below the top rung — 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 124 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.
send.startSSE::processSSEItem (cyclomatic 133) channel/web/static/js/chat/send.js:401— send.startSSE::processSSEItem has cyclomatic complexity 133 (threshold 15). To reduce it, separate the cases: extract each independent 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 (send.startSSE) 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.
chatStore.useChatStore.attachStream (cyclomatic 112) desktop/src/renderer/src/store/chatStore.ts:339— chatStore.useChatStore.attachStream has cyclomatic complexity 112 (threshold 15). Of this number, 46 points are the body's own statements and 66 belong to 19 function items inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ChatPage.ChatPage (cyclomatic 99) desktop/src/renderer/src/pages/ChatPage.tsx:78— ChatPage.ChatPage has cyclomatic complexity 99 (threshold 15). Most of this is not in the body itself: 7 of the 99 points are its own statements and the rest belongs to 27 function literals inside it that branch (lines 398, 188, 278, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentStreamExecutor._call_llm_stream (cyclomatic 94) REDACTED:1573— AgentStreamExecutor._call_llm_stream has cyclomatic complexity 94 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SkillsPage.SkillsPage (cyclomatic 84) desktop/src/renderer/src/pages/SkillsPage.tsx:380— SkillsPage.SkillsPage has cyclomatic complexity 84 (threshold 15). Of this number, 46 points are the body's own statements and 38 belong to 20 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.
AgentBridge.agent_reply (cyclomatic 82) bridge/agent_bridge.py:1510— AgentBridge.agent_reply has cyclomatic complexity 82 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
QrScanPanel.QrScanPanel (cyclomatic 82) desktop/src/renderer/src/components/QrScanPanel.tsx:32— QrScanPanel.QrScanPanel has cyclomatic complexity 82 (threshold 15). Of this number, 18 points are the body's own statements and 64 belong to 13 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.
KnowledgePage.KnowledgePage (cyclomatic 79) desktop/src/renderer/src/pages/KnowledgePage.tsx:243— KnowledgePage.KnowledgePage has cyclomatic complexity 79 (threshold 15). Of this number, 26 points are the body's own statements and 53 belong to 22 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Godcmd.on_handle_context (cyclomatic 76) plugins/godcmd/godcmd.py:230— Godcmd.on_handle_context has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SkillAddModal.SkillAddModal (cyclomatic 76) desktop/src/renderer/src/pages/skills/SkillAddModal.tsx:144— SkillAddModal.SkillAddModal has cyclomatic complexity 76 (threshold 15). Of this number, 39 points are the body's own statements and 37 belong to 21 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AgentStreamExecutor.run_stream (cyclomatic 73) REDACTED:890— AgentStreamExecutor.run_stream 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.
workspaceStore.useWorkspaceStore (cyclomatic 72) desktop/src/renderer/src/store/workspaceStore.ts:138— workspaceStore.useWorkspaceStore has cyclomatic complexity 72 (threshold 15). Most of this is not in the body itself: 1 of the 72 points is its own statement and the rest belongs to 18 function literals inside it that branch (lines 406, 220, 350, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
loadHistory (cyclomatic 71) channel/web/static/js/chat/render.js:782— loadHistory has cyclomatic complexity 71 (threshold 15). Most of this is not in the body itself: 5 of the 71 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 797, a function literal at line 833, a function literal at line 877, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
saveTaskEdit (cyclomatic 70) channel/web/static/js/views/tasks-modal.js:463— saveTaskEdit has cyclomatic complexity 70 (threshold 15). Of this number, 62 points are the body's own statements and 8 belong to 17 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SessionList.SessionList (cyclomatic 68) desktop/src/renderer/src/layout/SessionList.tsx:146— SessionList.SessionList has cyclomatic complexity 68 (threshold 15). Most of this is not in the body itself: 12 of the 68 points are its own statements and the rest belongs to 20 function items inside it that branch (a function literal at line 360, a function literal at line 469, newChatInSpace, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ChannelsPage.ChannelCard (cyclomatic 66) desktop/src/renderer/src/pages/ChannelsPage.tsx:541— ChannelsPage.ChannelCard has cyclomatic complexity 66 (threshold 15). Of this number, 38 points are the body's own statements and 28 belong to 7 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ArtifactsPage.ArtifactsPage (cyclomatic 63) desktop/src/renderer/src/pages/ArtifactsPage.tsx:72— ArtifactsPage.ArtifactsPage has cyclomatic complexity 63 (threshold 15). Of this number, 20 points are the body's own statements and 43 belong to 18 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.
MessageBubble.MessageBubble (cyclomatic 62) desktop/src/renderer/src/components/MessageBubble.tsx:74— MessageBubble.MessageBubble has cyclomatic complexity 62 (threshold 15). Of this number, 53 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
GoogleGeminiBot.call_with_tools (cyclomatic 61) models/gemini/google_gemini_bot.py:285— GoogleGeminiBot.call_with_tools has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App.App (cyclomatic 61) desktop/src/renderer/src/App.tsx:41— App.App has cyclomatic complexity 61 (threshold 15). Of this number, 31 points are the body's own statements and 30 belong to 13 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Bash.execute (cyclomatic 60) agent/tools/bash/bash.py:121— Bash.execute has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
conversation_store._group_into_display_turns (cyclomatic 58) agent/memory/conversation_store.py:422— conversation_store._group_into_display_turns has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FeishuMessage.__init__ (cyclomatic 56) channel/feishu/feishu_message.py:31— FeishuMessage.__init__ has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NavRail.NavRail (cyclomatic 54) desktop/src/renderer/src/layout/NavRail.tsx:62— NavRail.NavRail has cyclomatic complexity 54 (threshold 15). Of this number, 27 points are the body's own statements and 27 belong to 12 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.
ChatTimeline.ChatTimeline (cyclomatic 53) desktop/src/renderer/src/components/ChatTimeline.tsx:54— ChatTimeline.ChatTimeline has cyclomatic complexity 53 (threshold 15). Most of this is not in the body itself: 5 of the 53 points are its own statements and the rest belongs to 19 function literals inside it that branch (lines 308, 107, 174, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ClaudeAPIBot._stream_once (cyclomatic 52) models/claudeapi/claude_api_bot.py:785— ClaudeAPIBot._stream_once 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.
McpEditorModal.McpEditorModal (cyclomatic 52) desktop/src/renderer/src/pages/skills/McpEditorModal.tsx:81— McpEditorModal.McpEditorModal has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 14 of the 52 points are its own statements and the rest belongs to 8 function items inside it that branch (switchTab, save, a function literal at line 93, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
inbound.serve_invoke (cyclomatic 51) agent/multiagent/inbound.py:21— inbound.serve_invoke has cyclomatic complexity 51 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ContextUsagePopover.ContextUsagePopover (cyclomatic 51) desktop/src/renderer/src/components/ContextUsagePopover.tsx:45— ContextUsagePopover.ContextUsagePopover has cyclomatic complexity 51 (threshold 15). Most of this is not in the body itself: 15 of the 51 points are its own statements and the rest belongs to 15 function items inside it that branch (doCompact, onBtnClick, a function literal at line 90, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
KnowledgeGraph.KnowledgeGraph (cyclomatic 51) desktop/src/renderer/src/components/KnowledgeGraph.tsx:42— KnowledgeGraph.KnowledgeGraph has cyclomatic complexity 51 (threshold 15). Most of this is not in the body itself: 2 of the 51 points are its own statements and the rest belongs to 25 function items inside it that branch (a function literal at line 155, a function literal at line 100, onPointerUp, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
DingTalkChanel.send (cyclomatic 49) channel/dingtalk/dingtalk_channel.py:871— DingTalkChanel.send 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.
WechatMPChannel.send (cyclomatic 49) channel/wechatmp/wechatmp_channel.py:168— WechatMPChannel.send 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.
docEditorStore.createDocEditorStore (cyclomatic 48) desktop/src/renderer/src/store/docEditorStore.ts:134— docEditorStore.createDocEditorStore has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 1 of the 48 points is its own statement and the rest belongs to 11 function literals inside it that branch (lines 231, 186, 152, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MemoryManager.sync (cyclomatic 46) REDACTED:319— MemoryManager.sync has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
models.renderCapabilityBody (cyclomatic 46) channel/web/static/js/views/models.js:1233— models.renderCapabilityBody has cyclomatic complexity 46 (threshold 15). Of this number, 44 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
sessionStore.useSessionStore (cyclomatic 46) desktop/src/renderer/src/store/sessionStore.ts:130— sessionStore.useSessionStore has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 1 of the 46 points is its own statement and the rest belongs to 17 function literals inside it that branch (lines 288, 143, 235, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
skill._install_hub (cyclomatic 45) cli/commands/skill.py:1264— skill._install_hub has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CapabilityCard.CapabilityCard (cyclomatic 45) desktop/src/renderer/src/pages/settings/CapabilityCard.tsx:32— CapabilityCard.CapabilityCard has cyclomatic complexity 45 (threshold 15). Of this number, 18 points are the body's own statements and 27 belong to 8 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ChatService.run (cyclomatic 43) agent/chat/service.py:30— ChatService.run has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
artifact.collect_message_artifacts (cyclomatic 43) agent/protocol/artifact.py:349— artifact.collect_message_artifacts has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
render.createBotMessageEl (cyclomatic 43) channel/web/static/js/chat/render.js:445— render.createBotMessageEl has cyclomatic complexity 43 (threshold 15). Of this number, 41 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BasicSettings.BasicSettings (cyclomatic 43) desktop/src/renderer/src/pages/settings/BasicSettings.tsx:37— BasicSettings.BasicSettings has cyclomatic complexity 43 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (BasicSettings.BasicSettings::loadConfig) 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.
TasksPage.TaskEditModal (cyclomatic 43) desktop/src/renderer/src/pages/TasksPage.tsx:1168— TasksPage.TaskEditModal has cyclomatic complexity 43 (threshold 15). Of this number, 20 points are the body's own statements and 23 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Bridge.__init__ (cyclomatic 42) bridge/bridge.py:14— Bridge.__init__ has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ChatChannel._compose_context (cyclomatic 42) channel/chat_channel.py:46— ChatChannel._compose_context has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelsTab.VendorModal (cyclomatic 42) desktop/src/renderer/src/pages/settings/ModelsTab.tsx:406— ModelsTab.VendorModal has cyclomatic complexity 42 (threshold 15). Of this number, 18 points are the body's own statements and 24 belong to 8 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Query.POST (cyclomatic 41) channel/wechatmp/passive_reply.py:23— Query.POST 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.
knowledge.openKnowledgeDialog (cyclomatic 41) channel/web/static/js/views/knowledge.js:384— knowledge.openKnowledgeDialog has cyclomatic complexity 41 (threshold 15). Of this number, 24 points are the body's own statements and 17 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
loadTasksView (cyclomatic 41) channel/web/static/js/views/tasks.js:400— loadTasksView has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 3 of the 41 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 427, 410, 498, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
models.openSearchKeyModal (cyclomatic 40) channel/web/static/js/views/models.js:941— models.openSearchKeyModal has cyclomatic complexity 40 (threshold 15). Of this number, 35 points are the body's own statements and 5 belong to 4 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WorkspacePanel.WorkspacePanel (cyclomatic 40) desktop/src/renderer/src/components/WorkspacePanel.tsx:51— WorkspacePanel.WorkspacePanel has cyclomatic complexity 40 (threshold 15). Of this number, 28 points are the body's own statements and 12 belong to 5 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WebSearch._search_anysearch (cyclomatic 39) agent/tools/web_search/web_search.py:709— WebSearch._search_anysearch has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ModelsHandler._search_provider_key (cyclomatic 39) channel/web/api/models.py:1451— ModelsHandler._search_provider_key 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.
ModelScopeBot._handle_stream_response (cyclomatic 39) models/modelscope/modelscope_bot.py:525— ModelScopeBot._handle_stream_response 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.
FeiShuChanel._handle_message_event (cyclomatic 38) channel/feishu/feishu_channel.py:704— FeiShuChanel._handle_message_event has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WechatKfChannel.send (cyclomatic 38) REDACTED:164— WechatKfChannel.send has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
QQMessage.__init__ (cyclomatic 37) channel/qq/qq_message.py:64— QQMessage.__init__ has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SchedulerUpdateHandler.POST (cyclomatic 37) channel/web/api/scheduler.py:268— SchedulerUpdateHandler.POST has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
sessions._session_model_catalog (cyclomatic 37) channel/web/api/sessions.py:506— sessions._session_model_catalog has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkspaceSelector.WorkspaceSelector (cyclomatic 37) desktop/src/renderer/src/components/WorkspaceSelector.tsx:23— WorkspaceSelector.WorkspaceSelector has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 14 of the 37 points are its own statements and the rest belongs to 10 function items inside it that branch (createProject, a function literal at line 37, selectProject, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentsPage.AgentProfilePane (cyclomatic 37) desktop/src/renderer/src/pages/AgentsPage.tsx:377— AgentsPage.AgentProfilePane has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 14 of the 37 points are its own statements and the rest belongs to 9 function items inside it that branch (save, a function literal at line 421, a function literal at line 403, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ArtifactPreview.ArtifactPreview (cyclomatic 37) desktop/src/renderer/src/pages/artifacts/ArtifactPreview.tsx:112— ArtifactPreview.ArtifactPreview has cyclomatic complexity 37 (threshold 15). Of this number, 31 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SchedulerTool._create_task (cyclomatic 36) agent/tools/scheduler/scheduler_tool.py:164— SchedulerTool._create_task 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.
GoogleGeminiBot._handle_gemini_rest_stream_response (cyclomatic 36) models/gemini/google_gemini_bot.py:675— GoogleGeminiBot._handle_gemini_rest_stream_response has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OpenAICompatibleBot._convert_messages_to_openai_format (cyclomatic 36) models/openai_compatible_bot.py:418— OpenAICompatibleBot._convert_messages_to_openai_format has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TasksPage.TasksPage (cyclomatic 36) desktop/src/renderer/src/pages/TasksPage.tsx:85— TasksPage.TasksPage has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 11 of the 36 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 244, a function literal at line 175, runFromCard, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WebChannel.post_message (cyclomatic 35) channel/web/core/channel.py:1014— WebChannel.post_message 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.
install.run_install_browser (cyclomatic 35) cli/commands/install.py:188— install.run_install_browser 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.
models.rebuildCapabilityVoiceDropdown (cyclomatic 35) channel/web/static/js/views/models.js:1788— models.rebuildCapabilityVoiceDropdown has cyclomatic complexity 35 (threshold 15). Of this number, 26 points are the body's own statements and 9 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useBackend.useBackend (cyclomatic 35) desktop/src/renderer/src/hooks/useBackend.ts:44— useBackend.useBackend has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to 10 function literals inside it that branch (lines 103, 175, 74, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ChannelsPage.ChannelsPage (cyclomatic 35) desktop/src/renderer/src/pages/ChannelsPage.tsx:79— ChannelsPage.ChannelsPage has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 13 of the 35 points are its own statements and the rest belongs to 11 function items inside it that branch (loadChannels, a function literal at line 146, a function literal at line 154, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
installContextUsagePopover (cyclomatic 35) channel/web/static/js/chat/context-usage.js:157— installContextUsagePopover has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 3 of the 35 points are its own statements and the rest belongs to 20 function items inside it that branch (a function literal at line 211, _ctxShowCard, a function literal at line 265, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentDelegateTool._delegate (cyclomatic 34) agent/tools/agent_delegate/agent_delegate.py:449— AgentDelegateTool._delegate has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DeepSeekBot._convert_messages_to_openai_format (cyclomatic 34) models/deepseek/deepseek_bot.py:517— DeepSeekBot._convert_messages_to_openai_format has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MimoBot._convert_messages_to_openai_format (cyclomatic 34) models/mimo/mimo_bot.py:506— MimoBot._convert_messages_to_openai_format has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
models.rebuildCapabilityModelDropdown (cyclomatic 34) channel/web/static/js/views/models.js:1698— models.rebuildCapabilityModelDropdown has cyclomatic complexity 34 (threshold 15). Of this number, 20 points are the body's own statements and 14 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TasksPage.RunDetailModal (cyclomatic 34) desktop/src/renderer/src/pages/TasksPage.tsx:581— TasksPage.RunDetailModal has cyclomatic complexity 34 (threshold 15). Of this number, 33 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
message_utils.sanitize_claude_messages (cyclomatic 33) agent/protocol/message_utils.py:127— message_utils.sanitize_claude_messages has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
models._discover_models (cyclomatic 33) channel/web/api/models.py:218— models._discover_models has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WebChannel.send (cyclomatic 33) channel/web/core/channel.py:163— WebChannel.send has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CloudClient.on_config (cyclomatic 33) common/cloud_client.py:369— CloudClient.on_config has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MinimaxBot._handle_stream_response (cyclomatic 33) models/minimax/minimax_bot.py:530— MinimaxBot._handle_stream_response has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
responses_adapter.responses_stream_to_chat_chunks (cyclomatic 33) models/openai/responses_adapter.py:345— responses_adapter.responses_stream_to_chat_chunks has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
composer-input.chatInput.addEventListener("keydown") (cyclomatic 33) channel/web/static/js/chat/composer-input.js:271— composer-input.chatInput.addEventListener("keydown") has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
agentStore.useAgentStore (cyclomatic 33) desktop/src/renderer/src/store/agentStore.ts:91— agentStore.useAgentStore has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 99, 201, 186). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cyclomatic 33) channel/web/static/js/chat/composer-input.js:271— (anonymous) has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SkillsHandler.POST (cyclomatic 32) channel/web/api/skills.py:338— SkillsHandler.POST 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.
ModelsTab.CustomProviderModal (cyclomatic 32) desktop/src/renderer/src/pages/settings/ModelsTab.tsx:593— ModelsTab.CustomProviderModal has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 12 of the 32 points are its own statements and the rest belongs to 4 function items inside it that branch (save, a function literal at line 604, remove, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
Edit._execute_locked (cyclomatic 31) agent/tools/edit/edit.py:77— Edit._execute_locked 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.
AgentInitializer._restorable_turn (cyclomatic 31) bridge/agent_initializer.py:551— AgentInitializer._restorable_turn 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.
channel_instances.upsert_instance (cyclomatic 31) channel/channel_instances.py:479— channel_instances.upsert_instance 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.
FeishuMessage._extract_quoted_text (cyclomatic 31) channel/feishu/feishu_message.py:283— FeishuMessage._extract_quoted_text 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.
ModelsHandler._handle_discover_models (cyclomatic 31) channel/web/api/models.py:1814— ModelsHandler._handle_discover_models 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.
index.setupIPC (cyclomatic 31) desktop/src/main/index.ts:538— index.setupIPC has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to 12 function items inside it that branch (a function literal at line 706, a function literal at line 639, a function literal at line 723, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
service.validate_server (cyclomatic 30) agent/tools/mcp/service.py:99— service.validate_server has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConfigHandler._save_settings (cyclomatic 30) channel/web/api/REDACTED:182— ConfigHandler._save_settings has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelsHandler._search_capability (cyclomatic 30) channel/web/api/models.py:1489— ModelsHandler._search_capability has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
state.messagesDiv.addEventListener("click") (cyclomatic 30) channel/web/static/js/chat/state.js:546— state.messagesDiv.addEventListener("click") has cyclomatic complexity 30 (threshold 15). Of this number, 20 points are the body's own statements and 10 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
knowledge.renderKnowledgeGraph (cyclomatic 30) channel/web/static/js/views/knowledge.js:916— knowledge.renderKnowledgeGraph has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 2 of the 30 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 1034, a function literal at line 1035, a function literal at line 1061, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
MessageSteps.ToolStep (cyclomatic 30) desktop/src/renderer/src/components/MessageSteps.tsx:113— MessageSteps.ToolStep has cyclomatic complexity 30 (threshold 15). Of this number, 26 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ChatInput.ChatInput (cyclomatic 30) desktop/src/renderer/src/components/ChatInput.tsx:60— ChatInput.ChatInput has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (ChatInput.ChatInput::handleKeyDown) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
MemoryPage.MemoryPage (cyclomatic 30) desktop/src/renderer/src/pages/MemoryPage.tsx:66— MemoryPage.MemoryPage has cyclomatic complexity 30 (threshold 15). Of this number, 16 points are the body's own statements and 14 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous) (cyclomatic 30) channel/web/static/js/chat/state.js:546— (anonymous) has cyclomatic complexity 30 (threshold 15). Of this number, 20 points are the body's own statements and 10 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
executor.run_evolution_for_session (cyclomatic 29) agent/evolution/executor.py:380— executor.run_evolution_for_session 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.
AgentInitializer._load_tools (cyclomatic 29) bridge/agent_initializer.py:963— AgentInitializer._load_tools 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.
FeiShuChanel.send (cyclomatic 29) channel/feishu/feishu_channel.py:907— FeiShuChanel.send 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.
backup.restore_backup_archive (cyclomatic 29) cli/commands/backup.py:427— backup.restore_backup_archive 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.
ChannelTeamSelect.ChannelTeamSelect (cyclomatic 29) desktop/src/renderer/src/components/ChannelTeamSelect.tsx:32— ChannelTeamSelect.ChannelTeamSelect has cyclomatic complexity 29 (threshold 15). Of this number, 19 points are the body's own statements and 10 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
initConfigView (cyclomatic 29) channel/web/static/js/views/config.js:155— initConfigView has cyclomatic complexity 29 (threshold 15). Of this number, 27 points are the body's own statements and 2 belong to 7 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
FeishuProgressState.consume (cyclomatic 28) channel/feishu/feishu_progress_card.py:47— FeishuProgressState.consume 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.
TelegramChannel._on_message (cyclomatic 28) channel/telegram/telegram_channel.py:288— TelegramChannel._on_message 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.
WebChannel.upload_file (cyclomatic 28) channel/web/core/channel.py:802— WebChannel.upload_file has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
channels.renderActiveChannels (cyclomatic 28) channel/web/static/js/views/channels.js:60— channels.renderActiveChannels has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 2 of the 28 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 82, 166). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
FileTree.FileTree (cyclomatic 28) desktop/src/renderer/src/components/FileTree.tsx:12— FileTree.FileTree has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 9 of the 28 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 27, 56, 156, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
OnboardingWizard.OnboardingWizard (cyclomatic 28) desktop/src/renderer/src/components/OnboardingWizard.tsx:26— OnboardingWizard.OnboardingWizard has cyclomatic complexity 28 (threshold 15). Of this number, 18 points are the body's own statements and 10 belong to 6 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
TasksPage.RecordsView (cyclomatic 28) desktop/src/renderer/src/pages/TasksPage.tsx:386— TasksPage.RecordsView has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 6 of the 28 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 475, loadMore, loadRuns, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
discoverCatalogModels (cyclomatic 28) channel/web/static/js/views/models.js:2607— discoverCatalogModels has cyclomatic complexity 28 (threshold 15). Of this number, 15 points are the body's own statements and 13 belong to 7 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DiscordChannel._on_message (cyclomatic 27) channel/discord/discord_channel.py:169— DiscordChannel._on_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_compat._request_values (cyclomatic 27) channel/web/api/openai_compat.py:142— openai_compat._request_values 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.
SchedulerCreateHandler.POST (cyclomatic 27) channel/web/api/scheduler.py:602— SchedulerCreateHandler.POST 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.
MoonshotBot._convert_messages_to_openai_format (cyclomatic 27) models/moonshot/moonshot_bot.py:539— MoonshotBot._convert_messages_to_openai_format 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.
MentionText.MentionText (cyclomatic 27) desktop/src/renderer/src/components/MentionText.tsx:19— MentionText.MentionText has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 36, 26). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ModelsTab.TtsCard (cyclomatic 27) desktop/src/renderer/src/pages/settings/ModelsTab.tsx:752— ModelsTab.TtsCard has cyclomatic complexity 27 (threshold 15). Of this number, 19 points are the body's own statements and 8 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
integration._execute_skill_call (cyclomatic 26) agent/tools/scheduler/integration.py:1089— integration._execute_skill_call 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.
WechatComAppChannel.send (cyclomatic 26) channel/wechatcom/wechatcomapp_channel.py:100— WechatComAppChannel.send 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.
LinkAIBot._chat (cyclomatic 26) models/linkai/link_ai_bot.py:127— LinkAIBot._chat 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.
MinimaxBot._convert_messages_to_openai_format (cyclomatic 26) models/minimax/minimax_bot.py:310— MinimaxBot._convert_messages_to_openai_format 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.
MoonshotBot._handle_stream_response (cyclomatic 26) models/moonshot/moonshot_bot.py:329— MoonshotBot._handle_stream_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.
LinkAI.on_handle_context (cyclomatic 26) plugins/linkai/linkai.py:37— LinkAI.on_handle_context 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.
render.renderStepsHtml (cyclomatic 26) channel/web/static/js/chat/render.js:285— render.renderStepsHtml has cyclomatic complexity 26 (threshold 15). Of this number, 21 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
markdown.createMd (cyclomatic 26) channel/web/static/js/core/markdown.js:50— markdown.createMd has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 8 of the 26 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 75, 62, 100, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentAdminService.update_agent (cyclomatic 25) agent/admin.py:479— AgentAdminService.update_agent 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.
AgentStreamExecutor._trim_messages (cyclomatic 25) REDACTED:2785— AgentStreamExecutor._trim_messages 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.
DingTalkMessage.__init__ (cyclomatic 25) REDACTED:65— DingTalkMessage.__init__ 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.
QQChannel._upload_rich_media_chunked (cyclomatic 25) REDACTED:918— QQChannel._upload_rich_media_chunked 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.
SlackChannel._handle_event (cyclomatic 25) channel/slack/slack_channel.py:196— SlackChannel._handle_event 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.
backup._validate_archive (cyclomatic 25) cli/commands/backup.py:261— backup._validate_archive 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.
config.load_config (cyclomatic 25) REDACTED:550— config.load_config has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DeepSeekBot._handle_stream_response (cyclomatic 25) models/deepseek/deepseek_bot.py:323— DeepSeekBot._handle_stream_response 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.
DoubaoBot._convert_messages_to_openai_format (cyclomatic 25) models/doubao/doubao_bot.py:482— DoubaoBot._convert_messages_to_openai_format 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.
MimoBot._handle_stream_response (cyclomatic 25) models/mimo/mimo_bot.py:314— MimoBot._handle_stream_response 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.
ModelScopeBot.call_with_tools (cyclomatic 25) models/modelscope/modelscope_bot.py:377— ModelScopeBot.call_with_tools 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.
Role.on_handle_context (cyclomatic 25) plugins/role/role.py:131— Role.on_handle_context has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
workspace.wsRenderPreview (cyclomatic 25) channel/web/static/js/workspace.js:307— workspace.wsRenderPreview 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.
UpdateBanner.UpdateBanner (cyclomatic 25) desktop/src/renderer/src/components/UpdateBanner.tsx:21— UpdateBanner.UpdateBanner has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ModelSelector.CatalogModelSelector (cyclomatic 25) desktop/src/renderer/src/components/ModelSelector.tsx:16— ModelSelector.CatalogModelSelector has cyclomatic complexity 25 (threshold 15). Of this number, 13 points are the body's own statements and 12 belong to 6 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ModelCatalogEditor.ModelCatalogEditor::discover (cyclomatic 25) desktop/src/renderer/src/pages/settings/ModelCatalogEditor.tsx:188— ModelCatalogEditor.ModelCatalogEditor::discover 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.
ModelsTab.SearchKeyModal (cyclomatic 25) desktop/src/renderer/src/pages/settings/ModelsTab.tsx:1080— ModelsTab.SearchKeyModal has cyclomatic complexity 25 (threshold 15). Of this number, 13 points are the body's own statements and 12 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SkillCreateForm.SkillCreateForm (cyclomatic 25) desktop/src/renderer/src/pages/skills/SkillCreateForm.tsx:108— SkillCreateForm.SkillCreateForm has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 9 of the 25 points are its own statements and the rest belongs to 7 function items inside it that branch (submit, a function literal at line 128, a function literal at line 122, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ArtifactCard.Thumb (cyclomatic 25) desktop/src/renderer/src/pages/artifacts/ArtifactCard.tsx:43— ArtifactCard.Thumb has cyclomatic complexity 25 (threshold 15). Of this number, 19 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MenuEditor.EditorDialog::renderItem (cyclomatic 25) desktop/src/renderer/src/components/MenuEditor.tsx:393— MenuEditor.EditorDialog::renderItem 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.
startSSE::connect::onmessage (cyclomatic 25) channel/web/static/js/chat/send.js:892— startSSE::connect::onmessage 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.
integration._execute_agent_task (cyclomatic 24) agent/tools/scheduler/integration.py:793— integration._execute_agent_task has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SearchFiles._find_by_name (cyclomatic 24) agent/tools/search_files/search_files.py:275— SearchFiles._find_by_name 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.
TerminalAgentRenderer._handle_event (cyclomatic 24) channel/terminal/terminal_channel.py:94— TerminalAgentRenderer._handle_event 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.
menu._clean_item (cyclomatic 24) channel/web/api/menu.py:49— menu._clean_item 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.
WeixinChannel._qr_login (cyclomatic 24) channel/weixin/weixin_channel.py:534— WeixinChannel._qr_login 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.
WeixinChannel._process_message (cyclomatic 24) channel/weixin/weixin_channel.py:798— WeixinChannel._process_message 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.
DoubaoBot._handle_stream_response (cyclomatic 24) models/doubao/doubao_bot.py:280— DoubaoBot._handle_stream_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.
generate.resolve_size (cyclomatic 24) skills/image-generation/scripts/generate.py:65— generate.resolve_size 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.
knowledge._knowledgeResultMessage (cyclomatic 24) channel/web/static/js/views/knowledge.js:356— knowledge._knowledgeResultMessage 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.saveCapability (cyclomatic 24) channel/web/static/js/views/models.js:1938— models.saveCapability has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ChatFallbackCard.ChatFallbackModal (cyclomatic 24) desktop/src/renderer/src/pages/settings/ChatFallbackCard.tsx:206— ChatFallbackCard.ChatFallbackModal has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 8 of the 24 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 220, addLink, a function literal at line 223, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
policy._check_bash_workspace_write (cyclomatic 23) agent/permission/policy.py:867— policy._check_bash_workspace_write 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.
EnvConfig.execute (cyclomatic 23) agent/tools/env_config/env_config.py:159— EnvConfig.execute 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.
AgentInitializer._filter_text_only_messages (cyclomatic 23) bridge/agent_initializer.py:679— AgentInitializer._filter_text_only_messages has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
channel_factory._build_channel (cyclomatic 23) channel/channel_factory.py:54— channel_factory._build_channel 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.
TelegramChannel._async_send (cyclomatic 23) channel/telegram/telegram_channel.py:656— TelegramChannel._async_send 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.
CloudClient.on_chat (cyclomatic 23) common/cloud_client.py:1359— CloudClient.on_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.
DeepSeekBot.call_with_tools (cyclomatic 23) models/deepseek/deepseek_bot.py:224— DeepSeekBot.call_with_tools 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.
link_ai_bot._linkai_call_with_tools (cyclomatic 23) models/linkai/link_ai_bot.py:567— link_ai_bot._linkai_call_with_tools 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.
responses_adapter.responses_to_chat_completion (cyclomatic 23) models/openai/responses_adapter.py:283— responses_adapter.responses_to_chat_completion has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
app-icon.sweepWindowsShortcuts (cyclomatic 23) desktop/src/main/app-icon.ts:394— app-icon.sweepWindowsShortcuts 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.
PythonBackend.start (cyclomatic 23) REDACTED:699— PythonBackend.start has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 11 of the 23 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 834, onOutput, a function literal at line 861). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
primitives.Dropdown (cyclomatic 23) desktop/src/renderer/src/pages/settings/primitives.tsx:131— primitives.Dropdown has cyclomatic complexity 23 (threshold 15). Of this number, 12 points are the body's own statements and 11 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
chatStore.useChatStore.send (cyclomatic 23) desktop/src/renderer/src/store/chatStore.ts:775— chatStore.useChatStore.send has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
loadKnowledgeView (cyclomatic 23) channel/web/static/js/views/knowledge.js:140— loadKnowledgeView has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 157, 197, 151, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
KnowledgeService.dispatch (cyclomatic 22) agent/knowledge/service.py:790— KnowledgeService.dispatch 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.
policy._check_git_read_only (cyclomatic 22) agent/permission/policy.py:787— policy._check_git_read_only 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.
AgentStreamExecutor._execute_tool (cyclomatic 22) REDACTED:2248— AgentStreamExecutor._execute_tool 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.
McpClient._streamable_http_post (cyclomatic 22) agent/tools/mcp/mcp_client.py:735— McpClient._streamable_http_post 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.
SearchFiles.execute (cyclomatic 22) agent/tools/search_files/search_files.py:364— SearchFiles.execute 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.
DingTalkChanel.handle_group (cyclomatic 22) channel/dingtalk/dingtalk_channel.py:766— DingTalkChanel.handle_group 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.
AgentsHandler.POST (cyclomatic 22) channel/web/api/agents.py:173— AgentsHandler.POST 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.
ChannelsHandler._channel_instances_view (cyclomatic 22) channel/web/api/channels.py:216— ChannelsHandler._channel_instances_view 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.
HistoryHandler.GET (cyclomatic 22) channel/web/api/sessions.py:1007— HistoryHandler.GET 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.
WecomBotMessage.__init__ (cyclomatic 22) channel/wecom_bot/wecom_bot_message.py:86— WecomBotMessage.__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.
OpenAIHTTPClient._stream_chat (cyclomatic 22) models/openai/openai_http_client.py:405— OpenAIHTTPClient._stream_chat has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
reasoning_capabilities.get_reasoning_capability (cyclomatic 22) models/reasoning_capabilities.py:95— reasoning_capabilities.get_reasoning_capability 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.
WordsSearch.SetKeywords (cyclomatic 22) plugins/banwords/lib/WordsSearch.py:78— WordsSearch.SetKeywords has cyclomatic complexity 22 (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.
MinimaxProvider.generate (cyclomatic 22) skills/image-generation/scripts/generate.py:978— MinimaxProvider.generate 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.
nav.navigateTo (cyclomatic 22) channel/web/static/js/core/nav.js:194— nav.navigateTo 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.
menu-editor._meItemHTML (cyclomatic 22) channel/web/static/js/views/menu-editor.js:105— menu-editor._meItemHTML 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.
MemoryFlushManager.deep_dream (cyclomatic 21) REDACTED:511— MemoryFlushManager.deep_dream 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.
registry._profile_from_mapping (cyclomatic 21) agent/registry.py:107— registry._profile_from_mapping has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SkillLoader._load_skill_from_file (cyclomatic 21) agent/skills/loader.py:161— SkillLoader._load_skill_from_file 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.
runner.run_tasks (cyclomatic 21) agent/subagent/runner.py:268— runner.run_tasks 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.
Read.execute (cyclomatic 21) agent/tools/read/read.py:134— Read.execute has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ChannelManager.start (cyclomatic 21) app.py:201— ChannelManager.start has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DingTalkChanel.handle_single (cyclomatic 21) channel/dingtalk/dingtalk_channel.py:690— DingTalkChanel.handle_single has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TelegramChannel._parse_message (cyclomatic 21) channel/telegram/telegram_channel.py:396— TelegramChannel._parse_message 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.
ConfigHandler.GET (cyclomatic 21) channel/web/api/REDACTED:62— ConfigHandler.GET 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.
ModelsHandler._set_chat_fallback (cyclomatic 21) channel/web/api/models.py:2392— ModelsHandler._set_chat_fallback has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SessionSettingsHandler.POST (cyclomatic 21) channel/web/api/sessions.py:741— SessionSettingsHandler.POST 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.
WebChannel.stream_response (cyclomatic 21) channel/web/core/channel.py:1285— WebChannel.stream_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.
skill._route_install (cyclomatic 21) cli/commands/skill.py:963— skill._route_install 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.
ClaudeAPIBot.reply_text (cyclomatic 21) models/claudeapi/claude_api_bot.py:217— ClaudeAPIBot.reply_text 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.
CowCliPlugin._config_set (cyclomatic 21) plugins/cow_cli/cow_cli.py:816— CowCliPlugin._config_set 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.
CowCliPlugin._skill_list_local (cyclomatic 21) plugins/cow_cli/cow_cli.py:1057— CowCliPlugin._skill_list_local 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.
MJBot.process_mj_task (cyclomatic 21) plugins/linkai/midjourney.py:106— MJBot.process_mj_task 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.
config.initDropdown (cyclomatic 21) channel/web/static/js/views/config.js:29— config.initDropdown has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to 6 function items inside it that branch (render, a function literal at line 52, paintFace, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
tasks-modal.openTaskEditModal (cyclomatic 21) channel/web/static/js/views/tasks-modal.js:338— tasks-modal.openTaskEditModal has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AgentsPage.AgentCoreFiles (cyclomatic 21) desktop/src/renderer/src/pages/AgentsPage.tsx:597— AgentsPage.AgentCoreFiles has cyclomatic complexity 21 (threshold 15). Of this number, 11 points are the body's own statements and 10 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
loadTaskInstances (cyclomatic 21) channel/web/static/js/views/tasks-modal.js:109— loadTaskInstances has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 121, 125, 119, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
parseSkillFrontmatter (cyclomatic 21) REDACTED:1438— parseSkillFrontmatter has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentAdminService.create_agent (cyclomatic 20) agent/admin.py:376— AgentAdminService.create_agent 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.
ConversationStore._migrate (cyclomatic 20) agent/memory/conversation_store.py:2567— ConversationStore._migrate has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
AgentStreamExecutor._smart_compact_to_budget (cyclomatic 20) REDACTED:2632— AgentStreamExecutor._smart_compact_to_budget 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.
integration._execute_tool_call (cyclomatic 20) agent/tools/scheduler/integration.py:1010— integration._execute_tool_call 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.
SearchFiles._backend_python (cyclomatic 20) agent/tools/search_files/search_files.py:704— SearchFiles._backend_python 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.
WebSearch.execute (cyclomatic 20) agent/tools/web_search/web_search.py:326— WebSearch.execute 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.
WorkspaceService.dispatch (cyclomatic 20) agent/workspace/service.py:283— WorkspaceService.dispatch 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.
channel_instances._explicit_instances (cyclomatic 20) channel/channel_instances.py:204— channel_instances._explicit_instances 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.
WeixinMessage.__init__ (cyclomatic 20) channel/weixin/weixin_message.py:32— WeixinMessage.__init__ 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.
CloudClient._handle_channel_sync (cyclomatic 20) common/cloud_client.py:812— CloudClient._handle_channel_sync 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.
ClaudeAPIBot.call_with_tools (cyclomatic 20) models/claudeapi/claude_api_bot.py:469— ClaudeAPIBot.call_with_tools 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.
DashscopeBot.call_with_tools (cyclomatic 20) models/dashscope/dashscope_bot.py:232— DashscopeBot.call_with_tools 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.
ZHIPUAIBot._handle_stream_response (cyclomatic 20) models/zhipuai/zhipuai_bot.py:379— ZHIPUAIBot._handle_stream_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.
LinkAI._process_admin_cmd (cyclomatic 20) plugins/linkai/linkai.py:131— LinkAI._process_admin_cmd 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.
QwenProvider.generate (cyclomatic 20) skills/image-generation/scripts/generate.py:862— QwenProvider.generate 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.
quick_validate.validate_skill (cyclomatic 20) skills/skill-creator/scripts/quick_validate.py:12— quick_validate.validate_skill 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.
channels-feishu.switchFeishuMode (cyclomatic 20) channel/web/static/js/views/channels-feishu.js:47— channels-feishu.switchFeishuMode 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.
channels-wecom.switchWecomBotMode (cyclomatic 20) channel/web/static/js/views/channels-wecom.js:70— channels-wecom.switchWecomBotMode 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.
config.onProviderChange (cyclomatic 20) channel/web/static/js/views/config.js:266— config.onProviderChange has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent 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-custom-provider.openCustomProviderModal (cyclomatic 20) channel/web/static/js/views/models-custom-provider.js:12— models-custom-provider.openCustomProviderModal has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
sessionSettingsStore.useSessionSettingsStore (cyclomatic 20) desktop/src/renderer/src/store/sessionSettingsStore.ts:49— sessionSettingsStore.useSessionSettingsStore has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 77, 59, 100, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chatStore.attachmentsFromSteps (cyclomatic 20) desktop/src/renderer/src/store/chatStore.ts:164— chatStore.attachmentsFromSteps 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.
AgentScopeSelect.AgentScopeSelect (cyclomatic 20) desktop/src/renderer/src/components/AgentScopeSelect.tsx:26— AgentScopeSelect.AgentScopeSelect has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
mcpConfig.parseMcpJson (cyclomatic 20) desktop/src/renderer/src/pages/skills/mcpConfig.ts:64— mcpConfig.parseMcpJson has cyclomatic complexity 20 (threshold 15). Of this number, 15 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
showRunDetailModal (cyclomatic 20) channel/web/static/js/views/tasks.js:251— showRunDetailModal has cyclomatic complexity 20 (threshold 15). Of this number, 14 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
loadMemoryView (cyclomatic 20) channel/web/static/js/views/memory.js:21— loadMemoryView has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 25, a function literal at line 51, a function literal at line 25, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
loadAgentCatalog (cyclomatic 20) channel/web/static/js/views/agents.js:110— loadAgentCatalog has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 113, 152, 112, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
factory._init_explicit_provider (cyclomatic 19) agent/memory/embedding/factory.py:84— factory._init_explicit_provider 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.
Agent.get_context_usage (cyclomatic 19) agent/protocol/agent.py:525— Agent.get_context_usage 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.
AgentRegistry.from_config (cyclomatic 19) agent/registry.py:194— AgentRegistry.from_config 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.
ToolManager.sync_mcp_into_agent (cyclomatic 19) agent/tools/tool_manager.py:631— ToolManager.sync_mcp_into_agent 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.
WebSearch._search_zhipu (cyclomatic 19) agent/tools/web_search/web_search.py:443— WebSearch._search_zhipu has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
web_search._get_api_key (cyclomatic 19) agent/tools/web_search/web_search.py:104— web_search._get_api_key has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AgentBridge._seed_team_members (cyclomatic 19) bridge/agent_bridge.py:724— AgentBridge._seed_team_members 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.
ChannelsHandler.GET (cyclomatic 19) channel/web/api/channels.py:298— ChannelsHandler.GET 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.
ModelsHandler._image_capability (cyclomatic 19) channel/web/api/models.py:1367— ModelsHandler._image_capability 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.
ModelsHandler._handle_set_custom_provider (cyclomatic 19) channel/web/api/models.py:2054— ModelsHandler._handle_set_custom_provider 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.
ModelsHandler._set_chat (cyclomatic 19) channel/web/api/models.py:2310— ModelsHandler._set_chat 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.
ModelsHandler._handle_set_search_credential (cyclomatic 19) channel/web/api/models.py:2691— ModelsHandler._handle_set_search_credential 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.
models._discovered_capabilities (cyclomatic 19) channel/web/api/models.py:166— models._discovered_capabilities 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.
WechatKfChannel.consume_callback (cyclomatic 19) REDACTED:343— WechatKfChannel.consume_callback 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.
MimoBot.call_with_tools (cyclomatic 19) models/mimo/mimo_bot.py:223— MimoBot.call_with_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.
CowCliPlugin._resolve_active_embedding (cyclomatic 19) plugins/cow_cli/cow_cli.py:1557— CowCliPlugin._resolve_active_embedding 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.
SeedreamProvider.generate (cyclomatic 19) skills/image-generation/scripts/generate.py:727— SeedreamProvider.generate 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.
MinimaxVoice.textToVoice (cyclomatic 19) voice/minimax/minimax_voice.py:29— MinimaxVoice.textToVoice has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
artifacts._artInit (cyclomatic 19) channel/web/static/js/views/artifacts.js:84— artifacts._artInit has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 116, 139, 107, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
artifacts._artRenderPreviewChrome (cyclomatic 19) channel/web/static/js/views/artifacts.js:747— artifacts._artRenderPreviewChrome has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
skills.parseMcpJson (cyclomatic 19) REDACTED:419— skills.parseMcpJson has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
skills.renderSkillPreviewList (cyclomatic 19) REDACTED:1053— skills.renderSkillPreviewList has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 1057, 1099, 1122). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentAvatar.AgentAvatar (cyclomatic 19) desktop/src/renderer/src/components/AgentAvatar.tsx:53— AgentAvatar.AgentAvatar has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AgentSelector.AgentSelector (cyclomatic 19) desktop/src/renderer/src/components/AgentSelector.tsx:30— AgentSelector.AgentSelector has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
frontmatter.parseSkillFrontmatter (cyclomatic 19) desktop/src/renderer/src/pages/skills/frontmatter.ts:20— frontmatter.parseSkillFrontmatter 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.
LogsPage.LogsPage (cyclomatic 19) desktop/src/renderer/src/pages/LogsPage.tsx:10— LogsPage.LogsPage has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 7 function items inside it that branch (getLogColor, a function literal at line 21, handleDownload, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentsPage.AgentDetail (cyclomatic 19) desktop/src/renderer/src/pages/AgentsPage.tsx:205— AgentsPage.AgentDetail has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ConversationStore.append_messages (cyclomatic 18) agent/memory/conversation_store.py:796— ConversationStore.append_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.
builder._build_runtime_section (cyclomatic 18) agent/prompt/builder.py:1067— builder._build_runtime_section 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.
Ls.execute (cyclomatic 18) agent/tools/ls/ls.py:52— Ls.execute 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.
integration._migrate_legacy_task_stores (cyclomatic 18) agent/tools/scheduler/integration.py:64— integration._migrate_legacy_task_stores 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.
integration._execute_send_message (cyclomatic 18) agent/tools/scheduler/integration.py:923— integration._execute_send_message 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.
ChatChannel._decorate_reply (cyclomatic 18) channel/chat_channel.py:327— ChatChannel._decorate_reply 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.
ModelsHandler._custom_provider_cards (cyclomatic 18) channel/web/api/models.py:732— ModelsHandler._custom_provider_cards has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ModelsHandler._vision_capability (cyclomatic 18) channel/web/api/models.py:1148— ModelsHandler._vision_capability 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.
sessions._session_settings_state (cyclomatic 18) channel/web/api/sessions.py:600— sessions._session_settings_state has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WorkspaceResolveHandler.GET (cyclomatic 18) channel/web/api/workspace.py:114— WorkspaceResolveHandler.GET 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.
backup.create_backup_archive (cyclomatic 18) cli/commands/backup.py:119— backup.create_backup_archive 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.
DashscopeBot._convert_messages_to_dashscope_format (cyclomatic 18) models/dashscope/dashscope_bot.py:638— DashscopeBot._convert_messages_to_dashscope_format 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.
link_ai_bot._linkai_convert_messages_to_openai_format (cyclomatic 18) models/linkai/link_ai_bot.py:788— link_ai_bot._linkai_convert_messages_to_openai_format 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.
responses_adapter.messages_to_input (cyclomatic 18) models/openai/responses_adapter.py:121— responses_adapter.messages_to_input 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.
LinkAIProvider.generate (cyclomatic 18) skills/image-generation/scripts/generate.py:426— LinkAIProvider.generate has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
session-settings.renderModelMenu (cyclomatic 18) channel/web/static/js/chat/session-settings.js:216— session-settings.renderModelMenu has cyclomatic complexity 18 (threshold 15). Of this number, 11 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
state.fetch (cyclomatic 18) channel/web/static/js/chat/state.js:57— state.fetch 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.
artifacts._artCardHTML (cyclomatic 18) channel/web/static/js/views/artifacts.js:550— artifacts._artCardHTML 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.
config.syncReasoningEffortOptions (cyclomatic 18) channel/web/static/js/views/config.js:399— config.syncReasoningEffortOptions has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
menu-editor._meOnClick (cyclomatic 18) channel/web/static/js/views/menu-editor.js:169— menu-editor._meOnClick has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
models.renderFallbackChainEditor (cyclomatic 18) channel/web/static/js/views/models.js:403— models.renderFallbackChainEditor has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 469, 415, 484). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
sessions._sessionItemEl (cyclomatic 18) channel/web/static/js/views/sessions.js:465— sessions._sessionItemEl has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
skills.renderSkillFilesTree (cyclomatic 18) REDACTED:1646— skills.renderSkillFilesTree has cyclomatic complexity 18 (threshold 15). Of this number, 9 points are the body's own statements and 9 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
chatStore.historyToMessage (cyclomatic 18) desktop/src/renderer/src/store/chatStore.ts:256— chatStore.historyToMessage has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ChatInput.ChatInput::handleKeyDown (cyclomatic 18) desktop/src/renderer/src/components/ChatInput.tsx:452— ChatInput.ChatInput::handleKeyDown has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (ChatInput.ChatInput) 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.
BasicSettings.BasicSettings::loadConfig (cyclomatic 18) desktop/src/renderer/src/pages/settings/BasicSettings.tsx:172— BasicSettings.BasicSettings::loadConfig has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (BasicSettings.BasicSettings) 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.
ModelsTab.SearchCard (cyclomatic 18) desktop/src/renderer/src/pages/settings/ModelsTab.tsx:921— ModelsTab.SearchCard has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DocEditor.DocEditor (cyclomatic 18) desktop/src/renderer/src/components/DocEditor.tsx:79— DocEditor.DocEditor has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 5 function items inside it that branch (onKeyDown, a function literal at line 100, a function literal at line 108, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
KnowledgePage.KnowledgeDialog::submit (cyclomatic 18) desktop/src/renderer/src/pages/KnowledgePage.tsx:861— KnowledgePage.KnowledgeDialog::submit 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.
SkillAddModal.PreviewCard (cyclomatic 18) desktop/src/renderer/src/pages/skills/SkillAddModal.tsx:568— SkillAddModal.PreviewCard has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AgentsPage.AgentSkills (cyclomatic 18) desktop/src/renderer/src/pages/AgentsPage.tsx:742— AgentsPage.AgentSkills has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 801, a function literal at line 753, toggleSkill, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
saveModelConfig (cyclomatic 18) channel/web/static/js/views/config.js:471— saveModelConfig has cyclomatic complexity 18 (threshold 15). Of this number, 11 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
sendMessage (cyclomatic 18) channel/web/static/js/chat/send.js:95— sendMessage has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
provider.create_embedding_provider (cyclomatic 17) REDACTED:483— provider.create_embedding_provider 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.
SQLiteVectorBackend.search (cyclomatic 17) agent/memory/vector_backend.py:104— SQLiteVectorBackend.search 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.
policy._split_process_substitutions (cyclomatic 17) agent/permission/policy.py:310— policy._split_process_substitutions 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.
policy._workspace_write_paths (cyclomatic 17) agent/permission/policy.py:835— policy._workspace_write_paths 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.
AgentStreamExecutor._truncate_historical_tool_results (cyclomatic 17) REDACTED:2547— AgentStreamExecutor._truncate_historical_tool_results 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.
config.should_include_skill (cyclomatic 17) agent/skills/REDACTED:103— config.should_include_skill 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.
WebFetch._fetch_deepseek (cyclomatic 17) agent/tools/web_fetch/web_fetch.py:221— WebFetch._fetch_deepseek 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.
DingTalkChanel.startup (cyclomatic 17) channel/dingtalk/dingtalk_channel.py:177— DingTalkChanel.startup 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.
QQChannel._handle_msg_event (cyclomatic 17) REDACTED:503— QQChannel._handle_msg_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.
TerminalChannel.send (cyclomatic 17) channel/terminal/terminal_channel.py:206— TerminalChannel.send 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.
VoiceTtsHandler.POST (cyclomatic 17) channel/web/api/files.py:126— VoiceTtsHandler.POST has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ModelsHandler._provider_overview (cyclomatic 17) channel/web/api/models.py:803— ModelsHandler._provider_overview 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.
sessions._list_sessions_across_agents (cyclomatic 17) channel/web/api/sessions.py:255— sessions._list_sessions_across_agents 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.
ProjectBrowseHandler.GET (cyclomatic 17) channel/web/api/workspace.py:487— ProjectBrowseHandler.GET 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.
AzureChatGPTBot.create_img (cyclomatic 17) models/chatgpt/chat_gpt_bot.py:405— AzureChatGPTBot.create_img has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
link_ai_bot._handle_linkai_stream_response (cyclomatic 17) models/linkai/link_ai_bot.py:717— link_ai_bot._handle_linkai_stream_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.
MoonshotBot.call_with_tools (cyclomatic 17) models/moonshot/moonshot_bot.py:237— MoonshotBot.call_with_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.
ZHIPUAIBot.reply_text (cyclomatic 17) models/zhipuai/zhipuai_bot.py:111— ZHIPUAIBot.reply_text 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.
ZHIPUAIBot.call_with_tools (cyclomatic 17) models/zhipuai/zhipuai_bot.py:206— ZHIPUAIBot.call_with_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.
ZHIPUAIBot._convert_messages_to_zhipu_format (cyclomatic 17) models/zhipuai/zhipuai_bot.py:497— ZHIPUAIBot._convert_messages_to_zhipu_format 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.
Hello.on_handle_context (cyclomatic 17) plugins/hello/hello.py:45— Hello.on_handle_context 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.
GeminiProvider.generate (cyclomatic 17) skills/image-generation/scripts/generate.py:520— GeminiProvider.generate 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.
render.createUserMessageEl (cyclomatic 17) channel/web/static/js/chat/render.js:45— render.createUserMessageEl has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 60). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
scheduler-notify.maybeNotifyScheduledRun (cyclomatic 17) channel/web/static/js/chat/scheduler-notify.js:70— scheduler-notify.maybeNotifyScheduledRun 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.
artifacts._artOnKey (cyclomatic 17) channel/web/static/js/views/artifacts.js:1027— artifacts._artOnKey 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.
models.openDeepseekSearchModal (cyclomatic 17) channel/web/static/js/views/models.js:1120— models.openDeepseekSearchModal has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
workspace.renderFileCard (cyclomatic 17) channel/web/static/js/workspace.js:654— workspace.renderFileCard 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.
http-relay.relay (cyclomatic 17) desktop/src/main/http-relay.ts:30— http-relay.relay has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 31, 83, 72, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentsPage.CreateAgentModal (cyclomatic 17) desktop/src/renderer/src/pages/AgentsPage.tsx:842— AgentsPage.CreateAgentModal has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 5 function items inside it that branch (submit, onPickAvatar, a function literal at line 855, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
_artTogglePin (cyclomatic 17) channel/web/static/js/views/artifacts.js:911— _artTogglePin has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 921, 924, 942, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
renderAgentSkillsPane (cyclomatic 17) channel/web/static/js/views/agents.js:504— renderAgentSkillsPane has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 517, render, a function literal at line 528, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
renderVoicePill (cyclomatic 17) channel/web/static/js/chat/render.js:619— renderVoicePill has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 11 function items inside it that branch (fmt, setIcon, a function literal at line 648, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
_ctxDoCompact (cyclomatic 17) channel/web/static/js/chat/context-usage.js:347— _ctxDoCompact has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 360, 359, 389). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ConversationStore.get_run_detail (cyclomatic 16) agent/memory/conversation_store.py:1685— ConversationStore.get_run_detail 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.run_stream (cyclomatic 16) agent/protocol/agent.py:759— Agent.run_stream 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.compact_context (cyclomatic 16) agent/protocol/agent.py:909— Agent.compact_context 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.
message_utils.compress_turn_to_text_only (cyclomatic 16) agent/protocol/message_utils.py:293— message_utils.compress_turn_to_text_only 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.
SkillLoader._load_skills_recursive (cyclomatic 16) agent/skills/loader.py:76— SkillLoader._load_skills_recursive 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.
AgentDelegateTool._team_members (cyclomatic 16) agent/tools/agent_delegate/agent_delegate.py:331— AgentDelegateTool._team_members 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.
Bash._get_safety_warning (cyclomatic 16) agent/tools/bash/bash.py:567— Bash._get_safety_warning 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.
BrowserService.__init__ (cyclomatic 16) agent/tools/browser/browser_service.py:428— BrowserService.__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.
mcp_oauth.discover_metadata (cyclomatic 16) agent/tools/mcp/mcp_oauth.py:200— mcp_oauth.discover_metadata 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.
SchedulerTool._parse_schedule (cyclomatic 16) agent/tools/scheduler/scheduler_tool.py:443— SchedulerTool._parse_schedule 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.
Send.execute (cyclomatic 16) agent/tools/send/send.py:48— Send.execute 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.
WebFetch._fetch_document (cyclomatic 16) agent/tools/web_fetch/web_fetch.py:355— WebFetch._fetch_document 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.
WebSearch._search_linkai (cyclomatic 16) agent/tools/web_search/web_search.py:575— WebSearch._search_linkai 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.
AgentLLMModel._primary_bot_type (cyclomatic 16) bridge/agent_bridge.py:355— AgentLLMModel._primary_bot_type 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.
AgentInitializer.initialize_agent (cyclomatic 16) bridge/agent_initializer.py:112— AgentInitializer.initialize_agent 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.
QQChannel._handle_ws_message (cyclomatic 16) REDACTED:435— QQChannel._handle_ws_message 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.
ChannelsHandler.POST (cyclomatic 16) channel/web/api/channels.py:372— ChannelsHandler.POST 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.
ChannelsHandler._handle_save (cyclomatic 16) channel/web/api/channels.py:424— ChannelsHandler._handle_save 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.
ModelsHandler._embedding_capability (cyclomatic 16) channel/web/api/models.py:1279— ModelsHandler._embedding_capability 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.
ModelsHandler._preset_seed (cyclomatic 16) channel/web/api/models.py:1685— ModelsHandler._preset_seed 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.
ModelsHandler._set_image (cyclomatic 16) channel/web/api/models.py:2229— ModelsHandler._set_image has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WebChannel.cancel_request (cyclomatic 16) channel/web/core/channel.py:1394— WebChannel.cancel_request 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.
WeixinChannel._poll_loop (cyclomatic 16) channel/weixin/weixin_channel.py:667— WeixinChannel._poll_loop 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.
OpenAICompatibleBot.call_with_tools (cyclomatic 16) models/openai_compatible_bot.py:70— OpenAICompatibleBot.call_with_tools 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.
CowCliPlugin._format_tasks (cyclomatic 16) plugins/cow_cli/cow_cli.py:468— CowCliPlugin._format_tasks 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.
generate._build_providers (cyclomatic 16) skills/image-generation/scripts/generate.py:1133— generate._build_providers 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.
generate.main (cyclomatic 16) skills/image-generation/scripts/generate.py:1218— generate.main 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.
message-actions.editUserMessage (cyclomatic 16) channel/web/static/js/chat/message-actions.js:145— message-actions.editUserMessage has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
send.startSSE (cyclomatic 16) channel/web/static/js/chat/send.js:211— send.startSSE has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (send.startSSE::processSSEItem) 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.
utils.renderSubagentStep (cyclomatic 16) channel/web/static/js/core/utils.js:82— utils.renderSubagentStep 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.onCapabilityProviderChange (cyclomatic 16) channel/web/static/js/views/models.js:1856— models.onCapabilityProviderChange has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
workspace.savePreviewEdit (cyclomatic 16) channel/web/static/js/workspace.js:573— workspace.savePreviewEdit 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.
workspace.initMention (cyclomatic 16) channel/web/static/js/workspace.js:1239— workspace.initMention has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1261, 1291, 1244, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
FileCard.FileCard (cyclomatic 16) desktop/src/renderer/src/components/FileCard.tsx:25— FileCard.FileCard has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 4 function items inside it that branch (resolved, open, download, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ChatFallbackCard.LinkEditor (cyclomatic 16) desktop/src/renderer/src/pages/settings/ChatFallbackCard.tsx:88— ChatFallbackCard.LinkEditor has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 5 function items inside it that branch (isConfigured, a function literal at line 108, handleProvider, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
regenerateResponse (cyclomatic 16) channel/web/static/js/chat/send.js:6— regenerateResponse has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Godcmd.on_handle_context (cognitive 232) plugins/godcmd/godcmd.py:230— Godcmd.on_handle_context has cognitive complexity 232 (threshold 15). Drivers by points: if/else 63 (201 pts), error handling 3 (15 pts), loops 2 (11 pts), boolean chains 5 (nesting depth added 159). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AgentStreamExecutor._call_llm_stream (cognitive 206) REDACTED:1573— AgentStreamExecutor._call_llm_stream has cognitive complexity 206 (threshold 15). Drivers by points: if/else 60 (154 pts), boolean chains 23, ternaries 5 (11 pts), error handling 6 (10 pts), loops 4 (8 pts) (nesting depth added 108). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GoogleGeminiBot.call_with_tools (cognitive 179) models/gemini/google_gemini_bot.py:285— GoogleGeminiBot.call_with_tools has cognitive complexity 179 (threshold 15). Drivers by points: if/else 41 (136 pts), loops 7 (27 pts), boolean chains 8, error handling 2 (6 pts), ternaries 1 (2 pts) (nesting depth added 120). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AgentStreamExecutor.run_stream (cognitive 171) REDACTED:890— AgentStreamExecutor.run_stream has cognitive complexity 171 (threshold 15). Drivers by points: if/else 47 (121 pts), ternaries 8 (17 pts), loops 6 (16 pts), boolean chains 11, error handling 4 (6 pts) (nesting depth added 95). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
conversation_store._group_into_display_turns (cognitive 142) agent/memory/conversation_store.py:422— conversation_store._group_into_display_turns has cognitive complexity 142 (threshold 15). Drivers by points: if/else 31 (105 pts), loops 6 (13 pts), boolean chains 12, ternaries 3 (8 pts), error handling 2 (4 pts) (nesting depth added 88). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
skill._install_hub (cognitive 124) cli/commands/skill.py:1264— skill._install_hub has cognitive complexity 124 (threshold 15). Drivers by points: if/else 30 (91 pts), error handling 6 (18 pts), boolean chains 7, ternaries 2 (7 pts), loops 1 (nesting depth added 78). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ChatPage.ChatPage (cognitive 120) desktop/src/renderer/src/pages/ChatPage.tsx:78— ChatPage.ChatPage has cognitive complexity 120 (threshold 15). Drivers by points: if/else 55 (67 pts), boolean chains 26, ternaries 10 (25 pts), error handling 1 (2 pts) (nesting depth added 28). Most of this is not in the body itself: 7 of the 120 points are its own statements and the rest belongs to 27 function literals inside it that branch (lines 398, 188, 278, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
FeishuMessage.__init__ (cognitive 116) channel/feishu/feishu_message.py:31— FeishuMessage.__init__ has cognitive complexity 116 (threshold 15). Drivers by points: if/else 27 (69 pts), loops 8 (17 pts), ternaries 5 (16 pts), boolean chains 14 (nesting depth added 62). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
saveTaskEdit (cognitive 113) channel/web/static/js/views/tasks-modal.js:463— saveTaskEdit has cognitive complexity 113 (threshold 15). Drivers by points: if/else 30 (45 pts), ternaries 14 (36 pts), boolean chains 29, error handling 2 (3 pts) (nesting depth added 38). Of this number, 96 points are the body's own statements and 17 belong to 17 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentBridge.agent_reply (cognitive 112) bridge/agent_bridge.py:1510— AgentBridge.agent_reply has cognitive complexity 112 (threshold 15). Drivers by points: if/else 29 (40 pts), boolean chains 26, error handling 11 (23 pts), ternaries 14 (21 pts), loops 1 (2 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatChannel._compose_context (cognitive 108) channel/chat_channel.py:46— ChatChannel._compose_context has cognitive complexity 108 (threshold 15). Drivers by points: if/else 33 (87 pts), boolean chains 10, loops 1 (6 pts), ternaries 1 (5 pts) (nesting depth added 63). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ClaudeAPIBot._stream_once (cognitive 107) models/claudeapi/claude_api_bot.py:785— ClaudeAPIBot._stream_once has cognitive complexity 107 (threshold 15). Drivers by points: if/else 19 (64 pts), boolean chains 16, ternaries 4 (13 pts), error handling 3 (7 pts), loops 2 (7 pts) (nesting depth added 63). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DingTalkChanel.send (cognitive 101) channel/dingtalk/dingtalk_channel.py:871— DingTalkChanel.send has cognitive complexity 101 (threshold 15). Drivers by points: if/else 40 (80 pts), boolean chains 10, ternaries 2 (6 pts), error handling 1 (3 pts), loops 1 (2 pts) (nesting depth added 47). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
artifact.collect_message_artifacts (cognitive 97) agent/protocol/artifact.py:349— artifact.collect_message_artifacts has cognitive complexity 97 (threshold 15). Drivers by points: if/else 10 (33 pts), ternaries 7 (25 pts), loops 6 (21 pts), boolean chains 15, error handling 1 (3 pts) (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MinimaxBot._convert_messages_to_openai_format (cognitive 94) models/minimax/minimax_bot.py:310— MinimaxBot._convert_messages_to_openai_format has cognitive complexity 94 (threshold 15). Drivers by points: if/else 17 (73 pts), loops 4 (15 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 70). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
KnowledgePage.KnowledgePage (cognitive 93) desktop/src/renderer/src/pages/KnowledgePage.tsx:243— KnowledgePage.KnowledgePage has cognitive complexity 93 (threshold 15). Drivers by points: if/else 31 (36 pts), ternaries 14 (27 pts), boolean chains 24, error handling 6 (nesting depth added 18). Of this number, 36 points are the body's own statements and 57 belong to 22 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAICompatibleBot._convert_messages_to_openai_format (cognitive 91) models/openai_compatible_bot.py:418— OpenAICompatibleBot._convert_messages_to_openai_format has cognitive complexity 91 (threshold 15). Drivers by points: if/else 21 (67 pts), loops 5 (14 pts), boolean chains 6, ternaries 1 (4 pts) (nesting depth added 58). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
workspaceStore.useWorkspaceStore (cognitive 89) desktop/src/renderer/src/store/workspaceStore.ts:138— workspaceStore.useWorkspaceStore has cognitive complexity 89 (threshold 15). Drivers by points: if/else 30 (33 pts), ternaries 15 (29 pts), boolean chains 19, error handling 6 (8 pts) (nesting depth added 19). None of this is in the body itself: all 89 points belong to 18 function literals inside it that branch (lines 220, 406, 350, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WechatMPChannel.send (cognitive 88) channel/wechatmp/wechatmp_channel.py:168— WechatMPChannel.send has cognitive complexity 88 (threshold 15). Drivers by points: if/else 16 (35 pts), error handling 13 (33 pts), loops 4 (9 pts), ternaries 2 (7 pts), boolean chains 4 (nesting depth added 49). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Bash.execute (cognitive 86) agent/tools/bash/bash.py:121— Bash.execute has cognitive complexity 86 (threshold 15). Drivers by points: if/else 35 (50 pts), error handling 11 (19 pts), boolean chains 9, ternaries 3 (6 pts), 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.
MemoryManager.sync (cognitive 85) REDACTED:319— MemoryManager.sync has cognitive complexity 85 (threshold 15). Drivers by points: if/else 25 (44 pts), error handling 7 (13 pts), loops 8 (13 pts), ternaries 2 (9 pts), boolean chains 6 (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.
Query.POST (cognitive 84) channel/wechatmp/passive_reply.py:23— Query.POST has cognitive complexity 84 (threshold 15). Drivers by points: if/else 33 (66 pts), boolean chains 10, loops 2 (5 pts), error handling 2 (3 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.
ModelScopeBot._handle_stream_response (cognitive 81) models/modelscope/modelscope_bot.py:525— ModelScopeBot._handle_stream_response has cognitive complexity 81 (threshold 15). Drivers by points: if/else 21 (48 pts), boolean chains 9, error handling 4 (9 pts), ternaries 2 (9 pts), loops 3 (6 pts) (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeepSeekBot._convert_messages_to_openai_format (cognitive 75) models/deepseek/deepseek_bot.py:517— DeepSeekBot._convert_messages_to_openai_format has cognitive complexity 75 (threshold 15). Drivers by points: if/else 21 (61 pts), loops 4 (9 pts), boolean chains 5 (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MimoBot._convert_messages_to_openai_format (cognitive 75) models/mimo/mimo_bot.py:506— MimoBot._convert_messages_to_openai_format has cognitive complexity 75 (threshold 15). Drivers by points: if/else 21 (61 pts), loops 4 (9 pts), boolean chains 5 (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SkillsPage.SkillsPage (cognitive 75) desktop/src/renderer/src/pages/SkillsPage.tsx:380— SkillsPage.SkillsPage has cognitive complexity 75 (threshold 15). Drivers by points: boolean chains 37, ternaries 14 (22 pts), if/else 12, error handling 4 (nesting depth added 8). Of this number, 39 points are the body's own statements and 36 belong to 20 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.
MinimaxBot._handle_stream_response (cognitive 70) models/minimax/minimax_bot.py:530— MinimaxBot._handle_stream_response has cognitive complexity 70 (threshold 15). Drivers by points: if/else 20 (48 pts), loops 5 (12 pts), error handling 3 (4 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
loadHistory (cognitive 69) channel/web/static/js/chat/render.js:782— loadHistory has cognitive complexity 69 (threshold 15). Drivers by points: if/else 27 (33 pts), boolean chains 26, ternaries 7 (8 pts), error handling 2 (nesting depth added 7). Most of this is not in the body itself: 4 of the 69 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 797, a function literal at line 833, a function literal at line 877, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
Bridge.__init__ (cognitive 67) bridge/bridge.py:14— Bridge.__init__ has cognitive complexity 67 (threshold 15). Drivers by points: if/else 24 (49 pts), boolean chains 18 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MoonshotBot._convert_messages_to_openai_format (cognitive 67) models/moonshot/moonshot_bot.py:539— MoonshotBot._convert_messages_to_openai_format has cognitive complexity 67 (threshold 15). Drivers by points: if/else 17 (53 pts), loops 4 (12 pts), boolean chains 2 (nesting depth added 44). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GoogleGeminiBot._handle_gemini_rest_stream_response (cognitive 66) models/gemini/google_gemini_bot.py:675— GoogleGeminiBot._handle_gemini_rest_stream_response has cognitive complexity 66 (threshold 15). Drivers by points: if/else 20 (44 pts), loops 4 (9 pts), boolean chains 7, error handling 3 (5 pts), ternaries 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DoubaoBot._convert_messages_to_openai_format (cognitive 64) models/doubao/doubao_bot.py:482— DoubaoBot._convert_messages_to_openai_format has cognitive complexity 64 (threshold 15). Drivers by points: if/else 16 (50 pts), loops 4 (12 pts), boolean chains 2 (nesting depth added 42). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
message_utils.sanitize_claude_messages (cognitive 63) agent/protocol/message_utils.py:127— message_utils.sanitize_claude_messages has cognitive complexity 63 (threshold 15). Drivers by points: if/else 17 (44 pts), boolean chains 10, loops 5 (9 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
responses_adapter.responses_stream_to_chat_chunks (cognitive 62) models/openai/responses_adapter.py:345— responses_adapter.responses_stream_to_chat_chunks has cognitive complexity 62 (threshold 15). Drivers by points: if/else 16 (39 pts), boolean chains 11, ternaries 4 (11 pts), loops 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentInitializer._restorable_turn (cognitive 60) bridge/agent_initializer.py:551— AgentInitializer._restorable_turn has cognitive complexity 60 (threshold 15). Drivers by points: if/else 19 (47 pts), ternaries 2 (5 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WechatKfChannel.send (cognitive 60) REDACTED:164— WechatKfChannel.send has cognitive complexity 60 (threshold 15). Drivers by points: if/else 14 (26 pts), error handling 7 (15 pts), loops 4 (8 pts), ternaries 4 (6 pts), boolean chains 5 (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.
ModelScopeBot.call_with_tools (cognitive 60) models/modelscope/modelscope_bot.py:377— ModelScopeBot.call_with_tools has cognitive complexity 60 (threshold 15). Drivers by points: if/else 26 (52 pts), loops 1 (4 pts), boolean chains 2, error handling 1, ternaries 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
chatStore.useChatStore.attachStream (cognitive 60) desktop/src/renderer/src/store/chatStore.ts:339— chatStore.useChatStore.attachStream has cognitive complexity 60 (threshold 15). Drivers by points: boolean chains 48, if/else 9, ternaries 3. Of this number, 45 points are the body's own statements and 15 belong to 19 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.
SessionList.SessionList (cognitive 60) desktop/src/renderer/src/layout/SessionList.tsx:146— SessionList.SessionList has cognitive complexity 60 (threshold 15). Drivers by points: boolean chains 22, if/else 19 (22 pts), ternaries 11 (15 pts), error handling 1 (nesting depth added 7). Most of this is not in the body itself: 9 of the 60 points are its own statements and the rest belongs to 20 function items inside it that branch (a function literal at line 360, newChatInSpace, a function literal at line 261, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
FeiShuChanel._handle_message_event (cognitive 59) channel/feishu/feishu_channel.py:704— FeiShuChanel._handle_message_event has cognitive complexity 59 (threshold 15). Drivers by points: if/else 30 (47 pts), boolean chains 5, loops 2 (5 pts), error handling 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
knowledge._knowledgeResultMessage (cognitive 59) channel/web/static/js/views/knowledge.js:356— knowledge._knowledgeResultMessage has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 12 (48 pts), boolean chains 10, if/else 1 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
KnowledgeGraph.KnowledgeGraph (cognitive 59) desktop/src/renderer/src/components/KnowledgeGraph.tsx:42— KnowledgeGraph.KnowledgeGraph has cognitive complexity 59 (threshold 15). Drivers by points: if/else 25 (31 pts), boolean chains 20, ternaries 3 (4 pts), loops 2 (3 pts), error handling 1 (nesting depth added 8). Most of this is not in the body itself: 1 of the 59 points is its own statement and the rest belongs to 25 function items inside it that branch (a function literal at line 155, onPointerMove, onPointerUp, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
McpEditorModal.McpEditorModal (cognitive 59) desktop/src/renderer/src/pages/skills/McpEditorModal.tsx:81— McpEditorModal.McpEditorModal has cognitive complexity 59 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 18, ternaries 7 (9 pts), error handling 5 (6 pts) (nesting depth added 11). Most of this is not in the body itself: 15 of the 59 points are its own statements and the rest belongs to 8 function items inside it that branch (switchTab, save, readServers, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SkillAddModal.SkillAddModal (cognitive 59) desktop/src/renderer/src/pages/skills/SkillAddModal.tsx:144— SkillAddModal.SkillAddModal has cognitive complexity 59 (threshold 15). Drivers by points: boolean chains 34, if/else 20 (22 pts), ternaries 2, error handling 1 (nesting depth added 2). Of this number, 27 points are the body's own statements and 32 belong to 21 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.
ChatService.run (cognitive 58) agent/chat/service.py:30— ChatService.run has cognitive complexity 58 (threshold 15). Drivers by points: if/else 23 (37 pts), boolean chains 11, ternaries 5, error handling 2 (3 pts), loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentInitializer._load_tools (cognitive 58) bridge/agent_initializer.py:963— AgentInitializer._load_tools has cognitive complexity 58 (threshold 15). Drivers by points: if/else 19 (46 pts), boolean chains 6, loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
docEditorStore.createDocEditorStore (cognitive 58) desktop/src/renderer/src/store/docEditorStore.ts:134— docEditorStore.createDocEditorStore has cognitive complexity 58 (threshold 15). Drivers by points: if/else 20 (23 pts), ternaries 12 (20 pts), boolean chains 12, error handling 3 (nesting depth added 11). None of this is in the body itself: all 58 points belong to 11 function literals inside it that branch (lines 231, 186, 152, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
QQMessage.__init__ (cognitive 56) channel/qq/qq_message.py:64— QQMessage.__init__ has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (36 pts), boolean chains 12, ternaries 3 (6 pts), loops 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
backup.restore_backup_archive (cognitive 56) cli/commands/backup.py:427— backup.restore_backup_archive has cognitive complexity 56 (threshold 15). Drivers by points: if/else 22 (41 pts), loops 4 (11 pts), boolean chains 4 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArtifactsPage.ArtifactsPage (cognitive 56) desktop/src/renderer/src/pages/ArtifactsPage.tsx:72— ArtifactsPage.ArtifactsPage has cognitive complexity 56 (threshold 15). Drivers by points: if/else 27 (29 pts), boolean chains 20, ternaries 6, loops 1 (nesting depth added 2). Of this number, 20 points are the body's own statements and 36 belong to 18 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WebChannel.send (cognitive 55) channel/web/core/channel.py:163— WebChannel.send has cognitive complexity 55 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 9, error handling 3 (7 pts), ternaries 2 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sessionStore.useSessionStore (cognitive 55) desktop/src/renderer/src/store/sessionStore.ts:130— sessionStore.useSessionStore has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 16, ternaries 9 (12 pts), loops 2 (3 pts), error handling 2 (nesting depth added 9). None of this is in the body itself: all 55 points belong to 17 function literals inside it that branch (lines 288, 143, 235, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
DingTalkMessage.__init__ (cognitive 54) REDACTED:65— DingTalkMessage.__init__ has cognitive complexity 54 (threshold 15). Drivers by points: if/else 20 (41 pts), loops 2 (6 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
sessions._session_model_catalog (cognitive 54) channel/web/api/sessions.py:506— sessions._session_model_catalog has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (32 pts), boolean chains 18, loops 2, error handling 1, ternaries 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
app-icon.sweepWindowsShortcuts (cognitive 54) desktop/src/main/app-icon.ts:394— app-icon.sweepWindowsShortcuts has cognitive complexity 54 (threshold 15). Drivers by points: if/else 12 (34 pts), error handling 4 (14 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SchedulerUpdateHandler.POST (cognitive 53) channel/web/api/scheduler.py:268— SchedulerUpdateHandler.POST has cognitive complexity 53 (threshold 15). Drivers by points: if/else 22 (38 pts), boolean chains 14, 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.
ChatTimeline.ChatTimeline (cognitive 53) desktop/src/renderer/src/components/ChatTimeline.tsx:54— ChatTimeline.ChatTimeline has cognitive complexity 53 (threshold 15). Drivers by points: if/else 31 (34 pts), boolean chains 12, ternaries 6, loops 1 (nesting depth added 3). Most of this is not in the body itself: 4 of the 53 points are its own statements and the rest belongs to 19 function literals inside it that branch (lines 308, 107, 259, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
inbound.serve_invoke (cognitive 52) agent/multiagent/inbound.py:21— inbound.serve_invoke has cognitive complexity 52 (threshold 15). Drivers by points: boolean chains 25, if/else 19 (21 pts), error handling 4, loops 1, ternaries 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
App.App (cognitive 51) desktop/src/renderer/src/App.tsx:41— App.App has cognitive complexity 51 (threshold 15). Drivers by points: boolean chains 24, if/else 20 (21 pts), ternaries 6 (nesting depth added 1). Of this number, 21 points are the body's own statements and 30 belong to 13 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
loadTasksView (cognitive 51) channel/web/static/js/views/tasks.js:400— loadTasksView has cognitive complexity 51 (threshold 15). Drivers by points: if/else 19 (28 pts), boolean chains 13, ternaries 7 (8 pts), error handling 2 (nesting depth added 10). Most of this is not in the body itself: 2 of the 51 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 427, 498, 410, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
renderCapabilityBody (cognitive 51) channel/web/static/js/views/models.js:1233— renderCapabilityBody has cognitive complexity 51 (threshold 15). Drivers by points: boolean chains 19, if/else 13 (16 pts), ternaries 11 (16 pts) (nesting depth added 8). Of this number, 48 points are the body's own statements and 3 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
renderStepsHtml (cognitive 51) channel/web/static/js/chat/render.js:285— renderStepsHtml has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 10 (30 pts), if/else 8 (14 pts), boolean chains 5, loops 2 (nesting depth added 26). Of this number, 38 points are the body's own statements and 13 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.
Edit._execute_locked (cognitive 50) agent/tools/edit/edit.py:77— Edit._execute_locked has cognitive complexity 50 (threshold 15). Drivers by points: if/else 25 (40 pts), error handling 4 (5 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
channel_instances.upsert_instance (cognitive 50) channel/channel_instances.py:479— channel_instances.upsert_instance has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (32 pts), boolean chains 13, ternaries 2 (4 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QrScanPanel.QrScanPanel (cognitive 50) desktop/src/renderer/src/components/QrScanPanel.tsx:32— QrScanPanel.QrScanPanel has cognitive complexity 50 (threshold 15). Drivers by points: boolean chains 25, if/else 14 (15 pts), ternaries 5 (6 pts), error handling 3, loops 1 (nesting depth added 2). Most of this is not in the body itself: 14 of the 50 points are its own statements and the rest belongs to 13 function items inside it that branch (startWeixin, startFeishu, refreshChannelQr, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
FeishuMessage._extract_quoted_text (cognitive 49) channel/feishu/feishu_message.py:283— FeishuMessage._extract_quoted_text has cognitive complexity 49 (threshold 15). Drivers by points: if/else 13 (27 pts), boolean chains 11, loops 2 (5 pts), ternaries 1 (5 pts), error handling 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.
ModelsHandler._search_provider_key (cognitive 48) channel/web/api/models.py:1451— ModelsHandler._search_provider_key has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 10 (20 pts), boolean chains 19, if/else 9 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TasksPage.TasksPage (cognitive 48) desktop/src/renderer/src/pages/TasksPage.tsx:85— TasksPage.TasksPage has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 13 (29 pts), boolean chains 15, error handling 3, if/else 1 (nesting depth added 16). Most of this is not in the body itself: 11 of the 48 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 244, a function literal at line 175, runFromCard, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentInitializer._filter_text_only_messages (cognitive 47) bridge/agent_initializer.py:679— AgentInitializer._filter_text_only_messages has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (33 pts), loops 5 (9 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WechatComAppChannel.send (cognitive 47) channel/wechatcom/wechatcomapp_channel.py:100— WechatComAppChannel.send has cognitive complexity 47 (threshold 15). Drivers by points: if/else 11 (20 pts), error handling 7 (17 pts), loops 4 (8 pts), ternaries 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MoonshotBot._handle_stream_response (cognitive 47) models/moonshot/moonshot_bot.py:329— MoonshotBot._handle_stream_response has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (34 pts), error handling 3 (4 pts), loops 2 (4 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NavRail.NavRail (cognitive 47) desktop/src/renderer/src/layout/NavRail.tsx:62— NavRail.NavRail has cognitive complexity 47 (threshold 15). Drivers by points: boolean chains 19, ternaries 14 (16 pts), if/else 11 (12 pts) (nesting depth added 3). Of this number, 20 points are the body's own statements and 27 belong to 12 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ToolManager._load_tools_from_init (cognitive 46) agent/tools/tool_manager.py:136— ToolManager._load_tools_from_init has cognitive complexity 46 (threshold 15). Drivers by points: if/else 8 (28 pts), error handling 5 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
install.run_install_browser (cognitive 46) cli/commands/install.py:188— install.run_install_browser has cognitive complexity 46 (threshold 15). Drivers by points: if/else 23 (29 pts), boolean chains 12, error handling 3 (4 pts), ternaries 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.
state.messagesDiv.addEventListener("click") (cognitive 46) channel/web/static/js/chat/state.js:546— state.messagesDiv.addEventListener("click") has cognitive complexity 46 (threshold 15). Drivers by points: if/else 21 (37 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 17). Of this number, 26 points are the body's own statements and 20 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 46) channel/web/static/js/chat/state.js:546— (anonymous) has cognitive complexity 46 (threshold 15). Drivers by points: if/else 21 (37 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 17). Of this number, 26 points are the body's own statements and 20 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
policy._check_bash_workspace_write (cognitive 45) agent/permission/policy.py:867— policy._check_bash_workspace_write has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (34 pts), loops 3 (5 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
models._discover_models (cognitive 45) channel/web/api/models.py:218— models._discover_models has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 8, ternaries 3 (6 pts), error handling 3 (4 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeepSeekBot._handle_stream_response (cognitive 45) models/deepseek/deepseek_bot.py:323— DeepSeekBot._handle_stream_response has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (32 pts), error handling 3 (4 pts), loops 2 (4 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MimoBot._handle_stream_response (cognitive 45) models/mimo/mimo_bot.py:314— MimoBot._handle_stream_response has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (32 pts), error handling 3 (4 pts), loops 2 (4 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WordsSearch.SetKeywords (cognitive 45) plugins/banwords/lib/WordsSearch.py:78— WordsSearch.SetKeywords has cognitive complexity 45 (threshold 15). Drivers by points: loops 15 (27 pts), if/else 7 (17 pts), boolean chains 1 (nesting depth added 22). 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.
FileTree.FileTree (cognitive 45) desktop/src/renderer/src/components/FileTree.tsx:12— FileTree.FileTree has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 10 (30 pts), boolean chains 9, if/else 4 (5 pts), error handling 1 (nesting depth added 21). Most of this is not in the body itself: 13 of the 45 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 27, 56, 156, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CapabilityCard.CapabilityCard (cognitive 45) desktop/src/renderer/src/pages/settings/CapabilityCard.tsx:32— CapabilityCard.CapabilityCard has cognitive complexity 45 (threshold 15). Drivers by points: boolean chains 24, if/else 13 (15 pts), ternaries 5 (6 pts) (nesting depth added 3). Most of this is not in the body itself: 15 of the 45 points are its own statements and the rest belongs to 8 function items inside it that branch (handleProvider, handleModel, isConfigured, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WebSearch._search_anysearch (cognitive 44) agent/tools/web_search/web_search.py:709— WebSearch._search_anysearch has cognitive complexity 44 (threshold 15). Drivers by points: if/else 26 (30 pts), boolean chains 8, error handling 2 (3 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
FeishuProgressState.consume (cognitive 44) channel/feishu/feishu_progress_card.py:47— FeishuProgressState.consume has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (31 pts), boolean chains 8, ternaries 2 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConfigHandler._save_settings (cognitive 44) channel/web/api/REDACTED:182— ConfigHandler._save_settings has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (28 pts), error handling 4 (7 pts), boolean chains 5, loops 3, ternaries 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.
config.load_config (cognitive 44) REDACTED:550— config.load_config has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (27 pts), error handling 3 (6 pts), loops 3 (5 pts), ternaries 1 (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.
DoubaoBot._handle_stream_response (cognitive 44) models/doubao/doubao_bot.py:280— DoubaoBot._handle_stream_response has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (31 pts), error handling 3 (4 pts), loops 2 (4 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rebuildCapabilityVoiceDropdown (cognitive 44) channel/web/static/js/views/models.js:1788— rebuildCapabilityVoiceDropdown has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 15, ternaries 5 (11 pts) (nesting depth added 10). Of this number, 32 points are the body's own statements and 12 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
service.validate_server (cognitive 43) agent/tools/mcp/service.py:99— service.validate_server has cognitive complexity 43 (threshold 15). Drivers by points: if/else 23 (33 pts), boolean chains 8, error handling 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SchedulerTool._create_task (cognitive 43) agent/tools/scheduler/scheduler_tool.py:164— SchedulerTool._create_task has cognitive complexity 43 (threshold 15). Drivers by points: if/else 20 (26 pts), boolean chains 9, ternaries 8 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
SearchFiles._find_by_name (cognitive 43) agent/tools/search_files/search_files.py:275— SearchFiles._find_by_name has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (27 pts), loops 3 (5 pts), ternaries 2 (5 pts), boolean chains 3, error handling 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WebChannel.post_message (cognitive 43) channel/web/core/channel.py:1014— WebChannel.post_message has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 11, ternaries 2 (6 pts), loops 1 (2 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MessageBubble.MessageBubble (cognitive 43) desktop/src/renderer/src/components/MessageBubble.tsx:74— MessageBubble.MessageBubble has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 36, ternaries 4 (5 pts), if/else 2 (nesting depth added 1). Of this number, 40 points are the body's own statements and 3 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
TasksPage.TaskEditModal (cognitive 43) desktop/src/renderer/src/pages/TasksPage.tsx:1168— TasksPage.TaskEditModal has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 21, ternaries 8 (10 pts), if/else 9, error handling 3 (nesting depth added 2). Of this number, 17 points are the body's own statements and 26 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DashscopeBot._convert_messages_to_dashscope_format (cognitive 42) models/dashscope/dashscope_bot.py:638— DashscopeBot._convert_messages_to_dashscope_format has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (32 pts), loops 3 (9 pts), boolean chains 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.
LinkAIBot._chat (cognitive 42) models/linkai/link_ai_bot.py:127— LinkAIBot._chat has cognitive complexity 42 (threshold 15). Drivers by points: if/else 23 (37 pts), boolean chains 3, error handling 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ZHIPUAIBot._convert_messages_to_zhipu_format (cognitive 42) models/zhipuai/zhipuai_bot.py:497— ZHIPUAIBot._convert_messages_to_zhipu_format has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 3 (9 pts), ternaries 1 (4 pts), boolean chains 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.
openSearchKeyModal (cognitive 42) channel/web/static/js/views/models.js:941— openSearchKeyModal has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 18, if/else 12 (16 pts), ternaries 7 (8 pts) (nesting depth added 5). Of this number, 35 points are the body's own statements and 7 belong to 7 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
rebuildCapabilityModelDropdown (cognitive 42) channel/web/static/js/views/models.js:1698— rebuildCapabilityModelDropdown has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 13, ternaries 5 (7 pts) (nesting depth added 8). Of this number, 25 points are the body's own statements and 17 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FeiShuChanel.send (cognitive 41) channel/feishu/feishu_channel.py:907— FeiShuChanel.send has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (32 pts), boolean chains 8, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WechatKfChannel.consume_callback (cognitive 41) REDACTED:343— WechatKfChannel.consume_callback has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (26 pts), error handling 2 (5 pts), loops 2 (5 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WeixinMessage.__init__ (cognitive 41) channel/weixin/weixin_message.py:32— WeixinMessage.__init__ has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (37 pts), boolean chains 3, loops 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.
link_ai_bot._handle_linkai_stream_response (cognitive 41) models/linkai/link_ai_bot.py:717— link_ai_bot._handle_linkai_stream_response has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 3 (15 pts), if/else 5 (14 pts), error handling 3 (7 pts), boolean chains 4, loops 1 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ContextUsagePopover.ContextUsagePopover (cognitive 41) desktop/src/renderer/src/components/ContextUsagePopover.tsx:45— ContextUsagePopover.ContextUsagePopover has cognitive complexity 41 (threshold 15). Drivers by points: if/else 25, boolean chains 12, error handling 2, ternaries 2. Most of this is not in the body itself: 7 of the 41 points are its own statements and the rest belongs to 15 function items inside it that branch (doCompact, a function literal at line 90, onBtnClick, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
MemoryPage.MemoryPage (cognitive 41) desktop/src/renderer/src/pages/MemoryPage.tsx:66— MemoryPage.MemoryPage has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 11 (23 pts), boolean chains 13, if/else 3, error handling 2 (nesting depth added 12). Of this number, 27 points are the body's own statements and 14 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DingTalkChanel.startup (cognitive 40) channel/dingtalk/dingtalk_channel.py:177— DingTalkChanel.startup has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (25 pts), error handling 4 (8 pts), loops 3 (7 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CowCliPlugin._skill_list_local (cognitive 40) plugins/cow_cli/cow_cli.py:1057— CowCliPlugin._skill_list_local has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 3 (6 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentsPage.AgentProfilePane (cognitive 40) desktop/src/renderer/src/pages/AgentsPage.tsx:377— AgentsPage.AgentProfilePane has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 19, if/else 8 (9 pts), ternaries 8 (9 pts), loops 2 (3 pts) (nesting depth added 3). Most of this is not in the body itself: 13 of the 40 points are its own statements and the rest belongs to 9 function items inside it that branch (save, a function literal at line 421, a function literal at line 409, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentStreamExecutor._smart_compact_to_budget (cognitive 39) REDACTED:2632— AgentStreamExecutor._smart_compact_to_budget has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 4 (9 pts), boolean chains 4 (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.
EnvConfig.execute (cognitive 39) agent/tools/env_config/env_config.py:159— EnvConfig.execute has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 4, loops 2 (4 pts), ternaries 1 (4 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.
SkillsHandler.POST (cognitive 39) channel/web/api/skills.py:338— SkillsHandler.POST has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 9, error handling 3 (5 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.
Role.on_handle_context (cognitive 39) plugins/role/role.py:131— Role.on_handle_context has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (26 pts), loops 3 (11 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.
composer-input.chatInput.addEventListener("keydown") (cognitive 39) channel/web/static/js/chat/composer-input.js:271— composer-input.chatInput.addEventListener("keydown") has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (29 pts), boolean chains 10 (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.
createBotMessageEl (cognitive 39) channel/web/static/js/chat/render.js:445— createBotMessageEl has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 22, ternaries 9, if/else 8. Of this number, 37 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
(anonymous) (cognitive 39) channel/web/static/js/chat/composer-input.js:271— (anonymous) has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (29 pts), boolean chains 10 (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.
SearchFiles._backend_python (cognitive 38) agent/tools/search_files/search_files.py:704— SearchFiles._backend_python has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 3 (5 pts), ternaries 4 (5 pts), boolean chains 4 (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.
ToolManager._load_tools_from_directory (cognitive 38) agent/tools/tool_manager.py:206— ToolManager._load_tools_from_directory has cognitive complexity 38 (threshold 15). Drivers by points: if/else 6 (20 pts), error handling 3 (12 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PluginManager.scan_plugins (cognitive 38) plugins/plugin_manager.py:181— PluginManager.scan_plugins has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 3 (8 pts), error handling 1 (4 pts) (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
agentStore.useAgentStore (cognitive 38) desktop/src/renderer/src/store/agentStore.ts:91— agentStore.useAgentStore has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 6 (10 pts), boolean chains 9, ternaries 2 (3 pts), loops 1 (nesting depth added 10). None of this is in the body itself: all 38 points belong to 3 function literals inside it that branch (lines 99, 201, 186). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
openKnowledgeDialog (cognitive 38) channel/web/static/js/views/knowledge.js:384— openKnowledgeDialog has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 18, boolean chains 14, if/else 6. Of this number, 20 points are the body's own statements and 18 belong to 7 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ChatChannel._decorate_reply (cognitive 37) channel/chat_channel.py:327— ChatChannel._decorate_reply has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (31 pts), boolean chains 6 (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.
WeixinChannel._poll_loop (cognitive 37) channel/weixin/weixin_channel.py:667— WeixinChannel._poll_loop has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (26 pts), error handling 2 (5 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
backup._validate_archive (cognitive 37) cli/commands/backup.py:261— backup._validate_archive has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 8, loops 2 (3 pts), error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CloudClient.on_config (cognitive 37) common/cloud_client.py:369— CloudClient.on_config has cognitive complexity 37 (threshold 15). Drivers by points: if/else 22 (28 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WorkspaceSelector.WorkspaceSelector (cognitive 37) desktop/src/renderer/src/components/WorkspaceSelector.tsx:23— WorkspaceSelector.WorkspaceSelector has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14, boolean chains 12, ternaries 6 (8 pts), error handling 3 (nesting depth added 2). Most of this is not in the body itself: 12 of the 37 points are its own statements and the rest belongs to 10 function items inside it that branch (createProject, a function literal at line 37, a function literal at line 85, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ModelsTab.VendorModal (cognitive 37) desktop/src/renderer/src/pages/settings/ModelsTab.tsx:406— ModelsTab.VendorModal has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 20, if/else 9, ternaries 8. Of this number, 16 points are the body's own statements and 21 belong to 8 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
saveModelConfig (cognitive 37) channel/web/static/js/views/config.js:471— saveModelConfig has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (29 pts), ternaries 1 (4 pts), boolean chains 3, error handling 1 (nesting depth added 17). Most of this is not in the body itself: 13 of the 37 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 508, 503, 502, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
message_utils.compress_turn_to_text_only (cognitive 36) agent/protocol/message_utils.py:293— message_utils.compress_turn_to_text_only has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
runner.run_tasks (cognitive 36) agent/subagent/runner.py:268— runner.run_tasks has cognitive complexity 36 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 6 (10 pts), ternaries 3 (10 pts), boolean chains 5 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentInitializer._initialize_scheduler (cognitive 36) bridge/agent_initializer.py:1078— AgentInitializer._initialize_scheduler has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (23 pts), error handling 2 (5 pts), ternaries 1 (5 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WebChannel.upload_file (cognitive 36) channel/web/core/channel.py:802— WebChannel.upload_file has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 9, loops 1 (2 pts), error handling 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WebChannel.stream_response (cognitive 36) channel/web/core/channel.py:1285— WebChannel.stream_response has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (3 pts), error handling 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.
WeixinChannel._qr_login (cognitive 36) channel/weixin/weixin_channel.py:534— WeixinChannel._qr_login has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (26 pts), error handling 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
generate.resolve_size (cognitive 36) skills/image-generation/scripts/generate.py:65— generate.resolve_size has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 6, loops 3 (6 pts), ternaries 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.
executor.run_evolution_for_session (cognitive 35) agent/evolution/executor.py:380— executor.run_evolution_for_session has cognitive complexity 35 (threshold 15). Drivers by points: if/else 20 (22 pts), boolean chains 6, error handling 3 (5 pts), loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DiscordChannel._on_message (cognitive 35) channel/discord/discord_channel.py:169— DiscordChannel._on_message has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 3 (8 pts), boolean chains 6, loops 1 (3 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QQChannel._upload_rich_media_chunked (cognitive 35) REDACTED:918— QQChannel._upload_rich_media_chunked has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 7 (10 pts), boolean chains 4, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel._on_message (cognitive 35) channel/telegram/telegram_channel.py:288— TelegramChannel._on_message has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 8, ternaries 3 (8 pts), loops 1 (3 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelsHandler._search_capability (cognitive 35) channel/web/api/models.py:1489— ModelsHandler._search_capability has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 14, if/else 8 (10 pts), ternaries 6 (10 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.
ModelsHandler._handle_discover_models (cognitive 35) channel/web/api/models.py:1814— ModelsHandler._handle_discover_models has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 16, if/else 10 (14 pts), ternaries 2 (4 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DashscopeBot.call_with_tools (cognitive 35) models/dashscope/dashscope_bot.py:232— DashscopeBot.call_with_tools has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (31 pts), boolean chains 3, error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ZHIPUAIBot._handle_stream_response (cognitive 35) models/zhipuai/zhipuai_bot.py:379— ZHIPUAIBot._handle_stream_response has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 6, error handling 2 (4 pts), loops 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.
BasicSettings.BasicSettings (cognitive 35) desktop/src/renderer/src/pages/settings/BasicSettings.tsx:37— BasicSettings.BasicSettings has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 53, ternaries 31 (42 pts), if/else 28 (30 pts), error handling 8 (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (BasicSettings.BasicSettings::loadConfig) 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.
AgentDelegateTool._delegate (cognitive 34) agent/tools/agent_delegate/agent_delegate.py:449— AgentDelegateTool._delegate has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 14, ternaries 3, error handling 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
channel_instances._explicit_instances (cognitive 34) channel/channel_instances.py:204— channel_instances._explicit_instances has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 7, loops 3 (6 pts), 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.
WeixinChannel._process_message (cognitive 34) channel/weixin/weixin_channel.py:798— WeixinChannel._process_message has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 5, loops 1 (3 pts), error handling 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LinkAI.on_handle_context (cognitive 34) plugins/linkai/linkai.py:37— LinkAI.on_handle_context has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 7 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MentionText.MentionText (cognitive 34) desktop/src/renderer/src/components/MentionText.tsx:19— MentionText.MentionText has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 8, ternaries 4 (7 pts), loops 4 (5 pts) (nesting depth added 9). Most of this is not in the body itself: 1 of the 34 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 36, 26). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
createMd (cognitive 34) channel/web/static/js/core/markdown.js:50— createMd has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 10, loops 2 (3 pts), ternaries 2 (3 pts), error handling 1 (2 pts) (nesting depth added 10). Most of this is not in the body itself: 4 of the 34 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 75, highlight, link_open, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
policy._split_process_substitutions (cognitive 33) agent/permission/policy.py:310— policy._split_process_substitutions has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (24 pts), boolean chains 5, loops 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.
AgentStreamExecutor._trim_messages (cognitive 33) REDACTED:2785— AgentStreamExecutor._trim_messages has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (20 pts), loops 4 (7 pts), boolean chains 6 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SlackChannel._handle_event (cognitive 33) channel/slack/slack_channel.py:196— SlackChannel._handle_event has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 3 (8 pts), boolean chains 6, loops 1 (3 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChannelsHandler._channel_instances_view (cognitive 33) channel/web/api/channels.py:216— ChannelsHandler._channel_instances_view has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 9, 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.
WecomBotMessage.__init__ (cognitive 33) channel/wecom_bot/wecom_bot_message.py:86— WecomBotMessage.__init__ has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (17 pts), error handling 2 (6 pts), boolean chains 4, loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
responses_adapter.responses_to_chat_completion (cognitive 33) models/openai/responses_adapter.py:283— responses_adapter.responses_to_chat_completion has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 12, if/else 5 (10 pts), ternaries 2 (7 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reasoning_capabilities.get_reasoning_capability (cognitive 33) models/reasoning_capabilities.py:95— reasoning_capabilities.get_reasoning_capability has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (30 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
installContextUsagePopover (cognitive 33) channel/web/static/js/chat/context-usage.js:157— installContextUsagePopover has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 9, ternaries 4 (6 pts), error handling 1 (nesting depth added 3). Most of this is not in the body itself: 2 of the 33 points are its own statements and the rest belongs to 20 function items inside it that branch (a function literal at line 211, a function literal at line 265, _ctxShowCard, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ConversationStore.delete_message_pair (cognitive 32) agent/memory/conversation_store.py:1046— ConversationStore.delete_message_pair has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (5 pts), error handling 1 (4 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
config.should_include_skill (cognitive 32) agent/skills/REDACTED:103— config.should_include_skill has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.setupIPC (cognitive 32) desktop/src/main/index.ts:538— index.setupIPC has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (15 pts), ternaries 7 (8 pts), boolean chains 7, error handling 2 (nesting depth added 2). None of this is in the body itself: all 32 points belong to 12 function items inside it that branch (a function literal at line 639, a function literal at line 706, a function literal at line 723, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TasksPage.RecordsView (cognitive 32) desktop/src/renderer/src/pages/TasksPage.tsx:386— TasksPage.RecordsView has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 15, ternaries 5 (12 pts), error handling 3, if/else 2 (nesting depth added 7). Most of this is not in the body itself: 5 of the 32 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 475, loadMore, loadRuns, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ArtifactPreview.ArtifactPreview (cognitive 32) desktop/src/renderer/src/pages/artifacts/ArtifactPreview.tsx:112— ArtifactPreview.ArtifactPreview has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 19, if/else 7 (8 pts), ternaries 4 (5 pts) (nesting depth added 2). Of this number, 25 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
initConfigView (cognitive 32) channel/web/static/js/views/config.js:155— initConfigView has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 14, if/else 9 (11 pts), ternaries 5 (6 pts), other 1 (nesting depth added 3). Of this number, 28 points are the body's own statements and 4 belong to 7 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
integration._resolve_delivery_channel (cognitive 31) agent/tools/scheduler/integration.py:396— integration._resolve_delivery_channel has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 1 (4 pts), boolean chains 3, error handling 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SchedulerTool._parse_schedule (cognitive 31) agent/tools/scheduler/scheduler_tool.py:443— SchedulerTool._parse_schedule has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (26 pts), ternaries 2 (4 pts), error handling 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChannelManager.start (cognitive 31) app.py:201— ChannelManager.start has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, error handling 2 (5 pts), loops 4, 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.
ModelScopeBot.reply_text_stream (cognitive 31) models/modelscope/modelscope_bot.py:174— ModelScopeBot.reply_text_stream has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (22 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CowCliPlugin._config_set (cognitive 31) plugins/cow_cli/cow_cli.py:816— CowCliPlugin._config_set has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (21 pts), error handling 4 (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.
LinkAIProvider.generate (cognitive 31) skills/image-generation/scripts/generate.py:426— LinkAIProvider.generate has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 3 (8 pts), error handling 1 (3 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.
QwenProvider.generate (cognitive 31) skills/image-generation/scripts/generate.py:862— QwenProvider.generate has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 6, loops 3 (5 pts), error handling 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useBackend.useBackend (cognitive 31) desktop/src/renderer/src/hooks/useBackend.ts:44— useBackend.useBackend has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 11, ternaries 3 (4 pts) (nesting depth added 2). None of this is in the body itself: all 31 points belong to 10 function literals inside it that branch (lines 103, 74, 90, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ChannelsPage.ChannelsPage (cognitive 31) desktop/src/renderer/src/pages/ChannelsPage.tsx:79— ChannelsPage.ChannelsPage has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 17, if/else 7 (8 pts), ternaries 4 (5 pts), error handling 1 (nesting depth added 2). Most of this is not in the body itself: 10 of the 31 points are its own statements and the rest belongs to 11 function items inside it that branch (loadChannels, a function literal at line 146, a function literal at line 158, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
discoverCatalogModels (cognitive 31) channel/web/static/js/views/models.js:2607— discoverCatalogModels has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 9, ternaries 2, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 14 of the 31 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 2634, 2666, 2644, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
executor._workspace_snapshot (cognitive 30) agent/evolution/executor.py:316— executor._workspace_snapshot has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 3 (9 pts), loops 3 (5 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.
ChatChannel._extract_and_send_images (cognitive 30) channel/chat_channel.py:422— ChatChannel._extract_and_send_images has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 4 (6 pts), error handling 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelsHandler._image_capability (cognitive 30) channel/web/api/models.py:1367— ModelsHandler._image_capability has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 6, loops 3 (6 pts), ternaries 2 (5 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelsHandler._handle_set_custom_provider (cognitive 30) channel/web/api/models.py:2054— ModelsHandler._handle_set_custom_provider has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 4, ternaries 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.
openai_compat._request_values (cognitive 30) channel/web/api/openai_compat.py:142— openai_compat._request_values has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 11, loops 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
link_ai_bot._linkai_call_with_tools (cognitive 30) models/linkai/link_ai_bot.py:567— link_ai_bot._linkai_call_with_tools has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 4, ternaries 2 (3 pts), error handling 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
MinimaxProvider.generate (cognitive 30) skills/image-generation/scripts/generate.py:978— MinimaxProvider.generate has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, loops 3 (4 pts), error handling 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
saveCapability (cognitive 30) channel/web/static/js/views/models.js:1938— saveCapability has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 9, ternaries 5 (8 pts) (nesting depth added 7). Of this number, 27 points are the body's own statements and 3 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_meItemHTML (cognitive 30) channel/web/static/js/views/menu-editor.js:105— _meItemHTML has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 11 (19 pts), if/else 6, boolean chains 5 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fetch (cognitive 30) channel/web/static/js/chat/state.js:57— fetch has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 6, ternaries 3 (5 pts), error handling 1 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentStreamExecutor._filter_think_stream (cognitive 29) REDACTED:707— AgentStreamExecutor._filter_think_stream has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (24 pts), ternaries 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillLoader._load_skill_from_file (cognitive 29) agent/skills/loader.py:161— SkillLoader._load_skill_from_file has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 3 (6 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
McpClient._streamable_http_post (cognitive 29) agent/tools/mcp/mcp_client.py:735— McpClient._streamable_http_post has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 4 (8 pts), boolean chains 6, 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.
dingtalk_message.download_image_file (cognitive 29) REDACTED:196— dingtalk_message.download_image_file has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (22 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel._async_send (cognitive 29) channel/telegram/telegram_channel.py:656— TelegramChannel._async_send has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 4 (8 pts), boolean chains 7, error handling 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HistoryHandler.GET (cognitive 29) channel/web/api/sessions.py:1007— HistoryHandler.GET has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 4 (7 pts), boolean chains 6, ternaries 3 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
skill._route_install (cognitive 29) cli/commands/skill.py:963— skill._route_install has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (21 pts), ternaries 2 (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.
DeepSeekBot.call_with_tools (cognitive 29) models/deepseek/deepseek_bot.py:224— DeepSeekBot.call_with_tools has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 5, loops 1 (2 pts), error handling 1, ternaries 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.
ModelScopeBot._convert_messages_for_modelscope (cognitive 29) models/modelscope/modelscope_bot.py:749— ModelScopeBot._convert_messages_for_modelscope has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 2 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAIHTTPClient._stream_chat (cognitive 29) models/openai/openai_http_client.py:405— OpenAIHTTPClient._stream_chat has cognitive complexity 29 (threshold 15). Drivers by points: error handling 9 (12 pts), if/else 6 (12 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.
LinkAI._process_admin_cmd (cognitive 29) plugins/linkai/linkai.py:131— LinkAI._process_admin_cmd has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 7 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MinimaxVoice.textToVoice (cognitive 29) voice/minimax/minimax_voice.py:29— MinimaxVoice.textToVoice has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 3 (6 pts), boolean chains 5, 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.
knowledge.renderKnowledgeGraph (cognitive 29) channel/web/static/js/views/knowledge.js:916— knowledge.renderKnowledgeGraph has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 16, if/else 9, ternaries 4. Most of this is not in the body itself: 1 of the 29 points is its own statement and the rest belongs to 13 function items inside it that branch (a function literal at line 1034, a function literal at line 1035, a function literal at line 1061, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
chatStore.attachmentsFromSteps (cognitive 29) desktop/src/renderer/src/store/chatStore.ts:164— chatStore.attachmentsFromSteps has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 5 (12 pts), boolean chains 8, if/else 3 (6 pts), error handling 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkspacePanel.WorkspacePanel (cognitive 29) desktop/src/renderer/src/components/WorkspacePanel.tsx:51— WorkspacePanel.WorkspacePanel has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 18, if/else 6, ternaries 5. Of this number, 19 points are the body's own statements and 10 belong to 5 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ModelCatalogEditor.ModelCatalogEditor::discover (cognitive 29) desktop/src/renderer/src/pages/settings/ModelCatalogEditor.tsx:188— ModelCatalogEditor.ModelCatalogEditor::discover has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 12, ternaries 7 (12 pts), if/else 2 (3 pts), 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.
ModelsTab.CustomProviderModal (cognitive 29) desktop/src/renderer/src/pages/settings/ModelsTab.tsx:593— ModelsTab.CustomProviderModal has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 15, if/else 10, ternaries 4. Most of this is not in the body itself: 10 of the 29 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 604, save, remove, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
switchWecomBotMode (cognitive 29) channel/web/static/js/views/channels-wecom.js:70— switchWecomBotMode has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 5 (10 pts), boolean chains 7 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
switchFeishuMode (cognitive 29) channel/web/static/js/views/channels-feishu.js:47— switchFeishuMode has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 5 (10 pts), boolean chains 7 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConversationStore._migrate (cognitive 28) agent/memory/conversation_store.py:2567— ConversationStore._migrate has cognitive complexity 28 (threshold 15). Drivers by points: error handling 10 (19 pts), if/else 9 (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.
MemoryFlushManager.deep_dream (cognitive 28) REDACTED:511— MemoryFlushManager.deep_dream has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (16 pts), error handling 4 (7 pts), boolean chains 4, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
policy._check_git_read_only (cognitive 28) agent/permission/policy.py:787— policy._check_git_read_only has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (19 pts), ternaries 3 (4 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.
policy._workspace_write_paths (cognitive 28) agent/permission/policy.py:835— policy._workspace_write_paths has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 3 (9 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.
tool_retrieval.build_retrieval_query (cognitive 28) agent/tools/mcp/tool_retrieval.py:52— tool_retrieval.build_retrieval_query has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (4 pts), ternaries 1 (2 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.
integration._migrate_legacy_task_stores (cognitive 28) agent/tools/scheduler/integration.py:64— integration._migrate_legacy_task_stores has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 3 (5 pts), loops 4 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
integration._execute_skill_call (cognitive 28) agent/tools/scheduler/integration.py:1089— integration._execute_skill_call has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 7, error handling 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.
ToolManager.sync_mcp_into_agent (cognitive 28) agent/tools/tool_manager.py:631— ToolManager.sync_mcp_into_agent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 3 (6 pts), boolean chains 5 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChannelManager.stop (cognitive 28) app.py:307— ChannelManager.stop has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 3, error handling 1 (3 pts), loops 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.
TelegramChannel._parse_message (cognitive 28) channel/telegram/telegram_channel.py:396— TelegramChannel._parse_message has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 5 (10 pts), boolean chains 7 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
menu._clean_item (cognitive 28) channel/web/api/menu.py:49— menu._clean_item has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 11, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelsHandler._set_chat_fallback (cognitive 28) channel/web/api/models.py:2392— ModelsHandler._set_chat_fallback has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 9, error handling 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelsHandler._handle_set_search_credential (cognitive 28) channel/web/api/models.py:2691— ModelsHandler._handle_set_search_credential has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 7 (10 pts), boolean chains 6 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SchedulerCreateHandler.POST (cognitive 28) channel/web/api/scheduler.py:602— SchedulerCreateHandler.POST has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 13, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
wecom_bot_message._guess_ext_from_bytes (cognitive 28) channel/wecom_bot/wecom_bot_message.py:35— wecom_bot_message._guess_ext_from_bytes has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CloudClient._handle_channel_sync (cognitive 28) common/cloud_client.py:812— CloudClient._handle_channel_sync has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 7, error handling 1 (2 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AzureChatGPTBot.create_img (cognitive 28) models/chatgpt/chat_gpt_bot.py:405— AzureChatGPTBot.create_img has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 4 (9 pts), boolean chains 5, 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.
ClaudeAPIBot.reply_text (cognitive 28) models/claudeapi/claude_api_bot.py:217— ClaudeAPIBot.reply_text has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 2, loops 2, error handling 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.
MimoBot.call_with_tools (cognitive 28) models/mimo/mimo_bot.py:223— MimoBot.call_with_tools has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (19 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MJBot.process_mj_task (cognitive 28) plugins/linkai/midjourney.py:106— MJBot.process_mj_task has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 5, 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.
SeedreamProvider.generate (cognitive 28) skills/image-generation/scripts/generate.py:727— SeedreamProvider.generate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PythonBackend.start (cognitive 28) REDACTED:699— PythonBackend.start has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (15 pts), error handling 3 (6 pts), boolean chains 5, loops 1, ternaries 1 (nesting depth added 5). Of this number, 14 points are the body's own statements and 14 belong to 3 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
KnowledgePage.KnowledgeDialog::submit (cognitive 28) desktop/src/renderer/src/pages/KnowledgePage.tsx:861— KnowledgePage.KnowledgeDialog::submit has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillCreateForm.SkillCreateForm (cognitive 28) desktop/src/renderer/src/pages/skills/SkillCreateForm.tsx:108— SkillCreateForm.SkillCreateForm has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 6 (9 pts), boolean chains 8, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 11 of the 28 points are its own statements and the rest belongs to 7 function items inside it that branch (submit, a function literal at line 128, a function literal at line 122, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ChannelTeamSelect.ChannelTeamSelect (cognitive 28) desktop/src/renderer/src/components/ChannelTeamSelect.tsx:32— ChannelTeamSelect.ChannelTeamSelect has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 13, ternaries 7 (9 pts), if/else 6 (nesting depth added 2). Of this number, 17 points are the body's own statements and 11 belong to 6 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ChatChannel._generate_reply (cognitive 27) channel/chat_channel.py:223— ChatChannel._generate_reply has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 2 (7 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DingTalkChanel.handle_group (cognitive 27) channel/dingtalk/dingtalk_channel.py:766— DingTalkChanel.handle_group has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
feishu_scheduler_card.build_scheduler_card (cognitive 27) channel/feishu/feishu_scheduler_card.py:23— feishu_scheduler_card.build_scheduler_card has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 4 (7 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QQChannel._handle_msg_event (cognitive 27) REDACTED:503— QQChannel._handle_msg_event has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 1 (3 pts), ternaries 1 (3 pts), boolean chains 2, error handling 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.
ModelsHandler._embedding_capability (cognitive 27) channel/web/api/models.py:1279— ModelsHandler._embedding_capability has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sessions._list_sessions_across_agents (cognitive 27) channel/web/api/sessions.py:255— sessions._list_sessions_across_agents has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (6 pts), ternaries 3 (5 pts), boolean chains 4, error handling 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.
ClaudeAPIBot.call_with_tools (cognitive 27) models/claudeapi/claude_api_bot.py:469— ClaudeAPIBot.call_with_tools has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 5, ternaries 1 (3 pts), 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.
workspace.wsRenderPreview (cognitive 27) channel/web/static/js/workspace.js:307— workspace.wsRenderPreview has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 8, error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ModelsTab.SearchKeyModal (cognitive 27) desktop/src/renderer/src/pages/settings/ModelsTab.tsx:1080— ModelsTab.SearchKeyModal has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 9, ternaries 7 (8 pts) (nesting depth added 3). Most of this is not in the body itself: 13 of the 27 points are its own statements and the rest belongs to 3 function items inside it that branch (handleSave, a function literal at line 1156, a function literal at line 1090). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ChannelsPage.ChannelCard (cognitive 27) desktop/src/renderer/src/pages/ChannelsPage.tsx:541— ChannelsPage.ChannelCard has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 25, ternaries 13 (17 pts), if/else 12 (14 pts), error handling 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (ChannelsPage.ChannelCard::run) 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.
initDropdown (cognitive 27) channel/web/static/js/views/config.js:29— initDropdown has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 6, ternaries 3 (4 pts) (nesting depth added 5). Most of this is not in the body itself: 3 of the 27 points are its own statements and the rest belongs to 8 function items inside it that branch (render, a function literal at line 52, paintFace, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
onProviderChange (cognitive 27) channel/web/static/js/views/config.js:266— onProviderChange has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 6, ternaries 3 (4 pts) (nesting depth added 7). Of this number, 20 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentAdminService.update_agent (cognitive 26) agent/admin.py:479— AgentAdminService.update_agent has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 11, if/else 8 (9 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.
KnowledgeService.build_graph (cognitive 26) agent/knowledge/service.py:718— KnowledgeService.build_graph has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 2 (5 pts), loops 3 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
conversation_store._resolve_global_binding (cognitive 26) agent/memory/conversation_store.py:2789— conversation_store._resolve_global_binding has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (9 pts), error handling 3 (5 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Agent.get_context_usage (cognitive 26) agent/protocol/agent.py:525— Agent.get_context_usage has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), error handling 3 (4 pts), boolean chains 3, ternaries 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentStreamExecutor._check_consecutive_failures (cognitive 26) REDACTED:819— AgentStreamExecutor._check_consecutive_failures has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 3, boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentStreamExecutor._execute_tool (cognitive 26) REDACTED:2248— AgentStreamExecutor._execute_tool has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (16 pts), ternaries 3 (4 pts), boolean chains 3, error handling 2 (3 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
McpClient._read_sse_response (cognitive 26) agent/tools/mcp/mcp_client.py:868— McpClient._read_sse_response has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), error handling 1 (4 pts), boolean chains 1, loops 1, ternaries 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.
AgentLLMModel.call_stream (cognitive 26) bridge/agent_bridge.py:503— AgentLLMModel.call_stream has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentBridge._migrate_config_to_env (cognitive 26) bridge/agent_bridge.py:1999— AgentBridge._migrate_config_to_env has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (5 pts), error handling 2 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentInitializer._migrate_config_to_env (cognitive 26) bridge/agent_initializer.py:1215— AgentInitializer._migrate_config_to_env has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (5 pts), error handling 2 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TerminalChannel.send (cognitive 26) channel/terminal/terminal_channel.py:206— TerminalChannel.send has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 2 (4 pts), loops 1 (2 pts), ternaries 2, boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConfigHandler.GET (cognitive 26) channel/web/api/REDACTED:62— ConfigHandler.GET has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 4 (6 pts), boolean chains 5, loops 3, error handling 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelsHandler._vision_capability (cognitive 26) channel/web/api/models.py:1148— ModelsHandler._vision_capability has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, ternaries 2 (5 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelsHandler._set_chat (cognitive 26) channel/web/api/models.py:2310— ModelsHandler._set_chat has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, loops 1 (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.
sessions._artifacts_from_steps (cognitive 26) channel/web/api/sessions.py:86— sessions._artifacts_from_steps has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (11 pts), ternaries 3 (9 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkspaceResolveHandler.GET (cognitive 26) channel/web/api/workspace.py:114— WorkspaceResolveHandler.GET has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, error handling 3 (4 pts), ternaries 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CloudClient.on_chat (cognitive 26) common/cloud_client.py:1359— CloudClient.on_chat has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 9, ternaries 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
link_ai_bot._linkai_convert_messages_to_openai_format (cognitive 26) models/linkai/link_ai_bot.py:788— link_ai_bot._linkai_convert_messages_to_openai_format has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 4, loops 3 (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.
responses_adapter.messages_to_input (cognitive 26) models/openai/responses_adapter.py:121— responses_adapter.messages_to_input has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 9, loops 2 (4 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.
check-load-order.scripts.forEach() (cognitive 26) channel/web/tools/check-load-order.mjs:109— check-load-order.scripts.forEach() has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (7 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 12). Of this number, 15 points are the body's own statements and 11 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OnboardingWizard.OnboardingWizard (cognitive 26) desktop/src/renderer/src/components/OnboardingWizard.tsx:26— OnboardingWizard.OnboardingWizard has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 16, ternaries 5 (7 pts), if/else 2, error handling 1 (nesting depth added 2). Of this number, 17 points are the body's own statements and 9 belong to 6 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
TasksPage.RunDetailModal (cognitive 26) desktop/src/renderer/src/pages/TasksPage.tsx:581— TasksPage.RunDetailModal has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 15, ternaries 7 (10 pts), if/else 1 (nesting depth added 3). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
parseSkillFrontmatter (cognitive 26) REDACTED:1438— parseSkillFrontmatter has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (nesting depth added 8). Of this number, 24 points are the body's own statements and 2 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
loadMemoryView (cognitive 26) channel/web/static/js/views/memory.js:21— loadMemoryView has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 4 (8 pts), boolean chains 5, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 3 of the 26 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 25, a function literal at line 51, a function literal at line 25, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
submitAddChannel (cognitive 26) channel/web/static/js/views/channels.js:584— submitAddChannel has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 1 (4 pts), boolean chains 2, error handling 1 (nesting depth added 10). Most of this is not in the body itself: 3 of the 26 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 610, 591, 622, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ConversationStore.append_messages (cognitive 25) agent/memory/conversation_store.py:796— ConversationStore.append_messages has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 6, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentStreamExecutor._truncate_historical_tool_results (cognitive 25) REDACTED:2547— AgentStreamExecutor._truncate_historical_tool_results has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 4, loops 3 (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.
Bash._get_safety_warning (cognitive 25) agent/tools/bash/bash.py:567— Bash._get_safety_warning has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (20 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.
integration._execute_agent_task (cognitive 25) agent/tools/scheduler/integration.py:793— integration._execute_agent_task has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 4, error handling 3, 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.
SearchFiles._parse_null_output (cognitive 25) agent/tools/search_files/search_files.py:658— SearchFiles._parse_null_output has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (21 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.
DingTalkChanel.handle_single (cognitive 25) channel/dingtalk/dingtalk_channel.py:690— DingTalkChanel.handle_single has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TerminalAgentRenderer._handle_event (cognitive 25) channel/terminal/terminal_channel.py:94— TerminalAgentRenderer._handle_event has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 3 (6 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChannelsHandler._handle_save (cognitive 25) channel/web/api/channels.py:424— ChannelsHandler._handle_save has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (21 pts), error handling 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.
SessionSettingsHandler.POST (cognitive 25) channel/web/api/sessions.py:741— SessionSettingsHandler.POST has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7, ternaries 2 (4 pts), error handling 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.
ZHIPUAIBot.reply_text (cognitive 25) models/zhipuai/zhipuai_bot.py:111— ZHIPUAIBot.reply_text has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 5, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Hello.on_handle_context (cognitive 25) plugins/hello/hello.py:45— Hello.on_handle_context has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (22 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.
GeminiProvider.generate (cognitive 25) skills/image-generation/scripts/generate.py:520— GeminiProvider.generate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3, error handling 1 (3 pts), 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.
render.createUserMessageEl (cognitive 25) channel/web/static/js/chat/render.js:45— render.createUserMessageEl has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 6 (14 pts), if/else 4 (6 pts), boolean chains 5 (nesting depth added 10). Most of this is not in the body itself: 7 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 60). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
ModelsTab.TtsCard (cognitive 25) desktop/src/renderer/src/pages/settings/ModelsTab.tsx:752— ModelsTab.TtsCard has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 20, ternaries 3 (4 pts), if/else 1 (nesting depth added 1). Of this number, 16 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AgentsPage.AgentSkills (cognitive 25) desktop/src/renderer/src/pages/AgentsPage.tsx:742— AgentsPage.AgentSkills has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 6, boolean chains 5 (nesting depth added 7). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 801, toggleSkill, a function literal at line 753, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
renderSkillPreviewList (cognitive 25) REDACTED:1053— renderSkillPreviewList has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 8 (11 pts), boolean chains 3 (nesting depth added 5). None of this is in the body itself: all 25 points belong to 6 function items inside it that branch ((anonymous)::toggle, a function literal at line 1057, a function literal at line 1122, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
renderFallbackChainEditor (cognitive 25) channel/web/static/js/views/models.js:403— renderFallbackChainEditor has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 5 (8 pts), boolean chains 3 (nesting depth added 7). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 469, 484, 415, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
loadKnowledgeView (cognitive 25) channel/web/static/js/views/knowledge.js:140— loadKnowledgeView has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, ternaries 3 (5 pts), error handling 1 (nesting depth added 4). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 157, 197, 151, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cognitive 25) channel/web/tools/check-load-order.mjs:109— (anonymous) has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3 (6 pts), ternaries 2 (6 pts), boolean chains 1 (nesting depth added 11). Of this number, 14 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentRegistry.from_config (cognitive 24) agent/registry.py:194— AgentRegistry.from_config has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (7 pts), boolean chains 6, 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.
SkillLoader._load_skills_recursive (cognitive 24) agent/skills/loader.py:76— SkillLoader._load_skills_recursive has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SearchFiles.execute (cognitive 24) agent/tools/search_files/search_files.py:364— SearchFiles.execute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 6, error handling 4 (5 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AgentLLMModel.call (cognitive 24) bridge/agent_bridge.py:433— AgentLLMModel.call has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChannelsHandler.GET (cognitive 24) channel/web/api/channels.py:298— ChannelsHandler.GET has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 7, loops 2 (3 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelsHandler._provider_overview (cognitive 24) channel/web/api/models.py:803— ModelsHandler._provider_overview has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 8, if/else 2 (5 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelsHandler._preset_seed (cognitive 24) channel/web/api/models.py:1685— ModelsHandler._preset_seed has cognitive complexity 24 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 5 (7 pts), boolean chains 5, ternaries 2 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WecomBotChannel._build_context (cognitive 24) REDACTED:588— WecomBotChannel._build_context has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 1 (3 pts), error handling 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
skill._stage_upload_into (cognitive 24) cli/commands/skill.py:1077— skill._stage_upload_into has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 1 (4 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PluginManager.activate_plugins (cognitive 24) plugins/plugin_manager.py:235— PluginManager.activate_plugins has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (4 pts), error handling 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.
Tool.on_handle_context (cognitive 24) plugins/tool/tool.py:49— Tool.on_handle_context has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 1 (3 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
quick_validate.validate_skill (cognitive 24) skills/skill-creator/scripts/quick_validate.py:12— quick_validate.validate_skill has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (21 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.
ChatInput.ChatInput::handleKeyDown (cognitive 24) desktop/src/renderer/src/components/ChatInput.tsx:452— ChatInput.ChatInput::handleKeyDown has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 5 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ChatInput.ChatInput) 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.
frontmatter.parseSkillFrontmatter (cognitive 24) desktop/src/renderer/src/pages/skills/frontmatter.ts:20— frontmatter.parseSkillFrontmatter has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
renderActiveChannels (cognitive 24) channel/web/static/js/views/channels.js:60— renderActiveChannels has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 12, boolean chains 8, if/else 4. Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 82, 166, 167). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SQLiteVectorBackend.search (cognitive 23) agent/memory/vector_backend.py:104— SQLiteVectorBackend.search has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, error handling 1 (2 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
message_utils._repair_tool_use_adjacency (cognitive 23) agent/protocol/message_utils.py:27— message_utils._repair_tool_use_adjacency has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (20 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.
feishu_static_card.download_public_image (cognitive 23) channel/feishu/feishu_static_card.py:154— feishu_static_card.download_public_image has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProjectBrowseHandler.GET (cognitive 23) channel/web/api/workspace.py:487— ProjectBrowseHandler.GET has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 3 (4 pts), loops 2 (3 pts), boolean chains 2, ternaries 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
backup.create_backup_archive (cognitive 23) cli/commands/backup.py:119— backup.create_backup_archive has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 3 (4 pts), ternaries 3 (4 pts), boolean chains 2, error handling 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.
DashscopeBot._handle_stream_response (cognitive 23) models/dashscope/dashscope_bot.py:423— DashscopeBot._handle_stream_response has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (21 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.
LinkAIBot._fetch_agent_suffix (cognitive 23) models/linkai/link_ai_bot.py:444— LinkAIBot._fetch_agent_suffix has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (18 pts), boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CowCliPlugin._resolve_active_embedding (cognitive 23) plugins/cow_cli/cow_cli.py:1557— CowCliPlugin._resolve_active_embedding has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 9, ternaries 2, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
nav.navigateTo (cognitive 23) channel/web/static/js/core/nav.js:194— nav.navigateTo has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
models._saveSearchKey (cognitive 23) channel/web/static/js/views/models.js:1045— models._saveSearchKey has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 1 (nesting depth added 9). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1066, 1091, 1109). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PythonBackend.findListenerPids (cognitive 23) REDACTED:562— PythonBackend.findListenerPids has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts), boolean chains 2, ternaries 2, error handling 1 (nesting depth added 10). None of this is in the body itself: all 23 points belong to 2 function literals inside it that branch (lines 574, 563). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chatStore.useChatStore.send (cognitive 23) desktop/src/renderer/src/store/chatStore.ts:775— chatStore.useChatStore.send has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (6 pts), ternaries 5, error handling 1 (nesting depth added 1). Of this number, 21 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MessageSteps.ToolStep (cognitive 23) desktop/src/renderer/src/components/MessageSteps.tsx:113— MessageSteps.ToolStep has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, ternaries 7 (10 pts), if/else 1 (nesting depth added 3). Of this number, 20 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
mcpConfig.parseMcpJson (cognitive 23) desktop/src/renderer/src/pages/skills/mcpConfig.ts:64— mcpConfig.parseMcpJson has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 6, ternaries 1 (2 pts), error handling 1 (nesting depth added 4). Of this number, 19 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentsPage.AgentCoreFiles (cognitive 23) desktop/src/renderer/src/pages/AgentsPage.tsx:597— AgentsPage.AgentCoreFiles has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 6 (8 pts), boolean chains 7, if/else 7, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 11 of the 23 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 614, save, a function literal at line 624, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ArtifactCard.Thumb (cognitive 23) desktop/src/renderer/src/pages/artifacts/ArtifactCard.tsx:43— ArtifactCard.Thumb has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 9, ternaries 4 (nesting depth added 1). Of this number, 16 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
parseMcpJson (cognitive 23) REDACTED:419— parseMcpJson has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 8, error handling 1 (nesting depth added 3). Of this number, 18 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
sendMessage (cognitive 23) channel/web/static/js/chat/send.js:95— sendMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 3, error handling 1, ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 9 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 154, a function literal at line 180, postWithRetry, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
KnowledgeService.import_documents (cognitive 22) agent/knowledge/service.py:427— KnowledgeService.import_documents has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 3 (6 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
KnowledgeService._scan_dir (cognitive 22) agent/knowledge/service.py:644— KnowledgeService._scan_dir has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), error handling 1 (4 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.
MemoryFlushManager._extract_response_text (cognitive 22) REDACTED:764— MemoryFlushManager._extract_response_text has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 1 (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.
builder._build_knowledge_section (cognitive 22) agent/prompt/builder.py:599— builder._build_knowledge_section has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 7 (10 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
builder._build_runtime_section (cognitive 22) agent/prompt/builder.py:1067— builder._build_runtime_section has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 6 (8 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Agent.run_stream (cognitive 22) agent/protocol/agent.py:759— Agent.run_stream has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, 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.
artifact._tool_results (cognitive 22) agent/protocol/artifact.py:326— artifact._tool_results has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (12 pts), ternaries 2 (5 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.
BrowserService.__init__ (cognitive 22) agent/tools/browser/browser_service.py:428— BrowserService.__init__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, ternaries 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.
Ls.execute (cognitive 22) agent/tools/ls/ls.py:52— Ls.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (14 pts), error handling 3 (4 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Read.execute (cognitive 22) agent/tools/read/read.py:134— Read.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 3, error handling 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Vision._append_other_model_providers (cognitive 22) agent/tools/vision/vision.py:473— Vision._append_other_model_providers has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, ternaries 2 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WebSearch._search_linkai (cognitive 22) agent/tools/web_search/web_search.py:575— WebSearch._search_linkai has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 6, loops 1 (3 pts), error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentsHandler.POST (cognitive 22) channel/web/api/agents.py:173— AgentsHandler.POST has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, ternaries 2 (4 pts), error handling 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.
WechatKfChannel._pull_messages (cognitive 22) REDACTED:454— WechatKfChannel._pull_messages has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
config._merge_legacy_namespace (cognitive 22) REDACTED:778— config._merge_legacy_namespace has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAICompatibleBot.call_with_tools (cognitive 22) models/openai_compatible_bot.py:70— OpenAICompatibleBot.call_with_tools has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (18 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ZHIPUAIBot.call_with_tools (cognitive 22) models/zhipuai/zhipuai_bot.py:206— ZHIPUAIBot.call_with_tools has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
send.startSSE (cognitive 22) channel/web/static/js/chat/send.js:211— send.startSSE has cognitive complexity 22 (threshold 15). Drivers by points: if/else 100 (191 pts), boolean chains 67, ternaries 8 (15 pts), loops 2 (6 pts), error handling 1 (3 pts) (nesting depth added 104). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
models.onCapabilityProviderChange (cognitive 22) channel/web/static/js/views/models.js:1856— models.onCapabilityProviderChange has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 6, 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.
ChatInput.ChatInput (cognitive 22) desktop/src/renderer/src/components/ChatInput.tsx:60— ChatInput.ChatInput has cognitive complexity 22 (threshold 15). Drivers by points: if/else 61 (77 pts), boolean chains 43, ternaries 10 (12 pts), error handling 5 (7 pts), loops 4 (nesting depth added 20). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (ChatInput.ChatInput::handleKeyDown) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ChatFallbackCard.ChatFallbackModal (cognitive 22) desktop/src/renderer/src/pages/settings/ChatFallbackCard.tsx:206— ChatFallbackCard.ChatFallbackModal has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 16, if/else 3, ternaries 3. Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 220, addLink, a function literal at line 223, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentAdminService.create_agent (cognitive 21) agent/admin.py:376— AgentAdminService.create_agent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, ternaries 3, error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ChatService._restore_verbatim_query (cognitive 21) agent/chat/service.py:719— ChatService._restore_verbatim_query has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), ternaries 1 (4 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
factory._init_explicit_provider (cognitive 21) agent/memory/embedding/factory.py:84— factory._init_explicit_provider has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, ternaries 3, error handling 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
policy._check_bash_read_only (cognitive 21) agent/permission/policy.py:729— policy._check_bash_read_only has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 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.
builder._build_tooling_section (cognitive 21) agent/prompt/builder.py:218— builder._build_tooling_section has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (8 pts), loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Agent.compact_context (cognitive 21) agent/protocol/agent.py:909— Agent.compact_context has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 2 (4 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
registry._profile_from_mapping (cognitive 21) agent/registry.py:107— registry._profile_from_mapping has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), ternaries 4, 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.
AgentDelegateTool._team_members (cognitive 21) agent/tools/agent_delegate/agent_delegate.py:331— AgentDelegateTool._team_members has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, 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.
BrowserService._run_loop (cognitive 21) agent/tools/browser/browser_service.py:567— BrowserService._run_loop has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 4 (7 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
integration._remember_delivered_output (cognitive 21) agent/tools/scheduler/integration.py:590— integration._remember_delivered_output 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.
search_files._brace_group (cognitive 21) agent/tools/search_files/search_files.py:91— search_files._brace_group has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (17 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.
AgentBridge._seed_team_members (cognitive 21) bridge/agent_bridge.py:724— AgentBridge._seed_team_members has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, error handling 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
AgentInitializer._flush_all_agents (cognitive 21) bridge/agent_initializer.py:1313— AgentInitializer._flush_all_agents has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (4 pts), loops 3, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChannelsHandler._handle_connect (cognitive 21) channel/web/api/channels.py:490— ChannelsHandler._handle_connect has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
models._discovered_capabilities (cognitive 21) channel/web/api/models.py:166— models._discovered_capabilities has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
weixin_api.upload_media_to_cdn (cognitive 21) REDACTED:399— weixin_api.upload_media_to_cdn has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
skill._merge_builtin_into_config (cognitive 21) cli/commands/skill.py:779— skill._merge_builtin_into_config has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
responses_adapter._content_to_input_parts (cognitive 21) models/openai/responses_adapter.py:91— responses_adapter._content_to_input_parts has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (6 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.
godcmd.get_help_text (cognitive 21) plugins/godcmd/godcmd.py:137— godcmd.get_help_text has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts), boolean chains 3, 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.
GeminiProvider._extract_images (cognitive 21) skills/image-generation/scripts/generate.py:595— GeminiProvider._extract_images has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (8 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.
generate._build_providers (cognitive 21) skills/image-generation/scripts/generate.py:1133— generate._build_providers has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, ternaries 2 (3 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useSchedulerNotifyPoll.maybeNotify (cognitive 21) desktop/src/renderer/src/hooks/useSchedulerNotifyPoll.ts:68— useSchedulerNotifyPoll.maybeNotify has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, loops 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
renderSkillFilesTree (cognitive 21) REDACTED:1646— renderSkillFilesTree has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10 (13 pts), if/else 5 (6 pts), boolean chains 2 (nesting depth added 4). Of this number, 12 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
renderVoicePill (cognitive 21) channel/web/static/js/chat/render.js:619— renderVoicePill has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 5, error handling 2 (4 pts), ternaries 3 (nesting depth added 3). Most of this is not in the body itself: 5 of the 21 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 666, fmt, setIcon, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentAdminService.set_knowledge_mode (cognitive 20) agent/admin.py:695— AgentAdminService.set_knowledge_mode has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (18 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.
policy._protected_operand (cognitive 20) agent/permission/policy.py:530— policy._protected_operand has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (4 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
workspace.load_context_files (cognitive 20) agent/prompt/workspace.py:112— workspace.load_context_files has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 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.
SkillManager._sync_skills_config (cognitive 20) agent/skills/manager.py:211— SkillManager._sync_skills_config has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillManager._normalize_skill_filter (cognitive 20) agent/skills/manager.py:328— SkillManager._normalize_skill_filter has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
browser_service._flatten_tree (cognitive 20) agent/tools/browser/browser_service.py:363— browser_service._flatten_tree has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 4 (5 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ToolManager._load_mcp_tools_async (cognitive 20) agent/tools/tool_manager.py:500— ToolManager._load_mcp_tools_async has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (3 pts), loops 2 (3 pts), ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Vision._route_by_provider_id (cognitive 20) agent/tools/vision/vision.py:356— Vision._route_by_provider_id has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (6 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelsHandler._custom_provider_cards (cognitive 20) channel/web/api/models.py:732— ModelsHandler._custom_provider_cards has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, ternaries 3 (6 pts), error handling 1, if/else 1, loops 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
openai_http_client._resolve_attribution_headers (cognitive 20) models/openai/openai_http_client.py:76— openai_http_client._resolve_attribution_headers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (6 pts), error handling 2 (5 pts), ternaries 1 (5 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.
CowCliPlugin._knowledge_tree (cognitive 20) plugins/cow_cli/cow_cli.py:1954— CowCliPlugin._knowledge_tree has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (7 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Role.__init__ (cognitive 20) plugins/role/role.py:44— Role.__init__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (6 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.
generate._compress_image (cognitive 20) skills/image-generation/scripts/generate.py:145— generate._compress_image has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 3 (5 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
menu-editor._meValidate (cognitive 20) channel/web/static/js/views/menu-editor.js:391— menu-editor._meValidate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (12 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tasks-modal.openTaskEditModal (cognitive 20) channel/web/static/js/views/tasks-modal.js:338— tasks-modal.openTaskEditModal has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 13, if/else 6 (7 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.
ModelSelector.CatalogModelSelector (cognitive 20) desktop/src/renderer/src/components/ModelSelector.tsx:16— ModelSelector.CatalogModelSelector has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 14, ternaries 4, if/else 2. Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 85, a function literal at line 79, a function literal at line 73, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentsPage.AgentDetail (cognitive 20) desktop/src/renderer/src/pages/AgentsPage.tsx:205— AgentsPage.AgentDetail has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 5, ternaries 3, error handling 1. Of this number, 11 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
loadTaskInstances (cognitive 20) channel/web/static/js/views/tasks-modal.js:109— loadTaskInstances has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, ternaries 4, error handling 2 (3 pts), if/else 3 (nesting depth added 1). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 121, 125, 119, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
openCustomProviderModal (cognitive 20) channel/web/static/js/views/models-custom-provider.js:12— openCustomProviderModal has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (9 pts), if/else 7, boolean chains 4 (nesting depth added 1). Of this number, 17 points are the body's own statements and 3 belong to 4 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
regenerateResponse (cognitive 20) channel/web/static/js/chat/send.js:6— regenerateResponse has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 3). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 55, a function literal at line 74, postWithRetry, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
startPolling (cognitive 20) channel/web/static/js/chat/send.js:1040— startPolling has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, error handling 1, ternaries 1 (nesting depth added 6). None of this is in the body itself: all 20 points belong to 4 function items inside it that branch (a function literal at line 1057, poll, a function literal at line 1056, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
trigger._scan_once (cognitive 19) agent/evolution/trigger.py:118— trigger._scan_once has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 4, ternaries 2 (4 pts), 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.
ConversationStore.get_run_detail (cognitive 19) agent/memory/conversation_store.py:1685— ConversationStore.get_run_detail has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, error handling 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.
ConversationStore.list_user_messages (cognitive 19) agent/memory/conversation_store.py:1885— ConversationStore.list_user_messages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 3 (6 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
provider.create_embedding_provider (cognitive 19) REDACTED:483— provider.create_embedding_provider has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (8 pts), ternaries 2 (3 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
message_utils.find_first_user_text_block (cognitive 19) agent/protocol/message_utils.py:411— message_utils.find_first_user_text_block has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 3 (7 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.
DelegationPolicy.from_config (cognitive 19) agent/tools/agent_delegate/agent_delegate.py:202— DelegationPolicy.from_config has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, 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.
service.save_servers (cognitive 19) agent/tools/mcp/service.py:228— service.save_servers 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.
SchedulerTool._resolve_owner_agent_id (cognitive 19) agent/tools/scheduler/scheduler_tool.py:590— SchedulerTool._resolve_owner_agent_id has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 3 (6 pts), boolean chains 4, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SubagentTool._collect_tasks (cognitive 19) agent/tools/subagent/subagent.py:275— SubagentTool._collect_tasks has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (8 pts), loops 1 (2 pts) (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WebSearch.execute (cognitive 19) agent/tools/web_search/web_search.py:326— WebSearch.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, error handling 3, boolean chains 2, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WorkspaceService.search (cognitive 19) agent/workspace/service.py:179— WorkspaceService.search has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentInitializer.initialize_agent (cognitive 19) bridge/agent_initializer.py:112— AgentInitializer.initialize_agent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, ternaries 2 (4 pts), error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DingTalkCardStreamer.handle_event (cognitive 19) channel/dingtalk/dingtalk_stream_card.py:141— DingTalkCardStreamer.handle_event has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiscordChannel._compose_context (cognitive 19) channel/discord/discord_channel.py:394— DiscordChannel._compose_context has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SlackChannel._compose_context (cognitive 19) channel/slack/slack_channel.py:401— SlackChannel._compose_context has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel._compose_context (cognitive 19) channel/telegram/telegram_channel.py:531— TelegramChannel._compose_context has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelsHandler._persist_custom_providers (cognitive 19) channel/web/api/models.py:1982— ModelsHandler._persist_custom_providers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 1 (3 pts), boolean chains 2, 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.
ModelsHandler._set_image (cognitive 19) channel/web/api/models.py:2229— ModelsHandler._set_image has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Query.POST (cognitive 19) channel/wechatmp/active_reply.py:19— Query.POST has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
backup._iter_workspace_files (cognitive 19) cli/commands/backup.py:93— backup._iter_workspace_files has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
backup._multi_agent_destinations (cognitive 19) cli/commands/backup.py:369— backup._multi_agent_destinations has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 2 (5 pts), ternaries 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
skill._scan_skills_in_repo (cognitive 19) cli/commands/skill.py:252— skill._scan_skills_in_repo has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
office_text._iter_docx_blocks (cognitive 19) common/office_text.py:20— office_text._iter_docx_blocks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (8 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.
ClaudeAPIBot._handle_stream_response (cognitive 19) models/claudeapi/claude_api_bot.py:758— ClaudeAPIBot._handle_stream_response has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MoonshotBot.call_with_tools (cognitive 19) models/moonshot/moonshot_bot.py:237— MoonshotBot.call_with_tools has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, error handling 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Keyword.on_handle_context (cognitive 19) plugins/keyword/keyword.py:51— Keyword.on_handle_context has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, error handling 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.
LinkAI._is_summary_open (cognitive 19) plugins/linkai/linkai.py:196— LinkAI._is_summary_open has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 6 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sessions._sessionGroups (cognitive 19) channel/web/static/js/views/sessions.js:272— sessions._sessionGroups has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (14 pts), if/else 4 (5 pts) (nesting depth added 9). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 283, a function literal at line 293, bucket). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ApiClient.postFormData (cognitive 19) desktop/src/renderer/src/api/client.ts:188— ApiClient.postFormData has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 2 (5 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.
sessionSettingsStore.useSessionSettingsStore (cognitive 19) desktop/src/renderer/src/store/sessionSettingsStore.ts:49— sessionSettingsStore.useSessionSettingsStore has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, error handling 2, ternaries 1 (nesting depth added 1). None of this is in the body itself: all 19 points belong to 4 function literals inside it that branch (lines 59, 77, 100, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ChatApiCard.ChatApiCard (cognitive 19) desktop/src/renderer/src/pages/settings/ChatApiCard.tsx:73— ChatApiCard.ChatApiCard has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8 (13 pts), if/else 3, boolean chains 2, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 5 function items inside it that branch (onToggle, post, a function literal at line 81, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
loadAgentCatalog (cognitive 19) channel/web/static/js/views/agents.js:110— loadAgentCatalog has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (8 pts), error handling 1 (nesting depth added 1). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 113, 152, 112, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
_ctxDoCompact (cognitive 19) channel/web/static/js/chat/context-usage.js:347— _ctxDoCompact has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 360, 359, 389). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
session_service._assemble_optimize_prompt (cognitive 18) agent/chat/session_service.py:141— session_service._assemble_optimize_prompt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, 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.
TextChunker.chunk_text (cognitive 18) agent/memory/chunker.py:38— TextChunker.chunk_text has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryManager.search (cognitive 18) REDACTED:137— MemoryManager.search has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), error handling 2 (4 pts), boolean chains 3, ternaries 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
builder._build_team_section (cognitive 18) agent/prompt/builder.py:982— builder._build_team_section has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (4 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Agent._estimate_message_tokens (cognitive 18) agent/protocol/agent.py:462— Agent._estimate_message_tokens has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agent_stream._parse_tool_args (cognitive 18) REDACTED:210— agent_stream._parse_tool_args has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 2 (4 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
frontmatter.parse_frontmatter (cognitive 18) agent/skills/frontmatter.py:20— frontmatter.parse_frontmatter has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 3 (6 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.
integration._execute_send_message (cognitive 18) agent/tools/scheduler/integration.py:923— integration._execute_send_message has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, 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.
integration._execute_tool_call (cognitive 18) agent/tools/scheduler/integration.py:1010— integration._execute_tool_call has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 5, ternaries 2 (3 pts), error handling 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SchedulerService._check_and_execute_tasks (cognitive 18) agent/tools/scheduler/scheduler_service.py:117— SchedulerService._check_and_execute_tasks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 2 (4 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SearchFiles._python_scan_file (cognitive 18) agent/tools/search_files/search_files.py:746— SearchFiles._python_scan_file has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 3 (4 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.
Vision._route_by_model_name (cognitive 18) agent/tools/vision/vision.py:410— Vision._route_by_model_name has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 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.
WebSearch._search_zhipu (cognitive 18) agent/tools/web_search/web_search.py:443— WebSearch._search_zhipu has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 5, loops 1, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
web_search._get_api_key (cognitive 18) agent/tools/web_search/web_search.py:104— web_search._get_api_key has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WorkspaceService.dispatch (cognitive 18) agent/workspace/service.py:283— WorkspaceService.dispatch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 6, error handling 4 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
session_prefs.forget_agent (cognitive 18) agent/workspace/session_prefs.py:169— session_prefs.forget_agent has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentInitializer._restore_conversation_history (cognitive 18) bridge/agent_initializer.py:255— AgentInitializer._restore_conversation_history has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, 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.
channel_factory._build_channel (cognitive 18) channel/channel_factory.py:54— channel_factory._build_channel has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 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.
FeiShuChanel._compose_context (cognitive 18) channel/feishu/feishu_channel.py:2241— FeiShuChanel._compose_context has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 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.
QQChannel._start_ws (cognitive 18) REDACTED:250— QQChannel._start_ws has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VoiceTtsHandler.POST (cognitive 18) channel/web/api/files.py:126— VoiceTtsHandler.POST has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 6, error handling 3 (5 pts) (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelsHandler._chat_capability (cognitive 18) channel/web/api/models.py:939— ModelsHandler._chat_capability has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, error handling 1 (2 pts), loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sessions._add_delegate_displays (cognitive 18) channel/web/api/sessions.py:140— sessions._add_delegate_displays has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, error handling 2 (4 pts), if/else 2 (4 pts), loops 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WebChannel.cancel_request (cognitive 18) channel/web/core/channel.py:1394— WebChannel.cancel_request has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (6 pts), boolean chains 5, error handling 3 (4 pts), 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.
skill._install_from_repo_root (cognitive 18) cli/commands/skill.py:1544— skill._install_from_repo_root has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (17 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.
CowCliPlugin._memory_status (cognitive 18) plugins/cow_cli/cow_cli.py:1599— CowCliPlugin._memory_status has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, ternaries 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
generate.main (cognitive 18) skills/image-generation/scripts/generate.py:1218— generate.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 4, error handling 3 (4 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
message-actions.editUserMessage (cognitive 18) channel/web/static/js/chat/message-actions.js:145— message-actions.editUserMessage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, loops 1, ternaries 1 (nesting depth added 3). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
artifacts._artCardHTML (cognitive 18) channel/web/static/js/views/artifacts.js:550— artifacts._artCardHTML has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 10 (11 pts), boolean chains 7 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
knowledge.openKnowledgeDocumentEditor (cognitive 18) channel/web/static/js/views/knowledge.js:528— knowledge.openKnowledgeDocumentEditor has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (12 pts), if/else 4, boolean chains 2 (nesting depth added 4). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 539, 550, 556). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
knowledge.validateKnowledgeImportFiles (cognitive 18) channel/web/static/js/views/knowledge.js:626— knowledge.validateKnowledgeImportFiles has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 4 (5 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PythonBackend.resolveEnvPath (cognitive 18) REDACTED:310— PythonBackend.resolveEnvPath has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, error handling 1 (2 pts), 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.
useTheme.applyAppearanceAndTheme (cognitive 18) desktop/src/renderer/src/hooks/useTheme.ts:65— useTheme.applyAppearanceAndTheme has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 5 (7 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SessionList.buildGroups (cognitive 18) desktop/src/renderer/src/layout/SessionList.tsx:76— SessionList.buildGroups has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 4, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 6). Of this number, 11 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentScopeSelect.AgentScopeSelect (cognitive 18) desktop/src/renderer/src/components/AgentScopeSelect.tsx:26— AgentScopeSelect.AgentScopeSelect has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, ternaries 5 (6 pts), if/else 3 (nesting depth added 1). Of this number, 14 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
KnowledgePage.findTitle (cognitive 18) desktop/src/renderer/src/pages/KnowledgePage.tsx:220— KnowledgePage.findTitle has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, loops 4, ternaries 1 (nesting depth added 4). Of this number, 10 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentsPage.CreateAgentModal (cognitive 18) desktop/src/renderer/src/pages/AgentsPage.tsx:842— AgentsPage.CreateAgentModal has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 6, error handling 1 (2 pts), ternaries 2 (nesting depth added 1). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 5 function items inside it that branch (submit, onPickAvatar, a function literal at line 855, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
wsApi (cognitive 18) channel/web/static/js/workspace.js:103— wsApi has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 4 (6 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.
showRunDetailModal (cognitive 18) channel/web/static/js/views/tasks.js:251— showRunDetailModal has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 6, ternaries 3, error handling 1. Of this number, 13 points are the body's own statements and 5 belong to 4 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
_artInit (cognitive 18) channel/web/static/js/views/artifacts.js:84— _artInit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, boolean chains 3, error handling 1. Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 13 function literals inside it that branch (lines 116, 139, 107, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
renderSubagentStep (cognitive 18) channel/web/static/js/core/utils.js:82— renderSubagentStep has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
showLoginScreen (cognitive 18) channel/web/static/js/core/auth.js:45— showLoginScreen has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (17 pts), error handling 1 (nesting depth added 3). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 81, a function literal at line 103, onsubmit, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
backup.restore_backup (cognitive 17) agent/evolution/backup.py:103— backup.restore_backup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, loops 2, error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
conversation_store._merge_one_agent (cognitive 17) agent/memory/conversation_store.py:3061— conversation_store._merge_one_agent has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 4 (5 pts), 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.
AgentStreamExecutor._select_tools_for_injection (cognitive 17) REDACTED:1366— AgentStreamExecutor._select_tools_for_injection has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, ternaries 3 (6 pts), boolean chains 3, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
message_utils.drop_orphaned_tool_results_openai (cognitive 17) agent/protocol/message_utils.py:241— message_utils.drop_orphaned_tool_results_openai has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
step_writer._closed_prefix (cognitive 17) agent/protocol/step_writer.py:128— step_writer._closed_prefix has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 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.
frontmatter.parse_metadata (cognitive 17) agent/skills/frontmatter.py:78— frontmatter.parse_metadata has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (4 pts), error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
exit_codes._last_segment (cognitive 17) agent/tools/bash/exit_codes.py:28— exit_codes._last_segment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
browser_service._process_table (cognitive 17) agent/tools/browser/browser_service.py:283— browser_service._process_table has cognitive complexity 17 (threshold 15). Drivers by points: error handling 3 (6 pts), if/else 3 (6 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Read._paginate (cognitive 17) agent/tools/read/read.py:270— Read._paginate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 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.
integration.effective_task_agent_id (cognitive 17) agent/tools/scheduler/integration.py:180— integration.effective_task_agent_id has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RecipientStore.remember (cognitive 17) agent/tools/scheduler/recipient_store.py:98— RecipientStore.remember has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (7 pts), error handling 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ToolManager._teardown_mcp_server (cognitive 17) agent/tools/tool_manager.py:463— ToolManager._teardown_mcp_server has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 3 (5 pts), error handling 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.
app._sync_builtin_skills (cognitive 17) app.py:708— app._sync_builtin_skills has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentInitializer._attribute_history (cognitive 17) bridge/agent_initializer.py:396— AgentInitializer._attribute_history has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), ternaries 1 (4 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.
DingTalkCardStreamer._on_agent_end (cognitive 17) channel/dingtalk/dingtalk_stream_card.py:182— DingTalkCardStreamer._on_agent_end has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, 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.
DiscordChannel._async_send (cognitive 17) channel/discord/discord_channel.py:461— DiscordChannel._async_send has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (5 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.
ModelsHandler._tts_capability (cognitive 17) channel/web/api/models.py:1237— ModelsHandler._tts_capability has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (5 pts), ternaries 3, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sessions._session_settings_state (cognitive 17) channel/web/api/sessions.py:600— sessions._session_settings_state has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 4, ternaries 3, error handling 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SkillsHandler.GET (cognitive 17) channel/web/api/skills.py:316— SkillsHandler.GET has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (6 pts), boolean chains 1, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillUploadHandler.POST (cognitive 17) channel/web/api/skills.py:523— SkillUploadHandler.POST has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, error handling 2, 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.
skills._market_spec (cognitive 17) channel/web/api/skills.py:79— skills._market_spec has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 2, 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.
Dequeue.putleft (cognitive 17) common/dequeue.py:7— Dequeue.putleft has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
office_text.iter_pptx_shape_text (cognitive 17) common/office_text.py:64— office_text.iter_pptx_shape_text has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (7 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.
config.sync_image_generation_custom_provider_env (cognitive 17) REDACTED:846— config.sync_image_generation_custom_provider_env has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, ternaries 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClaudeAPIBot.reply (cognitive 17) models/claudeapi/claude_api_bot.py:176— ClaudeAPIBot.reply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 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.
GoogleGeminiBot._build_inline_part_from_image_url (cognitive 17) models/gemini/google_gemini_bot.py:188— GoogleGeminiBot._build_inline_part_from_image_url has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
link_ai_bot._linkai_error_body (cognitive 17) models/linkai/link_ai_bot.py:62— link_ai_bot._linkai_error_body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 6, loops 1 (2 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MinimaxBot.reply_text (cognitive 17) models/minimax/minimax_bot.py:99— MinimaxBot.reply_text has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), error handling 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelScopeBot.reply (cognitive 17) models/modelscope/modelscope_bot.py:41— ModelScopeBot.reply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelScopeBot.reply_text (cognitive 17) models/modelscope/modelscope_bot.py:110— ModelScopeBot.reply_text has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 3 (5 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.
OpenAIBot.reply (cognitive 17) models/openai/open_ai_bot.py:69— OpenAIBot.reply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 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.
XunFeiBot.reply (cognitive 17) models/xunfei/xunfei_spark_bot.py:56— XunFeiBot.reply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 1 (3 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
state.messagesDiv.addEventListener("scroll") (cognitive 17) channel/web/static/js/chat/state.js:505— state.messagesDiv.addEventListener("scroll") has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 4 (7 pts), boolean chains 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
agents.setAgentKnowledgeMode (cognitive 17) channel/web/static/js/views/agents.js:471— agents.setAgentKnowledgeMode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
menu-editor._meOnClick (cognitive 17) channel/web/static/js/views/menu-editor.js:169— menu-editor._meOnClick has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 8. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
workspace.document.addEventListener("click") (cognitive 17) channel/web/static/js/workspace.js:760— workspace.document.addEventListener("click") has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 2 (3 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.
updater.setUpdateFeedQuery (cognitive 17) desktop/src/main/updater.ts:131— updater.setUpdateFeedQuery has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 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.
primitives.Dropdown (cognitive 17) desktop/src/renderer/src/pages/settings/primitives.tsx:131— primitives.Dropdown has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, ternaries 5, if/else 4. Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 6 function items inside it that branch (place, a function literal at line 174, a function literal at line 168, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
chatStore.historyToMessage (cognitive 17) desktop/src/renderer/src/store/chatStore.ts:256— chatStore.historyToMessage has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 2 (3 pts), ternaries 3, loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Markdown.md.core.ruler.after("linkify","fix_greedy_linkify") (cognitive 17) REDACTED:72— Markdown.md.core.ruler.after("linkify","fix_greedy_linkify") has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
KnowledgePage.findFileByName (cognitive 17) desktop/src/renderer/src/pages/KnowledgePage.tsx:179— KnowledgePage.findFileByName has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, loops 4, ternaries 1 (nesting depth added 4). Of this number, 9 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChannelsPage.ChannelCard::run (cognitive 17) desktop/src/renderer/src/pages/ChannelsPage.tsx:600— ChannelsPage.ChannelCard::run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (6 pts), boolean chains 2, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ChannelsPage.ChannelCard) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
(anonymous) (cognitive 17) channel/web/static/js/workspace.js:760— (anonymous) has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 2 (3 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.
_sessionItemEl (cognitive 17) channel/web/static/js/views/sessions.js:465— _sessionItemEl has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9, boolean chains 7, if/else 1. Of this number, 16 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
savePasswordConfig (cognitive 17) channel/web/static/js/views/config.js:594— savePasswordConfig has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 1 (nesting depth added 7). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 609, 608, 642, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
renderChannelTeam (cognitive 17) channel/web/static/js/views/channels.js:198— renderChannelTeam has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (8 pts), boolean chains 5, if/else 4 (nesting depth added 3). Of this number, 14 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_artMountThumb (cognitive 17) channel/web/static/js/views/artifacts.js:584— _artMountThumb has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 4). Of this number, 10 points are the body's own statements and 7 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_artTogglePin (cognitive 17) channel/web/static/js/views/artifacts.js:911— _artTogglePin has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, error handling 1, ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 921, 924, 942, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
renderModelMenu (cognitive 17) channel/web/static/js/chat/session-settings.js:216— renderModelMenu has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 12, ternaries 3, if/else 2. Of this number, 10 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
session_service.optimize_prompt (cognitive 16) agent/chat/session_service.py:232— session_service.optimize_prompt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, loops 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConversationStore.prune_scheduled_messages (cognitive 16) agent/memory/conversation_store.py:1139— ConversationStore.prune_scheduled_messages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2, 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.
conversation_store._merge_secondary_agents (cognitive 16) agent/memory/conversation_store.py:3000— conversation_store._merge_secondary_agents has cognitive complexity 16 (threshold 15). Drivers by points: error handling 4 (8 pts), if/else 3 (6 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.
MemoryStorage._init_db (cognitive 16) agent/memory/storage.py:342— MemoryStorage._init_db has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 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.
MemoryFlushManager._extract_summary_fallback (cognitive 16) REDACTED:843— MemoryFlushManager._extract_summary_fallback has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
builder._build_skills_section (cognitive 16) agent/prompt/builder.py:346— builder._build_skills_section has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 2 (4 pts), loops 1 (2 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Agent.apply_project_dir (cognitive 16) agent/protocol/agent.py:198— Agent.apply_project_dir has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agent.resolve_family_spec (cognitive 16) agent/protocol/agent.py:59— agent.resolve_family_spec has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 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.
message_utils.identify_complete_turns (cognitive 16) agent/protocol/message_utils.py:356— message_utils.identify_complete_turns has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 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.
config.get_missing_requirements (cognitive 16) agent/skills/REDACTED:177— config.get_missing_requirements 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.
ChromeLauncher._profile_chrome_processes (cognitive 16) agent/tools/browser/chrome_launcher.py:115— ChromeLauncher._profile_chrome_processes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 2 (3 pts), ternaries 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mcp_oauth.discover_metadata (cognitive 16) agent/tools/mcp/mcp_oauth.py:200— mcp_oauth.discover_metadata has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
integration._run_scheduled_task (cognitive 16) agent/tools/scheduler/integration.py:718— integration._run_scheduled_task has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 2 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
truncate.truncate_tail (cognitive 16) agent/tools/utils/truncate.py:174— truncate.truncate_tail has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WebFetch._fetch_deepseek (cognitive 16) agent/tools/web_fetch/web_fetch.py:221— WebFetch._fetch_deepseek has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 4, error handling 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Write.execute (cognitive 16) agent/tools/write/write.py:45— Write.execute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, error handling 4 (6 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
session_prefs.set_prefs (cognitive 16) agent/workspace/session_prefs.py:120— session_prefs.set_prefs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentLLMModel._primary_bot_type (cognitive 16) bridge/agent_bridge.py:355— AgentLLMModel._primary_bot_type has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ChatChannel._send_reply (cognitive 16) channel/chat_channel.py:372— ChatChannel._send_reply has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 6, loops 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiscordChannel._parse_message (cognitive 16) channel/discord/discord_channel.py:295— DiscordChannel._parse_message has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 6, 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.
SlackChannel._do_send (cognitive 16) channel/slack/slack_channel.py:464— SlackChannel._do_send has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (5 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.
ModelsHandler._chat_fallback_capability (cognitive 16) channel/web/api/models.py:1000— ModelsHandler._chat_fallback_capability has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (5 pts), loops 1 (2 pts), ternaries 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.
WeixinChannel.startup (cognitive 16) channel/weixin/weixin_channel.py:202— WeixinChannel.startup has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
install._playwright_cli (cognitive 16) cli/commands/install.py:102— install._playwright_cli has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), error handling 3 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
knowledge._stats (cognitive 16) cli/commands/knowledge.py:39— knowledge._stats has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 3 (5 pts), ternaries 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.
process.start (cognitive 16) cli/commands/process.py:113— process.start has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CloudClient._handle_channel_update (cognitive 16) common/cloud_client.py:959— CloudClient._handle_channel_update 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.
ChatGPTSession.discard_exceeding (cognitive 16) models/chatgpt/chat_gpt_session.py:21— ChatGPTSession.discard_exceeding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DashscopeBot.reply_text (cognitive 16) models/dashscope/dashscope_bot.py:120— DashscopeBot.reply_text has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 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.
DashscopeSession.discard_exceeding (cognitive 16) models/dashscope/dashscope_session.py:11— DashscopeSession.discard_exceeding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeepSeekSession.discard_exceeding (cognitive 16) models/deepseek/deepseek_session.py:11— DeepSeekSession.discard_exceeding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DoubaoSession.discard_exceeding (cognitive 16) models/doubao/doubao_session.py:12— DoubaoSession.discard_exceeding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MimoBot.reply_text (cognitive 16) models/mimo/mimo_bot.py:164— MimoBot.reply_text has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 2 (3 pts), loops 1 (2 pts), boolean chains 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MimoSession.discard_exceeding (cognitive 16) models/mimo/mimo_session.py:11— MimoSession.discard_exceeding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MinimaxSession.discard_exceeding (cognitive 16) models/minimax/minimax_session.py:21— MinimaxSession.discard_exceeding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelScopeBot.create_img (cognitive 16) models/modelscope/modelscope_bot.py:242— ModelScopeBot.create_img has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 1, 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.
ModelScopeSession.discard_exceeding (cognitive 16) models/modelscope/modelscope_session.py:11— ModelScopeSession.discard_exceeding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MoonshotSession.discard_exceeding (cognitive 16) models/moonshot/moonshot_session.py:11— MoonshotSession.discard_exceeding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAISession.discard_exceeding (cognitive 16) models/openai/open_ai_session.py:31— OpenAISession.discard_exceeding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAIHTTPClient._iter_sse_events (cognitive 16) models/openai/openai_http_client.py:521— OpenAIHTTPClient._iter_sse_events has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QianfanSession.discard_exceeding (cognitive 16) models/qianfan/qianfan_session.py:11— QianfanSession.discard_exceeding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ZhipuAISession.discard_exceeding (cognitive 16) models/zhipuai/zhipu_ai_session.py:13— ZhipuAISession.discard_exceeding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WordsSearch.FindAll (cognitive 16) plugins/banwords/lib/WordsSearch.py:186— WordsSearch.FindAll has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (WordsSearch.Replace) 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.
WordsSearch.Replace (cognitive 16) plugins/banwords/lib/WordsSearch.py:229— WordsSearch.Replace has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (WordsSearch.FindAll) 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.
CowCliPlugin._build_aliases (cognitive 16) plugins/cow_cli/cow_cli.py:95— CowCliPlugin._build_aliases has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 2, loops 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CowCliPlugin._cmd_tasks (cognitive 16) plugins/cow_cli/cow_cli.py:432— CowCliPlugin._cmd_tasks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CowCliPlugin._format_tasks (cognitive 16) plugins/cow_cli/cow_cli.py:468— CowCliPlugin._format_tasks has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (5 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CowCliPlugin._knowledge_stats (cognitive 16) plugins/cow_cli/cow_cli.py:1909— CowCliPlugin._knowledge_stats has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 3 (5 pts), ternaries 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.
Godcmd.__init__ (cognitive 16) plugins/godcmd/godcmd.py:188— Godcmd.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Role._load_role_file (cognitive 16) plugins/role/role.py:85— Role._load_role_file has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), boolean chains 1, 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.
scheduler-notify.maybeNotifyScheduledRun (cognitive 16) channel/web/static/js/chat/scheduler-notify.js:70— scheduler-notify.maybeNotifyScheduledRun has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
state.handleFolderSelect (cognitive 16) channel/web/static/js/chat/state.js:914— state.handleFolderSelect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 6). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 931). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
agents.highlightMentions (cognitive 16) channel/web/static/js/views/agents.js:1084— agents.highlightMentions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, loops 2, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1111, 1100, 1089). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
artifacts._artRenderPreviewChrome (cognitive 16) channel/web/static/js/views/artifacts.js:747— artifacts._artRenderPreviewChrome has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 4, ternaries 2 (3 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
knowledge.openKnowledgeDialog::submitAction (cognitive 16) channel/web/static/js/views/knowledge.js:439— knowledge.openKnowledgeDialog::submitAction has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sessions.switchSession (cognitive 16) channel/web/static/js/views/sessions.js:629— sessions.switchSession has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
skills.saveMcpEditor (cognitive 16) REDACTED:550— skills.saveMcpEditor has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, error handling 2 (nesting depth added 3). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
workspace.savePreviewEdit (cognitive 16) channel/web/static/js/workspace.js:573— workspace.savePreviewEdit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, ternaries 2, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
http-relay.relay (cognitive 16) desktop/src/main/http-relay.ts:30— http-relay.relay has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 4, loops 2 (3 pts), error handling 1 (nesting depth added 1). None of this is in the body itself: all 16 points belong to 6 function literals inside it that branch (lines 31, 72, 83, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentAvatar.AgentAvatar (cognitive 16) desktop/src/renderer/src/components/AgentAvatar.tsx:53— AgentAvatar.AgentAvatar has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (5 pts), ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
chatStore.useChatStore.loadHistory (cognitive 16) desktop/src/renderer/src/store/chatStore.ts:934— chatStore.useChatStore.loadHistory has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 5, if/else 4 (5 pts), ternaries 4 (5 pts), error handling 1 (nesting depth added 2). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Markdown.Markdown (cognitive 16) REDACTED:232— Markdown.Markdown has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6 (nesting depth added 3). None of this is in the body itself: all 16 points belong to 2 function literals inside it that branch (lines 239, 235). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AgentSelector.AgentSelector (cognitive 16) desktop/src/renderer/src/components/AgentSelector.tsx:30— AgentSelector.AgentSelector has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 13, ternaries 3. Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BasicSettings.BasicSettings::loadConfig (cognitive 16) desktop/src/renderer/src/pages/settings/BasicSettings.tsx:172— BasicSettings.BasicSettings::loadConfig has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, ternaries 3 (4 pts), if/else 2, error handling 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (BasicSettings.BasicSettings) 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.
ModelsTab.SearchCard (cognitive 16) desktop/src/renderer/src/pages/settings/ModelsTab.tsx:921— ModelsTab.SearchCard has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 4, ternaries 3. Of this number, 11 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DocEditor.DocEditor (cognitive 16) desktop/src/renderer/src/components/DocEditor.tsx:79— DocEditor.DocEditor has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 6, loops 1. Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 5 function items inside it that branch (onKeyDown, a function literal at line 108, a function literal at line 100, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
mcpConfig.configForJson (cognitive 16) desktop/src/renderer/src/pages/skills/mcpConfig.ts:40— mcpConfig.configForJson has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillAddModal.PreviewCard (cognitive 16) desktop/src/renderer/src/pages/skills/SkillAddModal.tsx:568— SkillAddModal.PreviewCard has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, ternaries 5. Of this number, 13 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SkillsPage.SkillFileTree (cognitive 16) desktop/src/renderer/src/pages/SkillsPage.tsx:200— SkillsPage.SkillFileTree has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (10 pts), if/else 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 4). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 3 function items inside it that branch (a function literal at line 216, hiddenByFold, a function literal at line 224). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
syncSkillAddFooter (cognitive 16) REDACTED:889— syncSkillAddFooter has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 2 (5 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openVendorModal (cognitive 16) channel/web/static/js/views/models.js:2064— openVendorModal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3 (nesting depth added 4). Of this number, 9 points are the body's own statements and 7 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
syncReasoningEffortOptions (cognitive 16) channel/web/static/js/views/config.js:399— syncReasoningEffortOptions has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 3, ternaries 2 (3 pts) (nesting depth added 1). Of this number, 15 points are the body's own statements and 1 belongs to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
startWeixinQrLogin (cognitive 16) channel/web/static/js/views/channels-weixin.js:196— startWeixinQrLogin has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, error handling 1, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 204, 229, 203, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
_artRemove (cognitive 16) channel/web/static/js/views/artifacts.js:984— _artRemove has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, 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 5 function literals inside it that branch (lines 992, 1010, 991, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
sendVoiceMessage (cognitive 16) channel/web/static/js/chat/message-actions.js:8— sendVoiceMessage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, error handling 1, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 43, postWithRetry, a function literal at line 66, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
Change-coupling hub: doubao_bot.py → deepseek_bot.py, minimax_bot.py, moonshot_bot.py models/doubao/doubao_bot.py— `models/doubao/doubao_bot.py` changes together with 3 other files — `models/deepseek/deepseek_bot.py`, `models/minimax/minimax_bot.py`, `models/moonshot/moonshot_bot.py` — 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· Near-duplicate member family (11 members, 26 shared lines) · ×1
Near-duplicate member family (11 members, 26 shared lines) models/chatgpt/chat_gpt_session.py:22— models/chatgpt/chat_gpt_session.py:22-50 | models/dashscope/dashscope_session.py:12-41 | models/deepseek/deepseek_session.py:12-41 | models/doubao/doubao_session.py:13-42 | models/mimo/mimo_session.py:12-41 | models/minimax/minimax_session.py:22-50 | models/modelscope/modelscope_session.py:12-41 | models/moonshot/moonshot_session.py:12-41 | models/openai/open_ai_session.py:32-60 | models/qianfan/qianfan_session.py:12-41 | models/zhipuai/zhipu_ai_session.py:14-43 — These 11 members are variants of one another: a block of 26 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 11 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 11 times.
D4 · Code Duplication· Near-duplicate member family (8 members, 26 shared lines) · ×1
Near-duplicate member family (8 members, 26 shared lines) models/dashscope/dashscope_bot.py:78— models/dashscope/dashscope_bot.py:78-118 | models/deepseek/deepseek_bot.py:127-169 | models/doubao/doubao_bot.py:43-88 | models/mimo/mimo_bot.py:120-162 | models/minimax/minimax_bot.py:53-97 | models/moonshot/moonshot_bot.py:83-128 | models/qianfan/qianfan_bot.py:86-129 | models/zhipuai/zhipuai_bot.py:54-109 — These 8 members are variants of one another: a block of 26 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication· Near-duplicate member family (8 members, 18 shared lines) · ×1
Near-duplicate member family (8 members, 18 shared lines) models/chatgpt/chat_gpt_bot.py:126— models/chatgpt/chat_gpt_bot.py:126-189 | models/dashscope/dashscope_bot.py:78-118 | models/deepseek/deepseek_bot.py:127-169 | models/doubao/doubao_bot.py:43-88 | models/mimo/mimo_bot.py:120-162 | models/moonshot/moonshot_bot.py:83-128 | models/qianfan/qianfan_bot.py:86-129 | models/zhipuai/zhipuai_bot.py:54-109 — These 8 members are variants of one another: a block of 18 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication· Near-duplicate member family (7 members, 24 shared lines) · ×1
Near-duplicate member family (7 members, 24 shared lines) models/deepseek/deepseek_bot.py:127— models/deepseek/deepseek_bot.py:127-169 | models/doubao/doubao_bot.py:43-88 | models/mimo/mimo_bot.py:120-162 | models/minimax/minimax_bot.py:53-97 | models/modelscope/modelscope_bot.py:43-108 | models/moonshot/moonshot_bot.py:83-128 | models/zhipuai/zhipuai_bot.py:54-109 — These 7 members are variants of one another: a block of 24 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Near-duplicate member family (6 members, 22 shared lines) · ×1
Near-duplicate member family (6 members, 22 shared lines) models/dashscope/dashscope_bot.py:78— models/dashscope/dashscope_bot.py:78-118 | models/doubao/doubao_bot.py:43-88 | models/minimax/minimax_bot.py:53-97 | models/modelscope/modelscope_bot.py:43-108 | models/moonshot/moonshot_bot.py:83-128 | models/zhipuai/zhipuai_bot.py:54-109 — These 6 members are variants of one another: a block of 22 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Near-duplicate member family (6 members, 15 shared lines) · ×1
Near-duplicate member family (6 members, 15 shared lines) models/chatgpt/chat_gpt_bot.py:126— models/chatgpt/chat_gpt_bot.py:126-189 | models/dashscope/dashscope_bot.py:78-118 | models/doubao/doubao_bot.py:43-88 | models/modelscope/modelscope_bot.py:43-108 | models/moonshot/moonshot_bot.py:83-128 | models/zhipuai/zhipuai_bot.py:54-109 — These 6 members are variants of one another: a block of 15 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Near-duplicate member family (5 members, 46 shared lines) · ×1
Near-duplicate member family (5 members, 46 shared lines) models/deepseek/deepseek_bot.py:324— models/deepseek/deepseek_bot.py:324-446 | models/doubao/doubao_bot.py:281-416 | models/mimo/mimo_bot.py:315-436 | models/minimax/minimax_bot.py:531-716 | models/moonshot/moonshot_bot.py:330-468 — These 5 members are variants of one another: a block of 46 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Near-duplicate member family (5 members, 35 shared lines) · ×1
Near-duplicate member family (5 members, 35 shared lines) models/deepseek/deepseek_bot.py:451— models/deepseek/deepseek_bot.py:451-513 | models/doubao/doubao_bot.py:421-478 | models/mimo/mimo_bot.py:441-502 | models/minimax/minimax_bot.py:456-528 | models/moonshot/moonshot_bot.py:473-535 — These 5 members are variants of one another: a block of 35 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 55 shared lines) · ×1
Near-duplicate member family (3 members, 55 shared lines) models/deepseek/deepseek_bot.py:518— models/deepseek/deepseek_bot.py:518-651 | models/mimo/mimo_bot.py:507-627 | models/moonshot/moonshot_bot.py:540-640 — These 3 members are variants of one another: a block of 55 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 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 3 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 9 shared lines) · ×1
Near-duplicate member family (3 members, 9 shared lines) skills/image-generation/scripts/generate.py:436— skills/image-generation/scripts/generate.py:436-495 | skills/image-generation/scripts/generate.py:531-592 | skills/image-generation/scripts/generate.py:988-1053 — These 3 members are variants of one another: a block of 9 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 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 3 times.
Near-duplicate member pair (207 shared lines) channel/feishu/feishu_channel.py:1089— channel/feishu/feishu_channel.py:1089-1428 | channel/feishu/feishu_channel.py:1431-1851 — These two members are variants of one another: 207 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (52 shared lines) agent/tools/scheduler/integration.py:796— agent/tools/scheduler/integration.py:796-920 | agent/tools/scheduler/integration.py:1092-1193 — These two members are variants of one another: 52 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (44 shared lines) agent/tools/scheduler/integration.py:1013— agent/tools/scheduler/integration.py:1013-1086 | agent/tools/scheduler/integration.py:1092-1193 — These two members are variants of one another: 44 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (40 shared lines) agent/tools/scheduler/integration.py:926— agent/tools/scheduler/integration.py:926-1007 | agent/tools/scheduler/integration.py:1092-1193 — These two members are variants of one another: 40 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (28 shared lines) REDACTED:165— REDACTED:165-307 | channel/wechatcom/wechatcomapp_channel.py:101-205 — These two members are variants of one another: 28 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (38 corresponding lines) · ×1
Edited copy of a member (38 corresponding lines) channel/web/api/channels.py:217— channel/web/api/channels.py:217-296 | channel/web/api/channels.py:299-370 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×1
Edited copy of a member (29 corresponding lines) models/claudeapi/claude_api_bot.py:218— models/claudeapi/claude_api_bot.py:218-328 | models/claudeapi/claude_api_bot.py:683-756 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (7 members, 50+ identical tokens) channel/discord/discord_channel.py:395— channel/discord/discord_channel.py:395-429 | channel/feishu/feishu_channel.py:2242-2294 | REDACTED:601-628 | channel/slack/slack_channel.py:402-436 | channel/telegram/telegram_channel.py:532-566 | REDACTED:764-795 | channel/weixin/weixin_channel.py:900-929 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (6 members, 50+ identical tokens) channel/dingtalk/dingtalk_channel.py:692— channel/dingtalk/dingtalk_channel.py:692-761 | channel/dingtalk/dingtalk_channel.py:768-842 | channel/feishu/feishu_channel.py:705-894 | REDACTED:504-576 | REDACTED:589-655 | channel/weixin/weixin_channel.py:799-895 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (5 members, 50+ identical tokens) models/deepseek/deepseek_bot.py:225— models/deepseek/deepseek_bot.py:225-319 | models/doubao/doubao_bot.py:199-276 | models/mimo/mimo_bot.py:224-310 | models/minimax/minimax_bot.py:238-308 | models/moonshot/moonshot_bot.py:238-325 — 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 (98 lines × 2) channel/feishu/feishu_channel.py:1193— channel/feishu/feishu_channel.py:1193-1290 | channel/feishu/feishu_channel.py:1567-1664 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (66–67 lines × 2) models/dashscope/dashscope_bot.py:639— models/dashscope/dashscope_bot.py:639-705 | models/zhipuai/zhipuai_bot.py:498-563 — 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 (63–67 lines × 2) models/deepseek/deepseek_bot.py:585— models/deepseek/deepseek_bot.py:585-651 | models/mimo/mimo_bot.py:565-627 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 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 `models/deepseek/deepseek_bot.py:585` 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 (55–56 lines × 2) channel/feishu/feishu_channel.py:1118— channel/feishu/feishu_channel.py:1118-1172 | channel/feishu/feishu_channel.py:1464-1519 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (50–51 lines × 2) models/deepseek/deepseek_bot.py:366— models/deepseek/deepseek_bot.py:366-416 | models/mimo/mimo_bot.py:357-406 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (32–39 lines × 3) models/deepseek/deepseek_bot.py:408— models/deepseek/deepseek_bot.py:408-439 | models/mimo/mimo_bot.py:398-429 | models/moonshot/moonshot_bot.py:423-461 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 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 (38–39 lines × 2) bridge/agent_bridge.py:454— bridge/agent_bridge.py:454-492 | bridge/agent_bridge.py:526-563 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `bridge/agent_bridge.py:453` calls `getattr` and `bridge/agent_bridge.py:523` 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 (39 lines × 2) models/doubao/doubao_bot.py:339— models/doubao/doubao_bot.py:339-377 | models/moonshot/moonshot_bot.py:395-433 — `models/doubao/doubao_bot.py` and `models/moonshot/moonshot_bot.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 30 separate duplicated blocks between them, totalling at least 606 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (36–38 lines × 2) channel/web/api/channels.py:250— channel/web/api/channels.py:250-287 | channel/web/api/channels.py:315-350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `channel/web/api/channels.py:243` calls `get` and `channel/web/api/channels.py:314` 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 (34–37 lines × 2) models/deepseek/deepseek_bot.py:544— models/deepseek/deepseek_bot.py:544-580 | models/mimo/mimo_bot.py:527-560 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 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 `models/deepseek/deepseek_bot.py:544` 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–36 lines × 5) channel/discord/discord_channel.py:395— channel/discord/discord_channel.py:395-416 | channel/feishu/feishu_channel.py:2242-2277 | channel/slack/slack_channel.py:402-423 | channel/telegram/telegram_channel.py:532-553 | REDACTED:764-787 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times.
Duplicated block (30–36 lines × 3) models/deepseek/deepseek_bot.py:518— models/deepseek/deepseek_bot.py:518-553 | models/mimo/mimo_bot.py:507-536 | models/openai_compatible_bot.py:419-450 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (36 lines × 2) models/deepseek/deepseek_bot.py:472— models/deepseek/deepseek_bot.py:472-507 | models/mimo/mimo_bot.py:461-496 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 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 (22–34 lines × 4) models/deepseek/deepseek_bot.py:225— models/deepseek/deepseek_bot.py:225-246 | models/doubao/doubao_bot.py:199-232 | models/mimo/mimo_bot.py:224-245 | models/moonshot/moonshot_bot.py:238-271 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 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 (30–31 lines × 2) agent/tools/utils/truncate.py:79— agent/tools/utils/truncate.py:79-109 | agent/tools/utils/truncate.py:175-204 — both copies are in the same file, so extract the 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 `agent/tools/utils/truncate.py:79` 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 (31 lines × 2) channel/dingtalk/dingtalk_channel.py:714— channel/dingtalk/dingtalk_channel.py:714-744 | channel/dingtalk/dingtalk_channel.py:794-824 — both copies are in the same file, so extract the 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 (28–30 lines × 3) models/deepseek/deepseek_bot.py:334— models/deepseek/deepseek_bot.py:334-361 | models/mimo/mimo_bot.py:325-352 | models/moonshot/moonshot_bot.py:341-370 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (28 lines × 3) models/doubao/doubao_bot.py:445— models/doubao/doubao_bot.py:445-472 | models/minimax/minimax_bot.py:495-522 | models/moonshot/moonshot_bot.py:502-529 — `models/doubao/doubao_bot.py` and `models/minimax/minimax_bot.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 20 separate duplicated blocks between them, totalling at least 336 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (27–28 lines × 2) models/deepseek/deepseek_bot.py:287— models/deepseek/deepseek_bot.py:287-314 | models/mimo/mimo_bot.py:279-305 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (23–26 lines × 4) models/deepseek/deepseek_bot.py:352— models/deepseek/deepseek_bot.py:352-374 | models/doubao/doubao_bot.py:311-334 | models/mimo/mimo_bot.py:343-365 | models/moonshot/moonshot_bot.py:360-385 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (26 lines × 4) models/deepseek/deepseek_bot.py:569— models/deepseek/deepseek_bot.py:569-594 | models/doubao/doubao_bot.py:504-529 | models/mimo/mimo_bot.py:549-574 | models/moonshot/moonshot_bot.py:561-586 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (25–26 lines × 3) models/doubao/doubao_bot.py:354— models/doubao/doubao_bot.py:354-378 | models/minimax/minimax_bot.py:643-668 | models/moonshot/moonshot_bot.py:410-434 — `models/doubao/doubao_bot.py` and `models/minimax/minimax_bot.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 20 separate duplicated blocks between them, totalling at least 336 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 (21–25 lines × 2) models/doubao/doubao_bot.py:548— models/doubao/doubao_bot.py:548-568 | models/minimax/minimax_bot.py:386-410 — `models/doubao/doubao_bot.py` and `models/minimax/minimax_bot.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 20 separate duplicated blocks between them, totalling at least 336 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–24 lines × 5) models/deepseek/deepseek_bot.py:407— models/deepseek/deepseek_bot.py:407-423 | models/doubao/doubao_bot.py:366-388 | models/mimo/mimo_bot.py:397-413 | models/minimax/minimax_bot.py:655-678 | models/moonshot/moonshot_bot.py:422-444 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `models/doubao/doubao_bot.py:391` calls `get` and `models/deepseek/deepseek_bot.py:425` 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 (22–24 lines × 2) cli/commands/skill.py:1337— cli/commands/skill.py:1337-1360 | cli/commands/skill.py:1421-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.
Duplicated block (22–23 lines × 3) models/doubao/doubao_bot.py:130— models/doubao/doubao_bot.py:130-151 | models/modelscope/modelscope_bot.py:150-172 | models/moonshot/moonshot_bot.py:172-193 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `session` to `DoubaoSession` in one and `MoonshotSession` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (22–23 lines × 2) channel/feishu/feishu_channel.py:2110— channel/feishu/feishu_channel.py:2110-2131 | channel/feishu/feishu_channel.py:2176-2198 — both copies are in the same file, so extract the 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 (19–22 lines × 5) channel/dingtalk/dingtalk_channel.py:736— channel/dingtalk/dingtalk_channel.py:736-754 | channel/dingtalk/dingtalk_channel.py:816-834 | channel/feishu/feishu_channel.py:846-867 | REDACTED:549-567 | REDACTED:629-647 — there are 5 copies across 4 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 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `channel/feishu/feishu_channel.py:846` 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 (19–22 lines × 3) models/deepseek/deepseek_bot.py:466— models/deepseek/deepseek_bot.py:466-485 | models/mimo/mimo_bot.py:456-474 | models/moonshot/moonshot_bot.py:489-510 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 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 (10–22 lines × 2) agent/tools/search_files/search_files.py:474— agent/tools/search_files/search_files.py:474-483 | agent/tools/utils/credentials.py:32-53 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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 (22 lines × 2) channel/wechatcom/wechatcomapp_message.py:36— channel/wechatcom/wechatcomapp_message.py:36-57 | channel/wechatmp/wechatmp_message.py:43-64 — 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 `channel/wechatcom/wechatcomapp_message.py:36` 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) REDACTED:812— REDACTED:812-832 | REDACTED:860-880 — both copies are in the same file, so extract the 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 (16–21 lines × 2) channel/web/api/models.py:1149— channel/web/api/models.py:1149-1164 | channel/web/api/models.py:1368-1388 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19–20 lines × 10) models/chatgpt/chat_gpt_session.py:32— models/chatgpt/chat_gpt_session.py:32-50 | models/dashscope/dashscope_session.py:22-41 | models/deepseek/deepseek_session.py:22-41 | models/doubao/doubao_session.py:23-42 | models/mimo/mimo_session.py:22-41 | models/minimax/minimax_session.py:32-50 | models/modelscope/modelscope_session.py:22-41 | models/moonshot/moonshot_session.py:22-41 | models/qianfan/qianfan_session.py:22-41 | models/zhipuai/zhipu_ai_session.py:24-43 — before extracting anything, compare `models/chatgpt/chat_gpt_session.py` and `models/dashscope/dashscope_session.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 (18–20 lines × 2) REDACTED:931— REDACTED:931-950 | REDACTED:1023-1040 — both copies are in the same file, so extract the 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 lines × 2) models/deepseek/deepseek_bot.py:686— models/deepseek/deepseek_bot.py:686-705 | models/mimo/mimo_bot.py:663-682 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17–19 lines × 4) models/deepseek/deepseek_bot.py:461— models/deepseek/deepseek_bot.py:461-478 | models/doubao/doubao_bot.py:435-452 | models/mimo/mimo_bot.py:451-467 | models/moonshot/moonshot_bot.py:484-502 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14–19 lines × 3) models/deepseek/deepseek_bot.py:625— models/deepseek/deepseek_bot.py:625-643 | models/mimo/mimo_bot.py:606-619 | models/moonshot/moonshot_bot.py:618-634 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 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 (18–19 lines × 2) models/deepseek/deepseek_bot.py:253— models/deepseek/deepseek_bot.py:253-270 | models/mimo/mimo_bot.py:250-268 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `models/deepseek/deepseek_bot.py:271` calls `pop` and `models/mimo/mimo_bot.py:269` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17–19 lines × 2) models/minimax/minimax_bot.py:345— models/minimax/minimax_bot.py:345-361 | models/openai_compatible_bot.py:480-498 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (15–19 lines × 2) voice/openai/openai_voice.py:80— voice/openai/openai_voice.py:80-94 | voice/zhipuai/zhipuai_voice.py:92-110 — 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 `voice/openai/openai_voice.py:80` 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 (18 lines × 3) channel/discord/discord_channel.py:508— channel/discord/discord_channel.py:508-525 | channel/slack/slack_channel.py:509-526 | channel/telegram/telegram_channel.py:777-794 — 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.
Duplicated block (16–17 lines × 2) bridge/agent_bridge.py:2052— bridge/agent_bridge.py:2052-2067 | bridge/agent_initializer.py:1260-1276 — 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 `bridge/agent_bridge.py:2052` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–17 lines × 2) REDACTED:206— REDACTED:206-222 | channel/wechatcom/wechatcomapp_channel.py:123-137 — 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 (10–17 lines × 2) models/claudeapi/claude_api_bot.py:440— models/claudeapi/claude_api_bot.py:440-449 | models/claudeapi/claude_api_bot.py:685-701 — both copies are in the same file, so extract the block into 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–17 lines × 2) models/dashscope/dashscope_bot.py:146— models/dashscope/dashscope_bot.py:146-159 | models/dashscope/dashscope_bot.py:211-227 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 × 11) models/chatgpt/chat_gpt_session.py:22— models/chatgpt/chat_gpt_session.py:22-37 | models/dashscope/dashscope_session.py:12-27 | models/deepseek/deepseek_session.py:12-27 | models/doubao/doubao_session.py:13-28 | models/mimo/mimo_session.py:12-27 | models/minimax/minimax_session.py:22-37 | models/modelscope/modelscope_session.py:12-27 | models/moonshot/moonshot_session.py:12-27 | models/openai/open_ai_session.py:32-47 | models/qianfan/qianfan_session.py:12-27 | models/zhipuai/zhipu_ai_session.py:14-29 — before extracting anything, compare `models/chatgpt/chat_gpt_session.py` and `models/dashscope/dashscope_session.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `models/zhipuai/zhipu_ai_session.py:11` calls `warn` and `models/chatgpt/chat_gpt_session.py:19` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15–16 lines × 9) models/dashscope/dashscope_bot.py:81— models/dashscope/dashscope_bot.py:81-95 | models/deepseek/deepseek_bot.py:130-145 | models/doubao/doubao_bot.py:46-60 | models/mimo/mimo_bot.py:123-138 | models/minimax/minimax_bot.py:55-69 | models/modelscope/modelscope_bot.py:48-63 | models/moonshot/moonshot_bot.py:86-100 | models/qianfan/qianfan_bot.py:89-104 | models/zhipuai/zhipuai_bot.py:57-71 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 9 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 9 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 (14–16 lines × 5) models/deepseek/deepseek_bot.py:304— models/deepseek/deepseek_bot.py:304-319 | models/doubao/doubao_bot.py:263-276 | models/mimo/mimo_bot.py:295-310 | models/minimax/minimax_bot.py:295-308 | models/moonshot/moonshot_bot.py:312-325 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 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 `models/deepseek/deepseek_bot.py:304` 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–16 lines × 2) models/claudeapi/claude_api_bot.py:252— models/claudeapi/claude_api_bot.py:252-266 | models/claudeapi/claude_api_bot.py:692-707 — both copies are in the same file, so extract the block into 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–15 lines × 4) channel/feishu/feishu_channel.py:1280— channel/feishu/feishu_channel.py:1280-1292 | channel/feishu/feishu_channel.py:1302-1316 | channel/feishu/feishu_channel.py:1654-1666 | channel/feishu/feishu_channel.py:1706-1720 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15 lines × 4) models/deepseek/deepseek_bot.py:331— models/deepseek/deepseek_bot.py:331-345 | models/doubao/doubao_bot.py:292-306 | models/mimo/mimo_bot.py:322-336 | models/moonshot/moonshot_bot.py:338-352 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14–15 lines × 3) models/deepseek/deepseek_bot.py:598— models/deepseek/deepseek_bot.py:598-611 | models/mimo/mimo_bot.py:578-592 | models/moonshot/moonshot_bot.py:591-605 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14–15 lines × 2) agent/tools/scheduler/integration.py:1013— agent/tools/scheduler/integration.py:1013-1026 | agent/tools/scheduler/integration.py:1092-1106 — both copies are in the same file, so extract the 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–15 lines × 2) agent/tools/vision/vision.py:310— agent/tools/vision/vision.py:310-320 | agent/tools/vision/vision.py:324-338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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–14 lines × 5) models/deepseek/deepseek_bot.py:456— models/deepseek/deepseek_bot.py:456-466 | models/doubao/doubao_bot.py:430-440 | models/mimo/mimo_bot.py:446-456 | models/minimax/minimax_bot.py:467-480 | models/moonshot/moonshot_bot.py:479-489 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 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 `models/minimax/minimax_bot.py:467` 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 (14 lines × 4) models/deepseek/deepseek_bot.py:707— models/deepseek/deepseek_bot.py:707-720 | models/doubao/doubao_bot.py:181-194 | models/minimax/minimax_bot.py:222-235 | models/moonshot/moonshot_bot.py:220-233 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 4) models/deepseek/deepseek_bot.py:535— models/deepseek/deepseek_bot.py:535-547 | models/linkai/link_ai_bot.py:809-821 | models/mimo/mimo_bot.py:518-530 | models/openai_compatible_bot.py:432-444 — `models/deepseek/deepseek_bot.py` and `models/mimo/mimo_bot.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 36 separate duplicated blocks between them, totalling at least 826 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12–13 lines × 4) plugins/banwords/lib/WordsSearch.py:167— plugins/banwords/lib/WordsSearch.py:167-179 | plugins/banwords/lib/WordsSearch.py:190-202 | plugins/banwords/lib/WordsSearch.py:213-224 | plugins/banwords/lib/WordsSearch.py:233-244 — 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 (13 lines × 3) agent/chat/service.py:493— agent/chat/service.py:493-505 | agent/protocol/agent.py:876-888 | agent/protocol/message_utils.py:372-384 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (12–13 lines × 3) channel/feishu/feishu_channel.py:2045— channel/feishu/feishu_channel.py:2045-2057 | channel/feishu/feishu_channel.py:2113-2124 | channel/feishu/feishu_channel.py:2179-2191 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7–13 lines × 3) models/chatgpt/chat_gpt_bot.py:168— models/chatgpt/chat_gpt_bot.py:168-175 | models/modelscope/modelscope_bot.py:92-104 | models/zhipuai/zhipuai_bot.py:92-98 — 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.
Duplicated block (9–13 lines × 2) channel/web/api/sessions.py:870— channel/web/api/sessions.py:870-878 | channel/web/api/sessions.py:952-964 — both copies are in the same file, so extract the 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–12 lines × 10) models/deepseek/deepseek_bot.py:433— models/deepseek/deepseek_bot.py:433-443 | models/deepseek/deepseek_bot.py:502-513 | models/doubao/doubao_bot.py:403-413 | models/doubao/doubao_bot.py:467-478 | models/mimo/mimo_bot.py:423-433 | models/mimo/mimo_bot.py:491-502 | models/minimax/minimax_bot.py:517-528 | models/minimax/minimax_bot.py:702-712 | models/moonshot/moonshot_bot.py:455-465 | models/moonshot/moonshot_bot.py:524-535 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 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 (10–12 lines × 9) models/chatgpt/chat_gpt_bot.py:157— models/chatgpt/chat_gpt_bot.py:157-167 | models/dashscope/dashscope_bot.py:99-109 | models/deepseek/deepseek_bot.py:150-159 | models/doubao/doubao_bot.py:69-79 | models/mimo/mimo_bot.py:143-152 | models/minimax/minimax_bot.py:78-88 | models/moonshot/moonshot_bot.py:109-119 | models/qianfan/qianfan_bot.py:108-119 | models/zhipuai/zhipuai_bot.py:81-91 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 9 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 9 times. Read the line range as the matched WINDOW rather than a finished unit: at `models/deepseek/deepseek_bot.py:150` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7–12 lines × 7) models/chatgpt/chat_gpt_bot.py:167— models/chatgpt/chat_gpt_bot.py:167-173 | models/dashscope/dashscope_bot.py:109-115 | models/doubao/doubao_bot.py:79-85 | models/minimax/minimax_bot.py:88-94 | models/modelscope/modelscope_bot.py:91-102 | models/moonshot/moonshot_bot.py:119-125 | models/zhipuai/zhipuai_bot.py:91-97 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 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 7 times. Read the line range as the matched WINDOW rather than a finished unit: at `models/chatgpt/chat_gpt_bot.py:167` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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–12 lines × 6) channel/discord/discord_channel.py:410— channel/discord/discord_channel.py:410-418 | channel/feishu/feishu_channel.py:2268-2279 | channel/slack/slack_channel.py:417-425 | channel/telegram/telegram_channel.py:547-555 | REDACTED:780-789 | channel/weixin/weixin_channel.py:909-917 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times.
Duplicated block (10–12 lines × 3) agent/tools/scheduler/integration.py:838— agent/tools/scheduler/integration.py:838-848 | agent/tools/scheduler/integration.py:939-950 | agent/tools/scheduler/integration.py:1118-1127 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `agent/tools/scheduler/integration.py:951` calls `debug` and `agent/tools/scheduler/integration.py:849` 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–12 lines × 2) agent/tools/scheduler/integration.py:972— agent/tools/scheduler/integration.py:972-983 | agent/tools/scheduler/integration.py:1055-1064 — both copies are in the same file, so extract the 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 (8–12 lines × 2) voice/custom/custom_voice.py:84— voice/custom/custom_voice.py:84-91 | voice/openai/openai_voice.py:50-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `voice/custom/custom_voice.py:84` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 11) models/chatgpt/chat_gpt_session.py:39— models/chatgpt/chat_gpt_session.py:39-48 | models/dashscope/dashscope_session.py:29-39 | models/deepseek/deepseek_session.py:29-39 | models/doubao/doubao_session.py:30-40 | models/mimo/mimo_session.py:29-39 | models/minimax/minimax_session.py:39-48 | models/modelscope/modelscope_session.py:29-39 | models/moonshot/moonshot_session.py:29-39 | models/openai/open_ai_session.py:49-58 | models/qianfan/qianfan_session.py:29-39 | models/zhipuai/zhipu_ai_session.py:31-41 — before extracting anything, compare `models/chatgpt/chat_gpt_session.py` and `models/dashscope/dashscope_session.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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–11 lines × 7) channel/discord/discord_channel.py:411— channel/discord/discord_channel.py:411-419 | channel/feishu/feishu_channel.py:2270-2280 | REDACTED:617-625 | channel/slack/slack_channel.py:418-426 | channel/telegram/telegram_channel.py:548-556 | REDACTED:782-790 | channel/weixin/weixin_channel.py:910-918 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 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 7 times.
Duplicated block (11 lines × 4) channel/wechatmp/wechatmp_channel.py:216— channel/wechatmp/wechatmp_channel.py:216-226 | channel/wechatmp/wechatmp_channel.py:231-241 | channel/wechatmp/wechatmp_channel.py:248-258 | channel/wechatmp/wechatmp_channel.py:264-274 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10–11 lines × 3) agent/tools/scheduler/integration.py:803— agent/tools/scheduler/integration.py:803-813 | agent/tools/scheduler/integration.py:1019-1028 | agent/tools/scheduler/integration.py:1099-1108 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10–11 lines × 2) agent/chat/session_service.py:49— agent/chat/session_service.py:49-59 | agent/chat/session_service.py:274-283 — both copies are in the same file, so extract the 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 `agent/chat/session_service.py:49` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–11 lines × 2) channel/web/api/workspace.py:361— channel/web/api/workspace.py:361-371 | channel/web/api/workspace.py:398-405 — both copies are in the same file, so extract the 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 `channel/web/api/workspace.py:361` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 4) channel/discord/discord_channel.py:421— channel/discord/discord_channel.py:421-429 | channel/slack/slack_channel.py:428-436 | channel/telegram/telegram_channel.py:558-566 | channel/weixin/weixin_channel.py:920-929 — 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 `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–10 lines × 3) agent/tools/scheduler/integration.py:845— agent/tools/scheduler/integration.py:845-854 | agent/tools/scheduler/integration.py:1049-1057 | agent/tools/scheduler/integration.py:1124-1132 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (3–10 lines × 3) channel/discord/discord_channel.py:251— channel/discord/discord_channel.py:251-259 | channel/slack/slack_channel.py:268-270 | channel/telegram/telegram_channel.py:372-381 — 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 `channel/discord/discord_channel.py:251` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7–10 lines × 2) REDACTED:651— REDACTED:651-660 | REDACTED:1057-1063 — 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–10 lines × 2) cli/commands/skill.py:277— cli/commands/skill.py:277-286 | cli/commands/skill.py:301-309 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8–9 lines × 7) models/dashscope/dashscope_bot.py:111— models/dashscope/dashscope_bot.py:111-118 | models/deepseek/deepseek_bot.py:161-169 | models/doubao/doubao_bot.py:81-88 | models/mimo/mimo_bot.py:154-162 | models/minimax/minimax_bot.py:90-97 | models/moonshot/moonshot_bot.py:121-128 | models/qianfan/qianfan_bot.py:121-129 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 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 7 times. Read the line range as the matched WINDOW rather than a finished unit: at `models/deepseek/deepseek_bot.py:161` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8–9 lines × 4) agent/tools/web_fetch/web_fetch.py:259— agent/tools/web_fetch/web_fetch.py:259-267 | agent/tools/web_search/web_search.py:475-483 | agent/tools/web_search/web_search.py:533-540 | agent/tools/web_search/web_search.py:674-682 — 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. 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, `agent/tools/web_fetch/web_fetch.py:258` calls `fail` and `agent/tools/web_search/web_search.py:673` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–9 lines × 2) agent/tools/web_search/web_search.py:407— agent/tools/web_search/web_search.py:407-415 | agent/tools/web_search/web_search.py:902-909 — both copies are in the same file, so extract the 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 (8 lines × 9) models/chatgpt/chat_gpt_bot.py:126— models/chatgpt/chat_gpt_bot.py:126-133 | models/dashscope/dashscope_bot.py:78-85 | models/deepseek/deepseek_bot.py:127-134 | models/doubao/doubao_bot.py:43-50 | models/mimo/mimo_bot.py:120-127 | models/modelscope/modelscope_bot.py:45-52 | models/moonshot/moonshot_bot.py:83-90 | models/qianfan/qianfan_bot.py:86-93 | models/zhipuai/zhipuai_bot.py:54-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 9 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 9 times.
Duplicated block (8 lines × 7) models/deepseek/deepseek_bot.py:149— models/deepseek/deepseek_bot.py:149-156 | models/doubao/doubao_bot.py:68-77 | models/mimo/mimo_bot.py:142-149 | models/minimax/minimax_bot.py:77-86 | models/modelscope/modelscope_bot.py:78-89 | models/moonshot/moonshot_bot.py:108-117 | models/zhipuai/zhipuai_bot.py:80-89 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (7–8 lines × 6) channel/dingtalk/dingtalk_channel.py:744— channel/dingtalk/dingtalk_channel.py:744-751 | channel/dingtalk/dingtalk_channel.py:824-831 | channel/feishu/feishu_channel.py:854-861 | REDACTED:556-562 | REDACTED:636-642 | channel/weixin/weixin_channel.py:876-882 — there are 6 copies across 5 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 6 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `channel/feishu/feishu_channel.py:862` calls `info` and `channel/weixin/weixin_channel.py:883` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 5) skills/image-generation/scripts/generate.py:477— skills/image-generation/scripts/generate.py:477-484 | skills/image-generation/scripts/generate.py:582-589 | skills/image-generation/scripts/generate.py:776-783 | skills/image-generation/scripts/generate.py:909-916 | skills/image-generation/scripts/generate.py:1027-1034 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) agent/tools/scheduler/integration.py:929— agent/tools/scheduler/integration.py:929-936 | agent/tools/scheduler/integration.py:1018-1025 | agent/tools/scheduler/integration.py:1098-1105 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `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, `agent/tools/scheduler/integration.py:1016` calls `get` and `agent/tools/scheduler/integration.py:928` 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–8 lines × 2) REDACTED:177— REDACTED:177-184 | channel/wechatcom/wechatcomapp_channel.py:102-107 — 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 × 5) models/deepseek/deepseek_bot.py:329— models/deepseek/deepseek_bot.py:329-335 | models/doubao/doubao_bot.py:290-296 | models/mimo/mimo_bot.py:320-326 | models/minimax/minimax_bot.py:544-550 | models/moonshot/moonshot_bot.py:336-342 — `models/deepseek/deepseek_bot.py` and `models/doubao/doubao_bot.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 20 separate duplicated blocks between them, totalling at least 353 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 4) agent/tools/web_search/web_search.py:405— agent/tools/web_search/web_search.py:405-411 | agent/tools/web_search/web_search.py:670-676 | agent/tools/web_search/web_search.py:1024-1030 | agent/tools/web_search/web_search.py:1079-1085 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6–7 lines × 3) channel/discord/discord_channel.py:268— channel/discord/discord_channel.py:268-274 | channel/slack/slack_channel.py:288-293 | channel/telegram/telegram_channel.py:388-394 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (6 lines × 6) skills/image-generation/scripts/generate.py:302— skills/image-generation/scripts/generate.py:302-307 | skills/image-generation/scripts/generate.py:480-485 | skills/image-generation/scripts/generate.py:585-590 | skills/image-generation/scripts/generate.py:779-784 | skills/image-generation/scripts/generate.py:912-917 | skills/image-generation/scripts/generate.py:1030-1035 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) channel/web/api/models.py:2315— channel/web/api/models.py:2315-2320 | channel/web/api/models.py:2378-2383 | channel/web/api/models.py:2479-2484 | channel/web/api/models.py:2633-2638 — 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 (5 lines × 6) agent/tools/edit/edit.py:262— agent/tools/edit/edit.py:262-272 | agent/tools/ls/ls.py:146-151 | agent/tools/read/read.py:257-267 | agent/tools/search_files/search_files.py:467-471 | agent/tools/send/send.py:174-178 | agent/tools/vision/vision.py:156-160 — 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. 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 (18 lines × 7) models/dashscope/dashscope_bot.py:580— models/dashscope/dashscope_bot.py:580-605 | models/deepseek/deepseek_bot.py:654-676 | models/doubao/doubao_bot.py:577-601 | models/mimo/mimo_bot.py:630-647 | models/moonshot/moonshot_bot.py:643-667 | models/openai_compatible_bot.py:391-416 | models/zhipuai/zhipuai_bot.py:470-495 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 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 7 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 (5 lines × 4) channel/web/api/knowledge.py:57— channel/web/api/knowledge.py:57-61 | channel/web/api/skills.py:586-590 | channel/web/api/skills.py:621-625 | channel/web/api/workspace.py:373-377 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. 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.
Low cohesion: CloudClient (LCOM4 7) common/cloud_client.py:228— CloudClient'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.
Duplication concentrated across 3 sibling directories (20 clone groups) desktop/src/renderer/src/components/ChannelTeamSelect.tsx:38— 20 duplicated blocks under desktop/src/renderer/src/ have copies in at least two of the sibling directories components, layout, pages — 11 of them are reported below, and 9 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 20 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 20 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 20 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 2 sibling directories (16 clone groups) REDACTED:1450— 16 duplicated blocks under the repository root have copies in at least two of the sibling directories channel, desktop — 15 of them are reported below, and 1 is counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 16 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 16 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 16 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 3 sibling directories (8 clone groups) channel/web/static/js/core/confirm.js:35— 8 duplicated blocks under channel/web/static/js/ have copies in at least two of the sibling directories chat, core, views — 5 of them are reported below, and 3 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 8 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 8 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 8 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication· Duplicated block with local edits (63 matched lines × 2 locations) · ×1
Duplicated block with local edits (63 matched lines × 2 locations) channel/web/static/js/doc-editor.js:189— channel/web/static/js/doc-editor.js:189 · channel/web/static/js/workspace.js:532 — the two spans are one implementation copied and then locally edited — 456 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 (62 matched lines × 2 locations) · ×1
Duplicated block with local edits (62 matched lines × 2 locations) channel/web/static/js/views/channels-feishu.js:69— channel/web/static/js/views/channels-feishu.js:69 · channel/web/static/js/views/channels-wecom.js:90 — the two spans are one implementation copied and then locally edited — 383 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 (35 matched lines × 2 locations) · ×1
Duplicated block with local edits (35 matched lines × 2 locations) channel/web/static/js/views/channels-feishu.js:12— channel/web/static/js/views/channels-feishu.js:12 · channel/web/static/js/views/channels-wecom.js:34 — the two spans are one implementation copied and then locally edited — 288 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 (34 matched lines × 2 locations) · ×1
Duplicated block with local edits (34 matched lines × 2 locations) channel/web/static/js/views/models-custom-provider.js:129— channel/web/static/js/views/models-custom-provider.js:129 · channel/web/static/js/views/models.js:2770 — the two spans are one implementation copied and then locally edited — 217 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 (30 lines × 2 locations) desktop/src/renderer/src/components/DocEditor.tsx:156— desktop/src/renderer/src/components/DocEditor.tsx:156 · desktop/src/renderer/src/components/FileEditor.tsx:61 — 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 (29 lines × 2 locations) channel/web/static/js/chat/send.js:65— channel/web/static/js/chat/send.js:65 · channel/web/static/js/chat/send.js:171 — 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 (28 matched lines × 2 locations) · ×1
Duplicated block with local edits (28 matched lines × 2 locations) channel/web/static/js/views/models.js:941— channel/web/static/js/views/models.js:941 · channel/web/static/js/views/models.js:1120 — the two spans are one implementation copied and then locally edited — 229 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (26 matched lines × 2 locations) · ×1
Duplicated block with local edits (26 matched lines × 2 locations) REDACTED:1450— REDACTED:1450 · desktop/src/renderer/src/pages/skills/frontmatter.ts:33 — the two spans are one implementation copied and then locally edited — 341 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 (20 matched lines × 2 locations) · ×1
Duplicated block with local edits (20 matched lines × 2 locations) REDACTED:411— REDACTED:411 · desktop/src/renderer/src/pages/skills/mcpConfig.ts:56 — the two spans are one implementation copied and then locally edited — 193 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 (18 lines × 2 locations) channel/web/static/js/chat/composer-input.js:366— channel/web/static/js/chat/composer-input.js:366 · channel/web/static/js/chat/new-chat.js:188 — 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 (17 lines × 3 locations) channel/web/static/js/chat/message-actions.js:50— channel/web/static/js/chat/message-actions.js:50 · channel/web/static/js/chat/send.js:59 · channel/web/static/js/chat/send.js:163 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
R10 · Code Duplication· Duplicated block with local edits (17 matched lines × 2 locations) · ×1
Duplicated block with local edits (17 matched lines × 2 locations) channel/web/static/js/views/artifacts.js:340— channel/web/static/js/views/artifacts.js:340 · desktop/src/renderer/src/pages/artifacts/format.ts:8 — the two spans are one implementation copied and then locally edited — 216 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 (16 lines × 2 locations) desktop/src/renderer/src/components/ContextUsageDonut.tsx:56— desktop/src/renderer/src/components/ContextUsageDonut.tsx:56 · desktop/src/renderer/src/components/ContextUsageDonut.tsx:125 — 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.
R10 · Code Duplication· Duplicated block with local edits (13 matched lines × 2 locations) · ×1
Duplicated block with local edits (13 matched lines × 2 locations) REDACTED:560— REDACTED:560 · desktop/src/renderer/src/pages/skills/McpEditorModal.tsx:188 — the two spans are one implementation copied and then locally edited — 125 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Complex function processSSEItem (cyclomatic 133, cognitive 217) channel/web/static/js/chat/send.js:401— processSSEItem has cyclomatic complexity 133 and cognitive complexity 217; 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 saveTaskEdit (cyclomatic 62, cognitive 96) channel/web/static/js/views/tasks-modal.js:463— saveTaskEdit has cyclomatic complexity 62 and cognitive complexity 96; 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 onmessage (cyclomatic 56, cognitive 56) desktop/src/renderer/src/store/chatStore.ts:453— onmessage has cyclomatic complexity 56 and cognitive complexity 56; 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 MessageBubble (cyclomatic 49, cognitive 42) desktop/src/renderer/src/components/MessageBubble.tsx:74— MessageBubble has cyclomatic complexity 49 and cognitive complexity 42; 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 renderCapabilityBody (cyclomatic 44, cognitive 48) channel/web/static/js/views/models.js:1233— renderCapabilityBody has cyclomatic complexity 44 and cognitive complexity 48; 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 BasicSettings (cyclomatic 43, cognitive 39) desktop/src/renderer/src/pages/settings/BasicSettings.tsx:37— BasicSettings has cyclomatic complexity 43 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 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 createBotMessageEl (cyclomatic 41, cognitive 37) channel/web/static/js/chat/render.js:445— createBotMessageEl has cyclomatic complexity 41 and cognitive complexity 37; 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 SkillsPage (cyclomatic 38, cognitive 34) desktop/src/renderer/src/pages/SkillsPage.tsx:380— SkillsPage has cyclomatic complexity 38 and cognitive complexity 34; 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 ChannelCard (cyclomatic 38, cognitive 31) desktop/src/renderer/src/pages/ChannelsPage.tsx:541— ChannelCard has cyclomatic complexity 38 and cognitive complexity 31; 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 SkillAddModal (cyclomatic 35, cognitive 36) desktop/src/renderer/src/pages/skills/SkillAddModal.tsx:144— SkillAddModal has cyclomatic complexity 35 and cognitive complexity 36; 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 openSearchKeyModal (cyclomatic 35, cognitive 35) channel/web/static/js/views/models.js:941— openSearchKeyModal has cyclomatic complexity 35 and cognitive complexity 35; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 33, cognitive 39) channel/web/static/js/chat/composer-input.js:271— (anonymous) has cyclomatic complexity 33 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 RunDetailModal (cyclomatic 33, cognitive 24) desktop/src/renderer/src/pages/TasksPage.tsx:581— RunDetailModal has cyclomatic complexity 33 and cognitive complexity 24; 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 ArtifactPreview (cyclomatic 31, cognitive 28) desktop/src/renderer/src/pages/artifacts/ArtifactPreview.tsx:112— ArtifactPreview has cyclomatic complexity 31 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 App (cyclomatic 31, cognitive 23) desktop/src/renderer/src/App.tsx:41— App has cyclomatic complexity 31 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 (anonymous) (cyclomatic 29, cognitive 33) channel/web/static/js/chat/render.js:797— (anonymous) has cyclomatic complexity 29 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 KnowledgePage (cyclomatic 28, cognitive 27) desktop/src/renderer/src/pages/KnowledgePage.tsx:243— KnowledgePage has cyclomatic complexity 28 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 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 ChatInput (cyclomatic 28, cognitive 25) desktop/src/renderer/src/components/ChatInput.tsx:60— ChatInput has cyclomatic complexity 28 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 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 WorkspacePanel (cyclomatic 28, cognitive 22) desktop/src/renderer/src/components/WorkspacePanel.tsx:51— WorkspacePanel has cyclomatic complexity 28 and cognitive complexity 22; 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 initConfigView (cyclomatic 27, cognitive 28) channel/web/static/js/views/config.js:155— initConfigView has cyclomatic complexity 27 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 is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files· channel/web/static/js/views/models.js · ×1
channel/web/static/js/views/models.js: 2616 lines of code channel/web/static/js/views/models.js:1— channel/web/static/js/views/models.js has 2616 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· channel/web/static/js/core/i18n.js · ×1
channel/web/static/js/core/i18n.js: 2362 lines of code channel/web/static/js/core/i18n.js:1— channel/web/static/js/core/i18n.js has 2362 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· desktop/src/renderer/src/i18n.ts · ×1
desktop/src/renderer/src/i18n.ts: 2016 lines of code desktop/src/renderer/src/i18n.ts:1— desktop/src/renderer/src/i18n.ts has 2016 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 1872 lines of code REDACTED:1— REDACTED has 1872 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· channel/web/static/js/views/agents.js · ×1
channel/web/static/js/views/agents.js: 1334 lines of code channel/web/static/js/views/agents.js:1— channel/web/static/js/views/agents.js has 1334 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· desktop/src/renderer/src/api/client.ts · ×1
desktop/src/renderer/src/api/client.ts: 1263 lines of code desktop/src/renderer/src/api/client.ts:1— desktop/src/renderer/src/api/client.ts has 1263 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· desktop/src/renderer/src/pages/TasksPage.tsx · ×1
desktop/src/renderer/src/pages/TasksPage.tsx: 1254 lines of code desktop/src/renderer/src/pages/TasksPage.tsx:1— desktop/src/renderer/src/pages/TasksPage.tsx has 1254 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· channel/web/static/js/workspace.js · ×1
channel/web/static/js/workspace.js: 1236 lines of code channel/web/static/js/workspace.js:1— channel/web/static/js/workspace.js has 1236 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· desktop/src/renderer/src/types.ts · ×1
desktop/src/renderer/src/types.ts: 1217 lines of code desktop/src/renderer/src/types.ts:1— desktop/src/renderer/src/types.ts has 1217 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· desktop/src/renderer/src/pages/settings/ModelsTab.tsx · ×1
desktop/src/renderer/src/pages/settings/ModelsTab.tsx: 1167 lines of code desktop/src/renderer/src/pages/settings/ModelsTab.tsx:1— desktop/src/renderer/src/pages/settings/ModelsTab.tsx has 1167 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· desktop/src/renderer/src/pages/KnowledgePage.tsx · ×1
desktop/src/renderer/src/pages/KnowledgePage.tsx: 1121 lines of code desktop/src/renderer/src/pages/KnowledgePage.tsx:1— desktop/src/renderer/src/pages/KnowledgePage.tsx has 1121 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· channel/web/static/js/views/artifacts.js · ×1
channel/web/static/js/views/artifacts.js: 1018 lines of code channel/web/static/js/views/artifacts.js:1— channel/web/static/js/views/artifacts.js has 1018 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· channel/web/static/js/chat/send.js · ×1
channel/web/static/js/chat/send.js: 1012 lines of code channel/web/static/js/chat/send.js:1— channel/web/static/js/chat/send.js has 1012 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· channel/web/static/js/views/knowledge.js · ×1
channel/web/static/js/views/knowledge.js: 1002 lines of code channel/web/static/js/views/knowledge.js:1— channel/web/static/js/views/knowledge.js has 1002 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· desktop/src/renderer/src/store/chatStore.ts · ×1
desktop/src/renderer/src/store/chatStore.ts: 983 lines of code desktop/src/renderer/src/store/chatStore.ts:1— desktop/src/renderer/src/store/chatStore.ts has 983 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· desktop/src/renderer/src/pages/SkillsPage.tsx · ×1
desktop/src/renderer/src/pages/SkillsPage.tsx: 961 lines of code desktop/src/renderer/src/pages/SkillsPage.tsx:1— desktop/src/renderer/src/pages/SkillsPage.tsx has 961 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· desktop/src/renderer/src/pages/AgentsPage.tsx · ×1
desktop/src/renderer/src/pages/AgentsPage.tsx: 959 lines of code desktop/src/renderer/src/pages/AgentsPage.tsx:1— desktop/src/renderer/src/pages/AgentsPage.tsx has 959 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 958 lines of code REDACTED:1— REDACTED has 958 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· desktop/src/renderer/src/components/ChatInput.tsx · ×1
desktop/src/renderer/src/components/ChatInput.tsx: 933 lines of code desktop/src/renderer/src/components/ChatInput.tsx:1— desktop/src/renderer/src/components/ChatInput.tsx has 933 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· channel/web/static/js/chat/render.js · ×1
channel/web/static/js/chat/render.js: 916 lines of code channel/web/static/js/chat/render.js:1— channel/web/static/js/chat/render.js has 916 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· channel/web/static/js/chat/state.js · ×1
channel/web/static/js/chat/state.js: 893 lines of code channel/web/static/js/chat/state.js:1— channel/web/static/js/chat/state.js has 893 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· desktop/src/renderer/src/pages/ChannelsPage.tsx · ×1
desktop/src/renderer/src/pages/ChannelsPage.tsx: 819 lines of code desktop/src/renderer/src/pages/ChannelsPage.tsx:1— desktop/src/renderer/src/pages/ChannelsPage.tsx has 819 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· channel/web/static/js/views/sessions.js · ×1
channel/web/static/js/views/sessions.js: 817 lines of code channel/web/static/js/views/sessions.js:1— channel/web/static/js/views/sessions.js has 817 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
desktop/src/main/index.ts: 778 lines of code desktop/src/main/index.ts:1— desktop/src/main/index.ts has 778 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· desktop/src/renderer/src/components/MenuEditor.tsx · ×1
desktop/src/renderer/src/components/MenuEditor.tsx: 728 lines of code desktop/src/renderer/src/components/MenuEditor.tsx:1— desktop/src/renderer/src/components/MenuEditor.tsx has 728 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· channel/web/static/js/views/config.js · ×1
channel/web/static/js/views/config.js: 727 lines of code channel/web/static/js/views/config.js:1— channel/web/static/js/views/config.js has 727 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· channel/web/static/js/views/tasks-modal.js · ×1
channel/web/static/js/views/tasks-modal.js: 692 lines of code channel/web/static/js/views/tasks-modal.js:1— channel/web/static/js/views/tasks-modal.js has 692 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· desktop/src/renderer/src/pages/settings/BasicSettings.tsx · ×1
desktop/src/renderer/src/pages/settings/BasicSettings.tsx: 684 lines of code desktop/src/renderer/src/pages/settings/BasicSettings.tsx:1— desktop/src/renderer/src/pages/settings/BasicSettings.tsx has 684 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· desktop/src/renderer/src/layout/SessionList.tsx · ×1
desktop/src/renderer/src/layout/SessionList.tsx: 653 lines of code desktop/src/renderer/src/layout/SessionList.tsx:1— desktop/src/renderer/src/layout/SessionList.tsx has 653 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· desktop/src/renderer/src/pages/skills/SkillAddModal.tsx · ×1
desktop/src/renderer/src/pages/skills/SkillAddModal.tsx: 630 lines of code desktop/src/renderer/src/pages/skills/SkillAddModal.tsx:1— desktop/src/renderer/src/pages/skills/SkillAddModal.tsx has 630 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· channel/web/static/js/views/channels.js · ×1
channel/web/static/js/views/channels.js: 584 lines of code channel/web/static/js/views/channels.js:1— channel/web/static/js/views/channels.js has 584 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· desktop/src/renderer/src/pages/ChatPage.tsx · ×1
desktop/src/renderer/src/pages/ChatPage.tsx: 579 lines of code desktop/src/renderer/src/pages/ChatPage.tsx:1— desktop/src/renderer/src/pages/ChatPage.tsx has 579 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· desktop/src/main/app-icon.ts · ×1
desktop/src/main/app-icon.ts: 568 lines of code desktop/src/main/app-icon.ts:1— desktop/src/main/app-icon.ts has 568 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· channel/web/static/js/core/markdown.js · ×1
channel/web/static/js/core/markdown.js: 532 lines of code channel/web/static/js/core/markdown.js:1— channel/web/static/js/core/markdown.js has 532 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· desktop/src/renderer/src/pages/skills/McpEditorModal.tsx · ×1
desktop/src/renderer/src/pages/skills/McpEditorModal.tsx: 493 lines of code desktop/src/renderer/src/pages/skills/McpEditorModal.tsx:1— desktop/src/renderer/src/pages/skills/McpEditorModal.tsx has 493 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· channel/web/static/js/views/tasks.js · ×1
channel/web/static/js/views/tasks.js: 492 lines of code channel/web/static/js/views/tasks.js:1— channel/web/static/js/views/tasks.js has 492 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· desktop/src/renderer/src/layout/NavRail.tsx · ×1
desktop/src/renderer/src/layout/NavRail.tsx: 463 lines of code desktop/src/renderer/src/layout/NavRail.tsx:1— desktop/src/renderer/src/layout/NavRail.tsx has 463 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· channel/web/static/js/views/menu-editor.js · ×1
channel/web/static/js/views/menu-editor.js: 453 lines of code channel/web/static/js/views/menu-editor.js:1— channel/web/static/js/views/menu-editor.js has 453 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· desktop/src/renderer/src/pages/settings/ModelCatalogEditor.tsx · ×1
desktop/src/renderer/src/pages/settings/ModelCatalogEditor.tsx: 430 lines of code desktop/src/renderer/src/pages/settings/ModelCatalogEditor.tsx:1— desktop/src/renderer/src/pages/settings/ModelCatalogEditor.tsx has 430 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· desktop/src/renderer/src/store/workspaceStore.ts · ×1
desktop/src/renderer/src/store/workspaceStore.ts: 429 lines of code desktop/src/renderer/src/store/workspaceStore.ts:1— desktop/src/renderer/src/store/workspaceStore.ts has 429 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
Dead file (~145 LoC) desktop/src/main/preload.ts— no import path from any entry point (48 application, 5 tooling, 3 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~132 LoC) REDACTED— no import path from any entry point (48 application, 5 tooling, 3 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~88 LoC) desktop/electron-builder.js— no import path from any entry point (48 application, 5 tooling, 3 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~20 LoC) desktop/src/renderer/src/pages/PlaceholderPage.tsx— no import path from any entry point (48 application, 5 tooling, 3 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
X13 · Undrained process stream· Redirected process stream is never drained (deadlock) · ×1
Redirected process stream is never drained (deadlock) REDACTED:571— `spawn` pipes `stderr` here — it is given no `stdio` option, or `'pipe'` — but nothing in this scope ever reads `child.stderr`, while `child.stdout` is read and the child's end is awaited. Node holds an unread pipe's output only up to its buffer: once the child writes more than that to stderr (measured on Linux: about 128 KB — the 64 KB pipe plus Node's 64 KB read-ahead — and less elsewhere), the child blocks on the write, never exits, and the `close`/`exit` this code waits for never fires. Nothing fails loudly: the promise never settles, the request never returns, and the stuck child holds its resources until something kills it. Consume both streams (`child.stderr.on('data', …)`, or `child.stderr.resume()` to discard it), or stop piping the one you do not want — `stdio: ['pipe', 'pipe', 'inherit']` or `'ignore'` in that slot.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×1
Recursive walk over a caller-supplied document has no depth cap cli/config_json.py:8— `deep_merge_dicts` is public and takes `base: dict` from its caller, and it calls itself at line 8 (`deep_merge_dicts`) with a piece of `base` — and nowhere in `deep_merge_dicts` 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 `deep_merge_dicts` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
README/code drift docs/channels/index.mdx:14— docs/channels/index.mdx links to `/channels/weixin`, but `channels/weixin` 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.
README/code drift docs/channels/index.mdx:15— docs/channels/index.mdx links to `/channels/web`, but `channels/web` 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.
README/code drift docs/channels/index.mdx:16— docs/channels/index.mdx links to `/channels/feishu`, but `channels/feishu` 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.
README/code drift docs/channels/index.mdx:17— docs/channels/index.mdx links to `/channels/dingtalk`, but `channels/dingtalk` 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.
README/code drift docs/channels/index.mdx:18— docs/channels/index.mdx links to `/channels/wecom-bot`, but `channels/wecom-bot` 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.
README/code drift docs/channels/index.mdx:19— docs/channels/index.mdx links to `/channels/qq`, but `channels/qq` 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.
README/code drift docs/channels/index.mdx:20— docs/channels/index.mdx links to `/channels/wecom`, but `channels/wecom` 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.
README/code drift docs/channels/index.mdx:21— docs/channels/index.mdx links to `/channels/wechatmp`, but `channels/wechatmp` 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.
README/code drift docs/channels/index.mdx:22— docs/channels/index.mdx links to `/channels/wechat-kf`, but `channels/wechat-kf` 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.
README/code drift docs/channels/index.mdx:23— docs/channels/index.mdx links to `/channels/telegram`, but `channels/telegram` 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.
README/code drift docs/channels/index.mdx:24— docs/channels/index.mdx links to `/channels/slack`, but `channels/slack` 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.
README/code drift docs/channels/index.mdx:25— docs/channels/index.mdx links to `/channels/discord`, but `channels/discord` 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.
README/code drift docs/channels/index.mdx:31— docs/channels/index.mdx links to `/models/index`, but `models/index` 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.
README/code drift docs/channels/web.mdx:28— docs/channels/web.mdx links to `/extensions/chat-api`, but `extensions/chat-api` 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.
README/code drift docs/channels/web.mdx:119— docs/channels/web.mdx links to `/intro/architecture#project-workspace`, but `intro/architecture` 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.
README/code drift docs/channels/web.mdx:135— docs/channels/web.mdx links to `/extensions/custom-menu`, but `extensions/custom-menu` 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.
README/code drift docs/cli/process.mdx:98— docs/cli/process.mdx links to `/tools/browser`, but `tools/browser` 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.
README/code drift docs/extensions/agent-mail.mdx:21— docs/extensions/agent-mail.mdx names `.env`, but no file or folder `.env` exists. 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.
README/code drift docs/extensions/chat-api.mdx:42— docs/extensions/chat-api.mdx links to `/channels/web`, but `channels/web` 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.
README/code drift docs/guide/desktop.mdx:40— docs/guide/desktop.mdx links to `/guide/quick-start`, but `guide/quick-start` 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.
README/code drift docs/guide/manual-install.mdx:59— docs/guide/manual-install.mdx links to `/models/index`, but `models/index` 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.
README/code drift docs/guide/quick-start.mdx:54— docs/guide/quick-start.mdx links to `/cli/index`, but `cli/index` 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.
README/code drift docs/intro/architecture.mdx:75— docs/intro/architecture.mdx links to `/multi-agent/team`, but `multi-agent/team` 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.
README/code drift docs/intro/features.mdx:24— docs/intro/features.mdx links to `/memory`, but `memory` 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.
README/code drift docs/intro/features.mdx:24— docs/intro/features.mdx links to `/memory/deep-dream`, but `memory/deep-dream` 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.
Interpolated log message defeats structured logging app.py:96— `warning` at line 96 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:113— `info` at line 113 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:121— `info` at line 121 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:217— `warning` at line 217 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:232— `error` at line 232 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:289— `debug` at line 289 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:295— `error` at line 295 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:325— `warning` at line 325 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:329— `info` at line 329 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:336— `warning` at line 336 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:341— `info` at line 341 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:344— `warning` at line 344 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:359— `info` at line 359 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:362— `warning` at line 362 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:364— `warning` at line 364 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:382— `info` at line 382 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:387— `info` at line 387 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:420— `info` at line 420 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:424— `info` at line 424 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:427— `info` at line 427 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:435— `warning` at line 435 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:437— `info` at line 437 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:439— `info` at line 439 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:478— `debug` at line 478 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging app.py:483— `warning` at line 483 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Silent fallback default in catch agent/chat/service.py:700— `_roster` 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 agent/chat/service.py:749— `_speak_timeout` swallows every exception into `return 600.0` — 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 agent/evolution/executor.py:85— `_builtin_skill_names` swallows every exception into `return set()` — 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 agent/knowledge/service.py:309— `_read_index_summaries` 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 agent/prompt/builder.py:618— `_build_knowledge_section` 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 agent/prompt/builder.py:932— `_build_cloud_website_section` 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 agent/tools/bash/decode.py:18— `_fallback_encoding` swallows every exception into `return 'gbk'` — 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 agent/tools/scheduler/integration.py:214— `_take` (in `effective_task_agent_id`) 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 agent/tools/scheduler/scheduler_tool.py:572— `_format_schedule_description` 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 agent/tools/scheduler/scheduler_tool.py:627— `_resolve_owner_agent_id` 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 agent/tools/utils/memory_path.py:46— `_shared_knowledge_dir` 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 bridge/agent_bridge.py:986— `_session_members` 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 bridge/agent_bridge.py:1000— `_delegation_timeout` swallows every exception into `return 600.0` — 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 bridge/agent_bridge.py:1079— `_roster_speaker_labels` 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:786— `_filename_from_url` 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 channel/web/api/models.py:934— `_infer_provider_from_model` 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:318— `_get_query_token` 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:57— `_login_proxy` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch cli/commands/install.py:43— `_get_installed_version` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch cli/commands/install.py:145— `_playwright_cli` swallows every exception into `return 1` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch cli/commands/knowledge.py:21— `_get_knowledge_enabled` 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 cli/commands/skill.py:161— `_resolve_github_default_branch` swallows every exception into `return 'main'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch cli/commands/skill.py:459— `_read_skill_description` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch cli/utils.py:77— `load_config_json` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch cli/utils.py:93— `get_cli_language` swallows every exception into `return 'en'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Duplicated predicate REDACTED:429— `!cfg || typeof cfg !== 'object' || Array.isArray(cfg)` appears character-identically in 2 files — REDACTED, desktop/src/renderer/src/pages/skills/mcpConfig.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate channel/web/static/js/views/menu-editor.js:394— `!group.title && !MENU_GROUP_LABELS[group.id]` appears character-identically in 2 files — channel/web/static/js/views/menu-editor.js, desktop/src/renderer/src/components/MenuEditor.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 channel/web/static/js/chat/session-settings.js:281— `!menu || menu.classList.contains('hidden')` appears character-identically in 2 files — channel/web/static/js/chat/session-settings.js, channel/web/static/js/chat/workspace-selector.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate REDACTED:1858— `!part.startsWith('.') && !noise.includes(part)` appears character-identically in 2 files — REDACTED, desktop/src/renderer/src/pages/skills/SkillCreateForm.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 desktop/src/renderer/src/components/DocEditor.tsx:102— `!pendingConfirm && el && document.activeElement !== el` appears character-identically in 2 files — desktop/src/renderer/src/components/DocEditor.tsx, desktop/src/renderer/src/components/FileEditor.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 channel/web/static/js/views/models.js:2705— `!preset || JSON.stringify(preset) !== JSON.stringify(e)` appears character-identically in 2 files — channel/web/static/js/views/models.js, desktop/src/renderer/src/pages/settings/ModelCatalogEditor.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 channel/web/static/js/core/menu.js:72— `!saved || !Array.isArray(saved.groups) || !saved.groups.length` appears character-identically in 2 files — channel/web/static/js/core/menu.js, desktop/src/renderer/src/lib/menu.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate channel/web/static/js/core/markdown.js:84— `!textTok || textTok.type !== 'text' || !close || close.type !== 'link_close'` appears character-identically in 2 files — channel/web/static/js/core/markdown.js, 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 channel/web/static/js/views/artifacts.js:482— `(b.pinned_at || 0) - (a.pinned_at || 0) || b.updated_at - a.updated_at || b.id - a.id` appears character-identically in 2 files — channel/web/static/js/views/artifacts.js, desktop/src/renderer/src/store/artifactStore.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate channel/web/static/js/doc-editor.js:197— `(e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 's'` appears character-identically in 4 files — channel/web/static/js/doc-editor.js, channel/web/static/js/workspace.js, desktop/src/renderer/src/components/DocEditor.tsx, desktop/src/renderer/src/components/FileEditor.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 channel/web/static/js/views/artifacts.js:547— `(item && (item.title || item.file_name)) || ''` appears character-identically in 2 files — channel/web/static/js/views/artifacts.js, desktop/src/renderer/src/store/artifactStore.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate channel/web/static/js/chat/render.js:512— `(peer || sharedConversation()) && speaker` appears character-identically in 2 files — channel/web/static/js/chat/render.js, channel/web/static/js/chat/send.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate channel/web/static/js/views/tasks-modal.js:395— `action.content || action.task_description || ''` appears character-identically in 2 files — channel/web/static/js/views/tasks-modal.js, channel/web/static/js/views/tasks.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate channel/web/static/js/views/artifacts.js:1032— `confirmOverlay && !confirmOverlay.classList.contains('hidden')` appears character-identically in 2 files — channel/web/static/js/views/artifacts.js, channel/web/static/js/views/menu-editor.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate channel/web/static/js/chat/session-settings.js:270— `data.message || t('session_settings_failed')` appears character-identically in 2 files — channel/web/static/js/chat/session-settings.js, channel/web/static/js/views/sessions.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate channel/web/static/js/views/artifacts.js:1037— `e.key !== 'ArrowLeft' && e.key !== 'ArrowRight'` appears character-identically in 2 files — channel/web/static/js/views/artifacts.js, desktop/src/renderer/src/pages/ArtifactsPage.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 channel/web/static/js/chat/render.js:38— `f.path.split(/[\\/]/).filter(Boolean).pop() || f.path` appears character-identically in 2 files — channel/web/static/js/chat/render.js, desktop/src/renderer/src/lib/fileKind.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate channel/web/static/js/chat/render.js:40— `f.type === 'workspace_dir' || f.type === 'directory'` appears character-identically in 2 files — channel/web/static/js/chat/render.js, desktop/src/renderer/src/lib/fileKind.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate channel/web/static/js/workspace.js:885— `href.startsWith('//') || href.startsWith('#') || href.startsWith('/')` appears character-identically in 2 files — channel/web/static/js/workspace.js, desktop/src/renderer/src/lib/fileKind.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate channel/web/static/js/views/artifacts.js:820— `i.type === 'artifact' && i.path === item.abs_path` appears character-identically in 2 files — channel/web/static/js/views/artifacts.js, desktop/src/renderer/src/pages/artifacts/ArtifactPreview.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 desktop/src/renderer/src/components/MenuEditor.tsx:532— `i.type === 'builtin' && i.view && present.add(i.view)` appears character-identically in 2 files — desktop/src/renderer/src/components/MenuEditor.tsx, desktop/src/renderer/src/lib/menu.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/renderer/src/pages/settings/BasicSettings.tsx:144— `id.startsWith('custom:') || id === 'custom'` appears character-identically in 2 files — desktop/src/renderer/src/pages/settings/BasicSettings.tsx, desktop/src/renderer/src/pages/settings/ModelsTab.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 channel/web/static/js/views/channels-feishu.js:14— `idField && idField.value && secretField && secretField.value` appears character-identically in 2 files — channel/web/static/js/views/channels-feishu.js, channel/web/static/js/views/channels-wecom.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate channel/web/static/js/views/tasks-modal.js:122— `instData && instData.status === 'success'` appears character-identically in 2 files — channel/web/static/js/views/tasks-modal.js, channel/web/static/js/views/tasks.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate channel/web/static/js/views/artifacts.js:611— `item.kind === 'html' && item.preview_url` appears character-identically in 2 files — channel/web/static/js/views/artifacts.js, desktop/src/renderer/src/pages/artifacts/ArtifactCard.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.
Silent fallback default on parse failure agent/memory/conversation_store.py:789— `_author_of` 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 REDACTED:142— `_cache_hit_tokens` returns `0` when `(TypeError, 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:150— `_nonnegative_int` returns `0` when `(TypeError, 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 agent/tools/scheduler/recipient_store.py:73— `_load_unlocked` returns `{}` when `(OSError, ValueError, 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 agent/tools/utils/memory_path.py:25— `_relative` 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 channel/feishu/feishu_message.py:288— `_extract_quoted_text` returns `''` when `(TypeError, 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 channel/web/api/openai_compat.py:242— `count` (in `_openai_usage`) returns `0` when `(TypeError, 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 channel/web/api/sessions.py:61— `_paths_written_by_step` returns `[]` when `(ValueError, TypeError, AttributeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure channel/web/api/sessions.py:77— `_path_sent_by_step` returns `''` when `(ValueError, 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 REDACTED:278— `_verify_auth_token` 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 cli/commands/backup.py:59— `_read_config` 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 cli/commands/skill.py:1160— `_read_staged_config` 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.
Orphaned file skills/skill-creator/scripts/init_skill.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 plugins/banwords/lib/WordsSearch.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 translate/youdao/youdao_translate.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 skills/skill-creator/scripts/quick_validate.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 models/session_manager.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 skills/skill-creator/scripts/package_skill.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 agent/protocol/task.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 agent/protocol/result.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 models/openai/open_ai_session.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 agent/skills/types.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.
Unused export 'default' desktop/src/renderer/src/pages/settings/ChatFallbackCard.tsx:341— Nothing imports this binding — it is safe to review for removal.
Unused export 'default' desktop/src/renderer/src/pages/settings/ModelCatalogEditor.tsx:457— Nothing imports this binding — it is safe to review for removal.
X23 · Unguarded diagnostic materialisation· Diagnostic log message is built whether or not it is wanted · ×2
Diagnostic log message is built whether or not it is wanted models/gemini/google_gemini_bot.py:597— `debug` at line 597 is called with an argument built by `json.dumps(data, ensure_ascii = False)` (line 597), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted models/modelscope/modelscope_bot.py:680— `debug` at line 680 is called with an argument built by `list(current_tool_calls.values())` (line 680), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 22 significant file(s) lose their only recent owner: desktop/src/renderer/src/pages/TasksPage.tsx, desktop/src/renderer/src/layout/SessionList.tsx, desktop/src/renderer/src/components/KnowledgeGraph.tsx, desktop/src/renderer/src/pages/settings/primitives.tsx, desktop/src/renderer/src/components/WorkspaceSelector.tsx, desktop/src/renderer/src/hooks/useBackend.ts, desktop/src/renderer/src/hooks/useTheme.ts, desktop/src/renderer/src/components/NewChatMenu.tsx (+14 more). Pair on, review, or document these before any departure.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 7 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 (32 single-owned of 324 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 324 of the 468 production source files in this repository met that bar). They are anonymized user #2 (2 file(s)), anonymized user #3 (2 file(s)), anonymized user #4 (2 file(s)), anonymized user #5 (1 file(s)), anonymized user #6 (1 file(s)), anonymized user #7 (1 file(s)) (+1 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: desktop/src/renderer/src/components/ChatTimeline.tsx, agent/protocol/step_writer.py, desktop/src/renderer/src/components/DocEditor.tsx, desktop/src/renderer/src/components/FileEditor.tsx, REDACTED, channel/wechatcom/wechatcomapp_message.py, REDACTED, channel/feishu/feishu_scheduler_card.py (+2 more).
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 2 of 2 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `(repository root)` (124449 LoC, 659 module-visible types across 111 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history)· Rotate the exposed credentials · ×1
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 10 of 324 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 and example/demo trees and test files identified by path convention, largest first; 324 of the 468 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: skills/skill-creator/scripts/init_skill.py, plugins/banwords/lib/WordsSearch.py, translate/youdao/youdao_translate.py, skills/skill-creator/scripts/quick_validate.py, models/session_manager.py, skills/skill-creator/scripts/package_skill.py, agent/protocol/task.py, agent/protocol/result.py (and 2 more). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
No src/ separation — Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
Logging is not universal — Only 1/2 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `desktop`.
No SAST — 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 72772 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.
P4 · Deployment & Rollback· No rollback/health safety · ×1
No rollback/health safety — Deployment is orchestrated by compose, but no service declares a `healthcheck:` and nothing pins a previous image to fall back to — the runtime can tell that the container is up, not that it is serving, so a bad release is harder to detect and reverse.
R7 · Dead Code· Unused export 'useEnabledAgents' · ×1
Unused export 'useEnabledAgents' desktop/src/renderer/src/store/agentStore.ts:254— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'THEME_SPEC_VERSION' · ×1
Unused export 'THEME_SPEC_VERSION' desktop/src/renderer/src/theme/themes.ts:95— Nothing imports this binding — it is safe to review for removal.
Unused export 'LogEvent' desktop/src/renderer/src/types.ts:1321— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused private method 'findBundledBackend' · ×1
Unused private method 'findBundledBackend' REDACTED:413— Nothing in its class calls or references this private method — no member access, no string key, no decorator, and no test reaches it by name. A private member cannot be called from outside its class, so this is the whole search: remove it, or call it where it was meant to be used.
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 1/29 async functions that make a cancellable request (fetch, axios, ky, ofetch) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
Null assertions (`!`) reduce the strict null checking score — ~0.6 `!` null assertions per 1k TypeScript source lines — 22 assertion(s) across the 35446 source line(s) of the 108 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: desktop/src/renderer/src/components/KnowledgeGraph.tsx (7), desktop/src/renderer/src/components/ContextUsagePopover.tsx (3), desktop/src/renderer/src/layout/SessionList.tsx (3). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
Hand-rolled JSON/XML parsing via regex agent/tools/web_fetch/web_fetch.py:623— 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.
Outdated: websocket-client — `websocket-client` is pinned to 1.2.0, but 1.9.2 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 1.2.0 until the declaration is edited.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 1 file(s) — `channel/web/tools/check-load-order.mjs` — so the PII/GDPR sweep did not cover them at all.
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 01a17160-b852-7f75-a65d-956b408a6dbb · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 184 · Warnings: 1916 · Recommendations: 187 · Info: 1 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 25-10-2026 @ 04:45 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.