Public report of agentscope-ai/agentscope, published 20 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 report Measured 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, 20 October 2026, 16:40 UTC · Survey ID cd_b76ec73beb374386a04c6aba4a7f7487

agentscope-ai/agentscope

Measured 20 October 2026, 16:12 UTC, at code version 58da57a

CAI score 65out of 100 Adequate
CriticalWeakAdequateStrongExemplary
Down 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: 140,926 lines of product code in 1 project, tests not counted · Estimated rebuild effort: about 2.0 person-years · Weakest lens: Maturity, 56

Findings by how serious they are

34 critical 560 serious 57 minor

15 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
20 October 2026, 16:12 UTC

A measurement, not a certificate. The Code Assurance Index records a number together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee the code. The standard was written by Canine Development, which also builds Watchdog. It is open to any tool that implements it, and today Watchdog is the only one that does.

The score is deterministic, which means the same code always gets the same score. Watchdog works it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸

56of 60 dimensions measured by tools. The other 4 are advisory notes from an AI model, which explain the code but don't count towards the score.
632of 651 findings point to an exact file and line, so you can open each one in the code. The other 19 concern the repository as a whole, such as missing documentation.
60dimensions across 7 lenses, read from 140,926 lines of product code in 1 project.
Chapters

Executive summary

agentscope-ai/agentscope scores 65 out of 100 and is rated Adequate, while five of its seven lenses score higher still: Domain Modelling and Performance at 100, both rated Exemplary, and Architecture at 89, Security and Compliance at 87 and Code Health at 73, all rated Adequate.

The score is lower than those five because the weakest lens counts most, and here that is Maturity, which scores 56 and is rated Adequate. Its Architecture documentation dimension scores 0 out of 10, and until that reaches 4, Maturity can't be rated higher than Adequate. The first actions are to record your significant design decisions and to resolve the 3 Documentation finding(s) in Documentation Quality, and if Maturity rose to 70, the score would rise from 65 to about 69.

34 findings are critical, all in Static Analysis (SAST).

Watchdog couldn't measure 14 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 140,926 lines, which would take an estimated 2.0 person-years, around €300,000, to rebuild.

A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.

How the score is built: what each lens counts for The 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.
Maturity 56 · counts for 46%Production Readiness 61 · counts for 25%Code Health 73 · counts for 14%Security and Compliance 87 · counts for 8%Architecture 89 · counts for 4%Domain Modelling 100 · counts for 2%Performance 100 · counts for 1%

If Maturity rose from 56 to 70, the lowest score rated Strong, the score would rise from 65 to about 69.

Code composition: what the lines of code are
Product code 56%Tests 44%
New since the last survey: 66 findings

These 66 critical or serious findings weren't in the previous survey, on 3 October 2026.

  • Cyclomatic Complexity · RealtimeAgent.connect (cyclomatic 24) src/agentscope/agent/_realtime/_agent.py
  • Cyclomatic Complexity · OpenAIResponseModel._parse_completion_response (cyclomatic 20) src/agentscope/model/_openai_response/_model.py
  • Cyclomatic Complexity · WebRTCSession._run (cyclomatic 18) src/agentscope/app/_service/_webrtc_session.py
  • Cyclomatic Complexity · DashScopeAudioRealtimeModel.replay_history (cyclomatic 18) src/agentscope/realtime/_dashscope/_audio_model.py
  • Cognitive Complexity · DashScopeAudioRealtimeModel.replay_history (cognitive 44) src/agentscope/realtime/_dashscope/_audio_model.py
  • Cognitive Complexity · RealtimeAgent.connect (cognitive 34) src/agentscope/agent/_realtime/_agent.py
  • Cognitive Complexity · _utils._extract_input_schema (cognitive 30) src/agentscope/tool/_utils.py
  • Cognitive Complexity · WebRTCSession._run (cognitive 23) src/agentscope/app/_service/_webrtc_session.py
  • Cognitive Complexity · _excel._restore_native_excel_errors (cognitive 23) src/agentscope/rag/_parser/_excel.py
  • Cognitive Complexity · RealtimeAgent.reply_stream (cognitive 18) src/agentscope/agent/_realtime/_agent.py
  • Cognitive Complexity · _utils._remove_title_field (cognitive 18) src/agentscope/tool/_utils.py
  • Cognitive Complexity · WebRTCAudioTransport._handle_json (cognitive 17) src/agentscope/app/_service/_webrtc_audio_transport.py
  • Cognitive Complexity · DashScopeRealtimeModel._parse (cognitive 17) src/agentscope/realtime/_dashscope/_model.py
  • God Classes · FileTooLong: _router/_session.py src/agentscope/app/_router/_session.py
  • Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) src/agentscope/formatter/_dashscope_formatter.py
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/agentscope/formatter/_dashscope_formatter.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/agentscope/model/_dashscope/_model.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/agentscope/realtime/_dashscope/_model.py
  • Code Duplication · Duplicated block (17–33 lines × 7) src/agentscope/formatter/_anthropic_formatter.py
  • Code Duplication · Duplicated block (29 lines × 3) src/agentscope/model/_deepseek/_model.py
  • Code Duplication · Duplicated block (22–26 lines × 2) src/agentscope/app/_service/_chat.py
  • Code Duplication · Duplicated block (26 lines × 2) src/agentscope/model/_moonshot/_model.py
  • Code Duplication · Duplicated block (18–24 lines × 2) src/agentscope/app/_service/_chat.py
  • Code Duplication · Duplicated block (16–23 lines × 2) src/agentscope/tool/_adapters.py
  • Code Duplication · Duplicated block (20 lines × 3) src/agentscope/model/_moonshot/_model.py
  • Code Duplication · Duplicated block (19 lines × 2) src/agentscope/model/_moonshot/_model.py
  • Code Duplication · Duplicated block (17 lines × 4) src/agentscope/model/_dashscope/_model.py
  • Code Duplication · Duplicated block (17 lines × 2) src/agentscope/app/_router/_session.py
  • Code Duplication · Duplicated block (17 lines × 2) src/agentscope/realtime/_openai/_model.py
  • Code Duplication · Duplicated block (16 lines × 3) src/agentscope/model/_moonshot/_model.py
  • Code Duplication · Duplicated block (13–15 lines × 4) src/agentscope/model/_dashscope/_model.py
  • Code Duplication · Duplicated block (15 lines × 4) src/agentscope/model/_moonshot/_model.py
  • Code Duplication · Duplicated block (13 lines × 2) src/agentscope/formatter/_dashscope_formatter.py
  • Code Duplication · Duplicated block (10 lines × 8) src/agentscope/formatter/_anthropic_formatter.py
  • Code Duplication · Duplicated block (7 lines × 2) src/agentscope/tui/_ask_user.py
  • Code Duplication · Duplicated block (5 lines × 8) src/agentscope/formatter/_dashscope_formatter.py
  • Code Duplication · Duplicated block (8 lines × 2) src/agentscope/realtime/_openai/_model.py
  • Code Duplication · Duplicated block (34 lines × 2) src/agentscope/tool/_builtin/_edit.py
  • Churn × Complexity Hotspots · Hotspot: src/agentscope/formatter/_moonshot_formatter.py src/agentscope/formatter/_moonshot_formatter.py
  • Churn × Complexity Hotspots · Hotspot: src/agentscope/agent/_realtime/_agent.py src/agentscope/agent/_realtime/_agent.py
  • Churn × Complexity Hotspots · Hotspot: src/agentscope/realtime/_dashscope/_model.py src/agentscope/realtime/_dashscope/_model.py
  • Churn × Complexity Hotspots · Hotspot: src/agentscope/rag/_parser/_ppt.py src/agentscope/rag/_parser/_ppt.py
  • Churn × Complexity Hotspots · Hotspot: src/agentscope/tool/_toolkit.py src/agentscope/tool/_toolkit.py
  • Churn × Complexity Hotspots · Hotspot: src/agentscope/tool/_builtin/_glob.py src/agentscope/tool/_builtin/_glob.py
  • Churn × Complexity Hotspots · Repeated repair: src/agentscope/workspace/_base.py src/agentscope/workspace/_base.py
  • Churn × Complexity Hotspots · Repeated repair: src/agentscope/tool/_builtin/_read.py src/agentscope/tool/_builtin/_read.py
  • Churn × Complexity Hotspots · Repeated repair: src/agentscope/tool/_builtin/_backend.py src/agentscope/tool/_builtin/_backend.py
  • Churn × Complexity Hotspots · Repeated repair: src/agentscope/embedding/_dashscope/_model.py src/agentscope/embedding/_dashscope/_model.py
  • Churn × Complexity Hotspots · Repeated repair: src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py
  • Churn × Complexity Hotspots · Repeated repair: src/agentscope/tool/_utils.py src/agentscope/tool/_utils.py
  • Churn × Complexity Hotspots · Repeated repair: src/agentscope/app/_manager/_scheduler/_tools/_schedule_create.py src/agentscope/app/_manager/_scheduler/_tools/_schedule_create.py
  • Churn × Complexity Hotspots · Repeated repair: src/agentscope/app/_router/_schedule.py src/agentscope/app/_router/_schedule.py
  • Supply-chain Provenance & Signing · REDACTED
  • Supply-chain Provenance & Signing · REDACTED
  • Supply-chain Provenance & Signing · REDACTED
  • Supply-chain Provenance & Signing · REDACTED
  • Supply-chain Provenance & Signing · REDACTED
  • Supply-chain Provenance & Signing · REDACTED
  • Supply-chain Provenance & Signing · REDACTED
  • Async correctness · Task from `asyncio.ensure_future` is not kept src/agentscope/app/_manager/_background_task_manager.py
  • Async correctness · Task from `asyncio.create_task` is not kept src/agentscope/app/middleware/_tool_offload_middleware.py
  • Async correctness · Task from `asyncio.create_task` is not kept src/agentscope/middleware/_longterm_memory/_mem0/_middleware.py
  • Exception handling · Swallowed exception (caught, then discarded) src/agentscope/tool/_utils.py
  • Exception handling · Swallowed exception (caught, then discarded) src/agentscope/tool/_utils.py

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: 43 findings

These 43 critical or serious findings were in the previous survey, on 3 October 2026, and are gone from this one.

  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/agentscope/formatter/_dashscope_formatter.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/agentscope/formatter/_dashscope_formatter.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/agentscope/formatter/_dashscope_formatter.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/agentscope/model/_dashscope/_model.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/agentscope/realtime/_dashscope/_model.py
  • Code Duplication · Duplicated block (43 lines × 2) src/agentscope/model/_deepseek/_model.py
  • Code Duplication · Duplicated block (20–24 lines × 2) src/agentscope/app/_service/_chat.py
  • Code Duplication · Duplicated block (16–23 lines × 2) src/agentscope/tool/_adapters.py
  • Code Duplication · Duplicated block (22 lines × 2) src/agentscope/model/_moonshot/_model.py
  • Code Duplication · Duplicated block (20 lines × 2) src/agentscope/model/_openai_chat/_model.py
  • Code Duplication · Duplicated block (16–19 lines × 2) src/agentscope/model/_deepseek/_model.py
  • Code Duplication · Duplicated block (16–18 lines × 3) src/agentscope/model/_deepseek/_model.py
  • Code Duplication · Duplicated block (17 lines × 4) src/agentscope/model/_dashscope/_model.py
  • Code Duplication · Duplicated block (17 lines × 3) src/agentscope/realtime/_dashscope/_model.py
  • Code Duplication · Duplicated block (16 lines × 2) src/agentscope/model/_openai_chat/_model.py
  • Code Duplication · Duplicated block (13–15 lines × 3) src/agentscope/model/_dashscope/_model.py
  • Code Duplication · Duplicated block (15 lines × 2) src/agentscope/model/_openai_chat/_model.py
  • Code Duplication · Duplicated block (13 lines × 7) src/agentscope/formatter/_anthropic_formatter.py
  • Code Duplication · Duplicated block (13 lines × 2) src/agentscope/formatter/_dashscope_formatter.py
  • Code Duplication · Duplicated block (13 lines × 2) src/agentscope/realtime/_dashscope/_model.py
  • Code Duplication · Duplicated block (10 lines × 8) src/agentscope/formatter/_anthropic_formatter.py
  • Code Duplication · Duplicated block (7 lines × 4) src/agentscope/model/_dashscope/_model.py
  • Code Duplication · Duplicated block (7 lines × 2) src/agentscope/formatter/_gemini_formatter.py
  • Code Duplication · Duplicated block (8 lines × 3) src/agentscope/realtime/_dashscope/_model.py
  • Code Duplication · Duplicated block (31 lines × 3) src/agentscope/tool/_builtin/_edit.py
  • Churn × Complexity Hotspots · Hotspot: src/agentscope/formatter/_anthropic_formatter.py src/agentscope/formatter/_anthropic_formatter.py
  • Churn × Complexity Hotspots · Hotspot: src/agentscope/model/_dashscope/_model.py src/agentscope/model/_dashscope/_model.py
  • Churn × Complexity Hotspots · Hotspot: examples/web_ui/frontend/src/pages/credential/index.tsx examples/web_ui/frontend/src/pages/credential/index.tsx
  • Churn × Complexity Hotspots · Hotspot: src/agentscope/model/_xai/_model.py src/agentscope/model/_xai/_model.py
  • Churn × Complexity Hotspots · Repeated repair: src/agentscope/rag/_parser/_excel.py src/agentscope/rag/_parser/_excel.py
  • IaC & Container Security · Medium IaC: REDACTED build/lib/agentscope/workspace/_docker/Dockerfile.node_copy.template
  • IaC & Container Security · Medium IaC: REDACTED build/lib/agentscope/workspace/_docker/Dockerfile.node_copy.template
  • IaC & Container Security · Medium IaC: REDACTED build/lib/agentscope/workspace/_docker/Dockerfile.node_from.template
  • IaC & Container Security · Medium IaC: REDACTED build/lib/agentscope/workspace/_docker/Dockerfile.node_from.template
  • IaC & Container Security · Medium IaC: REDACTED build/lib/agentscope/workspace/_docker/Dockerfile.template
  • IaC & Container Security · Medium IaC: REDACTED build/lib/agentscope/workspace/_docker/Dockerfile.template
  • IaC & Container Security · Medium IaC: REDACTED build/lib/agentscope/workspace/_docker/Dockerfile.template
  • IaC & Container Security · Medium IaC: REDACTED build/lib/agentscope/workspace/_docker/Dockerfile.template
  • Supply-chain Provenance & Signing REDACTED
  • Exception handling · Swallowed exception (empty catch) src/agentscope/workspace/_docker/_docker_workspace.py
  • Exception handling · Swallowed exception (empty catch) src/agentscope/workspace/_k8s/_k8s_workspace.py
Rebuild cost: about €300,000 · Estimate
Cost to rebuild€98,000 to €490,000, for 1,634 to 5,185 hours of work, about 2.0 person-years for 1 to 4 engineers
Difficulty of the problemStandard, 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.9 at a score of 65. 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.
SizeLarge: 140,926 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
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.
Raises the score by about 7 points · Medium effort · Architecture documentation
2
Resolve the 3 Documentation finding(s) in Documentation Quality — start with README.md, NEWS.md, NEWS_zh.md.
Raises the score by about 3 points · Low effort · Documentation Quality
3
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.
Raises the score by about 4 points · Medium effort · Security & performance tooling

Diagnosis: what the measurements show together

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 €300,000 to build again, about 2.0 person-years of work. Its weakest lens is Maturity, at 56 (Adequate). Maturity is about how well the project explains and looks after itself, which decides whether a new developer, or a new supplier, can take over. Because the weakest lens counts most in the score, work on Maturity also moves the score most.
Based on: the rebuild estimate · the Maturity grade · how much each lens counts
What to do: Start with the Maturity actions in Top priorities.
If you do one thing first · First action
Record your significant design decisions. Of all the actions in this report, it raises the score most for the work it takes: about 7 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 7.0 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 3% to 6% on every change. The history of the code shows how much it changes: about 145,012 lines over the last 90 days, which is about 588,104 lines a year. At that pace, the extra work comes to an estimated 38 to 227.9 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.

517 modules, with 844 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; 477 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.
uses →1 examples.web_ui.frontend.src.api.types2 examples.web_ui.frontend.src.components.dialog.AddMCPDialog3 src.agentscope.app.channel._base4 src.agentscope.app.message_bus._base5 src.agentscope.app.storage._model._base6 src.agentscope.app.workspace_manager._base7 src.agentscope.credential._base8 src.agentscope.mcp._mcp_client9 src.agentscope.message._base10 src.agentscope.message._block11 src.agentscope.middleware._base12 src.agentscope.model._model_response13 src.agentscope.permission._context14 src.agentscope.permission._decision15 src.agentscope.tool._builtin._backend16 src.agentscope.app.storage._model._agent17 src.agentscope.app.storage._model._channel18 src.agentscope.event._event19 src.agentscope.model._base20 src.agentscope.realtime._base21 src.agentscope.state._state22 src.agentscope.tool._base23 src.agentscope.tool._response24 src.agentscope.agent._agent25 src.agentscope.agent._realtime._agent26 src.agentscope.app._manager._background_task_manager27 src.agentscope.app.channel._dingtalk._tools._base28 src.agentscope.app.channel._feishu._tools._base29 src.agentscope.app.storage._model._session30 src.agentscope.app.storage._base31 src.agentscope.app._manager._scheduler._scheduler_manager32 src.agentscope.app._service._access33 src.agentscope.app._service._sop34 src.agentscope.app.storage._redis_storage35 src.agentscope.app.storage._sql._storage36 src.agentscope.app._service37 src.agentscope.app._service._chat38 src.agentscope.app._service._realtime39 src.agentscope.app40 src.agentscope.app._router
1 examples.web_ui.frontend.src.api.types
2 examples.web_ui.frontend.src.components.dialog.AddMCPDialog
3 src.agentscope.app.channel._base
4 src.agentscope.app.message_bus._base
5 src.agentscope.app.storage._model._base
6 src.agentscope.app.workspace_manager._base
7 src.agentscope.credential._base
8 src.agentscope.mcp._mcp_client
9 src.agentscope.message._base
10 src.agentscope.message._block
11 src.agentscope.middleware._base
12 src.agentscope.model._model_response
13 src.agentscope.permission._context
14 src.agentscope.permission._decision
15 src.agentscope.tool._builtin._backend
16 src.agentscope.app.storage._model._agent1
17 src.agentscope.app.storage._model._channel1
18 src.agentscope.event._event21
19 src.agentscope.model._base11
20 src.agentscope.realtime._base11
21 src.agentscope.state._state1
22 src.agentscope.tool._base11
23 src.agentscope.tool._response1
24 src.agentscope.agent._agent1411111
25 src.agentscope.agent._realtime._agent21
26 src.agentscope.app._manager._background_task_manager1111
27 src.agentscope.app.channel._dingtalk._tools._base1111
28 src.agentscope.app.channel._feishu._tools._base1111
29 src.agentscope.app.storage._model._session11
30 src.agentscope.app.storage._base111112
31 src.agentscope.app._manager._scheduler._scheduler_manager1111
32 src.agentscope.app._service._access211
33 src.agentscope.app._service._sop212
34 src.agentscope.app.storage._redis_storage1111121
35 src.agentscope.app.storage._sql._storage1111121
36 src.agentscope.app._service11111115114
37 src.agentscope.app._service._chat11111111111
38 src.agentscope.app._service._realtime111111111
39 src.agentscope.app221211111
40 src.agentscope.app._router1311111118121
Uses a module listed above itPart of a loopThe module itself
1 examples.web_ui.frontend.src.api.types2 examples.web_ui.frontend.src.components.dialog.AddMCPDialog3 src.agentscope.app.channel._base4 src.agentscope.app.message_bus._base5 src.agentscope.app.storage._model._base6 src.agentscope.app.workspace_manager._base7 src.agentscope.credential._base8 src.agentscope.mcp._mcp_client9 src.agentscope.message._base10 src.agentscope.message._block11 src.agentscope.middleware._base12 src.agentscope.model._model_response13 src.agentscope.permission._context14 src.agentscope.permission._decision15 src.agentscope.tool._builtin._backend16 src.agentscope.app.storage._model._agent17 src.agentscope.app.storage._model._channel18 src.agentscope.event._event19 src.agentscope.model._base20 src.agentscope.realtime._base21 src.agentscope.state._state22 src.agentscope.tool._base23 src.agentscope.tool._response24 src.agentscope.agent._agent25 src.agentscope.agent._realtime._agent26 src.agentscope.app._manager._background_task_manager27 src.agentscope.app.channel._dingtalk._tools._base28 src.agentscope.app.channel._feishu._tools._base29 src.agentscope.app.storage._model._session30 src.agentscope.app.storage._base31 src.agentscope.app._manager._scheduler._scheduler_manager32 src.agentscope.app._service._access33 src.agentscope.app._service._sop34 src.agentscope.app.storage._redis_storage35 src.agentscope.app.storage._sql._storage36 src.agentscope.app._service37 src.agentscope.app._service._chat38 src.agentscope.app._service._realtime39 src.agentscope.app40 src.agentscope.app._routerexamples.web_ui.frontend.src.api.types1examples.web_ui.frontend.src.components.dialog.AddMCPDialog2src.agentscope.app.channel._base3src.agentscope.app.message_bus._base4src.agentscope.app.storage._model._base5src.agentscope.app.workspace_manager._base6src.agentscope.credential._base7src.agentscope.mcp._mcp_client8src.agentscope.message._base9src.agentscope.message._block10src.agentscope.middleware._base11src.agentscope.model._model_response12src.agentscope.permission._context13src.agentscope.permission._decision14src.agentscope.tool._builtin._backend15src.agentscope.app.storage._model._agent16src.agentscope.app.storage._model._channel17src.agentscope.event._event18src.agentscope.model._base19src.agentscope.realtime._base20src.agentscope.state._state21src.agentscope.tool._base22src.agentscope.tool._response23src.agentscope.agent._agent24src.agentscope.agent._realtime._agent25src.agentscope.app._manager._background_task_manager26src.agentscope.app.channel._dingtalk._tools._base27src.agentscope.app.channel._feishu._tools._base28src.agentscope.app.storage._model._session29src.agentscope.app.storage._base30src.agentscope.app._manager._scheduler._scheduler_manager31src.agentscope.app._service._access32src.agentscope.app._service._sop33src.agentscope.app.storage._redis_storage34src.agentscope.app.storage._sql._storage35src.agentscope.app._service36src.agentscope.app._service._chat37src.agentscope.app._service._realtime38src.agentscope.app39src.agentscope.app._router401121111111111411111211111111111111111111211112112121111121111112111111115114111111111111111111112212111111311111118121+477 more modules (most-connected shown)

At a glance — Code Health · 73% · Adequate · gated by D2 ·

At a glance — Architecture · 89% · Adequate · gated by D26 ·

At a glance — Maturity · 56% · Adequate · gated by M2 ·

At a glance — Readiness · 61% · Adequate · gated by P3 ·

At a glance — Security · 87% · Adequate · gated by D36 ·

At a glance — Domain Modelling · 100% · Exemplary ·

At a glance — Performance · 100% · Exemplary ·

Security & Compliance — OWASP Top-10 mapping

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 categoryFindingsSeverity
A05:2025 — Injection37High / Critical
A03:2025 — Software Supply Chain Failures13Medium
A02:2025 — Security Misconfiguration8Medium

Roadmap

Begin by documenting significant design decisions in a dedicated folder to establish architectural clarity, then integrate static analysis into the CI pipeline to prevent security regressions. Simultaneously, resolve existing documentation quality issues and update the README with clear testing instructions to improve onboarding. Finally, implement readiness probes and a rolling-update strategy to ensure automatic detection and rollback of bad releases.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
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.+6.9 ptsMediumArchitecture documentation
Resolve the 3 Documentation finding(s) in Documentation Quality — start with README.md, NEWS.md, NEWS_zh.md.+2.8 ptsLowDocumentation Quality
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.+4.5 ptsMediumSecurity & performance tooling
Resolve the 2 Off-boarding risk finding(s) in Bus Factor.+1.5 ptsLowBus Factor
Add readiness/liveness probes and a rolling-update (or blue/green) strategy so a bad release is caught and rolled back automatically.+2.2 ptsMediumDeployment & Rollback
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.+2.2 ptsMediumDocumentation (README)
Reconcile the README with reality: README claims Python 3.11+ but the repository is a single source repo with no dependency manifest; README describes an agent framework while the evidence shows only one project (the README) and no other projects exist; CONTRIBUTING.md names `docs/contributing-update`, but no file or folder `docs/contributing-update` exists.+1.6 ptsMediumDocumentation accuracy
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor.+0.7 ptsLowBus Factor

File quality

Per-file score 0–10 — a quality signature. Of 163 files carrying findings, judged against the Production bar: 4% slop · 61% mixed · 35% near-clean.

FileScoreBandWorst signal
REDACTED2.0SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.0SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.5MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.7MixedStatic Analysis (SAST): Medium: REDACTED
src/agentscope/agent/_agent.py6.0MixedExplicit Debt: TodoComment
src/agentscope/agent/_realtime/_agent.py6.0MixedExplicit Debt: TodoComment
src/agentscope/workspace/_base.py6.0MixedExplicit Debt: TodoComment
src/agentscope/middleware/_rag.py6.0MixedExplicit Debt: TodoComment
REDACTED6.1MixedIaC & Container Security: Medium IaC: REDACTED
src/agentscope/tool/_builtin/_backend.py6.3MixedCognitive Complexity: BackendBase._find_entries (cognitive 17)
src/agentscope/app/middleware/_team_member_middleware.py6.7MixedExplicit Debt: TodoComment
REDACTED6.9MixedIaC & Container Security: Medium IaC: REDACTED

How the grades work

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 — 34

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 — 560

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 — 57

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 15

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. 56 of 60 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 4 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 — 60 dimensions across the health lenses
D1D2D3D4D6D9D11D13D14D15D16D17D19D21D26D28D29D30D31D34D35D36D43D44AX10AX3AX4AX6C2DM6M1M2M3M4P1P10P2P3P4P6P7P8PF3X1X12X13X14X15X17X19X21X22X23X24X25X26X27X28X3X30

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
  1. 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, 632 of 651 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.)
  2. 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.
  3. 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.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Watchdog duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3 · 3.2.533✓ deterministic
LLM (sampled · advisory)Documentation quality, ADR conformance, naming — sampled over a bounded sample; advisory, never a deterministic measurementLocal LLM◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a15a16-5f86-7384-8e2c-06b3616a3832.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

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 READ here — but this repository measures it: a coverage step in CI (`coverage run`) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.py), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored. To have the real number read, produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
  • D12 Dependency Hygiene — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. This repository's 7 shipped Python distribution(s) across 1 manifest(s) WERE read; what went unanswered is the currency half, because it grades an EXACT pin against the newest release and every declaration here is a floor or a range — which installs the newest release it admits and so cannot be behind one. So pypi.org was never asked. This is a true statement about the repository, and the healthy one, NOT a gap on our side: no reader we could write would find a currency question here.
  • 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 (pyproject.toml), but no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict. For npm the surface is what a published package.json's entry points (exports, main, module, types) export, followed through the source; an entry that names build output the tree does not commit (dist/, build/) is not followed back to source, because only a tsconfig outDir/rootDir pair states that mapping and a bundler's input lives in executable configuration this engine does not evaluate.
  • D26 Project Cohesion — 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. Project size and spread are measured over build units whose source a code model reads. This repository's .tsx source is a material share of its production lines and was read by none, so the score is a verdict about the units that were read. Not a finding that the unread source is cohesive — it is unmeasured.
  • 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. `src/agentscope/realtime/_dashscope/_audio_model.py` 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.
  • 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 src/agentscope/app/channel/_registry.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 Dockerfile (REDACTED). docker build failed (exit 1) — DEPRECATED: The legacy builder is deprecated and will be removed in a future release. Install the buildx component to build images with BuildKit: https://docs.docker.com/go/bui…; 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.
  • 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 no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's Python 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 no C#, JavaScript/TypeScript, Java, Dart, Ruby or Scala was found, and this repository's Python 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.
  • 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.
  • X16 Unfloored truncation loop — 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, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala or Kotlin was found in this repository, 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.
  • X18 Disposal-pattern correctness — 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, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala or PHP was found in this repository, 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.
  • X29 Per-element action decided by a fixed element — 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, and JavaScript/TypeScript, Java, Rust, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, Rust, Dart, Ruby, Scala or Kotlin was found in this repository, 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.
  • 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. 2 further occurrence(s) are not listed individually; the score already reflects all 42.
  • X4 Structured logging — 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, and JavaScript/TypeScript, Java, Kotlin, Python, PHP, Dart, Ruby, Scala and Rust source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP log through no library that carries a message's values as fields (pino, winston, bunyan, tslog, LogTape, roarr; Python's logging, structlog; PHP's PSR-3 loggers), so its log calls cannot be judged, 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.
  • X5 Nullable reference types — 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 and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's Python 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.

Repo exclusion declarations: 34 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.

Limitations & what we did not check

Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • 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.
  • D11 Test Reliability: Flakiness is inferred from history/markers — Watchdog runs the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality 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 Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
  • M4 Documentation accuracy: 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".
  • 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 (4): D19, D21, D26, 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.

Dimensions

D1 · Cyclomatic Complexity6.0 / 10Adequate✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 6.0 / 10 · rule-coverage 100% · ceiling Prevented

77 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was ChatService._run_impl at 79. A further 2 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 ConsoleRenderer.render at 18 — 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: src/agentscope/console/_renderer.py (ConsoleRenderer.render at 18), src/agentscope/realtime/_xai/_model.py (XAIRealtimeModel._parse at 17). 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.

ChatService._run_impl (cyclomatic 79)src/agentscope/app/_service/_chat.py:786
BashCommandParser.check_sed_constraints (cyclomatic 60)src/agentscope/tool/_builtin/_bash_parser.py:691
Msg.append_event (cyclomatic 54)src/agentscope/message/_base.py:243
DeepSeekChatFormatter.format (cyclomatic 46)src/agentscope/formatter/_deepseek_formatter.py:45
XAIChatFormatter.format (cyclomatic 44)src/agentscope/formatter/_xai_formatter.py:121

+ 72 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 1 body over 60 down to 60 or less in Cyclomatic Complexity — start with ChatService._run_impl (cyclomatic 79). — Refactoring it lifts Cyclomatic Complexity from 6.0 to about 6.4/10.
  2. 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.

D2 · Cognitive Complexity2.6 / 10Weak✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 2.6 / 10 · rule-coverage 100% · ceiling Prevented

154 method(s) exceeded the cognitive complexity threshold of 15; the worst was _AnthropicFormatterBase._format_messages at 145.

_AnthropicFormatterBase._format_messages (cognitive 145)src/agentscope/formatter/_anthropic_formatter.py:33
XAIChatFormatter.format (cognitive 140)src/agentscope/formatter/_xai_formatter.py:121
ChatService._run_impl (cognitive 136)src/agentscope/app/_service/_chat.py:786
DeepSeekChatFormatter.format (cognitive 132)src/agentscope/formatter/_deepseek_formatter.py:45
MoonshotChatFormatter.format (cognitive 129)src/agentscope/formatter/_moonshot_formatter.py:105

+ 149 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 18 bodies over 60 down to 60 or less in Cognitive Complexity — start with _AnthropicFormatterBase._format_messages (cognitive 145), XAIChatFormatter.format (cognitive 140), ChatService._run_impl (cognitive 136). — 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 18 together lifts Cognitive Complexity from 2.6 to about 4.7/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
  2. 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.

D3 · God Classes9.5 / 10Stronggated by 21 serious findings✓ 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.

Maturity: Documented → Verified → Prevented · effective 9.5 / 10 · rule-coverage 100% · ceiling Prevented

21 god class(es) detected.

FileTooLong: agent/_agent.py · ×14src/agentscope/agent/_agent.py
TooManyMethods: RedisStorage · ×7src/agentscope/app/storage/_redis_storage.py:56

What to do

  1. Resolve the 14 FileTooLong finding(s) in God Classes — start with _agent.py (2), _channel.py (2), _redis_storage.py. — One of this dimension's main actionable groups (14 warning-level).
  2. Resolve the 7 TooManyMethods finding(s) in God Classes — start with _base.py (2), _agent.py (2), _channel.py (2). — One of this dimension's main actionable groups (7 warning-level).
  3. 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.

D4 · Code Duplication9.4 / 10Stronggated by 176 serious findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 9.4 / 10 · rule-coverage 100% · ceiling Verified

164 duplicated block group(s) detected. A further 12 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 20 of the 176 are in trees this repository does not ship — vendored, example/demo, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population. 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.

Duplicated block (15 lines × 2) · ×5src/agentscope/app/storage/_redis_storage.py:2530
Duplicated block (12 lines × 2) · ×5src/agentscope/agent/_agent.py:862
Duplicated block (16 lines × 2) · ×4src/agentscope/tts/_dashscope/_cosyvoice_model.py:322
Duplicated block (13 lines × 2) · ×4src/agentscope/app/channel/_discord/_channel.py:325
Duplicated block (10 lines × 2) · ×4src/agentscope/formatter/_xai_formatter.py:233

+ 121 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 5 Duplicated block (15 lines × 2) finding(s) in Code Duplication — start with _redis_storage.py, _model.py, _dashscope_formatter.py. — One of this dimension's main actionable groups (5 warning-level).
  2. Resolve the 5 Duplicated block (12 lines × 2) finding(s) in Code Duplication — start with _agent.py, _access.py, _channel.py. — One of this dimension's main actionable groups (5 warning-level).
  3. Resolve the 4 Duplicated block (16 lines × 2) finding(s) in Code Duplication — start with _cosyvoice_model.py, _wakeup_dispatcher.py, anthropic_multiagent.py. — One of this dimension's main actionable groups (4 warning-level).
  4. 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.

D6 · Cohesion (LCOM4)9.8 / 10Stronggated by 3 serious findings✓ Tool-verified

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 9.8 / 10 · rule-coverage 100% · ceiling Verified

3 of 200 classes have LCOM4 above 3.

Low cohesion: BackendBase (LCOM4 9) · ×3src/agentscope/tool/_builtin/_backend.py:138

What to do

  1. Resolve the 3 Low cohesion finding(s) in Cohesion (LCOM4) — start with _backend.py, _chat.py, _in_memory_message_bus.py. — One of this dimension's main actionable groups (3 warning-level).
  2. 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.

D9 · Test Distribution9.9 / 10Exemplary✓ Tool-verified

What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.

Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.

Maturity: Documented → Verified → Prevented · effective 9.9 / 10 · rule-coverage 100% · ceiling Documented

2954 test methods: 2940 unit, 0 integration, 0 BDD, 14 e2e. The Python suite contributes 2954 test function(s) across 201 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.

D11 · Test Reliability10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the tests pass reliably, with no flakiness.

Method: Suite re-run N times within tiered wall-clock budgets (unit to e2e); tests failing non-deterministically across runs flagged; guarded tests retried when #if guards detected.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 flaky across 1 measured tier(s). Python (repository root, 202 test files): measured (0 flaky).

✓ On the Gold path — maintain.

Detailed fixes: d11_recommendation.md.

D13 · Secret Scanning10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

Secret scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D14 · License Compliance10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 51 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 7 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (44 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. 1 of them publish no licence on PyPI this pass can read; that is missing data, not a violation, and none of them is charged. This repository publishes itself under Apache-2.0, which is its own choice and is not judged here.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots9.6 / 10Stronggated by 54 serious findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: src/agentscope/app/_service/_chat.py (16×79=1264); src/agentscope/agent/_agent.py (20×39=780); examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx (7×65=455) Repeated repair below the complexity floor: src/agentscope/workspace/_base.py (7 of 11 changes were fixes); src/agentscope/app/_manager/_scheduler/_scheduler_manager.py (6 of 7 changes were fixes); src/agentscope/_utils/_common.py (5 of 7 changes were fixes)

Hotspot: src/agentscope/app/_service/_chat.py · ×39src/agentscope/app/_service/_chat.py:786
Repeated repair: src/agentscope/workspace/_base.py · ×15src/agentscope/workspace/_base.py:812

What to do

  1. Resolve the 39 Hotspot finding(s) in Churn × Complexity Hotspots — start with _model.py (5), _agent.py (2), _base.py (2). — One of this dimension's main actionable groups (39 warning-level).
  2. Resolve the 15 Repeated repair finding(s) in Churn × Complexity Hotspots — start with _model.py (2), _base.py, _scheduler_manager.py. — One of this dimension's main actionable groups (15 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D16 · Bus Factor8.5 / 10Strong✓ Tool-verified

What it measures: Whether knowledge is concentrated in too few people (the "bus factor").

Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.

Maturity: Documented → Verified → Prevented · effective 8.5 / 10 · rule-coverage 100% · ceiling Documented

52 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is src/agentscope/app/message_bus/_base.py. Counted over 353 of the 545 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Off-boarding risk: anonymized user #1 · ×2
Further sole-owners (lower concentration)

What to do

  1. Resolve the 2 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (2 recommendation-level).
  2. 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.

D17 · Explicit Debt10.0 / 10Stronggated by 10 serious findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

10 deducted task-comment markers across 140926 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.

TodoComment · ×10examples/web_ui/frontend/src/api/types.ts:173

What to do

  1. Resolve the 10 TodoComment finding(s) in Explicit Debt — start with _agent.py (2), types.ts, DefaultRenderer.tsx. — One of this dimension's main actionable groups (10 warning-level).
  2. 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.

D19 · Documentation QualityStrong◐ Sampled · advisory

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.

Maturity: Documented → Verified → Prevented · effective Strong / 10 · rule-coverage 100% · ceiling Documented

The repository's root README and its four architecture/design docs are clear and complete for a project of this size: the root README states what AgentScope is (a multi-tenant agent service with real-time voice, console, TUI, and RAG examples), gives an overview link to docs.agentscope.io, and lists installation, usage, contribution, and license information. The four architecture/design docs cover the project's scope in full detail — the README itself documents only one directory (the root) but each of these files is a proper design doc for a distinct tier or subsystem (A2A service, agent-service FastAPI, console module, RAG examples). All sections are present and well-ordered; no clipped content. The repository's READMEs and architecture/Docs markdown files are well written for their respective directories: the READMEs describe runnable demos showing middleware plugged into agentscope.agent.Agent (mem0/mem0.ai, ReMe embedded in-process), install/build steps, import paths, construction options, usage examples, and a changelog; the architecture/Docs set documents mem0.ai's API, design decisions, and roadmap. The root README is not shown but its overview/installation/contribution sections are judged elsewhere.

Documentation: no project overview · ×3README.md

What to do

  1. Resolve the 3 Documentation finding(s) in Documentation Quality — start with README.md, NEWS.md, NEWS_zh.md. — One of this dimension's main actionable groups (3 recommendation-level).

Detailed fixes: d19_recommendation.md · top locations in Appendix A, every location in findings.md.

D21 · Naming ConsistencyExemplary◐ Sampled · advisory

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.

Maturity: Documented → Verified → Prevented · effective Exemplary / 10 · rule-coverage 100% · ceiling Verified

0 naming inconsistencies across 0 sampled symbols.

✓ On the Gold path — maintain.

Detailed fixes: d21_recommendation.md.

D26 · Project Cohesion0.0 / 10Critical✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic, LLM-independent.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

1 of 1 build units (Python) flagged as possibly oversized/incoherent. This repository's .tsx source was read by no build unit, so this covers part of the tree, not all of it.

Projects may be oversized for their cohesion

What to do

  1. 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.

D28 · Secrets (history)10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.

Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

gitleaks scanned the full history AND the current working tree and found no secrets.

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

D29 · Static Analysis (SAST)5.1 / 10Adequate✓ Tool-verified

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).

Maturity: Documented → Verified → Prevented · effective 5.1 / 10 · rule-coverage 100% · ceiling Documented

37 finding(s): 0 critical, 34 high, 3 medium, 0 low. 31 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 1 file(s) — `src/agentscope/realtime/_dashscope/_audio_model.py` — so no absence of findings in them is evidence of anything, and nothing in them was analysed. 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 1 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

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
  2. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  3. No action in Static Analysis (SAST) — all 31 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 (31 issue-level, 0 of them charged here).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D30 · Dependency Vulnerabilities10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No known-vulnerable dependencies in any ecosystem this repository declares.

✓ On the Gold path — maintain.

Detailed fixes: d30_recommendation.md.

D31 · IaC & Container Security9.2 / 10Stronggated by 8 serious findings✓ Tool-verified

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (Dockerfile/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 9.2 / 10 · rule-coverage 100% · ceiling Documented

8 finding(s): 0 critical, 0 high, 8 medium, 0 low.

REDACTED

What to do

  1. Resolve the 8 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (4), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (8 warning-level).

Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.

D34 · Knowledge Freshness10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

1 of 353 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is src/agentscope/workspace/_k8s/_k8s_backend.py. Counted over 353 of the 545 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned files with no living knowledge
Orphaned filesrc/agentscope/workspace/_k8s/_k8s_backend.py:1

✓ On the Gold path — maintain.

Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.

D35 · Change Coupling10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No strong hidden change-coupling between production files.

✓ On the Gold path — maintain.

Detailed fixes: d35_recommendation.md.

D36 · Supply-chain Provenance & Signing0.0 / 10Critical✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

0/4 supply-chain integrity signals present (provenance, signing, SBOM, pinned actions).

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 3 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 5 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (5 warning-level).
  2. Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No dependency in any ecosystem this repository declares is published as malicious.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 7 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.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AX10 · Code composition9.8 / 10Exemplary✓ Tool-verified

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.
AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

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.

AX4 · Dependency direction10.0 / 10Exemplary✓ Tool-verified

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.

AX6 · Interface segregation10.0 / 10Exemplary✓ Tool-verified

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.

C2 · Access Controls10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.

Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.

DM6 · Domain ↔ infrastructure boundary10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain aggregate fused to a persistence ORM (Django/SQLAlchemy) on its own declaration (active-record) couples the domain to infrastructure. The clean-architecture dependency rule.

Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.

Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.

M1 · Documentation (README)7.3 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.

Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.

What to do

  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
  • Add a README to the 2 of 3 project(s) that lack one — worth up to 1.3 pts.
M2 · Architecture documentation0.0 / 10Critical✓ Tool-verified

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.
  • No C4/Structurizr/PlantUML/Mermaid/Graphviz/D2 diagram, no drawn diagram named for the architecture, no file named `architecture` or `design` in any markup this check reads, and nothing in the README, docs or contributor guides that announces the shape — no `## Architecture` heading, no "architecture overview"/"high-level design" phrasing, no "the architecture is …" introduction, no guided code tour. A shape laid out in prose that never names itself as the architecture is not visible to this check, and neither is one kept outside the repository, so this row reports the absence of a re-findable shape document — not evidence that nobody wrote the shape down.

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.
  • Add a C4 context/container diagram (Structurizr, PlantUML or Mermaid) or an architecture.md overview.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

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.

M4 · Documentation accuracy8.0 / 10Strong◐ Sampled · advisory

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.

  • README claims Python 3.11+ but the repository is a single source repo with no dependency manifest — searched for: `Python version constraint`. Each was matched case- and separator-insensitively against file and directory NAMES anywhere in the tree, and against the CONTENTS of manifest files (package.json, *.csproj, *.props, *.slnx, *.yml, Dockerfile); the README's own prose never counts, so a claim is never refuted by merely being made. Nothing outside that search was read — a footprint living only in a submodule, in a file type not listed here, or under a name none of those terms matches is not seen, and this row is then wrong. — README.md:1
  • README describes an agent framework while the evidence shows only one project (the README) and no other projects exist — reported by the model that read the README against this repository; no term search was run for this one, so nothing here has been checked against the tree. Treat it as a reading to confirm, not as a measured contradiction: verify it against the code before acting on it, and if the footprint it describes does exist, this row is wrong. — README.md:1
  • CONTRIBUTING.md names `docs/contributing-update`, but no file or folder `docs/contributing-update` 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. — CONTRIBUTING.md:116

What to do

  • Reconcile the README with reality: README claims Python 3.11+ but the repository is a single source repo with no dependency manifest; README describes an agent framework while the evidence shows only one project (the README) and no other projects exist; CONTRIBUTING.md names `docs/contributing-update`, but no file or folder `docs/contributing-update` exists.
P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

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.

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.

P2 · Observability10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

P3 · Security & performance tooling0.0 / 10Critical✓ Tool-verified

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 45656 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.
P4 · Deployment & Rollback5.0 / 10Adequate✓ Tool-verified

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 automation exists but no readiness/liveness probes, rolling-update strategy, lifecycle hooks or migration job were evidenced — a bad release is harder to detect and reverse.
  • Deployment is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever reaches the release trigger goes to production unreviewed, so a mistaken merge or tag is live before anyone can stop it.

What to do

  • Add readiness/liveness probes and a rolling-update (or blue/green) strategy so a bad release is caught and rolled back automatically.
  • Add an approval/environment gate (required reviewers / protection rules) before production promotion.
P6 · Release Hygiene8.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

  • The changelog this check read carries 1 versioned entry, against a bar of 3. Counted as either the distinct `x.y.z` versions it names (a link's target is not counted) or its version-shaped section headings (`## [1.2.0]`, `## V14.x.x`, `## Updates in 8.0.x`), whichever is the larger — so a log sectioned by minor series counts its sections, not its individual patch numbers. Entries recorded somewhere this check does not read — release notes generated at tag time from a generator config it did not recognise, or a log kept outside the repository — are not counted here, and this row is about what is re-findable in the tree rather than about how often you release.

What to do

  • Keep the changelog current — add a versioned entry (Keep-a-Changelog ## [x.y.z]) for each release so the history isn't a stub.
P7 · Outbound HTTP resilience10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.

Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.

P8 · Schema migrations10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether database schema changes go through versioned migrations rather than being auto-created from the model at startup.

Method: Roslyn scan: EF Core DbContext for a versioned migrations directory versus bare EnsureCreated usage; off .NET, a file scan of dependency manifests, migration histories (Flyway, Liquibase, Alembic, Django, Rails, Prisma, TypeORM, Knex/Sequelize, golang-migrate, goose, Laravel, Doctrine, Diesel/sqlx) and schema auto-create in production source or config. Exhaustive, deterministic.

PF3 · Async & latency hygiene10.0 / 10Exemplary✓ Tool-verified

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.

X1 · Async correctness8.0 / 10Strong✓ Tool-verified

Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.

Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.

  • The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception. (×3) — src/agentscope/app/_manager/_background_task_manager.py:321, src/agentscope/app/middleware/_tool_offload_middleware.py:356, src/agentscope/middleware/_longterm_memory/_mem0/_middleware.py:741

What to do

  • Task from `asyncio.ensure_future` is not kept
X12 · Unreachable branch10.0 / 10Exemplary○ Nothing flagged

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.

X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.

Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.

X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

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.

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.

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.

  • `render_mcp` is public, takes a document from its caller (line 103) and hands it to `_substitute`, which calls itself at line 93 (`_substitute`) with a piece of `node` (and at line 98) — and nowhere in `_substitute` 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 `_substitute` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/agentscope/app/_service/_mcp_render.py:93

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.
X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

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.

X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

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.

X22 · Contradicted release guard10.0 / 10Exemplary○ Nothing flagged

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.

X23 · Unguarded diagnostic materialisation6.2 / 10Adequate✓ Tool-verified

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 526 is called with an argument built by `[ranked[i].chunk.source for i in ids]` (line 528), 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. — src/agentscope/middleware/_rag.py:526
  • `debug` at line 420 is called with an argument built by `list(data)` (line 420), 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. — src/agentscope/realtime/_gemini/_model.py:420

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.
X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged

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.

X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

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.

X26 · Unsynchronised callback handoff10.0 / 10Exemplary○ Nothing flagged

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.

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.

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.

X3 · Exception handling6.2 / 10Adequate✓ Tool-verified

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.

  • `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. (×16) — src/agentscope/agent/_agent.py:3043, src/agentscope/app/storage/_model/_schedule.py:36, src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:776, …
  • 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. (×13) — src/agentscope/app/channel/_stream.py:121, src/agentscope/app/channel/_dispatcher.py:170, src/agentscope/app/message_bus/_redis_message_bus.py:700, …
  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `__aexit__()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch. (×7) — src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:308, src/agentscope/app/workspace_manager/_k8s_workspace_manager.py:304, src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:428, …
  • `except (asyncio.CancelledError, 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. — src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:663
  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `close()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch. (×3) — src/agentscope/tts/_dashscope/_realtime_model.py:292, src/agentscope/tts/_dashscope/_cosyvoice_model.py:204, src/agentscope/workspace/_sandboxed_base.py:225

What to do

  • Swallowed exception (caught, then discarded)
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.

Reference — by lens

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.

LensScoreRatingImpact
Code Health73%Adequate — gated by D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture89%Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity56%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness61%Adequate — gated by P3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security87%Adequate — gated by D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Domain Modelling100%ExemplaryStrongest area.
Performance100%ExemplarySolid.
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.

  • P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
  • X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 7 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 control(s) we could not find positive evidence for

These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.

  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 57 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
  • 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 — docker build failed (exit 1) — DEPRECATED: The legacy builder is deprecated and will be removed in a future release. Install the buildx component to build images with BuildKit: https://docs.docker.com/go/bui…; 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.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or MongoEngine model, a migration or a SQL schema — and no database or data-store client (Django ORM, SQLAlchemy, psycopg, PyMongo, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential on a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or mongoengine model, in a migration or in a SQL schema — and no database or data-store client (django.db, sqlalchemy, psycopg2, pymongo, sqlite3, …) imported either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential on a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or mongoengine model, in a migration or in a SQL schema — and no database or data-store client (django.db, sqlalchemy, psycopg2, pymongo, sqlite3, …) imported either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D10 Test Quality — ~110921 lines of test source are present (.py) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D12 Dependency Hygiene — Dependency currency not established — no declaration carries an exact pin to grade
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D20 ADR Quality — N/A — ADRs are expected on deployable products with a user-facing host, not consumed libraries; no ADR log is required here.
  • 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. Aggregate roots were found in only one source directory (agentscope), 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.
  • D5 Coupling — Not applicable — this Python build ships 1 production module(s), so there is no coupling BETWEEN modules to measure. (Its test and non-production modules are not part of the shipped graph.)
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not included — suite not readable by the collector
  • ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • 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 runs on a garbage-collected runtime that gives a program no allocation-control idiom to choose on a hot path — no pools, stack allocation or value types — so allocation awareness is not something this code can be rated on.
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X16 Unfloored truncation loop — 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
  • X18 Disposal-pattern correctness — 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
  • X2 Cancellation propagation — no C# was loaded; this repository's Python was read, and no request in it can be cancelled by a caller — a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation
  • 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.
  • X29 Per-element action decided by a fixed element — 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
  • 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.
  • X4 Structured logging — 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
  • X5 Nullable reference types — 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
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • 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.

Critical — 34 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 6 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
Serious — 560 finding(s)
D15 · Churn × Complexity Hotspots · Hotspot · ×39
  • Hotspot: src/agentscope/app/_service/_chat.py src/agentscope/app/_service/_chat.py:786 — src/agentscope/app/_service/_chat.py changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 79 in ChatService._run_impl at line 786. 4 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/app/_service/_chat.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/agent/_agent.py src/agentscope/agent/_agent.py:1035 — src/agentscope/agent/_agent.py changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in Agent._reply_impl at line 1035. 12 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/agent/_agent.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: examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx:179 — examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 65 in ChatViewport.ChatViewport at line 179. 1 of those changes was a fix/bug commit, and the other 6 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/message/_base.py src/agentscope/message/_base.py:243 — src/agentscope/message/_base.py changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in Msg.append_event at line 243. 4 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/message/_base.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/tool/_builtin/_bash_parser.py src/agentscope/tool/_builtin/_bash_parser.py:691 — src/agentscope/tool/_builtin/_bash_parser.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 60 in BashCommandParser.check_sed_constraints at line 691. 6 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/tool/_builtin/_bash_parser.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: examples/web_ui/frontend/src/components/chat/TextInput.tsx examples/web_ui/frontend/src/components/chat/TextInput.tsx:139 — examples/web_ui/frontend/src/components/chat/TextInput.tsx changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 59 in TextInput.TextInput at line 139. 1 of those changes was a fix/bug commit, and the other 5 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- examples/web_ui/frontend/src/components/chat/TextInput.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/app/_app.py src/agentscope/app/_app.py:113 — src/agentscope/app/_app.py changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in _app.create_app at line 113. 1 of those changes was a fix/bug commit, 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/app/_app.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/formatter/_xai_formatter.py src/agentscope/formatter/_xai_formatter.py:121 — src/agentscope/formatter/_xai_formatter.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in XAIChatFormatter.format at line 121. 6 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/formatter/_xai_formatter.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/formatter/_moonshot_formatter.py src/agentscope/formatter/_moonshot_formatter.py:105 — src/agentscope/formatter/_moonshot_formatter.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in MoonshotChatFormatter.format at line 105. 6 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/formatter/_moonshot_formatter.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: examples/web_ui/frontend/src/pages/chat/index.tsx examples/web_ui/frontend/src/pages/chat/index.tsx:92 — examples/web_ui/frontend/src/pages/chat/index.tsx changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in index.ChatPageInner at line 92. 1 of those changes was a fix/bug commit, and the other 6 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- examples/web_ui/frontend/src/pages/chat/index.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/model/_openai_response/_model.py src/agentscope/model/_openai_response/_model.py:256 — src/agentscope/model/_openai_response/_model.py changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in OpenAIResponseModel._parse_stream_response at line 256. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/model/_openai_response/_model.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: examples/web_ui/frontend/src/components/popover/ModelParametersPopover.tsx examples/web_ui/frontend/src/components/popover/ModelParametersPopover.tsx:271 — examples/web_ui/frontend/src/components/popover/ModelParametersPopover.tsx changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in ModelParametersPopover.ModelParametersPopover at line 271. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- examples/web_ui/frontend/src/components/popover/ModelParametersPopover.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/model/_anthropic/_model.py src/agentscope/model/_anthropic/_model.py:415 — src/agentscope/model/_anthropic/_model.py changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in AnthropicChatModel._parse_anthropic_stream_completion_response at line 415. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/model/_anthropic/_model.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/agent/_realtime/_agent.py src/agentscope/agent/_realtime/_agent.py:675 — src/agentscope/agent/_realtime/_agent.py changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in RealtimeAgent._on_model_event at line 675. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/agent/_realtime/_agent.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/formatter/_gemini_formatter.py src/agentscope/formatter/_gemini_formatter.py:132 — src/agentscope/formatter/_gemini_formatter.py changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in GeminiChatFormatter.format at line 132. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/formatter/_gemini_formatter.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/formatter/_openai_response_formatter.py src/agentscope/formatter/_openai_response_formatter.py:178 — src/agentscope/formatter/_openai_response_formatter.py changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in OpenAIResponseFormatter.format at line 178. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/formatter/_openai_response_formatter.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/model/_gemini/_model.py src/agentscope/model/_gemini/_model.py:33 — src/agentscope/model/_gemini/_model.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in _model._sanitize_schema_for_gemini at line 33. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/model/_gemini/_model.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/pipeline/_goal_pipeline.py src/agentscope/pipeline/_goal_pipeline.py:112 — src/agentscope/pipeline/_goal_pipeline.py changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in GoalPipeline.reply_stream at line 112. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/pipeline/_goal_pipeline.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/realtime/_dashscope/_model.py src/agentscope/realtime/_dashscope/_model.py:327 — src/agentscope/realtime/_dashscope/_model.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in DashScopeRealtimeModel._parse at line 327. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/realtime/_dashscope/_model.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/formatter/_ollama_formatter.py src/agentscope/formatter/_ollama_formatter.py:118 — src/agentscope/formatter/_ollama_formatter.py changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in OllamaChatFormatter.format at line 118. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/formatter/_ollama_formatter.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: examples/web_ui/frontend/src/components/chat/ChatContent.tsx examples/web_ui/frontend/src/components/chat/ChatContent.tsx:118 — examples/web_ui/frontend/src/components/chat/ChatContent.tsx changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in ChatContent.ChatContentComponent at line 118. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- examples/web_ui/frontend/src/components/chat/ChatContent.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/agentscope/rag/_parser/_word.py src/agentscope/rag/_parser/_word.py:245 — src/agentscope/rag/_parser/_word.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in WordParser.parse at line 245. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/rag/_parser/_word.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: examples/web_ui/frontend/src/hooks/useMessages.ts examples/web_ui/frontend/src/hooks/useMessages.ts:184 — examples/web_ui/frontend/src/hooks/useMessages.ts changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in useMessages.useMessages.processEvent at line 184. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- examples/web_ui/frontend/src/hooks/useMessages.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: src/agentscope/model/_moonshot/_model.py src/agentscope/model/_moonshot/_model.py:244 — src/agentscope/model/_moonshot/_model.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in MoonshotChatModel._parse_stream_response at line 244. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/model/_moonshot/_model.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: examples/web_ui/frontend/src/components/knowledge/KnowledgeDocumentsPanel.tsx examples/web_ui/frontend/src/components/knowledge/KnowledgeDocumentsPanel.tsx:255 — examples/web_ui/frontend/src/components/knowledge/KnowledgeDocumentsPanel.tsx changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in KnowledgeDocumentsPanel.KnowledgeDocumentsPanel at line 255. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- examples/web_ui/frontend/src/components/knowledge/KnowledgeDocumentsPanel.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.
  • + 14 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (empty catch) · ×23
  • Swallowed exception (empty catch) src/agentscope/app/channel/_stream.py:121 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) src/agentscope/app/channel/_dispatcher.py:170 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) src/agentscope/app/message_bus/_redis_message_bus.py:700 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:308 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `__aexit__()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
  • Swallowed exception (empty catch) src/agentscope/app/workspace_manager/_k8s_workspace_manager.py:304 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `__aexit__()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
  • Swallowed exception (empty catch) src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:428 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `__aexit__()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
  • Swallowed exception (empty catch) src/agentscope/app/workspace_manager/_docker_workspace_manager.py:421 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `__aexit__()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
  • Swallowed exception (empty catch) src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:288 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `__aexit__()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
  • Swallowed exception (empty catch) src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:229 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `__aexit__()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
  • Swallowed exception (empty catch) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:247 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `__aexit__()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
  • Swallowed exception (empty catch) src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:630 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) src/agentscope/middleware/_longterm_memory/_reme/_middleware.py:362 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) src/agentscope/tts/_dashscope/_realtime_model.py:292 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `close()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
  • Swallowed exception (empty catch) src/agentscope/tts/_dashscope/_realtime_model.py:299 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) src/agentscope/tts/_dashscope/_cosyvoice_model.py:204 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `close()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
  • Swallowed exception (empty catch) src/agentscope/tts/_dashscope/_cosyvoice_model.py:212 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) src/agentscope/workspace/_sandboxed_base.py:225 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `close()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
  • Swallowed exception (empty catch) src/agentscope/workspace/_gateway_client.py:723 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) src/agentscope/workspace/_gateway_client.py:752 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) src/agentscope/workspace/_docker/_docker_workspace.py:174 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) src/agentscope/workspace/_docker/_docker_workspace.py:178 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) src/agentscope/workspace/_docker/_docker_workspace.py:182 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) src/agentscope/workspace/_docker/_docker_workspace.py:189 — 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.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×17
  • Swallowed exception (caught, then discarded) src/agentscope/agent/_agent.py:3043 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/app/storage/_model/_schedule.py:36 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:663 — `except (asyncio.CancelledError, Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:776 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:914 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:955 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/middleware/_tracing/_extractor.py:167 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/middleware/_tracing/_extractor.py:310 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/middleware/_tracing/_extractor.py:455 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/state/_state.py:72 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/tool/_utils.py:83 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/tool/_utils.py:107 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/tool/_builtin/_bash_parser.py:252 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/tool/_builtin/_bash.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) src/agentscope/workspace/_sandboxed_base.py:526 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/workspace/_gateway_client.py:539 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/workspace/_bubblewrap/_bubblewrap_workspace.py:646 — `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.
D15 · Churn × Complexity Hotspots · Repeated repair · ×15
  • Repeated repair: src/agentscope/workspace/_base.py src/agentscope/workspace/_base.py:812 — src/agentscope/workspace/_base.py changed 11 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is WorkspaceBase._enforce_mcp_capacity at line 812), 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(workspace): read the persisted .mcp file as utf-8-sig (#3338)”; “fix(workspace): append nothing when offloading an empty context batch (#3254)”; “fix(workspace): offload nested media from context archives (#3201)”; “fix(workspace): point the bubblewrap offload test at the workspace:// reference (#3151)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/workspace/_base.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: src/agentscope/app/_manager/_scheduler/_scheduler_manager.py src/agentscope/app/_manager/_scheduler/_scheduler_manager.py:332 — src/agentscope/app/_manager/_scheduler/_scheduler_manager.py changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is SchedulerManager.validate_schedule at line 332), 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): notify owner after deleting schedules (#3103)”; “fix(scheduler): normalize standard cron weekday numbering (#2770)”; “fix(scheduler): validate cron before persistence (#2442)”; “fix(scheduler): let one node own the timers (#2477)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/app/_manager/_scheduler/_scheduler_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: src/agentscope/_utils/_common.py src/agentscope/_utils/_common.py:95 — src/agentscope/_utils/_common.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 12 (its worst body is _common._json_loads_with_repair at line 95), 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(tool): run a no-argument tool call on an empty argument payload (#3095)”; “fix(utils): preserve instance values during schema flattening (#2592)”; “fix(utils): preserve property names during schema flattening (#2575)”; “fix(tool): apply schema-guided repair to tool arguments (#2496)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/_utils/_common.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: src/agentscope/mcp/_mcp_client.py src/agentscope/mcp/_mcp_client.py:144 — src/agentscope/mcp/_mcp_client.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 13 (its worst body is MCPClient.model_post_init at line 144), 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(mcp): support mcp 2.x Python SDK, unpin mcp<2.0.0 (#2216)”; “fix(mcp): build the owned streamable-HTTP client through the SDK factory (#3010)”; “fix(mcp): clean up cancelled MCP connections (#2499)”; “fix(mcp): detect SSE transport by URL path so query strings work (#2311)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/mcp/_mcp_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.
  • Repeated repair: src/agentscope/state/_state.py src/agentscope/state/_state.py:90 — src/agentscope/state/_state.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 ToolContext.cache_file at line 90), 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(state): skip oversized read-cache entries (#2534)”; “fix(tool): make read cache backend-aware so Read->Edit works in workspaces (#2092)”; “fix(state): preserve LRU cache under concurrent hits (#2457)”; “fix(state): refresh read file cache recency on access (#1811)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/state/_state.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: src/agentscope/tool/_builtin/_read.py src/agentscope/tool/_builtin/_read.py:385 — src/agentscope/tool/_builtin/_read.py changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is Read._read_pdf at line 385), 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(tool): report deferred PDF read failures (#3057)”; “fix(tool): isolate default Read input media types (#3161)”; “fix(tool): respect empty model input types (#2857)”; “fix(tool): make read cache backend-aware so Read->Edit works in workspaces (#2092)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/tool/_builtin/_read.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: src/agentscope/tool/_builtin/_write.py src/agentscope/tool/_builtin/_write.py:235 — src/agentscope/tool/_builtin/_write.py changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is Write.call at line 235), 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(tool): escape glob metacharacters in Write/Edit permission suggestions (#3378)”; “fix(tool): refresh the read cache after Edit and Write (#2865)”; “fix(tool): count written lines the way Read numbers them (#2734)”; “fix(tool): make read cache backend-aware so Read->Edit works in workspaces (#2092)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/tool/_builtin/_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: src/agentscope/tool/_builtin/_backend.py src/agentscope/tool/_builtin/_backend.py:603 — src/agentscope/tool/_builtin/_backend.py changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is BackendBase._find_entries at line 603), 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(tool): unlink local symbolic links without following targets (#3006)”; “fix(tool): clarify Windows asyncio subprocess error in LocalBackend (#2837)”; “fix(tool): pick the shell by the backend OS instead of the host OS in Bash (#2366)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/tool/_builtin/_backend.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: src/agentscope/middleware/_tracing/_extractor.py src/agentscope/middleware/_tracing/_extractor.py:109 — src/agentscope/middleware/_tracing/_extractor.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is _extractor._get_tool_definitions at line 109), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(tracing): report the MiniMax provider name on chat spans (#3023)”; “fix(tracing): report interrupted chat responses (#2450)”; “fix(tracing): include input messages in chat spans (#2391)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/middleware/_tracing/_extractor.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: src/agentscope/embedding/_dashscope/_model.py src/agentscope/embedding/_dashscope/_model.py:236 — src/agentscope/embedding/_dashscope/_model.py changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is DashScopeEmbeddingModel._split_multimodal_batches at line 236), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(embedding): preserve configured qwen3 multimodal dimensions (#3350)”; “fix(embedding): avoid blocking the event loop (#2703)”; “fix(embedding): expose DashScope multimodal capability (#2701)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/embedding/_dashscope/_model.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: src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:568 — src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is AgenticMemoryMiddleware.on_reply at line 568), 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(memory): keep frontmatter when the closing fence ends the text (#3345)”; “fix(memory): deduplicate selected files before limiting retrieval (#2776)”; “fix: repair agent-facing prompt template text defects (#2513)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.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: src/agentscope/tool/_utils.py src/agentscope/tool/_utils.py:123 — src/agentscope/tool/_utils.py changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is _utils._remove_title_field at line 123), 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(tool): preserve annotations and docstrings for partial functions (#3257)”; “fix(tool): omit injected state from inferred function schemas (#3090)”; “fix(tool): resolve PEP 563 lazy annotations when extracting tool schemas (#2371)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/tool/_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: src/agentscope/app/_manager/_scheduler/_tools/_schedule_create.py src/agentscope/app/_manager/_scheduler/_tools/_schedule_create.py:164 — src/agentscope/app/_manager/_scheduler/_tools/_schedule_create.py changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is ScheduleCreate.__call__ at line 164), 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(app): anchor a schedule's default start time to an absolute instant (#3101)”; “fix(scheduler): validate cron before persistence (#2442)”; “fix(scheduler): let one node own the timers (#2477)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/app/_manager/_scheduler/_tools/_schedule_create.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: src/agentscope/app/_router/_schedule.py src/agentscope/app/_router/_schedule.py:146 — src/agentscope/app/_router/_schedule.py changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is _schedule.update_schedule at line 146), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(app): anchor a schedule's default start time to an absolute instant (#3101)”; “fix(scheduler): validate cron before persistence (#2442)”; “fix(scheduler): let one node own the timers (#2477)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/app/_router/_schedule.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: src/agentscope/tts/_openai/_model.py src/agentscope/tts/_openai/_model.py:201 — src/agentscope/tts/_openai/_model.py changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is OpenAITTSModel._stream at line 201), 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(tts): respect per-call speech instructions (#2990)”; “fix(tts): label audio with the effective response format (#2980)”; “fix(model): reuse openai.AsyncClient across calls instead of new per call (#2063)”. 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-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 18:02:38 +08:00' --until='2026-10-20 18:02:38 +08:00' --full-history --no-merges -- src/agentscope/tts/_openai/_model.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.
D3 · God Classes · FileTooLong · ×14
  • FileTooLong: agent/_agent.py src/agentscope/agent/_agent.py — FileTooLong — 2292 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1792 over it, 4.58× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: storage/_redis_storage.py src/agentscope/app/storage/_redis_storage.py — FileTooLong — 1566 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1066 over it, 3.13× 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: _service/_chat.py src/agentscope/app/_service/_chat.py — FileTooLong — 913 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 413 over it, 1.83× 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/_channel.py src/agentscope/app/channel/_dingtalk/_channel.py — FileTooLong — 891 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 391 over it, 1.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: _realtime/_agent.py src/agentscope/agent/_realtime/_agent.py — FileTooLong — 850 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 350 over it, 1.70× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: _feishu/_channel.py src/agentscope/app/channel/_feishu/_channel.py — FileTooLong — 843 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 343 over it, 1.69× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: workspace/_base.py src/agentscope/workspace/_base.py — FileTooLong — 797 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 297 over it, 1.59× 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: tui/_messages.py src/agentscope/tui/_messages.py — FileTooLong — 714 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 214 over it, 1.43× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 600 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 100 over it, 1.20× 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: _agentic_memory/_middleware.py src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py — FileTooLong — 587 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 87 over it, 1.17× 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: workspace/_local_workspace.py src/agentscope/workspace/_local_workspace.py — FileTooLong — 542 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 42 over it, 1.08× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: middleware/_rag.py src/agentscope/middleware/_rag.py — FileTooLong — 527 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 27 over it, 1.05× 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: _builtin/_bash_parser.py src/agentscope/tool/_builtin/_bash_parser.py — FileTooLong — 525 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 25 over it, 1.05× 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: _router/_session.py src/agentscope/app/_router/_session.py — FileTooLong — 502 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2 over it, 1.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.
D17 · Explicit Debt · TodoComment · ×10
  • TodoComment examples/web_ui/frontend/src/api/types.ts:173 — // TODO: update when Python side is finalised — 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 examples/web_ui/frontend/src/components/chat/tool-renderers/DefaultRenderer.tsx:60 — // TODO: render multimodal outputs — 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 examples/web_ui/frontend/src/components/popover/ModelParametersPopover.tsx:134 — // TODO: experiment with using prop.description as placeholder text — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/agentscope/agent/_config.py:418 — # TODO: remove this line after PR #1564 is merged, where the ChatModel
  • TodoComment src/agentscope/agent/_agent.py:2490 — # TODO: Maybe some logic to mix the validation error in runtime — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/agentscope/agent/_realtime/_agent.py:241 — # TODO(realtime): tools and instructions are sent once, 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 src/agentscope/app/middleware/_team_member_middleware.py:160 — # TODO: When the subagent fails, the leader should be aware — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/agentscope/middleware/_rag.py:901 — # TODO: one message should embed into one vector; the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/agentscope/middleware/_tracing/_extractor.py:144 — # TODO: Currently only supports "function" type tools. If other 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 src/agentscope/workspace/_base.py:1191 — # context and reads the relative path. See docs TODO (frontend — 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.
D31 · IaC & Container Security · Medium IaC · ×8
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D3 · God Classes · TooManyMethods · ×7
  • TooManyMethods: RedisStorage src/agentscope/app/storage/_redis_storage.py:56 — TooManyMethods — 84 methods. The bar is 30 methods; this is 54 over it, 2.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: MessageBus src/agentscope/app/message_bus/_base.py:53 — TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× 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: Agent src/agentscope/agent/_agent.py:117 — 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: RealtimeAgent src/agentscope/agent/_realtime/_agent.py:92 — TooManyMethods — 37 methods. The bar is 30 methods; this is 7 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: WorkspaceBase src/agentscope/workspace/_base.py:225 — 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.
  • TooManyMethods: FeishuChannel src/agentscope/app/channel/_feishu/_channel.py:91 — TooManyMethods — 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: DingTalkChannel src/agentscope/app/channel/_dingtalk/_channel.py:83 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D36 · Supply-chain Provenance & Signing REDACTED · ×5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×5
  • Duplicated block (15 lines × 2) src/agentscope/app/storage/_redis_storage.py:2530 — src/agentscope/app/storage/_redis_storage.py:2530-2544 | src/agentscope/app/storage/_redis_storage.py:2561-2575 — both copies are in the same file, so extract the 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) src/agentscope/embedding/_dashscope/_model.py:357 — src/agentscope/embedding/_dashscope/_model.py:357-371 | src/agentscope/embedding/_dashscope/_model.py:444-458 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/embedding/_dashscope/_model.py:357` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) src/agentscope/formatter/_dashscope_formatter.py:274 — src/agentscope/formatter/_dashscope_formatter.py:274-288 | src/agentscope/formatter/_dashscope_formatter.py:336-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.
  • Duplicated block (15 lines × 2) src/agentscope/tool/_builtin/_bash.py:734 — src/agentscope/tool/_builtin/_bash.py:734-751 | src/agentscope/tool/_builtin/_powershell.py:262-276 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/tool/_builtin/_powershell.py:262` 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) examples/long_term_memory/mem0/oss_demo.py:76 — examples/long_term_memory/mem0/oss_demo.py:76-90 | examples/long_term_memory/reme/reme_demo.py:110-124 — 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.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×5
  • Duplicated block (12 lines × 2) src/agentscope/agent/_agent.py:862 — src/agentscope/agent/_agent.py:862-873 | src/agentscope/agent/_agent.py:2072-2083 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/agent/_agent.py:862` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) src/agentscope/app/_service/_access.py:387 — src/agentscope/app/_service/_access.py:387-398 | src/agentscope/app/_service/_access.py:542-553 — both copies are in the same file, so extract the 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) src/agentscope/app/channel/_dingtalk/_channel.py:347 — src/agentscope/app/channel/_dingtalk/_channel.py:347-360 | src/agentscope/app/channel/_feishu/_channel.py:686-697 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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) src/agentscope/embedding/_gemini/_model.py:346 — src/agentscope/embedding/_gemini/_model.py:346-357 | src/agentscope/embedding/_openai/_model.py:142-153 — 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 (12 lines × 2) src/agentscope/tool/_adapters.py:299 — src/agentscope/tool/_adapters.py:299-315 | src/agentscope/workspace/_gateway_client.py:126-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.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×4
  • Duplicated block (16 lines × 2) src/agentscope/tts/_dashscope/_cosyvoice_model.py:322 — src/agentscope/tts/_dashscope/_cosyvoice_model.py:322-337 | src/agentscope/tts/_dashscope/_realtime_model.py:416-431 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/tts/_dashscope/_cosyvoice_model.py:322` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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, `src/agentscope/tts/_dashscope/_realtime_model.py:432` calls `_reset_state` and `src/agentscope/tts/_dashscope/_cosyvoice_model.py:338` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 2) src/agentscope/app/_manager/_wakeup_dispatcher.py:114 — src/agentscope/app/_manager/_wakeup_dispatcher.py:114-131 | src/agentscope/app/_service/_index_task_consumer.py:75-90 — 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 (16 lines × 2) scripts/model_examples/anthropic_multiagent.py:19 — scripts/model_examples/anthropic_multiagent.py:19-39 | scripts/model_examples/anthropic_multiagent_multimodal.py:25-40 — 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, `scripts/model_examples/anthropic_multiagent_multimodal.py:42` calls `DataBlock`, `URLSource` and `scripts/model_examples/anthropic_multiagent.py:42` 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 (16 lines × 2) scripts/model_examples/gemini_multiagent.py:19 — scripts/model_examples/gemini_multiagent.py:19-39 | scripts/model_examples/gemini_multiagent_multimodal.py:19-34 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from 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, `scripts/model_examples/gemini_multiagent_multimodal.py:36` calls `DataBlock`, `URLSource` and `scripts/model_examples/gemini_multiagent.py:42` 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.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×4
  • Duplicated block (13 lines × 2) src/agentscope/app/channel/_discord/_channel.py:325 — src/agentscope/app/channel/_discord/_channel.py:325-337 | src/agentscope/app/channel/_feishu/_channel.py:672-684 — 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) src/agentscope/app/storage/_redis_storage.py:859 — src/agentscope/app/storage/_redis_storage.py:859-871 | src/agentscope/app/storage/_sql/_storage.py:563-575 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13 lines × 2) src/agentscope/formatter/_dashscope_formatter.py:196 — src/agentscope/formatter/_dashscope_formatter.py:196-208 | src/agentscope/formatter/_gemini_formatter.py:85-97 — 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 (13 lines × 2) src/agentscope/workspace/_local_workspace.py:709 — src/agentscope/workspace/_local_workspace.py:709-721 | src/agentscope/workspace/_sandboxed_base.py:345-357 — 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.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×4
  • Duplicated block (10 lines × 2) src/agentscope/formatter/_xai_formatter.py:233 — src/agentscope/formatter/_xai_formatter.py:233-242 | src/agentscope/formatter/_xai_formatter.py:301-310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_xai_formatter.py:233` 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) src/agentscope/model/_moonshot/_model.py:373 — src/agentscope/model/_moonshot/_model.py:373-382 | src/agentscope/model/_ollama/_model.py:315-324 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/model/_moonshot/_model.py:373` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) src/agentscope/workspace/_base.py:630 — src/agentscope/workspace/_base.py:630-639 | src/agentscope/workspace/_sandboxed_base.py:285-294 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) src/agentscope/app/workspace_manager/_docker_workspace_manager.py:415 — src/agentscope/app/workspace_manager/_docker_workspace_manager.py:415-424 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:422-431 — before extracting anything, compare `src/agentscope/app/workspace_manager/_docker_workspace_manager.py` and `src/agentscope/app/workspace_manager/_e2b_workspace_manager.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 146 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/agentscope/formatter/_dashscope_formatter.py:506 — src/agentscope/formatter/_dashscope_formatter.py:506-567 | src/agentscope/formatter/_moonshot_formatter.py:425-460 | src/agentscope/formatter/_openai_formatter.py:504-566 | src/agentscope/formatter/_openai_response_formatter.py:491-536 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/agentscope/model/_dashscope/_model.py:200 — src/agentscope/model/_dashscope/_model.py:200-280 | src/agentscope/model/_deepseek/_model.py:165-237 | src/agentscope/model/_moonshot/_model.py:164-242 | src/agentscope/model/_volcengine/_model.py:167-240 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/agentscope/realtime/_dashscope/_model.py:275 — src/agentscope/realtime/_dashscope/_model.py:275-289 | src/agentscope/realtime/_gemini/_model.py:319-333 | src/agentscope/realtime/_openai/_model.py:284-298 | src/agentscope/realtime/_xai/_model.py:251-265 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×3
  • Duplicated block (28 lines × 2) src/agentscope/model/_anthropic/_model.py:585 — src/agentscope/model/_anthropic/_model.py:585-612 | src/agentscope/model/_gemini/_model.py:542-571 — 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 (28 lines × 2) src/agentscope/tool/_builtin/_edit.py:96 — src/agentscope/tool/_builtin/_edit.py:96-123 | src/agentscope/tool/_builtin/_write.py:72-100 — before extracting anything, compare `src/agentscope/tool/_builtin/_edit.py` and `src/agentscope/tool/_builtin/_write.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 146 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (28 lines × 2) examples/long_term_memory/mem0/oss_demo.py:273 — examples/long_term_memory/mem0/oss_demo.py:273-300 | examples/long_term_memory/mem0/oss_demo.py:305-332 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×3
  • Duplicated block (17 lines × 2) src/agentscope/app/_router/_session.py:327 — src/agentscope/app/_router/_session.py:327-343 | src/agentscope/app/_router/_session.py:515-533 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/_router/_session.py:515` 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 (17 lines × 2) src/agentscope/realtime/_openai/_model.py:301 — src/agentscope/realtime/_openai/_model.py:301-317 | src/agentscope/realtime/_xai/_model.py:268-284 — `src/agentscope/realtime/_openai/_model.py` and `src/agentscope/realtime/_xai/_model.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 61 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) examples/pipeline/goal/goal_pipeline.py:27 — examples/pipeline/goal/goal_pipeline.py:27-43 | examples/pipeline/goal/goal_pipeline.py:46-62 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×3
  • Duplicated block (12–13 lines × 2) .github/scripts/update_news.py:107 — .github/scripts/update_news.py:107-118 | .github/scripts/update_news.py:123-135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `.github/scripts/update_news.py:123` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12–13 lines × 2) src/agentscope/formatter/_volcengine_formatter.py:179 — src/agentscope/formatter/_volcengine_formatter.py:179-190 | src/agentscope/formatter/_volcengine_formatter.py:246-258 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_volcengine_formatter.py:179` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12–13 lines × 2) src/agentscope/model/_openai_chat/_model.py:235 — src/agentscope/model/_openai_chat/_model.py:235-247 | src/agentscope/model/_xai/_model.py:204-215 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×3
  • Duplicated block (8 lines × 2) src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py:319 — src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py:319-326 | src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py:400-407 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py:319` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/agentscope/realtime/_openai/_model.py:140 — src/agentscope/realtime/_openai/_model.py:140-147 | src/agentscope/realtime/_xai/_model.py:125-132 — `src/agentscope/realtime/_openai/_model.py` and `src/agentscope/realtime/_xai/_model.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 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (8 lines × 2) src/agentscope/tts/_dashscope/_model.py:41 — src/agentscope/tts/_dashscope/_model.py:41-48 | src/agentscope/tts/_openai/_model.py:36-43 — 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.
D6 · Cohesion (LCOM4) · Low cohesion · ×3
  • Low cohesion: BackendBase (LCOM4 9) src/agentscope/tool/_builtin/_backend.py:138 — BackendBase's methods fall into 9 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 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ChatUI (LCOM4 5) src/agentscope/tui/_chat.py:340 — ChatUI's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: InMemoryMessageBus (LCOM4 4) src/agentscope/app/message_bus/_in_memory_message_bus.py:30 — InMemoryMessageBus's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D36 · Supply-chain Provenance & Signing REDACTED · ×2
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (7 members, 50+ identical tokens) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:156 — src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:156-203 | src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:150-171 | src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:186-239 | src/agentscope/app/workspace_manager/_docker_workspace_manager.py:251-313 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:270-335 | src/agentscope/app/workspace_manager/_k8s_workspace_manager.py:180-225 | src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:206-269 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:269 — src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:269-283 | src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:247-261 | src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:314-328 | src/agentscope/app/workspace_manager/_docker_workspace_manager.py:447-461 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:454-468 | src/agentscope/app/workspace_manager/_k8s_workspace_manager.py:324-338 | src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:331-345 — 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 · Duplicated block (29 lines × 3) · ×2
  • Duplicated block (29 lines × 3) src/agentscope/model/_deepseek/_model.py:207 — src/agentscope/model/_deepseek/_model.py:207-235 | src/agentscope/model/_moonshot/_model.py:212-240 | src/agentscope/model/_volcengine/_model.py:210-238 — `src/agentscope/model/_deepseek/_model.py` and `src/agentscope/model/_moonshot/_model.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 9 separate duplicated blocks between them, totalling at least 208 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 (29 lines × 3) scripts/model_examples/openai_chat_multimodal.py:36 — scripts/model_examples/openai_chat_multimodal.py:36-64 | scripts/model_examples/openai_response_multimodal.py:32-60 | scripts/model_examples/xai_multimodal.py:34-62 — before extracting anything, compare `scripts/model_examples/openai_chat_multimodal.py` and `scripts/model_examples/openai_response_multimodal.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/model_examples/openai_chat_multimodal.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.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×2
  • Duplicated block (29 lines × 2) src/agentscope/formatter/_deepseek_formatter.py:168 — src/agentscope/formatter/_deepseek_formatter.py:168-196 | src/agentscope/formatter/_volcengine_formatter.py:222-250 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_volcengine_formatter.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_deepseek_formatter.py:168` 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 (29 lines × 2) src/agentscope/tool/_builtin/_glob.py:193 — src/agentscope/tool/_builtin/_glob.py:193-222 | src/agentscope/tool/_builtin/_grep.py:229-257 — 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.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×2
  • Duplicated block (27 lines × 2) src/agentscope/formatter/_dashscope_formatter.py:541 — src/agentscope/formatter/_dashscope_formatter.py:541-567 | src/agentscope/formatter/_openai_formatter.py:540-566 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_dashscope_formatter.py:541` 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 (27 lines × 2) src/agentscope/app/channel/_dingtalk/_channel.py:525 — src/agentscope/app/channel/_dingtalk/_channel.py:525-551 | src/agentscope/app/channel/_feishu/_channel.py:946-973 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `ToolBase` names `.....tool` in one and `....tool` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×2
  • Duplicated block (25 lines × 2) src/agentscope/realtime/_dashscope/_model.py:368 — src/agentscope/realtime/_dashscope/_model.py:368-392 | src/agentscope/realtime/_xai/_model.py:324-348 — `src/agentscope/realtime/_dashscope/_model.py` and `src/agentscope/realtime/_xai/_model.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 3 separate duplicated blocks between them, totalling at least 61 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 `src/agentscope/realtime/_dashscope/_model.py:368` 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 (25 lines × 2) scripts/model_examples/dashscope_multimodal.py:158 — scripts/model_examples/dashscope_multimodal.py:158-183 | scripts/model_examples/minimax_multimodal.py:154-178 — before extracting anything, compare `scripts/model_examples/dashscope_multimodal.py` and `scripts/model_examples/minimax_multimodal.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×2
  • Duplicated block (22 lines × 2) src/agentscope/formatter/_deepseek_formatter.py:86 — src/agentscope/formatter/_deepseek_formatter.py:86-107 | src/agentscope/formatter/_deepseek_formatter.py:153-174 — both copies are in the same file, so extract the 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) src/agentscope/formatter/_volcengine_formatter.py:144 — src/agentscope/formatter/_volcengine_formatter.py:144-165 | src/agentscope/formatter/_volcengine_formatter.py:207-228 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (20 lines × 3) · ×2
  • Duplicated block (20 lines × 3) src/agentscope/formatter/_dashscope_formatter.py:287 — src/agentscope/formatter/_dashscope_formatter.py:287-306 | src/agentscope/formatter/_moonshot_formatter.py:176-195 | src/agentscope/formatter/_openai_formatter.py:304-323 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 119 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 3) src/agentscope/model/_moonshot/_model.py:396 — src/agentscope/model/_moonshot/_model.py:396-415 | src/agentscope/model/_openai_chat/_model.py:547-566 | src/agentscope/model/_openai_response/_model.py:531-550 — `src/agentscope/model/_moonshot/_model.py` and `src/agentscope/model/_openai_chat/_model.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 9 separate duplicated blocks between them, totalling at least 168 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 `src/agentscope/model/_moonshot/_model.py:396` 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.
D4 · Code Duplication · Duplicated block (18–20 lines × 2) · ×2
  • Duplicated block (18–20 lines × 2) REDACTED:729 — REDACTED:729-748 | REDACTED:841-858 — both copies are in the same file, so extract the 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:729` 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 (18–20 lines × 2) src/agentscope/embedding/_dashscope/_model.py:374 — src/agentscope/embedding/_dashscope/_model.py:374-393 | src/agentscope/embedding/_dashscope/_model.py:460-477 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/embedding/_dashscope/_model.py:374` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×2
  • Duplicated block (19 lines × 2) src/agentscope/model/_moonshot/_model.py:279 — src/agentscope/model/_moonshot/_model.py:279-297 | src/agentscope/model/_openai_chat/_model.py:350-368 — `src/agentscope/model/_moonshot/_model.py` and `src/agentscope/model/_openai_chat/_model.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 9 separate duplicated blocks between them, totalling at least 168 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 (19 lines × 2) src/agentscope/rag/_parser/_word.py:139 — src/agentscope/rag/_parser/_word.py:139-157 | src/agentscope/rag/_parser/_word.py:161-179 — both copies are in the same file, so extract the 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.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×2
  • Duplicated block (17–18 lines × 2) src/agentscope/app/channel/_feishu/_channel.py:922 — src/agentscope/app/channel/_feishu/_channel.py:922-939 | src/agentscope/app/channel/_feishu/_channel.py:1089-1105 — both copies are in the same file, so extract the 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–18 lines × 2) src/agentscope/embedding/_embedding_base.py:338 — src/agentscope/embedding/_embedding_base.py:338-354 | src/agentscope/model/_base.py:224-241 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/embedding/_embedding_base.py:338` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/agentscope/model/_base.py:241` calls `warning` and `src/agentscope/embedding/_embedding_base.py:355` 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.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×2
  • Duplicated block (18 lines × 2) src/agentscope/formatter/_moonshot_formatter.py:160 — src/agentscope/formatter/_moonshot_formatter.py:160-177 | src/agentscope/formatter/_moonshot_formatter.py:219-236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) src/agentscope/model/_deepseek/_model.py:387 — src/agentscope/model/_deepseek/_model.py:387-404 | src/agentscope/model/_xai/_model.py:437-454 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/model/_deepseek/_model.py:387` 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.
D4 · Code Duplication · Duplicated block (17 lines × 4) · ×2
  • Duplicated block (17 lines × 4) src/agentscope/model/_dashscope/_model.py:455 — src/agentscope/model/_dashscope/_model.py:455-471 | src/agentscope/model/_deepseek/_model.py:367-383 | src/agentscope/model/_moonshot/_model.py:375-391 | src/agentscope/model/_volcengine/_model.py:371-387 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 171 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, `src/agentscope/model/_moonshot/_model.py:392` calls `getattr` and `src/agentscope/model/_deepseek/_model.py:384` 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 × 4) src/agentscope/model/_deepseek/_model.py:258 — src/agentscope/model/_deepseek/_model.py:258-274 | src/agentscope/model/_moonshot/_model.py:263-279 | src/agentscope/model/_openai_chat/_model.py:334-350 | src/agentscope/model/_volcengine/_model.py:261-277 — `src/agentscope/model/_deepseek/_model.py` and `src/agentscope/model/_moonshot/_model.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 9 separate duplicated blocks between them, totalling at least 208 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, `src/agentscope/model/_moonshot/_model.py:283` calls `getattr` and `src/agentscope/model/_deepseek/_model.py:278` 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.
D4 · Code Duplication · Duplicated block (15 lines × 4) · ×2
  • Duplicated block (15 lines × 4) src/agentscope/model/_moonshot/_model.py:281 — src/agentscope/model/_moonshot/_model.py:281-295 | src/agentscope/model/_moonshot/_model.py:390-404 | src/agentscope/model/_openai_chat/_model.py:352-366 | src/agentscope/model/_openai_chat/_model.py:541-555 — `src/agentscope/model/_moonshot/_model.py` and `src/agentscope/model/_openai_chat/_model.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 9 separate duplicated blocks between them, totalling at least 168 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 × 4) src/agentscope/realtime/_dashscope/_model.py:275 — src/agentscope/realtime/_dashscope/_model.py:275-289 | src/agentscope/realtime/_gemini/_model.py:319-333 | src/agentscope/realtime/_openai/_model.py:284-298 | src/agentscope/realtime/_xai/_model.py:251-265 — `src/agentscope/realtime/_dashscope/_model.py` and `src/agentscope/realtime/_xai/_model.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 3 separate duplicated blocks between them, totalling at least 61 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.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×2
  • Duplicated block (14 lines × 2) src/agentscope/formatter/_dashscope_formatter.py:186 — src/agentscope/formatter/_dashscope_formatter.py:186-199 | src/agentscope/formatter/_openai_formatter.py:153-167 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) scripts/model_examples/openai_chat_multiagent_multimodal.py:24 — scripts/model_examples/openai_chat_multiagent_multimodal.py:24-37 | scripts/model_examples/openai_response_multiagent_multimodal.py:24-37 — before extracting anything, compare `scripts/model_examples/openai_chat_multiagent_multimodal.py` and `scripts/model_examples/openai_response_multiagent_multimodal.py` as WHOLE FILES: 87% 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 `scripts/model_examples/openai_chat_multiagent_multimodal.py:24` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×2
  • Duplicated block (11–13 lines × 2) src/agentscope/app/storage/_redis_storage.py:2421 — src/agentscope/app/storage/_redis_storage.py:2421-2433 | src/agentscope/app/storage/_redis_storage.py:2465-2475 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–13 lines × 2) src/agentscope/model/_volcengine/_model.py:279 — src/agentscope/model/_volcengine/_model.py:279-291 | src/agentscope/model/_volcengine/_model.py:386-396 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×2
  • Duplicated block (11 lines × 2) src/agentscope/app/_router/_schema/_hub_mcp.py:92 — src/agentscope/app/_router/_schema/_hub_mcp.py:92-102 | src/agentscope/app/_router/_schema/_hub_skill.py:69-79 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/_router/_schema/_hub_mcp.py:92` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) src/agentscope/app/storage/_sql/_storage.py:2091 — src/agentscope/app/storage/_sql/_storage.py:2091-2101 | src/agentscope/app/storage/_sql/_storage.py:2129-2139 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/storage/_sql/_storage.py:2091` 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.
D4 · Code Duplication · Duplicated block (10 lines × 8) · ×2
  • Duplicated block (10 lines × 8) src/agentscope/formatter/_anthropic_formatter.py:430 — src/agentscope/formatter/_anthropic_formatter.py:430-439 | src/agentscope/formatter/_dashscope_formatter.py:468-477 | src/agentscope/formatter/_deepseek_formatter.py:281-290 | src/agentscope/formatter/_gemini_formatter.py:339-348 | src/agentscope/formatter/_moonshot_formatter.py:387-396 | src/agentscope/formatter/_ollama_formatter.py:373-382 | src/agentscope/formatter/_openai_formatter.py:466-475 | src/agentscope/formatter/_volcengine_formatter.py:329-338 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 8 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_anthropic_formatter.py:430` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 8) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:222 — src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:222-231 | src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:206-215 | src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:258-272 | src/agentscope/app/workspace_manager/_docker_workspace_manager.py:370-384 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:396-410 | src/agentscope/app/workspace_manager/_k8s_workspace_manager.py:279-288 | src/agentscope/app/workspace_manager/_local_workspace_manager.py:182-197 | src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:281-294 — before extracting anything, compare `src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py` and `src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×2
  • Duplicated block (9 lines × 2) src/agentscope/app/storage/_redis_storage.py:478 — src/agentscope/app/storage/_redis_storage.py:478-486 | src/agentscope/app/storage/_redis_storage.py:613-621 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) src/agentscope/formatter/_deepseek_formatter.py:112 — src/agentscope/formatter/_deepseek_formatter.py:112-120 | src/agentscope/formatter/_volcengine_formatter.py:174-183 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_volcengine_formatter.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_deepseek_formatter.py:112` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×2
  • Duplicated block (7 lines × 4) src/agentscope/formatter/_dashscope_formatter.py:258 — src/agentscope/formatter/_dashscope_formatter.py:258-264 | src/agentscope/formatter/_deepseek_formatter.py:68-74 | src/agentscope/formatter/_openai_formatter.py:279-285 | src/agentscope/formatter/_volcengine_formatter.py:127-133 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_deepseek_formatter.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) src/agentscope/formatter/_dashscope_formatter.py:516 — src/agentscope/formatter/_dashscope_formatter.py:516-523 | src/agentscope/formatter/_moonshot_formatter.py:432-438 | src/agentscope/formatter/_openai_formatter.py:515-522 | src/agentscope/formatter/_openai_response_formatter.py:509-515 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 119 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×2
  • Duplicated block (7 lines × 2) src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:113 — src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:113-119 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:135-141 — before extracting anything, compare `src/agentscope/app/workspace_manager/_daytona_workspace_manager.py` and `src/agentscope/app/workspace_manager/_e2b_workspace_manager.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) src/agentscope/tui/_ask_user.py:196 — src/agentscope/tui/_ask_user.py:196-202 | src/agentscope/tui/_chat.py:194-200 — 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.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×2
  • Duplicated block (6 lines × 2) src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:94 — src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:94-99 | src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:148-153 — before extracting anything, compare `src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py` and `src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) src/agentscope/app/_router/_mcp.py:27 — src/agentscope/app/_router/_mcp.py:27-32 | src/agentscope/app/_router/_skill.py:22-27 — 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.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×2
  • Duplicated block (8 lines × 3) src/agentscope/app/_router/_skill.py:36 — src/agentscope/app/_router/_skill.py:36-43 | src/agentscope/app/_router/_sop.py:47-54 | src/agentscope/app/_router/_sop.py:62-69 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `storage` to `StorageBase = Depends(get_storage)` in one and `StorageBase` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 3) examples/long_term_memory/agentic_memory/main.py:135 — examples/long_term_memory/agentic_memory/main.py:135-142 | examples/long_term_memory/mem0/oss_demo.py:131-138 | examples/long_term_memory/reme/reme_demo.py:178-185 — 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, `examples/long_term_memory/reme/reme_demo.py:175` calls `reply_stream`, `_announce_memory` and `examples/long_term_memory/mem0/oss_demo.py:129` 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.
D4 · Code Duplication · Duplicated block (28 lines × 6) · ×2
  • Duplicated block (28 lines × 6) scripts/model_examples/gemini_multimodal.py:79 — scripts/model_examples/gemini_multimodal.py:79-106 | scripts/model_examples/moonshot_multimodal.py:72-100 | scripts/model_examples/ollama_multimodal.py:72-99 | scripts/model_examples/openai_chat_multimodal.py:77-105 | scripts/model_examples/openai_response_multimodal.py:73-101 | scripts/model_examples/xai_multimodal.py:75-103 — before extracting anything, compare `scripts/model_examples/openai_chat_multimodal.py` and `scripts/model_examples/openai_response_multimodal.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/model_examples/moonshot_multimodal.py:67` calls `Parameters` and `scripts/model_examples/ollama_multimodal.py:67` 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 (28 lines × 6) scripts/model_examples/gemini_multimodal.py:110 — scripts/model_examples/gemini_multimodal.py:110-137 | scripts/model_examples/moonshot_multimodal.py:104-131 | scripts/model_examples/ollama_multimodal.py:103-130 | scripts/model_examples/openai_chat_multimodal.py:109-136 | scripts/model_examples/openai_response_multimodal.py:105-132 | scripts/model_examples/xai_multimodal.py:107-134 — before extracting anything, compare `scripts/model_examples/openai_chat_multimodal.py` and `scripts/model_examples/openai_response_multimodal.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
X1 · Async correctness · Task from `asyncio.create_task` is not kept · ×2
  • Task from `asyncio.create_task` is not kept src/agentscope/app/middleware/_tool_offload_middleware.py:356 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept src/agentscope/middleware/_longterm_memory/_mem0/_middleware.py:741 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
D1 · Cyclomatic Complexity · ChatService._run_impl (cyclomatic 79) · ×1
  • ChatService._run_impl (cyclomatic 79) src/agentscope/app/_service/_chat.py:786 — ChatService._run_impl has cyclomatic complexity 79 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BashCommandParser.check_sed_constraints (cyclomatic 60) · ×1
  • BashCommandParser.check_sed_constraints (cyclomatic 60) src/agentscope/tool/_builtin/_bash_parser.py:691 — BashCommandParser.check_sed_constraints 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.
D1 · Cyclomatic Complexity · Msg.append_event (cyclomatic 54) · ×1
  • Msg.append_event (cyclomatic 54) src/agentscope/message/_base.py:243 — Msg.append_event has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DeepSeekChatFormatter.format (cyclomatic 46) · ×1
  • DeepSeekChatFormatter.format (cyclomatic 46) src/agentscope/formatter/_deepseek_formatter.py:45 — DeepSeekChatFormatter.format 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.
D1 · Cyclomatic Complexity · XAIChatFormatter.format (cyclomatic 44) · ×1
  • XAIChatFormatter.format (cyclomatic 44) src/agentscope/formatter/_xai_formatter.py:121 — XAIChatFormatter.format has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MoonshotChatFormatter.format (cyclomatic 43) · ×1
  • MoonshotChatFormatter.format (cyclomatic 43) src/agentscope/formatter/_moonshot_formatter.py:105 — MoonshotChatFormatter.format 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.
D1 · Cyclomatic Complexity · VolcengineChatFormatter.format (cyclomatic 42) · ×1
  • VolcengineChatFormatter.format (cyclomatic 42) src/agentscope/formatter/_volcengine_formatter.py:102 — VolcengineChatFormatter.format 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.
D1 · Cyclomatic Complexity · _AnthropicFormatterBase._format_messages (cyclomatic 40) · ×1
  • _AnthropicFormatterBase._format_messages (cyclomatic 40) src/agentscope/formatter/_anthropic_formatter.py:33 — _AnthropicFormatterBase._format_messages has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DashScopeChatFormatter.format (cyclomatic 40) · ×1
  • DashScopeChatFormatter.format (cyclomatic 40) src/agentscope/formatter/_dashscope_formatter.py:231 — DashScopeChatFormatter.format has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Agent._reply_impl (cyclomatic 39) · ×1
  • Agent._reply_impl (cyclomatic 39) src/agentscope/agent/_agent.py:1035 — Agent._reply_impl 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.
D1 · Cyclomatic Complexity · GoalPipeline.reply_stream (cyclomatic 38) · ×1
  • GoalPipeline.reply_stream (cyclomatic 38) src/agentscope/pipeline/_goal_pipeline.py:112 — GoalPipeline.reply_stream 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.
D1 · Cyclomatic Complexity · OllamaChatFormatter.format (cyclomatic 37) · ×1
  • OllamaChatFormatter.format (cyclomatic 37) src/agentscope/formatter/_ollama_formatter.py:118 — OllamaChatFormatter.format 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.
D1 · Cyclomatic Complexity · OpenAIChatFormatter.format (cyclomatic 36) · ×1
  • OpenAIChatFormatter.format (cyclomatic 36) src/agentscope/formatter/_openai_formatter.py:252 — OpenAIChatFormatter.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.
D1 · Cyclomatic Complexity · Agent._inject_runtime_state (cyclomatic 35) · ×1
  • Agent._inject_runtime_state (cyclomatic 35) src/agentscope/agent/_agent.py:1365 — Agent._inject_runtime_state 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.
D1 · Cyclomatic Complexity · GeminiChatFormatter.format (cyclomatic 33) · ×1
  • GeminiChatFormatter.format (cyclomatic 33) src/agentscope/formatter/_gemini_formatter.py:132 — GeminiChatFormatter.format 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.
D1 · Cyclomatic Complexity · OpenAIResponseFormatter.format (cyclomatic 33) · ×1
  • OpenAIResponseFormatter.format (cyclomatic 33) src/agentscope/formatter/_openai_response_formatter.py:178 — OpenAIResponseFormatter.format 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.
D1 · Cyclomatic Complexity · OpenAIChatModel._parse_stream_response (cyclomatic 33) · ×1
  • OpenAIChatModel._parse_stream_response (cyclomatic 33) src/agentscope/model/_openai_chat/_model.py:303 — OpenAIChatModel._parse_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.
D1 · Cyclomatic Complexity · DashScopeChatModel._parse_stream_response (cyclomatic 31) · ×1
  • DashScopeChatModel._parse_stream_response (cyclomatic 31) src/agentscope/model/_dashscope/_model.py:282 — DashScopeChatModel._parse_stream_response 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.
D1 · Cyclomatic Complexity · Grep.call (cyclomatic 31) · ×1
  • Grep.call (cyclomatic 31) src/agentscope/tool/_builtin/_grep.py:320 — Grep.call 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.
D1 · Cyclomatic Complexity · TaskUpdate.call (cyclomatic 31) · ×1
  • TaskUpdate.call (cyclomatic 31) src/agentscope/tool/_task/_update_task.py:135 — TaskUpdate.call 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.
D1 · Cyclomatic Complexity · FeishuChannel._normalize (cyclomatic 30) · ×1
  • FeishuChannel._normalize (cyclomatic 30) src/agentscope/app/channel/_feishu/_channel.py:378 — FeishuChannel._normalize 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.
D1 · Cyclomatic Complexity · OpenAIResponseModel._parse_stream_response (cyclomatic 29) · ×1
  • OpenAIResponseModel._parse_stream_response (cyclomatic 29) src/agentscope/model/_openai_response/_model.py:256 — OpenAIResponseModel._parse_stream_response 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.
D1 · Cyclomatic Complexity · AGUIProtocolMiddleware._to_agui_event (cyclomatic 28) · ×1
  • AGUIProtocolMiddleware._to_agui_event (cyclomatic 28) src/agentscope/app/middleware/_protocol/_agui.py:71 — AGUIProtocolMiddleware._to_agui_event has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Agent._execute_tool_call (cyclomatic 27) · ×1
  • Agent._execute_tool_call (cyclomatic 27) src/agentscope/agent/_agent.py:2426 — Agent._execute_tool_call 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.
D1 · Cyclomatic Complexity · RealtimeAgent._on_model_event (cyclomatic 26) · ×1
  • RealtimeAgent._on_model_event (cyclomatic 26) src/agentscope/agent/_realtime/_agent.py:675 — RealtimeAgent._on_model_event has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GitHubMCPHub._to_card (cyclomatic 26) · ×1
  • GitHubMCPHub._to_card (cyclomatic 26) src/agentscope/app/hub/_mcp/_github_hub.py:299 — GitHubMCPHub._to_card has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · _model._sanitize_schema_for_gemini (cyclomatic 26) · ×1
  • _model._sanitize_schema_for_gemini (cyclomatic 26) src/agentscope/model/_gemini/_model.py:33 — _model._sanitize_schema_for_gemini 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.
D1 · Cyclomatic Complexity · MessageUI.apply (cyclomatic 26) · ×1
  • MessageUI.apply (cyclomatic 26) src/agentscope/tui/_messages.py:620 — MessageUI.apply 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.
D1 · Cyclomatic Complexity · DashScopeRealtimeModel._parse (cyclomatic 25) · ×1
  • DashScopeRealtimeModel._parse (cyclomatic 25) src/agentscope/realtime/_dashscope/_model.py:327 — DashScopeRealtimeModel._parse has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · RealtimeAgent.connect (cyclomatic 24) · ×1
  • RealtimeAgent.connect (cyclomatic 24) src/agentscope/agent/_realtime/_agent.py:218 — RealtimeAgent.connect 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.
D1 · Cyclomatic Complexity · DingTalkChannel.send_response (cyclomatic 24) · ×1
  • DingTalkChannel.send_response (cyclomatic 24) src/agentscope/app/channel/_dingtalk/_channel.py:301 — DingTalkChannel.send_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.
D1 · Cyclomatic Complexity · OpenAIRealtimeModel._parse (cyclomatic 24) · ×1
  • OpenAIRealtimeModel._parse (cyclomatic 24) src/agentscope/realtime/_openai/_model.py:320 — OpenAIRealtimeModel._parse has cyclomatic complexity 24 (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.
D1 · Cyclomatic Complexity · A2AAgent._reply (cyclomatic 23) · ×1
  • A2AAgent._reply (cyclomatic 23) src/agentscope/agent/_a2a_agent.py:324 — A2AAgent._reply 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.
D1 · Cyclomatic Complexity · Agent._split_context_for_compression (cyclomatic 23) · ×1
  • Agent._split_context_for_compression (cyclomatic 23) src/agentscope/agent/_agent.py:2873 — Agent._split_context_for_compression 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.
D1 · Cyclomatic Complexity · _app.create_app (cyclomatic 23) · ×1
  • _app.create_app (cyclomatic 23) src/agentscope/app/_app.py:113 — _app.create_app 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.
D1 · Cyclomatic Complexity · FeishuChannel.send_response (cyclomatic 23) · ×1
  • FeishuChannel.send_response (cyclomatic 23) src/agentscope/app/channel/_feishu/_channel.py:654 — FeishuChannel.send_response 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.
D1 · Cyclomatic Complexity · AnthropicChatModel._parse_anthropic_stream_completion_response (cyclomatic 23) · ×1
  • AnthropicChatModel._parse_anthropic_stream_completion_response (cyclomatic 23) src/agentscope/model/_anthropic/_model.py:415 — AnthropicChatModel._parse_anthropic_stream_completion_response 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.
D1 · Cyclomatic Complexity · Agent._limit_context_images (cyclomatic 22) · ×1
  • Agent._limit_context_images (cyclomatic 22) src/agentscope/agent/_agent.py:792 — Agent._limit_context_images 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.
D1 · Cyclomatic Complexity · WordParser.parse (cyclomatic 22) · ×1
  • WordParser.parse (cyclomatic 22) src/agentscope/rag/_parser/_word.py:245 — WordParser.parse 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.
D1 · Cyclomatic Complexity · Agent._reasoning_impl (cyclomatic 21) · ×1
  • Agent._reasoning_impl (cyclomatic 21) src/agentscope/agent/_agent.py:1698 — Agent._reasoning_impl 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.
D1 · Cyclomatic Complexity · Agent._convert_chat_response_to_event (cyclomatic 20) · ×1
  • Agent._convert_chat_response_to_event (cyclomatic 20) src/agentscope/agent/_agent.py:3757 — Agent._convert_chat_response_to_event has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TracingMiddleware.on_reply (cyclomatic 20) · ×1
  • TracingMiddleware.on_reply (cyclomatic 20) src/agentscope/middleware/_tracing/_trace.py:137 — TracingMiddleware.on_reply 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.
D1 · Cyclomatic Complexity · ChatResponse.append_chat_response (cyclomatic 20) · ×1
  • ChatResponse.append_chat_response (cyclomatic 20) src/agentscope/model/_model_response.py:240 — ChatResponse.append_chat_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.
D1 · Cyclomatic Complexity · MoonshotChatModel._parse_stream_response (cyclomatic 20) · ×1
  • MoonshotChatModel._parse_stream_response (cyclomatic 20) src/agentscope/model/_moonshot/_model.py:244 — MoonshotChatModel._parse_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.
D1 · Cyclomatic Complexity · OpenAIResponseModel._parse_completion_response (cyclomatic 20) · ×1
  • OpenAIResponseModel._parse_completion_response (cyclomatic 20) src/agentscope/model/_openai_response/_model.py:450 — OpenAIResponseModel._parse_completion_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.
D1 · Cyclomatic Complexity · VolcengineChatModel._parse_stream_response (cyclomatic 20) · ×1
  • VolcengineChatModel._parse_stream_response (cyclomatic 20) src/agentscope/model/_volcengine/_model.py:242 — VolcengineChatModel._parse_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.
D1 · Cyclomatic Complexity · TeamPipeline._reply (cyclomatic 20) · ×1
  • TeamPipeline._reply (cyclomatic 20) src/agentscope/pipeline/_team_pipeline.py:205 — TeamPipeline._reply has cyclomatic complexity 20 (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.
D1 · Cyclomatic Complexity · ToolResponse.append_chunk (cyclomatic 20) · ×1
  • ToolResponse.append_chunk (cyclomatic 20) src/agentscope/tool/_response.py:72 — ToolResponse.append_chunk 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.
D1 · Cyclomatic Complexity · Agent._compress_context_impl (cyclomatic 19) · ×1
  • Agent._compress_context_impl (cyclomatic 19) src/agentscope/agent/_agent.py:490 — Agent._compress_context_impl has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Agent._next_action (cyclomatic 19) · ×1
  • Agent._next_action (cyclomatic 19) src/agentscope/agent/_agent.py:3495 — Agent._next_action has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatModelBase.count_tokens (cyclomatic 19) · ×1
  • ChatModelBase.count_tokens (cyclomatic 19) src/agentscope/model/_base.py:377 — ChatModelBase.count_tokens has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DeepSeekChatModel._parse_stream_response (cyclomatic 19) · ×1
  • DeepSeekChatModel._parse_stream_response (cyclomatic 19) src/agentscope/model/_deepseek/_model.py:239 — DeepSeekChatModel._parse_stream_response has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAIChatModel._parse_completion_response (cyclomatic 19) · ×1
  • OpenAIChatModel._parse_completion_response (cyclomatic 19) src/agentscope/model/_openai_chat/_model.py:460 — OpenAIChatModel._parse_completion_response has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WebRTCSession._run (cyclomatic 18) · ×1
  • WebRTCSession._run (cyclomatic 18) src/agentscope/app/_service/_webrtc_session.py:124 — WebRTCSession._run 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.
D1 · Cyclomatic Complexity · ChannelBase._render (cyclomatic 18) · ×1
  • ChannelBase._render (cyclomatic 18) src/agentscope/app/channel/_base.py:429 — ChannelBase._render has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DingTalkChannel._on_callback (cyclomatic 18) · ×1
  • DingTalkChannel._on_callback (cyclomatic 18) src/agentscope/app/channel/_dingtalk/_channel.py:1017 — DingTalkChannel._on_callback 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.
D1 · Cyclomatic Complexity · FeishuChannel.start_listening (cyclomatic 18) · ×1
  • FeishuChannel.start_listening (cyclomatic 18) src/agentscope/app/channel/_feishu/_channel.py:183 — FeishuChannel.start_listening 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.
D1 · Cyclomatic Complexity · ChatModelBase.generate_structured_output (cyclomatic 18) · ×1
  • ChatModelBase.generate_structured_output (cyclomatic 18) src/agentscope/model/_base.py:465 — ChatModelBase.generate_structured_output has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DashScopeAudioRealtimeModel.replay_history (cyclomatic 18) · ×1
  • DashScopeAudioRealtimeModel.replay_history (cyclomatic 18) src/agentscope/realtime/_dashscope/_audio_model.py:77 — DashScopeAudioRealtimeModel.replay_history 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.
D1 · Cyclomatic Complexity · DashScopeCosyVoiceTTSModel._synthesize_realtime (cyclomatic 18) · ×1
  • DashScopeCosyVoiceTTSModel._synthesize_realtime (cyclomatic 18) src/agentscope/tts/_dashscope/_cosyvoice_model.py:263 — DashScopeCosyVoiceTTSModel._synthesize_realtime 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.
D1 · Cyclomatic Complexity · K8sWorkspace._wait_pod_running (cyclomatic 18) · ×1
  • K8sWorkspace._wait_pod_running (cyclomatic 18) src/agentscope/workspace/_k8s/_k8s_workspace.py:502 — K8sWorkspace._wait_pod_running 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.
D1 · Cyclomatic Complexity · SessionSOPStep.reply_stream (cyclomatic 17) · ×1
  • SessionSOPStep.reply_stream (cyclomatic 17) src/agentscope/app/_service/_sop.py:103 — SessionSOPStep.reply_stream 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.
D1 · Cyclomatic Complexity · WorkspaceService._parse_porcelain_v2 (cyclomatic 17) · ×1
  • WorkspaceService._parse_porcelain_v2 (cyclomatic 17) src/agentscope/app/_service/_workspace.py:567 — WorkspaceService._parse_porcelain_v2 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.
D1 · Cyclomatic Complexity · AnthropicChatModel._parse_anthropic_completion_response (cyclomatic 17) · ×1
  • AnthropicChatModel._parse_anthropic_completion_response (cyclomatic 17) src/agentscope/model/_anthropic/_model.py:307 — AnthropicChatModel._parse_anthropic_completion_response 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.
D1 · Cyclomatic Complexity · GeminiRealtimeModel._parse_content (cyclomatic 17) · ×1
  • GeminiRealtimeModel._parse_content (cyclomatic 17) src/agentscope/realtime/_gemini/_model.py:423 — GeminiRealtimeModel._parse_content 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.
D1 · Cyclomatic Complexity · SOPStep.reply_stream (cyclomatic 17) · ×1
  • SOPStep.reply_stream (cyclomatic 17) src/agentscope/sop/_schema.py:229 — SOPStep.reply_stream 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.
D1 · Cyclomatic Complexity · BubblewrapBackend.__init__ (cyclomatic 17) · ×1
  • BubblewrapBackend.__init__ (cyclomatic 17) src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:47 — BubblewrapBackend.__init__ 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.
D1 · Cyclomatic Complexity · Agent.__init__ (cyclomatic 16) · ×1
  • Agent.__init__ (cyclomatic 16) src/agentscope/agent/_agent.py:120 — Agent.__init__ has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DingTalkChannel._parse_content (cyclomatic 16) · ×1
  • DingTalkChannel._parse_content (cyclomatic 16) src/agentscope/app/channel/_dingtalk/_channel.py:1069 — DingTalkChannel._parse_content 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.
D1 · Cyclomatic Complexity · OllamaMultiAgentFormatter._format_agent_message (cyclomatic 16) · ×1
  • OllamaMultiAgentFormatter._format_agent_message (cyclomatic 16) src/agentscope/formatter/_ollama_formatter.py:405 — OllamaMultiAgentFormatter._format_agent_message 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.
D1 · Cyclomatic Complexity · ReMeMiddleware.on_reply (cyclomatic 16) · ×1
  • ReMeMiddleware.on_reply (cyclomatic 16) src/agentscope/middleware/_longterm_memory/_reme/_middleware.py:312 — ReMeMiddleware.on_reply 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.
D1 · Cyclomatic Complexity · ChatModelBase._call_api_with_structured_output (cyclomatic 16) · ×1
  • ChatModelBase._call_api_with_structured_output (cyclomatic 16) src/agentscope/model/_base.py:603 — ChatModelBase._call_api_with_structured_output 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.
D1 · Cyclomatic Complexity · PPTParser._parse_slide (cyclomatic 16) · ×1
  • PPTParser._parse_slide (cyclomatic 16) src/agentscope/rag/_parser/_ppt.py:274 — PPTParser._parse_slide 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.
D1 · Cyclomatic Complexity · SOPEngine.reply_stream (cyclomatic 16) · ×1
  • SOPEngine.reply_stream (cyclomatic 16) src/agentscope/sop/_engine.py:76 — SOPEngine.reply_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.
D1 · Cyclomatic Complexity · BashCommandParser._is_single_command_read_only (cyclomatic 16) · ×1
  • BashCommandParser._is_single_command_read_only (cyclomatic 16) src/agentscope/tool/_builtin/_bash_parser.py:195 — BashCommandParser._is_single_command_read_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.
D1 · Cyclomatic Complexity · Edit.call (cyclomatic 16) · ×1
  • Edit.call (cyclomatic 16) src/agentscope/tool/_builtin/_edit.py:258 — Edit.call has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Glob.call (cyclomatic 16) · ×1
  • Glob.call (cyclomatic 16) src/agentscope/tool/_builtin/_glob.py:224 — Glob.call has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · _AnthropicFormatterBase._format_messages (cognitive 145) · ×1
  • _AnthropicFormatterBase._format_messages (cognitive 145) src/agentscope/formatter/_anthropic_formatter.py:33 — _AnthropicFormatterBase._format_messages has cognitive complexity 145 (threshold 15). Drivers by points: if/else 28 (110 pts), ternaries 4 (19 pts), loops 4 (13 pts), boolean chains 3 (nesting depth added 106). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · XAIChatFormatter.format (cognitive 140) · ×1
  • XAIChatFormatter.format (cognitive 140) src/agentscope/formatter/_xai_formatter.py:121 — XAIChatFormatter.format has cognitive complexity 140 (threshold 15). Drivers by points: if/else 27 (114 pts), loops 6 (24 pts), boolean chains 2 (nesting depth added 105). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ChatService._run_impl (cognitive 136) · ×1
  • ChatService._run_impl (cognitive 136) src/agentscope/app/_service/_chat.py:786 — ChatService._run_impl has cognitive complexity 136 (threshold 15). Drivers by points: if/else 41 (80 pts), error handling 7 (16 pts), boolean chains 14, loops 5 (13 pts), ternaries 9 (13 pts) (nesting depth added 60). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DeepSeekChatFormatter.format (cognitive 132) · ×1
  • DeepSeekChatFormatter.format (cognitive 132) src/agentscope/formatter/_deepseek_formatter.py:45 — DeepSeekChatFormatter.format has cognitive complexity 132 (threshold 15). Drivers by points: if/else 21 (83 pts), ternaries 6 (27 pts), loops 4 (13 pts), boolean chains 9 (nesting depth added 92). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MoonshotChatFormatter.format (cognitive 129) · ×1
  • MoonshotChatFormatter.format (cognitive 129) src/agentscope/formatter/_moonshot_formatter.py:105 — MoonshotChatFormatter.format has cognitive complexity 129 (threshold 15). Drivers by points: if/else 23 (94 pts), ternaries 3 (15 pts), loops 4 (13 pts), boolean chains 7 (nesting depth added 92). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · DashScopeChatFormatter.format (cognitive 114) · ×1
  • DashScopeChatFormatter.format (cognitive 114) src/agentscope/formatter/_dashscope_formatter.py:231 — DashScopeChatFormatter.format has cognitive complexity 114 (threshold 15). Drivers by points: if/else 23 (94 pts), loops 4 (13 pts), boolean chains 7 (nesting depth added 80). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · VolcengineChatFormatter.format (cognitive 113) · ×1
  • VolcengineChatFormatter.format (cognitive 113) src/agentscope/formatter/_volcengine_formatter.py:102 — VolcengineChatFormatter.format has cognitive complexity 113 (threshold 15). Drivers by points: if/else 22 (90 pts), loops 4 (13 pts), boolean chains 10 (nesting depth added 77). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · OllamaChatFormatter.format (cognitive 111) · ×1
  • OllamaChatFormatter.format (cognitive 111) src/agentscope/formatter/_ollama_formatter.py:118 — OllamaChatFormatter.format has cognitive complexity 111 (threshold 15). Drivers by points: if/else 20 (85 pts), loops 4 (13 pts), ternaries 2 (8 pts), boolean chains 5 (nesting depth added 80). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · GeminiChatFormatter.format (cognitive 110) · ×1
  • GeminiChatFormatter.format (cognitive 110) src/agentscope/formatter/_gemini_formatter.py:132 — GeminiChatFormatter.format has cognitive complexity 110 (threshold 15). Drivers by points: if/else 18 (78 pts), ternaries 4 (18 pts), loops 4 (13 pts), boolean chains 1 (nesting depth added 83). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · BashCommandParser.check_sed_constraints (cognitive 109) · ×1
  • BashCommandParser.check_sed_constraints (cognitive 109) src/agentscope/tool/_builtin/_bash_parser.py:691 — BashCommandParser.check_sed_constraints has cognitive complexity 109 (threshold 15). Drivers by points: if/else 30 (78 pts), boolean chains 16, loops 7 (12 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 54). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · OpenAIChatFormatter.format (cognitive 98) · ×1
  • OpenAIChatFormatter.format (cognitive 98) src/agentscope/formatter/_openai_formatter.py:252 — OpenAIChatFormatter.format has cognitive complexity 98 (threshold 15). Drivers by points: if/else 19 (78 pts), loops 4 (13 pts), boolean chains 7 (nesting depth added 68). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · OpenAIResponseFormatter.format (cognitive 94) · ×1
  • OpenAIResponseFormatter.format (cognitive 94) src/agentscope/formatter/_openai_response_formatter.py:178 — OpenAIResponseFormatter.format has cognitive complexity 94 (threshold 15). Drivers by points: if/else 19 (74 pts), ternaries 2 (10 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 68). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Agent._reply_impl (cognitive 86) · ×1
  • Agent._reply_impl (cognitive 86) src/agentscope/agent/_agent.py:1035 — Agent._reply_impl has cognitive complexity 86 (threshold 15). Drivers by points: if/else 25 (59 pts), loops 8 (22 pts), boolean chains 2, match/switch 1 (2 pts), error handling 1 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoalPipeline.reply_stream (cognitive 81) · ×1
  • GoalPipeline.reply_stream (cognitive 81) src/agentscope/pipeline/_goal_pipeline.py:112 — GoalPipeline.reply_stream has cognitive complexity 81 (threshold 15). Drivers by points: if/else 21 (54 pts), loops 7 (18 pts), boolean chains 7, ternaries 1 (2 pts) (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Msg.append_event (cognitive 71) · ×1
  • Msg.append_event (cognitive 71) src/agentscope/message/_base.py:243 — Msg.append_event has cognitive complexity 71 (threshold 15). Drivers by points: if/else 22 (48 pts), ternaries 3 (10 pts), loops 4 (8 pts), boolean chains 4, match/switch 1 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Agent._inject_runtime_state (cognitive 65) · ×1
  • Agent._inject_runtime_state (cognitive 65) src/agentscope/agent/_agent.py:1365 — Agent._inject_runtime_state has cognitive complexity 65 (threshold 15). Drivers by points: if/else 21 (46 pts), boolean chains 8, loops 3 (4 pts), ternaries 1 (4 pts), error handling 1 (3 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · OpenAIResponseModel._parse_stream_response (cognitive 64) · ×1
  • OpenAIResponseModel._parse_stream_response (cognitive 64) src/agentscope/model/_openai_response/_model.py:256 — OpenAIResponseModel._parse_stream_response has cognitive complexity 64 (threshold 15). Drivers by points: if/else 10 (33 pts), ternaries 5 (16 pts), loops 3 (10 pts), boolean chains 5 (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · OpenAIChatModel._parse_stream_response (cognitive 61) · ×1
  • OpenAIChatModel._parse_stream_response (cognitive 61) src/agentscope/model/_openai_chat/_model.py:303 — OpenAIChatModel._parse_stream_response has cognitive complexity 61 (threshold 15). Drivers by points: if/else 15 (35 pts), boolean chains 14, ternaries 3 (9 pts), loops 2 (3 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Agent._execute_tool_call (cognitive 60) · ×1
  • Agent._execute_tool_call (cognitive 60) src/agentscope/agent/_agent.py:2426 — Agent._execute_tool_call has cognitive complexity 60 (threshold 15). Drivers by points: if/else 14 (36 pts), loops 5 (13 pts), boolean chains 5, ternaries 1 (4 pts), error handling 2 (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · DashScopeChatModel._parse_stream_response (cognitive 59) · ×1
  • DashScopeChatModel._parse_stream_response (cognitive 59) src/agentscope/model/_dashscope/_model.py:282 — DashScopeChatModel._parse_stream_response has cognitive complexity 59 (threshold 15). Drivers by points: if/else 16 (37 pts), boolean chains 13, ternaries 2 (6 pts), loops 2 (3 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TaskUpdate.call (cognitive 59) · ×1
  • TaskUpdate.call (cognitive 59) src/agentscope/tool/_task/_update_task.py:135 — TaskUpdate.call has cognitive complexity 59 (threshold 15). Drivers by points: if/else 24 (42 pts), loops 6 (15 pts), boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordParser.parse (cognitive 55) · ×1
  • WordParser.parse (cognitive 55) src/agentscope/rag/_parser/_word.py:245 — WordParser.parse has cognitive complexity 55 (threshold 15). Drivers by points: if/else 11 (33 pts), loops 4 (15 pts), ternaries 1 (3 pts), boolean chains 2, error handling 2 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DingTalkChannel.send_response (cognitive 45) · ×1
  • DingTalkChannel.send_response (cognitive 45) src/agentscope/app/channel/_dingtalk/_channel.py:301 — DingTalkChannel.send_response has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (36 pts), loops 3 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatResponse.append_chat_response (cognitive 44) · ×1
  • ChatResponse.append_chat_response (cognitive 44) src/agentscope/model/_model_response.py:240 — ChatResponse.append_chat_response has cognitive complexity 44 (threshold 15). Drivers by points: if/else 8 (22 pts), ternaries 2 (10 pts), loops 3 (9 pts), boolean chains 3 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · DashScopeAudioRealtimeModel.replay_history (cognitive 44) · ×1
  • DashScopeAudioRealtimeModel.replay_history (cognitive 44) src/agentscope/realtime/_dashscope/_audio_model.py:77 — DashScopeAudioRealtimeModel.replay_history has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (29 pts), ternaries 3 (11 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Grep.call (cognitive 44) · ×1
  • Grep.call (cognitive 44) src/agentscope/tool/_builtin/_grep.py:320 — Grep.call has cognitive complexity 44 (threshold 15). Drivers by points: if/else 21 (32 pts), boolean chains 5, loops 3 (5 pts), error handling 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.
D2 · Cognitive Complexity · Agent._limit_context_images (cognitive 43) · ×1
  • Agent._limit_context_images (cognitive 43) src/agentscope/agent/_agent.py:792 — Agent._limit_context_images has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 6 (13 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _model._sanitize_schema_for_gemini (cognitive 43) · ×1
  • _model._sanitize_schema_for_gemini (cognitive 43) src/agentscope/model/_gemini/_model.py:33 — _model._sanitize_schema_for_gemini has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Agent._handle_incoming_event (cognitive 41) · ×1
  • Agent._handle_incoming_event (cognitive 41) src/agentscope/agent/_agent.py:1926 — Agent._handle_incoming_event has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 5 (18 pts), boolean chains 1 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · TTSMiddleware.on_reply (cognitive 40) · ×1
  • TTSMiddleware.on_reply (cognitive 40) src/agentscope/middleware/_tts_middleware.py:51 — TTSMiddleware.on_reply has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (26 pts), loops 4 (13 pts), boolean chains 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatModelBase.generate_structured_output (cognitive 40) · ×1
  • ChatModelBase.generate_structured_output (cognitive 40) src/agentscope/model/_base.py:465 — ChatModelBase.generate_structured_output has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 3 (5 pts), error handling 1 (3 pts), boolean chains 2, ternaries 1 (2 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.
D2 · Cognitive Complexity · ChatModelBase.count_tokens (cognitive 39) · ×1
  • ChatModelBase.count_tokens (cognitive 39) src/agentscope/model/_base.py:377 — ChatModelBase.count_tokens has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (26 pts), loops 4 (13 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TeamPipeline._reply (cognitive 39) · ×1
  • TeamPipeline._reply (cognitive 39) src/agentscope/pipeline/_team_pipeline.py:205 — TeamPipeline._reply has cognitive complexity 39 (threshold 15). Drivers by points: loops 8 (20 pts), if/else 7 (16 pts), boolean chains 3 (nesting depth added 21). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · A2AAgent._reply (cognitive 38) · ×1
  • A2AAgent._reply (cognitive 38) src/agentscope/agent/_a2a_agent.py:324 — A2AAgent._reply has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 4 (7 pts), ternaries 2 (6 pts), error handling 1 (2 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageUI.apply (cognitive 37) · ×1
  • MessageUI.apply (cognitive 37) src/agentscope/tui/_messages.py:620 — MessageUI.apply has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 7, loops 4 (7 pts), ternaries 4 (7 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FeishuChannel.send_response (cognitive 36) · ×1
  • FeishuChannel.send_response (cognitive 36) src/agentscope/app/channel/_feishu/_channel.py:654 — FeishuChannel.send_response has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (29 pts), boolean chains 5, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Agent._handle_incoming_messages (cognitive 35) · ×1
  • Agent._handle_incoming_messages (cognitive 35) src/agentscope/agent/_agent.py:2035 — Agent._handle_incoming_messages has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 2 (5 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MoonshotChatModel._parse_stream_response (cognitive 35) · ×1
  • MoonshotChatModel._parse_stream_response (cognitive 35) src/agentscope/model/_moonshot/_model.py:244 — MoonshotChatModel._parse_stream_response has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 3 (9 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VolcengineChatModel._parse_stream_response (cognitive 35) · ×1
  • VolcengineChatModel._parse_stream_response (cognitive 35) src/agentscope/model/_volcengine/_model.py:242 — VolcengineChatModel._parse_stream_response has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 3 (9 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PPTParser._parse_slide (cognitive 35) · ×1
  • PPTParser._parse_slide (cognitive 35) src/agentscope/rag/_parser/_ppt.py:274 — PPTParser._parse_slide has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (24 pts), error handling 2 (6 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · K8sWorkspace._wait_pod_running (cognitive 35) · ×1
  • K8sWorkspace._wait_pod_running (cognitive 35) src/agentscope/workspace/_k8s/_k8s_workspace.py:502 — K8sWorkspace._wait_pod_running has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (19 pts), boolean chains 7, loops 3 (7 pts), ternaries 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RealtimeAgent.connect (cognitive 34) · ×1
  • RealtimeAgent.connect (cognitive 34) src/agentscope/agent/_realtime/_agent.py:218 — RealtimeAgent.connect has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (2 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkspaceService._parse_porcelain_v2 (cognitive 34) · ×1
  • WorkspaceService._parse_porcelain_v2 (cognitive 34) src/agentscope/app/_service/_workspace.py:567 — WorkspaceService._parse_porcelain_v2 has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (25 pts), ternaries 2 (8 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIChatModel._parse_completion_response (cognitive 34) · ×1
  • OpenAIChatModel._parse_completion_response (cognitive 34) src/agentscope/model/_openai_chat/_model.py:460 — OpenAIChatModel._parse_completion_response has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 5, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · GeminiTTSModel._parse_stream_into_async_generator (cognitive 34) · ×1
  • GeminiTTSModel._parse_stream_into_async_generator (cognitive 34) src/agentscope/tts/_gemini/_model.py:242 — GeminiTTSModel._parse_stream_into_async_generator has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _app.create_app (cognitive 33) · ×1
  • _app.create_app (cognitive 33) src/agentscope/app/_app.py:113 — _app.create_app has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 7, loops 5 (6 pts), ternaries 3 (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.
D2 · Cognitive Complexity · GeminiChatModel._parse_stream_response (cognitive 33) · ×1
  • GeminiChatModel._parse_stream_response (cognitive 33) src/agentscope/model/_gemini/_model.py:341 — GeminiChatModel._parse_stream_response has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (24 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · _word._extract_text_from_paragraph (cognitive 33) · ×1
  • _word._extract_text_from_paragraph (cognitive 33) src/agentscope/rag/_parser/_word.py:38 — _word._extract_text_from_paragraph has cognitive complexity 33 (threshold 15). Drivers by points: loops 7 (19 pts), if/else 5 (14 pts) (nesting depth added 21). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · SOPEngine.reply_stream (cognitive 33) · ×1
  • SOPEngine.reply_stream (cognitive 33) src/agentscope/sop/_engine.py:76 — SOPEngine.reply_stream has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 3 (6 pts), ternaries 2 (5 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.
D2 · Cognitive Complexity · Agent._split_context_for_compression (cognitive 32) · ×1
  • Agent._split_context_for_compression (cognitive 32) src/agentscope/agent/_agent.py:2873 — Agent._split_context_for_compression has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (23 pts), loops 5 (6 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FeishuChannel.start_listening (cognitive 32) · ×1
  • FeishuChannel.start_listening (cognitive 32) src/agentscope/app/channel/_feishu/_channel.py:183 — FeishuChannel.start_listening has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (7 pts), error handling 2 (4 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FeishuChannel._normalize (cognitive 32) · ×1
  • FeishuChannel._normalize (cognitive 32) src/agentscope/app/channel/_feishu/_channel.py:378 — FeishuChannel._normalize has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 13, if/else 7 (8 pts), ternaries 5 (8 pts), loops 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DeepSeekChatModel._parse_stream_response (cognitive 32) · ×1
  • DeepSeekChatModel._parse_stream_response (cognitive 32) src/agentscope/model/_deepseek/_model.py:239 — DeepSeekChatModel._parse_stream_response has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 7, ternaries 2 (6 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _glob_helper._match_parts (cognitive 32) · ×1
  • _glob_helper._match_parts (cognitive 32) src/agentscope/tool/_builtin/_scripts/_glob_helper.py:76 — _glob_helper._match_parts has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (22 pts), error handling 2 (5 pts), loops 2 (5 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · OpenAIResponseModel._parse_completion_response (cognitive 31) · ×1
  • OpenAIResponseModel._parse_completion_response (cognitive 31) src/agentscope/model/_openai_response/_model.py:450 — OpenAIResponseModel._parse_completion_response has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 3 (7 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _word._extract_table_data (cognitive 31) · ×1
  • _word._extract_table_data (cognitive 31) src/agentscope/rag/_parser/_word.py:74 — _word._extract_table_data has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Agent._compress_context_impl (cognitive 30) · ×1
  • Agent._compress_context_impl (cognitive 30) src/agentscope/agent/_agent.py:490 — Agent._compress_context_impl has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (20 pts), error handling 3 (5 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionService.delete_agent (cognitive 30) · ×1
  • SessionService.delete_agent (cognitive 30) src/agentscope/app/_service/_session.py:478 — SessionService.delete_agent has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 3, error handling 1 (2 pts), boolean chains 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · GitHubMCPHub._to_card (cognitive 30) · ×1
  • GitHubMCPHub._to_card (cognitive 30) src/agentscope/app/hub/_mcp/_github_hub.py:299 — GitHubMCPHub._to_card has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 13, if/else 5 (8 pts), ternaries 4, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolResponse.append_chunk (cognitive 30) · ×1
  • ToolResponse.append_chunk (cognitive 30) src/agentscope/tool/_response.py:72 — ToolResponse.append_chunk has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 8, 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.
D2 · Cognitive Complexity · _utils._extract_input_schema (cognitive 30) · ×1
  • _utils._extract_input_schema (cognitive 30) src/agentscope/tool/_utils.py:190 — _utils._extract_input_schema has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 6 (18 pts), if/else 5 (11 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DashScopeCosyVoiceTTSModel._synthesize_realtime (cognitive 30) · ×1
  • DashScopeCosyVoiceTTSModel._synthesize_realtime (cognitive 30) src/agentscope/tts/_dashscope/_cosyvoice_model.py:263 — DashScopeCosyVoiceTTSModel._synthesize_realtime has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (23 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ChatAppBase._publish (cognitive 29) · ×1
  • _ChatAppBase._publish (cognitive 29) src/agentscope/tui/_launcher.py:93 — _ChatAppBase._publish has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 2 (7 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Agent._split_tool_result_for_compression (cognitive 28) · ×1
  • Agent._split_tool_result_for_compression (cognitive 28) src/agentscope/agent/_agent.py:3054 — Agent._split_tool_result_for_compression has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (22 pts), ternaries 1 (3 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.
D2 · Cognitive Complexity · AGUIProtocolMiddleware._to_agui_event (cognitive 28) · ×1
  • AGUIProtocolMiddleware._to_agui_event (cognitive 28) src/agentscope/app/middleware/_protocol/_agui.py:71 — AGUIProtocolMiddleware._to_agui_event has cognitive complexity 28 (threshold 15). Drivers by points: if/else 26 (27 pts), boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AnthropicMultiAgentFormatter._format_agent_message (cognitive 28) · ×1
  • AnthropicMultiAgentFormatter._format_agent_message (cognitive 28) src/agentscope/formatter/_anthropic_formatter.py:453 — AnthropicMultiAgentFormatter._format_agent_message has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (23 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.
D2 · Cognitive Complexity · Agent._reasoning_impl (cognitive 27) · ×1
  • Agent._reasoning_impl (cognitive 27) src/agentscope/agent/_agent.py:1698 — Agent._reasoning_impl has cognitive complexity 27 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 7 (9 pts), boolean chains 4, ternaries 4 (nesting depth added 7). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · FeishuChannel._parse_post (cognitive 27) · ×1
  • FeishuChannel._parse_post (cognitive 27) src/agentscope/app/channel/_feishu/_channel.py:557 — FeishuChannel._parse_post has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (12 pts), ternaries 2 (8 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RealtimeAgent._on_model_event (cognitive 26) · ×1
  • RealtimeAgent._on_model_event (cognitive 26) src/agentscope/agent/_realtime/_agent.py:675 — RealtimeAgent._on_model_event has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 4, ternaries 1 (2 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · OllamaMultiAgentFormatter._format_agent_message (cognitive 26) · ×1
  • OllamaMultiAgentFormatter._format_agent_message (cognitive 26) src/agentscope/formatter/_ollama_formatter.py:405 — OllamaMultiAgentFormatter._format_agent_message has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TracingMiddleware.on_reply (cognitive 26) · ×1
  • TracingMiddleware.on_reply (cognitive 26) src/agentscope/middleware/_tracing/_trace.py:137 — TracingMiddleware.on_reply has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 3 (5 pts), error handling 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.
D2 · Cognitive Complexity · AnthropicChatModel._parse_anthropic_stream_completion_response (cognitive 26) · ×1
  • AnthropicChatModel._parse_anthropic_stream_completion_response (cognitive 26) src/agentscope/model/_anthropic/_model.py:415 — AnthropicChatModel._parse_anthropic_stream_completion_response has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (20 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · SOPStep.reply_stream (cognitive 26) · ×1
  • SOPStep.reply_stream (cognitive 26) src/agentscope/sop/_schema.py:229 — SOPStep.reply_stream has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (5 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · RealtimeAgent._run_tool (cognitive 24) · ×1
  • RealtimeAgent._run_tool (cognitive 24) src/agentscope/agent/_realtime/_agent.py:1066 — RealtimeAgent._run_tool has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (7 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.
D2 · Cognitive Complexity · GeminiMultiAgentFormatter._format_agent_message (cognitive 24) · ×1
  • GeminiMultiAgentFormatter._format_agent_message (cognitive 24) src/agentscope/formatter/_gemini_formatter.py:372 — GeminiMultiAgentFormatter._format_agent_message has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (21 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.
D2 · Cognitive Complexity · WorkspaceBase._enforce_mcp_capacity (cognitive 24) · ×1
  • WorkspaceBase._enforce_mcp_capacity (cognitive 24) src/agentscope/workspace/_base.py:812 — WorkspaceBase._enforce_mcp_capacity has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Agent._next_action (cognitive 23) · ×1
  • Agent._next_action (cognitive 23) src/agentscope/agent/_agent.py:3495 — Agent._next_action has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · WebRTCSession._run (cognitive 23) · ×1
  • WebRTCSession._run (cognitive 23) src/agentscope/app/_service/_webrtc_session.py:124 — WebRTCSession._run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 6, error handling 3 (5 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiscordChannel.send_response (cognitive 23) · ×1
  • DiscordChannel.send_response (cognitive 23) src/agentscope/app/channel/_discord/_channel.py:306 — DiscordChannel.send_response has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (5 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.
D2 · Cognitive Complexity · ChatModelBase._call_api_with_structured_output (cognitive 23) · ×1
  • ChatModelBase._call_api_with_structured_output (cognitive 23) src/agentscope/model/_base.py:603 — ChatModelBase._call_api_with_structured_output has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · GeminiChatModel._parse_completion_response (cognitive 23) · ×1
  • GeminiChatModel._parse_completion_response (cognitive 23) src/agentscope/model/_gemini/_model.py:422 — GeminiChatModel._parse_completion_response has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · _excel._restore_native_excel_errors (cognitive 23) · ×1
  • _excel._restore_native_excel_errors (cognitive 23) src/agentscope/rag/_parser/_excel.py:79 — _excel._restore_native_excel_errors has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 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.
D2 · Cognitive Complexity · BashCommandParser._extract_paths_from_node (cognitive 23) · ×1
  • BashCommandParser._extract_paths_from_node (cognitive 23) src/agentscope/tool/_builtin/_bash_parser.py:305 — BashCommandParser._extract_paths_from_node has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DashScopeMultiAgentFormatter._format_agent_message (cognitive 22) · ×1
  • DashScopeMultiAgentFormatter._format_agent_message (cognitive 22) src/agentscope/formatter/_dashscope_formatter.py:501 — DashScopeMultiAgentFormatter._format_agent_message has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIMultiAgentFormatter._format_agent_message (cognitive 22) · ×1
  • OpenAIMultiAgentFormatter._format_agent_message (cognitive 22) src/agentscope/formatter/_openai_formatter.py:499 — OpenAIMultiAgentFormatter._format_agent_message has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RegisteredTool.get_tool_schema (cognitive 22) · ×1
  • RegisteredTool.get_tool_schema (cognitive 22) src/agentscope/tool/_types.py:56 — RegisteredTool.get_tool_schema has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BubblewrapBackend.__init__ (cognitive 22) · ×1
  • BubblewrapBackend.__init__ (cognitive 22) src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:47 — BubblewrapBackend.__init__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · K8sBackend._exec_ws_stdin (cognitive 22) · ×1
  • K8sBackend._exec_ws_stdin (cognitive 22) src/agentscope/workspace/_k8s/_k8s_backend.py:324 — K8sBackend._exec_ws_stdin has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), 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.
D2 · Cognitive Complexity · DiscordChannel.start_listening (cognitive 21) · ×1
  • DiscordChannel.start_listening (cognitive 21) src/agentscope/app/channel/_discord/_channel.py:159 — DiscordChannel.start_listening has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (5 pts), error handling 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FormatterBase._group_messages (cognitive 21) · ×1
  • FormatterBase._group_messages (cognitive 21) src/agentscope/formatter/_formatter_base.py:190 — FormatterBase._group_messages has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BashCommandParser._is_single_command_read_only (cognitive 21) · ×1
  • BashCommandParser._is_single_command_read_only (cognitive 21) src/agentscope/tool/_builtin/_bash_parser.py:195 — BashCommandParser._is_single_command_read_only has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DashScopeTTSModel._parse_into_async_generator (cognitive 21) · ×1
  • DashScopeTTSModel._parse_into_async_generator (cognitive 21) src/agentscope/tts/_dashscope/_model.py:183 — DashScopeTTSModel._parse_into_async_generator has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · A2AAgent._build_request (cognitive 20) · ×1
  • A2AAgent._build_request (cognitive 20) src/agentscope/agent/_a2a_agent.py:550 — A2AAgent._build_request has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 1 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Agent._convert_chat_response_to_event (cognitive 20) · ×1
  • Agent._convert_chat_response_to_event (cognitive 20) src/agentscope/agent/_agent.py:3757 — Agent._convert_chat_response_to_event has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4, boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _toolkit.get_toolkit (cognitive 20) · ×1
  • _toolkit.get_toolkit (cognitive 20) src/agentscope/app/_service/_toolkit.py:40 — _toolkit.get_toolkit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TeamSay.__call__ (cognitive 20) · ×1
  • TeamSay.__call__ (cognitive 20) src/agentscope/app/_tool/_team_say.py:121 — TeamSay.__call__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2, 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.
D2 · Cognitive Complexity · FileEmbeddingCache._maintain_cache_dir (cognitive 20) · ×1
  • FileEmbeddingCache._maintain_cache_dir (cognitive 20) src/agentscope/embedding/_file_cache.py:151 — FileEmbeddingCache._maintain_cache_dir has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RAGMiddleware.on_reasoning (cognitive 20) · ×1
  • RAGMiddleware.on_reasoning (cognitive 20) src/agentscope/middleware/_rag.py:929 — RAGMiddleware.on_reasoning has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · _word._extract_image_blocks (cognitive 20) · ×1
  • _word._extract_image_blocks (cognitive 20) src/agentscope/rag/_parser/_word.py:127 — _word._extract_image_blocks has cognitive complexity 20 (threshold 15). Drivers by points: error handling 2 (6 pts), if/else 2 (6 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Toolkit._get_available_tools (cognitive 20) · ×1
  • Toolkit._get_available_tools (cognitive 20) src/agentscope/tool/_toolkit.py:473 — Toolkit._get_available_tools has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 4 (7 pts), boolean chains 3, error handling 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BubblewrapBackend._terminate_process_tree (cognitive 20) · ×1
  • BubblewrapBackend._terminate_process_tree (cognitive 20) src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:199 — BubblewrapBackend._terminate_process_tree has cognitive complexity 20 (threshold 15). Drivers by points: error handling 8 (18 pts), if/else 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.
D2 · Cognitive Complexity · update_news.main (cognitive 19) · ×1
  • update_news.main (cognitive 19) .github/scripts/update_news.py:96 — update_news.main 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.
D2 · Cognitive Complexity · _a2a_agent._parts_to_events (cognitive 19) · ×1
  • _a2a_agent._parts_to_events (cognitive 19) src/agentscope/agent/_a2a_agent.py:53 — _a2a_agent._parts_to_events has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Agent._call_model (cognitive 19) · ×1
  • Agent._call_model (cognitive 19) src/agentscope/agent/_agent.py:3274 — Agent._call_model has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 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.
D2 · Cognitive Complexity · SessionSOPStep.reply_stream (cognitive 19) · ×1
  • SessionSOPStep.reply_stream (cognitive 19) src/agentscope/app/_service/_sop.py:103 — SessionSOPStep.reply_stream has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, loops 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.
D2 · Cognitive Complexity · ChannelBase._render (cognitive 19) · ×1
  • ChannelBase._render (cognitive 19) src/agentscope/app/channel/_base.py:429 — ChannelBase._render has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolOffloadMiddleware.on_acting (cognitive 19) · ×1
  • ToolOffloadMiddleware.on_acting (cognitive 19) src/agentscope/app/middleware/_tool_offload_middleware.py:105 — ToolOffloadMiddleware.on_acting has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (5 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Mem0Middleware.on_reply (cognitive 19) · ×1
  • Mem0Middleware.on_reply (cognitive 19) src/agentscope/middleware/_longterm_memory/_mem0/_middleware.py:285 — Mem0Middleware.on_reply has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · XAIChatModel._parse_stream_response (cognitive 19) · ×1
  • XAIChatModel._parse_stream_response (cognitive 19) src/agentscope/model/_xai/_model.py:294 — XAIChatModel._parse_stream_response has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Edit.call (cognitive 19) · ×1
  • Edit.call (cognitive 19) src/agentscope/tool/_builtin/_edit.py:258 — Edit.call has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 pts), error handling 2 (3 pts), ternaries 2, boolean chains 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Read._read_pdf (cognitive 19) · ×1
  • Read._read_pdf (cognitive 19) src/agentscope/tool/_builtin/_read.py:385 — Read._read_pdf has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DashScopeRealtimeTTSModel.synthesize (cognitive 19) · ×1
  • DashScopeRealtimeTTSModel.synthesize (cognitive 19) src/agentscope/tts/_dashscope/_realtime_model.py:365 — DashScopeRealtimeTTSModel.synthesize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 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.
D2 · Cognitive Complexity · DockerWorkspace._build_or_reuse_image (cognitive 19) · ×1
  • DockerWorkspace._build_or_reuse_image (cognitive 19) src/agentscope/workspace/_docker/_docker_workspace.py:202 — DockerWorkspace._build_or_reuse_image has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (17 pts), error handling 1, 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.
D2 · Cognitive Complexity · RealtimeAgent.reply_stream (cognitive 18) · ×1
  • RealtimeAgent.reply_stream (cognitive 18) src/agentscope/agent/_realtime/_agent.py:386 — RealtimeAgent.reply_stream has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 2 (5 pts), loops 3, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TeamMemberLoopMiddleware._last_tool_call_reports_to_leader (cognitive 18) · ×1
  • TeamMemberLoopMiddleware._last_tool_call_reports_to_leader (cognitive 18) src/agentscope/app/middleware/_team_member_middleware.py:50 — TeamMemberLoopMiddleware._last_tool_call_reports_to_leader has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · XAIMultiAgentFormatter.format (cognitive 18) · ×1
  • XAIMultiAgentFormatter.format (cognitive 18) src/agentscope/formatter/_xai_formatter.py:388 — XAIMultiAgentFormatter.format has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (16 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.
D2 · Cognitive Complexity · Mem0Middleware._resolve_client (cognitive 18) · ×1
  • Mem0Middleware._resolve_client (cognitive 18) src/agentscope/middleware/_longterm_memory/_mem0/_middleware.py:417 — Mem0Middleware._resolve_client has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiChatModel._format_tools (cognitive 18) · ×1
  • GeminiChatModel._format_tools (cognitive 18) src/agentscope/model/_gemini/_model.py:537 — GeminiChatModel._format_tools has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Toolkit.call_tool (cognitive 18) · ×1
  • Toolkit.call_tool (cognitive 18) src/agentscope/tool/_toolkit.py:225 — Toolkit.call_tool has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 2 (4 pts), error handling 3, boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _utils._remove_title_field (cognitive 18) · ×1
  • _utils._remove_title_field (cognitive 18) src/agentscope/tool/_utils.py:123 — _utils._remove_title_field has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalWorkspace.initialize (cognitive 18) · ×1
  • LocalWorkspace.initialize (cognitive 18) src/agentscope/workspace/_local_workspace.py:164 — LocalWorkspace.initialize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3 (5 pts), error handling 1 (2 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.
D2 · Cognitive Complexity · WebRTCAudioTransport._handle_json (cognitive 17) · ×1
  • WebRTCAudioTransport._handle_json (cognitive 17) src/agentscope/app/_service/_webrtc_audio_transport.py:334 — WebRTCAudioTransport._handle_json has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 2 (3 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.
D2 · Cognitive Complexity · AgentInvite.__call__ (cognitive 17) · ×1
  • AgentInvite.__call__ (cognitive 17) src/agentscope/app/_tool/_agent_invite.py:231 — AgentInvite.__call__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, error handling 1, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · DingTalkChannel._on_callback (cognitive 17) · ×1
  • DingTalkChannel._on_callback (cognitive 17) src/agentscope/app/channel/_dingtalk/_channel.py:1017 — DingTalkChannel._on_callback has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, ternaries 5, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · DashScopeChatModel._format_tools (cognitive 17) · ×1
  • DashScopeChatModel._format_tools (cognitive 17) src/agentscope/model/_dashscope/_model.py:495 — DashScopeChatModel._format_tools has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 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.
D2 · Cognitive Complexity · MoonshotChatModel._call_api (cognitive 17) · ×1
  • MoonshotChatModel._call_api (cognitive 17) src/agentscope/model/_moonshot/_model.py:156 — MoonshotChatModel._call_api has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · KnowledgeBase.search (cognitive 17) · ×1
  • KnowledgeBase.search (cognitive 17) src/agentscope/rag/_knowledge.py:190 — KnowledgeBase.search has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DashScopeRealtimeModel._parse (cognitive 17) · ×1
  • DashScopeRealtimeModel._parse (cognitive 17) src/agentscope/realtime/_dashscope/_model.py:327 — DashScopeRealtimeModel._parse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · OpenAIRealtimeModel._parse (cognitive 17) · ×1
  • OpenAIRealtimeModel._parse (cognitive 17) src/agentscope/realtime/_openai/_model.py:320 — OpenAIRealtimeModel._parse has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (8 pts), match/switch 1 (nesting depth added 4). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · BackendBase._find_entries (cognitive 17) · ×1
  • BackendBase._find_entries (cognitive 17) src/agentscope/tool/_builtin/_backend.py:603 — BackendBase._find_entries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 2 (4 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Bash.call (cognitive 17) · ×1
  • Bash.call (cognitive 17) src/agentscope/tool/_builtin/_bash.py:681 — Bash.call has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Glob.call (cognitive 17) · ×1
  • Glob.call (cognitive 17) src/agentscope/tool/_builtin/_glob.py:224 — Glob.call has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 5 (6 pts), boolean chains 2, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Toolkit.add_tool (cognitive 17) · ×1
  • Toolkit.add_tool (cognitive 17) src/agentscope/tool/_toolkit.py:640 — Toolkit.add_tool has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts), ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DashScopeRealtimeTTSModel.push (cognitive 17) · ×1
  • DashScopeRealtimeTTSModel.push (cognitive 17) src/agentscope/tts/_dashscope/_realtime_model.py:306 — DashScopeRealtimeTTSModel.push has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 2 (5 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GatewayClient.exec_request (cognitive 17) · ×1
  • GatewayClient.exec_request (cognitive 17) src/agentscope/workspace/_gateway_client.py:640 — GatewayClient.exec_request has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), error handling 4 (6 pts), ternaries 2, boolean chains 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Agent._execute_concurrent_tool_calls (cognitive 16) · ×1
  • Agent._execute_concurrent_tool_calls (cognitive 16) src/agentscope/agent/_agent.py:2186 — Agent._execute_concurrent_tool_calls has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 3 (6 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RealtimeAgent.send (cognitive 16) · ×1
  • RealtimeAgent.send (cognitive 16) src/agentscope/agent/_realtime/_agent.py:479 — RealtimeAgent.send has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (2 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SchedulerManager.validate_schedule (cognitive 16) · ×1
  • SchedulerManager.validate_schedule (cognitive 16) src/agentscope/app/_manager/_scheduler/_scheduler_manager.py:332 — SchedulerManager.validate_schedule has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, ternaries 1 (2 pts), error handling 1, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GitHubMCPHub._from_package (cognitive 16) · ×1
  • GitHubMCPHub._from_package (cognitive 16) src/agentscope/app/hub/_mcp/_github_hub.py:243 — GitHubMCPHub._from_package has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedisStorage.delete_agent (cognitive 16) · ×1
  • RedisStorage.delete_agent (cognitive 16) src/agentscope/app/storage/_redis_storage.py:804 — RedisStorage.delete_agent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 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.
D2 · Cognitive Complexity · MoonshotMultiAgentFormatter._format_agent_message (cognitive 16) · ×1
  • MoonshotMultiAgentFormatter._format_agent_message (cognitive 16) src/agentscope/formatter/_moonshot_formatter.py:420 — MoonshotMultiAgentFormatter._format_agent_message has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgenticMemoryMiddleware.on_reply (cognitive 16) · ×1
  • AgenticMemoryMiddleware.on_reply (cognitive 16) src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:568 — AgenticMemoryMiddleware.on_reply has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReMeMiddleware.on_reply (cognitive 16) · ×1
  • ReMeMiddleware.on_reply (cognitive 16) src/agentscope/middleware/_longterm_memory/_reme/_middleware.py:312 — ReMeMiddleware.on_reply has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, boolean chains 6, error handling 1 (2 pts), loops 1 (nesting depth added 1). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RAGMiddleware.on_reply (cognitive 16) · ×1
  • RAGMiddleware.on_reply (cognitive 16) src/agentscope/middleware/_rag.py:859 — RAGMiddleware.on_reply has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnthropicChatModel._parse_anthropic_completion_response (cognitive 16) · ×1
  • AnthropicChatModel._parse_anthropic_completion_response (cognitive 16) src/agentscope/model/_anthropic/_model.py:307 — AnthropicChatModel._parse_anthropic_completion_response has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (6 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ChatModelBase._validate_tool_choice (cognitive 16) · ×1
  • ChatModelBase._validate_tool_choice (cognitive 16) src/agentscope/model/_base.py:324 — ChatModelBase._validate_tool_choice has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (5 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DashScopeChatModel._parse_completion_response (cognitive 16) · ×1
  • DashScopeChatModel._parse_completion_response (cognitive 16) src/agentscope/model/_dashscope/_model.py:431 — DashScopeChatModel._parse_completion_response has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelCard.from_yaml (cognitive 16) · ×1
  • ModelCard.from_yaml (cognitive 16) src/agentscope/model/_model_card.py:73 — ModelCard.from_yaml has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatResponse.append_thinking (cognitive 16) · ×1
  • ChatResponse.append_thinking (cognitive 16) src/agentscope/model/_model_response.py:84 — ChatResponse.append_thinking has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · XAIChatModel._format_tools (cognitive 16) · ×1
  • XAIChatModel._format_tools (cognitive 16) src/agentscope/model/_xai/_model.py:239 — XAIChatModel._format_tools has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 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.
D2 · Cognitive Complexity · GeminiRealtimeModel._parse_content (cognitive 16) · ×1
  • GeminiRealtimeModel._parse_content (cognitive 16) src/agentscope/realtime/_gemini/_model.py:423 — GeminiRealtimeModel._parse_content has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), 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.
D2 · Cognitive Complexity · ToolContext.get_cache (cognitive 16) · ×1
  • ToolContext.get_cache (cognitive 16) src/agentscope/state/_state.py:46 — ToolContext.get_cache has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 1 (4 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.
D2 · Cognitive Complexity · Bash.check_permissions (cognitive 16) · ×1
  • Bash.check_permissions (cognitive 16) src/agentscope/tool/_builtin/_bash.py:204 — Bash.check_permissions 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.
D2 · Cognitive Complexity · _messages._group_tool_calls (cognitive 16) · ×1
  • _messages._group_tool_calls (cognitive 16) src/agentscope/tui/_messages.py:243 — _messages._group_tool_calls has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (5 members, 40 shared lines) · ×1
  • Near-duplicate member family (5 members, 40 shared lines) src/agentscope/model/_dashscope/_model.py:287 — src/agentscope/model/_dashscope/_model.py:287-429 | src/agentscope/model/_deepseek/_model.py:244-342 | src/agentscope/model/_moonshot/_model.py:249-350 | src/agentscope/model/_openai_chat/_model.py:308-458 | src/agentscope/model/_volcengine/_model.py:247-346 — These 5 members are variants of one another: a block of 40 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 pair (68 shared lines) · ×1
  • Near-duplicate member pair (68 shared lines) src/agentscope/formatter/_deepseek_formatter.py:49 — src/agentscope/formatter/_deepseek_formatter.py:49-247 | src/agentscope/formatter/_moonshot_formatter.py:109-309 — These two members are variants of one another: 68 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 · Near-duplicate member pair (56 shared lines) · ×1
  • Near-duplicate member pair (56 shared lines) src/agentscope/formatter/_dashscope_formatter.py:235 — src/agentscope/formatter/_dashscope_formatter.py:235-415 | src/agentscope/formatter/_openai_formatter.py:256-424 — These two members are variants of one another: 56 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 · Near-duplicate member pair (45 shared lines) · ×1
  • Near-duplicate member pair (45 shared lines) src/agentscope/formatter/_deepseek_formatter.py:49 — src/agentscope/formatter/_deepseek_formatter.py:49-247 | src/agentscope/formatter/_volcengine_formatter.py:106-295 — These two members are variants of one another: 45 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (91 corresponding lines) · ×1
  • Edited copy of a member (91 corresponding lines) src/agentscope/permission/_engine.py:122 — src/agentscope/permission/_engine.py:122-212 | src/agentscope/permission/_engine.py:302-393 — These two members are one piece of code written twice and then edited apart: 91 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (8 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (8 members, 50+ identical tokens) src/agentscope/formatter/_dashscope_formatter.py:119 — src/agentscope/formatter/_dashscope_formatter.py:119-141 | src/agentscope/formatter/_dashscope_formatter.py:147-170 | src/agentscope/formatter/_dashscope_formatter.py:176-217 | src/agentscope/formatter/_gemini_formatter.py:67-109 | src/agentscope/formatter/_moonshot_formatter.py:30-60 | src/agentscope/formatter/_ollama_formatter.py:73-100 | src/agentscope/formatter/_openai_formatter.py:84-121 | src/agentscope/formatter/_openai_formatter.py:127-183 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Duplicated block (51–62 lines × 4) · ×1
  • Duplicated block (51–62 lines × 4) src/agentscope/permission/_engine.py:122 — src/agentscope/permission/_engine.py:122-172 | src/agentscope/permission/_engine.py:219-270 | src/agentscope/permission/_engine.py:302-352 | src/agentscope/permission/_engine.py:400-461 — 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.
D4 · Code Duplication · Duplicated block (43–61 lines × 6) · ×1
  • Duplicated block (43–61 lines × 6) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:156 — src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:156-200 | src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:186-234 | src/agentscope/app/workspace_manager/_docker_workspace_manager.py:251-308 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:270-330 | src/agentscope/app/workspace_manager/_k8s_workspace_manager.py:180-222 | src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:206-264 — before extracting anything, compare `src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py` and `src/agentscope/app/workspace_manager/_daytona_workspace_manager.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 115 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:156` 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.
D4 · Code Duplication · Duplicated block (58 lines × 2) · ×1
  • Duplicated block (58 lines × 2) src/agentscope/tool/_builtin/_edit.py:130 — src/agentscope/tool/_builtin/_edit.py:130-187 | src/agentscope/tool/_builtin/_write.py:107-164 — before extracting anything, compare `src/agentscope/tool/_builtin/_edit.py` and `src/agentscope/tool/_builtin/_write.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 146 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (41–42 lines × 2) · ×1
  • Duplicated block (41–42 lines × 2) src/agentscope/message/_base.py:550 — src/agentscope/message/_base.py:550-591 | src/agentscope/message/_base.py:660-700 — both copies are in the same file, so extract the 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.
D4 · Code Duplication · Duplicated block (39–41 lines × 2) · ×1
  • Duplicated block (39–41 lines × 2) src/agentscope/formatter/_anthropic_formatter.py:322 — src/agentscope/formatter/_anthropic_formatter.py:322-360 | src/agentscope/formatter/_openai_formatter.py:190-230 — 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.
D4 · Code Duplication · Duplicated block (30–35 lines × 4) · ×1
  • Duplicated block (30–35 lines × 4) src/agentscope/model/_dashscope/_model.py:336 — src/agentscope/model/_dashscope/_model.py:336-365 | src/agentscope/model/_deepseek/_model.py:287-321 | src/agentscope/model/_moonshot/_model.py:295-329 | src/agentscope/model/_volcengine/_model.py:291-325 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 171 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 `src/agentscope/model/_dashscope/_model.py:336` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (26–35 lines × 3) · ×1
  • Duplicated block (26–35 lines × 3) src/agentscope/formatter/_dashscope_formatter.py:68 — src/agentscope/formatter/_dashscope_formatter.py:68-102 | src/agentscope/formatter/_openai_formatter.py:35-67 | src/agentscope/formatter/_volcengine_formatter.py:31-56 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_openai_formatter.py:35` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/agentscope/formatter/_dashscope_formatter.py:106` calls `_format_audio_source` and `src/agentscope/formatter/_volcengine_formatter.py:59` 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.
D4 · Code Duplication · Duplicated block (35 lines × 2) · ×1
  • Duplicated block (35 lines × 2) src/agentscope/app/_tool/_agent_create.py:489 — src/agentscope/app/_tool/_agent_create.py:489-523 | src/agentscope/app/_tool/_agent_invite.py:442-476 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/_tool/_agent_create.py:489` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (30–35 lines × 2) · ×1
  • Duplicated block (30–35 lines × 2) src/agentscope/app/message_bus/_redis_message_bus.py:119 — src/agentscope/app/message_bus/_redis_message_bus.py:119-153 | src/agentscope/app/storage/_redis_storage.py:218-247 — 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.
D4 · Code Duplication · Duplicated block (29–35 lines × 2) · ×1
  • Duplicated block (29–35 lines × 2) src/agentscope/formatter/_ollama_formatter.py:208 — src/agentscope/formatter/_ollama_formatter.py:208-242 | src/agentscope/formatter/_openai_formatter.py:346-374 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_ollama_formatter.py:208` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–33 lines × 7) · ×1
  • Duplicated block (17–33 lines × 7) src/agentscope/formatter/_anthropic_formatter.py:423 — src/agentscope/formatter/_anthropic_formatter.py:423-439 | src/agentscope/formatter/_dashscope_formatter.py:445-477 | src/agentscope/formatter/_deepseek_formatter.py:274-290 | src/agentscope/formatter/_gemini_formatter.py:332-348 | src/agentscope/formatter/_ollama_formatter.py:366-382 | src/agentscope/formatter/_openai_formatter.py:459-475 | src/agentscope/formatter/_volcengine_formatter.py:322-338 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 7 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_anthropic_formatter.py:423` 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.
D4 · Code Duplication · Duplicated block (29–33 lines × 6) · ×1
  • Duplicated block (29–33 lines × 6) src/agentscope/model/_dashscope/_model.py:200 — src/agentscope/model/_dashscope/_model.py:200-228 | src/agentscope/model/_deepseek/_model.py:165-197 | src/agentscope/model/_gemini/_model.py:266-294 | src/agentscope/model/_openai_chat/_model.py:206-238 | src/agentscope/model/_openai_response/_model.py:187-219 | src/agentscope/model/_volcengine/_model.py:167-199 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 171 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.
D4 · Code Duplication · Duplicated block (33 lines × 3) · ×1
  • Duplicated block (33 lines × 3) src/agentscope/model/_deepseek/_model.py:411 — src/agentscope/model/_deepseek/_model.py:411-443 | src/agentscope/model/_moonshot/_model.py:422-454 | src/agentscope/model/_volcengine/_model.py:414-446 — `src/agentscope/model/_deepseek/_model.py` and `src/agentscope/model/_moonshot/_model.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 9 separate duplicated blocks between them, totalling at least 208 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.
D4 · Code Duplication · Duplicated block (33 lines × 2) · ×1
  • Duplicated block (33 lines × 2) src/agentscope/formatter/_moonshot_formatter.py:186 — src/agentscope/formatter/_moonshot_formatter.py:186-218 | src/agentscope/formatter/_openai_formatter.py:314-346 — before extracting anything, compare `src/agentscope/formatter/_moonshot_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 184 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_moonshot_formatter.py:186` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (29–32 lines × 2) · ×1
  • Duplicated block (29–32 lines × 2) src/agentscope/app/middleware/_sop_step_middleware.py:37 — src/agentscope/app/middleware/_sop_step_middleware.py:37-65 | src/agentscope/app/middleware/_team_member_middleware.py:51-82 — before extracting anything, compare `src/agentscope/app/middleware/_sop_step_middleware.py` and `src/agentscope/app/middleware/_team_member_middleware.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22–32 lines × 2) · ×1
  • Duplicated block (22–32 lines × 2) src/agentscope/middleware/_longterm_memory/_mem0/_utils.py:17 — src/agentscope/middleware/_longterm_memory/_mem0/_utils.py:17-38 | src/agentscope/middleware/_longterm_memory/_reme/_utils.py:17-48 — 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.
D4 · Code Duplication · Duplicated block (20–32 lines × 2) · ×1
  • Duplicated block (20–32 lines × 2) src/agentscope/workspace/_docker/_docker_backend.py:173 — src/agentscope/workspace/_docker/_docker_backend.py:173-192 | src/agentscope/workspace/_k8s/_k8s_backend.py:261-292 — 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.
D4 · Code Duplication · Duplicated block (27–30 lines × 2) · ×1
  • Duplicated block (27–30 lines × 2) src/agentscope/embedding/_embedding_model_card.py:142 — src/agentscope/embedding/_embedding_model_card.py:142-168 | src/agentscope/model/_model_card.py:124-153 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/embedding/_embedding_model_card.py:142` 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.
D4 · Code Duplication · Duplicated block (15–28 lines × 4) · ×1
  • Duplicated block (15–28 lines × 4) src/agentscope/formatter/_dashscope_formatter.py:119 — src/agentscope/formatter/_dashscope_formatter.py:119-133 | src/agentscope/formatter/_dashscope_formatter.py:147-162 | src/agentscope/formatter/_moonshot_formatter.py:30-48 | src/agentscope/formatter/_openai_formatter.py:84-111 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 119 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/agentscope/formatter/_moonshot_formatter.py:49` calls `get`, `raise_for_status`, `b64encode` and `src/agentscope/formatter/_dashscope_formatter.py:134` 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.
D4 · Code Duplication · Duplicated block (27–28 lines × 3) · ×1
  • Duplicated block (27–28 lines × 3) src/agentscope/model/_dashscope/_model.py:436 — src/agentscope/model/_dashscope/_model.py:436-463 | src/agentscope/model/_deepseek/_model.py:349-375 | src/agentscope/model/_volcengine/_model.py:353-379 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 171 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 `src/agentscope/model/_dashscope/_model.py:436` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21–28 lines × 2) · ×1
  • Duplicated block (21–28 lines × 2) src/agentscope/app/middleware/_sop_step_middleware.py:149 — src/agentscope/app/middleware/_sop_step_middleware.py:149-169 | src/agentscope/app/middleware/_team_member_middleware.py:193-220 — before extracting anything, compare `src/agentscope/app/middleware/_sop_step_middleware.py` and `src/agentscope/app/middleware/_team_member_middleware.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/middleware/_sop_step_middleware.py:149` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (27–28 lines × 2) · ×1
  • Duplicated block (27–28 lines × 2) src/agentscope/formatter/_deepseek_formatter.py:163 — src/agentscope/formatter/_deepseek_formatter.py:163-189 | src/agentscope/formatter/_moonshot_formatter.py:225-252 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 133 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (27 lines × 3) · ×1
  • Duplicated block (27 lines × 3) src/agentscope/model/_deepseek/_model.py:244 — src/agentscope/model/_deepseek/_model.py:244-270 | src/agentscope/model/_moonshot/_model.py:249-275 | src/agentscope/model/_volcengine/_model.py:247-273 — `src/agentscope/model/_deepseek/_model.py` and `src/agentscope/model/_moonshot/_model.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 9 separate duplicated blocks between them, totalling at least 208 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.
D4 · Code Duplication · Duplicated block (25–27 lines × 2) · ×1
  • Duplicated block (25–27 lines × 2) src/agentscope/app/storage/_redis_storage.py:277 — src/agentscope/app/storage/_redis_storage.py:277-301 | src/agentscope/app/storage/_sql/_storage.py:684-710 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `CredentialBase` names `....credential` in one and `...credential` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (24–26 lines × 2) · ×1
  • Duplicated block (24–26 lines × 2) src/agentscope/agent/_agent.py:3592 — src/agentscope/agent/_agent.py:3592-3617 | src/agentscope/agent/_agent.py:3729-3752 — both copies are in the same file, so extract the 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.
D4 · Code Duplication · Duplicated block (22–26 lines × 2) · ×1
  • Duplicated block (22–26 lines × 2) src/agentscope/app/_service/_chat.py:1280 — src/agentscope/app/_service/_chat.py:1280-1305 | src/agentscope/app/_service/_chat.py:1374-1395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (21–26 lines × 2) · ×1
  • Duplicated block (21–26 lines × 2) src/agentscope/app/channel/_dingtalk/_channel.py:306 — src/agentscope/app/channel/_dingtalk/_channel.py:306-331 | src/agentscope/app/channel/_feishu/_channel.py:659-679 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/channel/_dingtalk/_channel.py:306` 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.
D4 · Code Duplication · Duplicated block (18–26 lines × 2) · ×1
  • Duplicated block (18–26 lines × 2) src/agentscope/app/storage/_redis_storage.py:2385 — src/agentscope/app/storage/_redis_storage.py:2385-2410 | src/agentscope/app/storage/_redis_storage.py:2444-2461 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×1
  • Duplicated block (26 lines × 2) src/agentscope/model/_moonshot/_model.py:387 — src/agentscope/model/_moonshot/_model.py:387-412 | src/agentscope/model/_openai_chat/_model.py:538-563 — `src/agentscope/model/_moonshot/_model.py` and `src/agentscope/model/_openai_chat/_model.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 9 separate duplicated blocks between them, totalling at least 168 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 `src/agentscope/model/_moonshot/_model.py:387` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (25 lines × 3) · ×1
  • Duplicated block (25 lines × 3) src/agentscope/formatter/_dashscope_formatter.py:349 — src/agentscope/formatter/_dashscope_formatter.py:349-373 | src/agentscope/formatter/_moonshot_formatter.py:235-259 | src/agentscope/formatter/_openai_formatter.py:356-380 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 119 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (24–25 lines × 3) · ×1
  • Duplicated block (24–25 lines × 3) src/agentscope/formatter/_dashscope_formatter.py:528 — src/agentscope/formatter/_dashscope_formatter.py:528-551 | src/agentscope/formatter/_gemini_formatter.py:404-428 | src/agentscope/formatter/_openai_formatter.py:527-550 — 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.
D4 · Code Duplication · Duplicated block (20–25 lines × 2) · ×1
  • Duplicated block (20–25 lines × 2) src/agentscope/app/middleware/_sop_step_middleware.py:113 — src/agentscope/app/middleware/_sop_step_middleware.py:113-132 | src/agentscope/app/middleware/_team_member_middleware.py:151-175 — before extracting anything, compare `src/agentscope/app/middleware/_sop_step_middleware.py` and `src/agentscope/app/middleware/_team_member_middleware.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/middleware/_sop_step_middleware.py:113` 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.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) src/agentscope/formatter/_deepseek_formatter.py:193 — src/agentscope/formatter/_deepseek_formatter.py:193-216 | src/agentscope/formatter/_moonshot_formatter.py:256-280 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 133 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (18–25 lines × 2) · ×1
  • Duplicated block (18–25 lines × 2) src/agentscope/tts/_dashscope/_cosyvoice_utils.py:90 — src/agentscope/tts/_dashscope/_cosyvoice_utils.py:90-107 | src/agentscope/tts/_dashscope/_realtime_model.py:89-113 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/tts/_dashscope/_realtime_model.py:89` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (24 lines × 5) · ×1
  • Duplicated block (24 lines × 5) src/agentscope/model/_dashscope/_model.py:359 — src/agentscope/model/_dashscope/_model.py:359-382 | src/agentscope/model/_deepseek/_model.py:315-338 | src/agentscope/model/_moonshot/_model.py:323-346 | src/agentscope/model/_openai_chat/_model.py:431-454 | src/agentscope/model/_volcengine/_model.py:319-342 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 171 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 `src/agentscope/model/_dashscope/_model.py:359` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–24 lines × 2) · ×1
  • Duplicated block (18–24 lines × 2) src/agentscope/app/_service/_chat.py:952 — src/agentscope/app/_service/_chat.py:952-975 | src/agentscope/app/_service/_realtime.py:86-103 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/_service/_chat.py:952` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×1
  • Duplicated block (24 lines × 2) src/agentscope/app/channel/_dingtalk/_channel.py:876 — src/agentscope/app/channel/_dingtalk/_channel.py:876-899 | src/agentscope/app/channel/_dingtalk/_channel.py:902-925 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (23–24 lines × 2) · ×1
  • Duplicated block (23–24 lines × 2) src/agentscope/formatter/_anthropic_formatter.py:491 — src/agentscope/formatter/_anthropic_formatter.py:491-514 | src/agentscope/formatter/_ollama_formatter.py:441-463 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_anthropic_formatter.py:491` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (21–23 lines × 3) · ×1
  • Duplicated block (21–23 lines × 3) src/agentscope/permission/_engine.py:170 — src/agentscope/permission/_engine.py:170-191 | src/agentscope/permission/_engine.py:350-372 | src/agentscope/permission/_engine.py:550-570 — 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. 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.
D4 · Code Duplication · Duplicated block (16–23 lines × 2) · ×1
  • Duplicated block (16–23 lines × 2) src/agentscope/tool/_adapters.py:255 — src/agentscope/tool/_adapters.py:255-277 | src/agentscope/workspace/_gateway_client.py:103-118 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (22 lines × 7) · ×1
  • Duplicated block (22 lines × 7) src/agentscope/formatter/_dashscope_formatter.py:468 — src/agentscope/formatter/_dashscope_formatter.py:468-489 | src/agentscope/formatter/_deepseek_formatter.py:281-302 | src/agentscope/formatter/_gemini_formatter.py:339-360 | src/agentscope/formatter/_moonshot_formatter.py:387-408 | src/agentscope/formatter/_ollama_formatter.py:373-394 | src/agentscope/formatter/_openai_formatter.py:466-487 | src/agentscope/formatter/_volcengine_formatter.py:329-350 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_deepseek_formatter.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (19–22 lines × 2) · ×1
  • Duplicated block (19–22 lines × 2) src/agentscope/app/channel/_dingtalk/_tools/_list_conversations.py:41 — src/agentscope/app/channel/_dingtalk/_tools/_list_conversations.py:41-62 | src/agentscope/app/channel/_feishu/_tools/_list_chats.py:40-58 — 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.
D4 · Code Duplication · Duplicated block (21–22 lines × 2) · ×1
  • Duplicated block (21–22 lines × 2) src/agentscope/workspace/_local_workspace.py:216 — src/agentscope/workspace/_local_workspace.py:216-237 | src/agentscope/workspace/_local_workspace.py:829-849 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (18–21 lines × 2) · ×1
  • Duplicated block (18–21 lines × 2) src/agentscope/app/storage/_redis_storage.py:917 — src/agentscope/app/storage/_redis_storage.py:917-937 | src/agentscope/app/storage/_sql/_storage.py:1237-1254 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `AgentState` names `....state` in one and `...state` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×1
  • Duplicated block (21 lines × 2) src/agentscope/workspace/_local_workspace.py:748 — src/agentscope/workspace/_local_workspace.py:748-768 | src/agentscope/workspace/_sandboxed_base.py:395-415 — 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.
D4 · Code Duplication · Duplicated block (16–19 lines × 3) · ×1
  • Duplicated block (16–19 lines × 3) src/agentscope/embedding/_embedding_model_card.py:140 — src/agentscope/embedding/_embedding_model_card.py:140-157 | src/agentscope/model/_model_card.py:122-140 | src/agentscope/tts/_tts_model_card.py:98-113 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. 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, `src/agentscope/tts/_tts_model_card.py:116` calls `get` and `src/agentscope/embedding/_embedding_model_card.py:159` 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.
D4 · Code Duplication · Duplicated block (18–19 lines × 3) · ×1
  • Duplicated block (18–19 lines × 3) src/agentscope/formatter/_deepseek_formatter.py:191 — src/agentscope/formatter/_deepseek_formatter.py:191-208 | src/agentscope/formatter/_moonshot_formatter.py:254-272 | src/agentscope/formatter/_openai_formatter.py:375-393 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 133 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/agentscope/formatter/_openai_formatter.py:395` calls `isinstance` and `src/agentscope/formatter/_deepseek_formatter.py:210` 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.
D4 · Code Duplication · Duplicated block (15–19 lines × 2) · ×1
  • Duplicated block (15–19 lines × 2) src/agentscope/tool/_builtin/_bash.py:754 — src/agentscope/tool/_builtin/_bash.py:754-772 | src/agentscope/tool/_builtin/_powershell.py:253-267 — 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.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×1
  • Duplicated block (17 lines × 3) src/agentscope/app/storage/_redis_storage.py:1015 — src/agentscope/app/storage/_redis_storage.py:1015-1031 | src/agentscope/app/storage/_redis_storage.py:1153-1169 | src/agentscope/app/storage/_redis_storage.py:1179-1195 — 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.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×1
  • Duplicated block (16–17 lines × 2) src/agentscope/formatter/_dashscope_formatter.py:506 — src/agentscope/formatter/_dashscope_formatter.py:506-521 | src/agentscope/formatter/_openai_formatter.py:504-520 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (15–17 lines × 2) · ×1
  • Duplicated block (15–17 lines × 2) src/agentscope/model/_openai_response/_model.py:397 — src/agentscope/model/_openai_response/_model.py:397-413 | src/agentscope/model/_openai_response/_model.py:525-539 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (13–17 lines × 2) · ×1
  • Duplicated block (13–17 lines × 2) src/agentscope/tool/_builtin/_backend.py:812 — src/agentscope/tool/_builtin/_backend.py:812-828 | src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:145-157 — 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.
D4 · Code Duplication · Duplicated block (16 lines × 5) · ×1
  • Duplicated block (16 lines × 5) src/agentscope/model/_dashscope/_model.py:310 — src/agentscope/model/_dashscope/_model.py:310-325 | src/agentscope/model/_deepseek/_model.py:262-277 | src/agentscope/model/_moonshot/_model.py:267-282 | src/agentscope/model/_openai_chat/_model.py:338-353 | src/agentscope/model/_volcengine/_model.py:265-280 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 171 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, `src/agentscope/model/_dashscope/_model.py:308` calls `_generate_id` and `src/agentscope/model/_deepseek/_model.py:260` 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.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) src/agentscope/model/_moonshot/_model.py:381 — src/agentscope/model/_moonshot/_model.py:381-396 | src/agentscope/model/_openai_chat/_model.py:532-547 | src/agentscope/model/_volcengine/_model.py:377-392 — `src/agentscope/model/_moonshot/_model.py` and `src/agentscope/model/_openai_chat/_model.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 9 separate duplicated blocks between them, totalling at least 168 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 `src/agentscope/model/_moonshot/_model.py:381` 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.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×1
  • Duplicated block (15–16 lines × 2) src/agentscope/formatter/_deepseek_formatter.py:96 — src/agentscope/formatter/_deepseek_formatter.py:96-110 | src/agentscope/formatter/_moonshot_formatter.py:166-181 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 133 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_deepseek_formatter.py:96` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×1
  • Duplicated block (14–16 lines × 2) src/agentscope/formatter/_xai_formatter.py:221 — src/agentscope/formatter/_xai_formatter.py:221-236 | src/agentscope/formatter/_xai_formatter.py:329-342 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_xai_formatter.py:221` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 7) · ×1
  • Duplicated block (15 lines × 7) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:269 — src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:269-283 | src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:247-261 | src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:314-328 | src/agentscope/app/workspace_manager/_docker_workspace_manager.py:447-461 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:454-468 | src/agentscope/app/workspace_manager/_k8s_workspace_manager.py:324-338 | src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:331-345 — before extracting anything, compare `src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py` and `src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13–15 lines × 4) · ×1
  • Duplicated block (13–15 lines × 4) src/agentscope/model/_dashscope/_model.py:460 — src/agentscope/model/_dashscope/_model.py:460-472 | src/agentscope/model/_moonshot/_model.py:380-392 | src/agentscope/model/_openai_chat/_model.py:529-543 | src/agentscope/model/_volcengine/_model.py:376-388 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_moonshot/_model.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 6 separate duplicated blocks between them, totalling at least 117 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 `src/agentscope/model/_openai_chat/_model.py:529` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×1
  • Duplicated block (14–15 lines × 2) src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:156 — src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:156-170 | src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:370-383 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:156` 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.
D4 · Code Duplication · Duplicated block (14 lines × 5) · ×1
  • Duplicated block (14 lines × 5) src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:158 — src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:158-171 | src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:226-239 | src/agentscope/app/workspace_manager/_docker_workspace_manager.py:300-313 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:322-335 | src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:256-269 — before extracting anything, compare `src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py` and `src/agentscope/app/workspace_manager/_daytona_workspace_manager.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13–14 lines × 3) · ×1
  • Duplicated block (13–14 lines × 3) src/agentscope/formatter/_xai_formatter.py:217 — src/agentscope/formatter/_xai_formatter.py:217-230 | src/agentscope/formatter/_xai_formatter.py:283-296 | src/agentscope/formatter/_xai_formatter.py:324-336 — 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.
D4 · Code Duplication · Duplicated block (12–13 lines × 5) · ×1
  • Duplicated block (12–13 lines × 5) src/agentscope/formatter/_deepseek_formatter.py:192 — src/agentscope/formatter/_deepseek_formatter.py:192-204 | src/agentscope/formatter/_moonshot_formatter.py:191-202 | src/agentscope/formatter/_moonshot_formatter.py:255-267 | src/agentscope/formatter/_openai_formatter.py:319-330 | src/agentscope/formatter/_openai_formatter.py:376-388 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 133 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_deepseek_formatter.py:192` 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.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) src/agentscope/app/storage/_redis_storage.py:2397 — src/agentscope/app/storage/_redis_storage.py:2397-2408 | src/agentscope/app/storage/_redis_storage.py:2448-2459 | src/agentscope/app/storage/_redis_storage.py:2485-2497 — 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.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×1
  • Duplicated block (11 lines × 3) src/agentscope/formatter/_dashscope_formatter.py:256 — src/agentscope/formatter/_dashscope_formatter.py:256-266 | src/agentscope/formatter/_openai_formatter.py:277-287 | src/agentscope/formatter/_volcengine_formatter.py:125-135 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×1
  • Duplicated block (10 lines × 4) src/agentscope/model/_dashscope/_model.py:271 — src/agentscope/model/_dashscope/_model.py:271-280 | src/agentscope/model/_deepseek/_model.py:228-237 | src/agentscope/model/_moonshot/_model.py:233-242 | src/agentscope/model/_volcengine/_model.py:231-240 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 171 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.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×1
  • Duplicated block (10 lines × 3) src/agentscope/model/_anthropic/_model.py:604 — src/agentscope/model/_anthropic/_model.py:604-613 | src/agentscope/model/_gemini/_model.py:563-572 | src/agentscope/model/_xai/_model.py:264-273 — 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.
D4 · Code Duplication · Duplicated block (9 lines × 8) · ×1
  • Duplicated block (9 lines × 8) src/agentscope/formatter/_anthropic_formatter.py:428 — src/agentscope/formatter/_anthropic_formatter.py:428-436 | src/agentscope/formatter/_dashscope_formatter.py:466-474 | src/agentscope/formatter/_deepseek_formatter.py:279-287 | src/agentscope/formatter/_gemini_formatter.py:337-345 | src/agentscope/formatter/_ollama_formatter.py:371-379 | src/agentscope/formatter/_openai_formatter.py:464-472 | src/agentscope/formatter/_openai_response_formatter.py:443-451 | src/agentscope/formatter/_volcengine_formatter.py:327-335 — 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 8 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (3–7 lines × 3) · ×1
  • Duplicated block (3–7 lines × 3) src/agentscope/app/storage/_sql/_alembic/versions/0002_mcps_skills.py:31 — src/agentscope/app/storage/_sql/_alembic/versions/0002_mcps_skills.py:31-33 | src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:29-34 | src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:48-54 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:29` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:29` calls `Column`, `DateTime` and `src/agentscope/app/storage/_sql/_alembic/versions/0002_mcps_skills.py:31` 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.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) src/agentscope/model/_dashscope/_model.py:224 — src/agentscope/model/_dashscope/_model.py:224-231 | src/agentscope/model/_deepseek/_model.py:193-200 | src/agentscope/model/_gemini/_model.py:290-297 | src/agentscope/model/_openai_chat/_model.py:234-241 | src/agentscope/model/_volcengine/_model.py:195-202 | src/agentscope/model/_xai/_model.py:203-208 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 171 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.
D4 · Code Duplication · Duplicated block (5 lines × 8) · ×1
  • Duplicated block (5 lines × 8) src/agentscope/formatter/_dashscope_formatter.py:127 — src/agentscope/formatter/_dashscope_formatter.py:127-131 | src/agentscope/formatter/_dashscope_formatter.py:156-160 | src/agentscope/formatter/_dashscope_formatter.py:196-200 | src/agentscope/formatter/_gemini_formatter.py:85-90 | src/agentscope/formatter/_moonshot_formatter.py:42-46 | src/agentscope/formatter/_ollama_formatter.py:86-91 | src/agentscope/formatter/_openai_formatter.py:104-109 | src/agentscope/formatter/_openai_formatter.py:163-168 — there are 8 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 8 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (7 lines × 8) · ×1
  • Duplicated block (7 lines × 8) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:206 — src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:206-219 | src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:197-203 | src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:242-255 | src/agentscope/app/workspace_manager/_docker_workspace_manager.py:354-367 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:380-393 | src/agentscope/app/workspace_manager/_k8s_workspace_manager.py:265-276 | src/agentscope/app/workspace_manager/_local_workspace_manager.py:173-179 | src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:272-278 — before extracting anything, compare `src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py` and `src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:283` calls `pause` and `src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:223` 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.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×1
  • Duplicated block (9 lines × 5) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:242 — src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:242-250 | src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:224-232 | src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:283-291 | src/agentscope/app/workspace_manager/_k8s_workspace_manager.py:299-307 | src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:303-311 — before extracting anything, compare `src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py` and `src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×1
  • Duplicated block (10 lines × 6) src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:235 — src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:235-244 | src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:296-311 | src/agentscope/app/workspace_manager/_docker_workspace_manager.py:429-444 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:436-451 | src/agentscope/app/workspace_manager/_k8s_workspace_manager.py:312-321 | src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:314-328 — before extracting anything, compare `src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py` and `src/agentscope/app/workspace_manager/_daytona_workspace_manager.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18 lines × 4) · ×1
  • Duplicated block (18 lines × 4) src/agentscope/realtime/_dashscope/_model.py:200 — src/agentscope/realtime/_dashscope/_model.py:200-217 | src/agentscope/realtime/_gemini/_model.py:206-226 | src/agentscope/realtime/_openai/_model.py:185-202 | src/agentscope/realtime/_xai/_model.py:170-187 — `src/agentscope/realtime/_dashscope/_model.py` and `src/agentscope/realtime/_xai/_model.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 3 separate duplicated blocks between them, totalling at least 61 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, `src/agentscope/realtime/_openai/_model.py:182` calls `request_response` and `src/agentscope/realtime/_gemini/_model.py:203` 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.
D4 · Code Duplication · Duplicated block (24 lines × 3) · ×1
  • Duplicated block (24 lines × 3) src/agentscope/tool/_builtin/_edit.py:194 — src/agentscope/tool/_builtin/_edit.py:194-217 | src/agentscope/tool/_builtin/_read.py:197-221 | src/agentscope/tool/_builtin/_write.py:171-194 — before extracting anything, compare `src/agentscope/tool/_builtin/_edit.py` and `src/agentscope/tool/_builtin/_write.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 146 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) src/agentscope/tool/_builtin/_edit.py:223 — src/agentscope/tool/_builtin/_edit.py:223-256 | src/agentscope/tool/_builtin/_write.py:200-233 — before extracting anything, compare `src/agentscope/tool/_builtin/_edit.py` and `src/agentscope/tool/_builtin/_write.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 146 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (28 lines × 3) · ×1
  • Duplicated block (28 lines × 3) src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py:498 — src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py:498-525 | src/agentscope/workspace/_e2b/_e2b_workspace.py:328-362 | src/agentscope/workspace/_opensandbox/_opensandbox_workspace.py:347-392 — 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.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×1
  • Duplicated block (11 lines × 4) src/agentscope/app/_router/_mcp.py:136 — src/agentscope/app/_router/_mcp.py:136-147 | src/agentscope/app/_router/_skill.py:52-62 | src/agentscope/app/_router/_sop.py:227-241 | src/agentscope/app/_router/_sop.py:375-389 — 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.
D4 · Code Duplication · Members sharing a duplicated core (11 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (11 members, 50+ identical tokens) scripts/model_examples/anthropic_call.py:72 — scripts/model_examples/anthropic_call.py:72-132 | scripts/model_examples/dashscope_call.py:69-129 | scripts/model_examples/deepseek_call.py:76-133 | scripts/model_examples/gemini_call.py:72-132 | scripts/model_examples/minimax_call.py:77-134 | scripts/model_examples/moonshot_call.py:68-124 | scripts/model_examples/ollama_call.py:75-132 | scripts/model_examples/openai_chat_call.py:72-132 | scripts/model_examples/openai_response_call.py:77-140 | scripts/model_examples/volcengine_call.py:60-104 | scripts/model_examples/xai_call.py:77-136 — These 11 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 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 · Duplicated block (33–35 lines × 3) · ×1
  • Duplicated block (33–35 lines × 3) scripts/model_examples/anthropic_multimodal.py:116 — scripts/model_examples/anthropic_multimodal.py:116-148 | scripts/model_examples/dashscope_multimodal.py:122-154 | scripts/model_examples/minimax_multimodal.py:116-150 — before extracting anything, compare `scripts/model_examples/dashscope_multimodal.py` and `scripts/model_examples/minimax_multimodal.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (30 lines × 3) · ×1
  • Duplicated block (30 lines × 3) scripts/model_examples/anthropic_multimodal.py:83 — scripts/model_examples/anthropic_multimodal.py:83-112 | scripts/model_examples/dashscope_multimodal.py:88-118 | scripts/model_examples/minimax_multimodal.py:81-112 — before extracting anything, compare `scripts/model_examples/dashscope_multimodal.py` and `scripts/model_examples/minimax_multimodal.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (25 lines × 9) · ×1
  • Duplicated block (25 lines × 9) scripts/model_examples/anthropic_call.py:104 — scripts/model_examples/anthropic_call.py:104-128 | scripts/model_examples/dashscope_call.py:101-125 | scripts/model_examples/deepseek_call.py:105-129 | scripts/model_examples/gemini_call.py:104-128 | scripts/model_examples/minimax_call.py:106-130 | scripts/model_examples/moonshot_call.py:96-120 | scripts/model_examples/ollama_call.py:104-128 | scripts/model_examples/openai_chat_call.py:104-128 | scripts/model_examples/xai_call.py:108-132 — before extracting anything, compare `scripts/model_examples/anthropic_call.py` and `scripts/model_examples/dashscope_call.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (19–21 lines × 11) · ×1
  • Duplicated block (19–21 lines × 11) scripts/model_examples/anthropic_call.py:87 — scripts/model_examples/anthropic_call.py:87-107 | scripts/model_examples/dashscope_call.py:84-104 | scripts/model_examples/deepseek_call.py:88-108 | scripts/model_examples/gemini_call.py:87-107 | scripts/model_examples/minimax_call.py:90-109 | scripts/model_examples/moonshot_call.py:79-99 | scripts/model_examples/ollama_call.py:87-107 | scripts/model_examples/openai_chat_call.py:87-107 | scripts/model_examples/openai_response_call.py:92-112 | scripts/model_examples/volcengine_call.py:70-88 | scripts/model_examples/xai_call.py:91-111 — before extracting anything, compare `scripts/model_examples/anthropic_call.py` and `scripts/model_examples/dashscope_call.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/model_examples/anthropic_call.py:87` 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, `scripts/model_examples/dashscope_call.py:83` calls `Parameters` and `scripts/model_examples/moonshot_call.py:78` 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.
D4 · Code Duplication · Duplicated block (20 lines × 10) · ×1
  • Duplicated block (20 lines × 10) scripts/model_examples/anthropic_call.py:113 — scripts/model_examples/anthropic_call.py:113-132 | scripts/model_examples/dashscope_call.py:110-129 | scripts/model_examples/deepseek_call.py:114-133 | scripts/model_examples/gemini_call.py:113-132 | scripts/model_examples/minimax_call.py:115-134 | scripts/model_examples/moonshot_call.py:105-124 | scripts/model_examples/ollama_call.py:113-132 | scripts/model_examples/openai_chat_call.py:113-132 | scripts/model_examples/openai_response_call.py:121-140 | scripts/model_examples/xai_call.py:117-136 — before extracting anything, compare `scripts/model_examples/anthropic_call.py` and `scripts/model_examples/dashscope_call.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/model_examples/anthropic_call.py:113` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15–18 lines × 2) · ×1
  • Duplicated block (15–18 lines × 2) examples/long_term_memory/mem0/oss_demo.py:133 — examples/long_term_memory/mem0/oss_demo.py:133-150 | examples/long_term_memory/reme/reme_demo.py:180-194 — 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.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×1
  • Duplicated block (13 lines × 3) scripts/model_examples/openai_chat_multiagent_multimodal.py:25 — scripts/model_examples/openai_chat_multiagent_multimodal.py:25-37 | scripts/model_examples/openai_response_multiagent_multimodal.py:25-37 | scripts/model_examples/xai_multiagent_multimodal.py:28-40 — before extracting anything, compare `scripts/model_examples/openai_chat_multiagent_multimodal.py` and `scripts/model_examples/openai_response_multiagent_multimodal.py` as WHOLE FILES: 87% 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 `scripts/model_examples/openai_chat_multiagent_multimodal.py:25` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (78 lines × 3) · ×1
  • Duplicated block (78 lines × 3) scripts/model_examples/openai_chat_multiagent.py:19 — scripts/model_examples/openai_chat_multiagent.py:19-96 | scripts/model_examples/openai_response_multiagent.py:20-98 | scripts/model_examples/xai_multiagent.py:20-97 — before extracting anything, compare `scripts/model_examples/openai_chat_multiagent.py` and `scripts/model_examples/openai_response_multiagent.py` as WHOLE FILES: 85% 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 1 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.
P12 · CI test-gate honesty · Coverage collected but not gated · ×1
  • Coverage collected but not gated — CI collects a coverage report but no step enforces a minimum — coverage could halve and CI stays green. Add a step that fails the build when coverage drops below a floor (your coverage tool's minimum-threshold flag, or a coverage-gate action) so the number guards something. What was searched, so you can tell an absence from a miss: this repository's CI files AND its coverage configuration — the well-known coverage and test-runner config files, read at the repository root and inside workspace package directories two levels down, so a floor declared beside the tests rather than in the pipeline is credited — matched against the threshold settings this check knows by name. A floor set in your coverage service's web UI rather than in a committed file, or under a setting whose name is not one of those, is not seen here.
X1 · Async correctness · Task from `asyncio.ensure_future` is not kept · ×1
  • Task from `asyncio.ensure_future` is not kept src/agentscope/app/_manager/_background_task_manager.py:321 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
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 src/agentscope/app/_service/_mcp_render.py:93 — `render_mcp` is public, takes a document from its caller (line 103) and hands it to `_substitute`, which calls itself at line 93 (`_substitute`) with a piece of `node` (and at line 98) — and nowhere in `_substitute` 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 `_substitute` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Minor — 56 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate src/agentscope/console/_renderer.py:269 — `block.type == block_type and block.id == block_id` appears character-identically in 2 files — src/agentscope/console/_renderer.py, src/agentscope/message/_base.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/app/storage/_redis_storage.py:292 — `c.data.get("type") == cred_type and c.id != credential_data.id` appears character-identically in 2 files — src/agentscope/app/storage/_redis_storage.py, src/agentscope/app/storage/_sql/_storage.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/app/_service/_chat.py:959 — `channel is not None and channel_origin is not None` appears character-identically in 2 files — src/agentscope/app/_service/_chat.py, src/agentscope/app/_service/_realtime.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/app/_service/_chat.py:953 — `channel_origin is not None and self._channel_clients is not None` appears character-identically in 2 files — src/agentscope/app/_service/_chat.py, src/agentscope/app/_service/_realtime.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/formatter/_deepseek_formatter.py:87 — `content_blocks or tool_calls or reasoning_content_blocks` appears character-identically in 2 files — src/agentscope/formatter/_deepseek_formatter.py, src/agentscope/formatter/_volcengine_formatter.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/agent/_agent.py:2540 — `decision.behavior == PermissionBehavior.ASK and decision.bypass_immune` appears character-identically in 2 files — src/agentscope/agent/_agent.py, src/agentscope/permission/_engine.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/tts/_dashscope/_cosyvoice_model.py:324 — `full_text and not self._callback.has_audio_data()` appears character-identically in 2 files — src/agentscope/tts/_dashscope/_cosyvoice_model.py, src/agentscope/tts/_dashscope/_realtime_model.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/model/_dashscope/_model.py:321 — `getattr(chunk, "id", None) or response_id` appears character-identically in 5 files — src/agentscope/model/_dashscope/_model.py, src/agentscope/model/_deepseek/_model.py, src/agentscope/model/_moonshot/_model.py, src/agentscope/model/_openai_chat/_model.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/model/_dashscope/_model.py:395 — `getattr(delta_audio, "transcript", "") or ""` appears character-identically in 2 files — src/agentscope/model/_dashscope/_model.py, src/agentscope/model/_openai_chat/_model.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/tool/_builtin/_glob.py:261 — `head_limit is not None and head_limit < 0` appears character-identically in 2 files — src/agentscope/tool/_builtin/_glob.py, src/agentscope/tool/_builtin/_grep.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:61 — `host_cache_dir is not None and not host_cache_dir.strip()` appears character-identically in 2 files — src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py, src/agentscope/workspace/_bubblewrap/_bubblewrap_workspace.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/model_examples/_utils.py:54 — `isinstance(block, DataBlock) and isinstance( block.source, Base64Source, )` appears character-identically in 3 files — scripts/model_examples/_utils.py, src/agentscope/app/channel/_feishu/_channel.py, src/agentscope/workspace/_base.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/agent/_agent.py:825 — `isinstance(block, ToolResultBlock) and isinstance( block.output, list, )` appears character-identically in 2 files — src/agentscope/agent/_agent.py, src/agentscope/workspace/_base.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/model/_dashscope/_model.py:454 — `isinstance(reasoning, str) and reasoning` appears character-identically in 4 files — src/agentscope/model/_dashscope/_model.py, src/agentscope/model/_deepseek/_model.py, src/agentscope/model/_openai_chat/_model.py, src/agentscope/model/_volcengine/_model.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/formatter/_anthropic_formatter.py:429 — `len(msgs) > 0 and msgs[0].role == "system"` appears character-identically in 8 files — src/agentscope/formatter/_anthropic_formatter.py, src/agentscope/formatter/_dashscope_formatter.py, src/agentscope/formatter/_deepseek_formatter.py, src/agentscope/formatter/_gemini_formatter.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/tui/_chat.py:537 — `message.role == "assistant" and message.finished_at is None` appears character-identically in 2 files — src/agentscope/tui/_chat.py, src/agentscope/tui/_launcher.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/app/middleware/_sop_step_middleware.py:49 — `msg.id != agent.state.reply_id or msg.role != "assistant" or msg.name != agent.name` appears character-identically in 2 files — src/agentscope/app/middleware/_sop_step_middleware.py, src/agentscope/app/middleware/_team_member_middleware.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/tui/_chat.py:479 — `msg.role == "assistant" and msg.finished_at is None` appears character-identically in 2 files — src/agentscope/tui/_chat.py, src/agentscope/tui/_launcher.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/formatter/_moonshot_formatter.py:443 — `not accumulated_text and not media_blocks` appears character-identically in 3 files — src/agentscope/formatter/_moonshot_formatter.py, src/agentscope/formatter/_openai_response_formatter.py, src/agentscope/formatter/_volcengine_formatter.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/middleware/_longterm_memory/_mem0/_utils.py:33 — `not isinstance(m, Msg) or m.role != "user"` appears character-identically in 2 files — src/agentscope/middleware/_longterm_memory/_mem0/_utils.py, src/agentscope/middleware/_longterm_memory/_reme/_utils.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/tui/_ask_user.py:235 — `not self.is_mounted or not self._pending` appears character-identically in 2 files — src/agentscope/tui/_ask_user.py, src/agentscope/tui/_chat.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:506 — `os.path.islink(path) or not os.path.isdir(path)` appears character-identically in 2 files — src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py, src/agentscope/workspace/_bubblewrap/_bubblewrap_workspace.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/formatter/_dashscope_formatter.py:259 — `pending_media and not isinstance(block, ToolResultBlock)` appears character-identically in 6 files — src/agentscope/formatter/_dashscope_formatter.py, src/agentscope/formatter/_deepseek_formatter.py, src/agentscope/formatter/_moonshot_formatter.py, src/agentscope/formatter/_ollama_formatter.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/app/middleware/_sop_step_middleware.py:79 — `result is not None and result.state == ToolResultState.SUCCESS` appears character-identically in 2 files — src/agentscope/app/middleware/_sop_step_middleware.py, src/agentscope/app/middleware/_team_member_middleware.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/agentscope/tool/_builtin/_bash.py:731 — `result.exit_code == -1 and result.stderr == b"timed out"` appears character-identically in 3 files — src/agentscope/tool/_builtin/_bash.py, src/agentscope/tool/_builtin/_grep.py, src/agentscope/tool/_builtin/_powershell.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
X7 · Silent fallback defaults · Silent fallback default in catch · ×5
  • Silent fallback default in catch src/agentscope/app/storage/_model/_schedule.py:36 — `_get_local_timezone` swallows every exception into `return 'UTC'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:914 — `_list_md_files` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch src/agentscope/middleware/_tracing/_extractor.py:455 — `_get_agent_messages` 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 examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx:123 — `loadPanelLayout` 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 examples/web_ui/frontend/src/pages/setup/index.tsx:35 — `notReadyComponents` 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.
D19 · Documentation Quality · Documentation · ×3
  • Documentation: no project overview README.md — The opening paragraph shows the logo and links to docs.agentscope.io but does not state what AgentScope 2.0 is or what it does for readers who skim it. State a one-line project description (what problem does this solve) so an outsider can grasp the value before reading further.
  • Documentation: contradicts the code docs/NEWS.md — The changelog entry for the `Model` section (deprecating model configuration in favor of explicit object instantiation) is stale given that the current ModelResponse class and asynchronous invocation are live. Verify each NEWS item reflects the latest API surface.
  • Documentation: contradicts the code docs/NEWS_zh.md — The changelog entry for the `Model` section (deprecating model configuration) is stale given that the current ModelResponse class and asynchronous invocation are live. Verify each NEWS item reflects the latest API surface.
M4 · Documentation accuracy · README/code drift · ×3
  • README/code drift README.md:1 — README claims Python 3.11+ but the repository is a single source repo with no dependency manifest — searched for: `Python version constraint`. Each was matched case- and separator-insensitively against file and directory NAMES anywhere in the tree, and against the CONTENTS of manifest files (package.json, *.csproj, *.props, *.slnx, *.yml, Dockerfile); the README's own prose never counts, so a claim is never refuted by merely being made. Nothing outside that search was read — a footprint living only in a submodule, in a file type not listed here, or under a name none of those terms matches is not seen, and this row is then wrong.
  • README/code drift README.md:1 — README describes an agent framework while the evidence shows only one project (the README) and no other projects exist — reported by the model that read the README against this repository; no term search was run for this one, so nothing here has been checked against the tree. Treat it as a reading to confirm, not as a measured contradiction: verify it against the code before acting on it, and if the footprint it describes does exist, this row is wrong.
  • README/code drift CONTRIBUTING.md:116 — CONTRIBUTING.md names `docs/contributing-update`, but no file or folder `docs/contributing-update` 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.
D16 · Bus Factor · Off-boarding risk · ×2
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 24 significant file(s) lose their only recent owner: src/agentscope/app/message_bus/_base.py, src/agentscope/app/_service/_workspace.py, scripts/issue_triage.py, src/agentscope/app/middleware/_tool_offload_middleware.py, src/agentscope/sop/_schema.py, src/agentscope/app/storage/_sql/_tables.py, src/agentscope/app/_router/_agent.py, src/agentscope/app/_tool/_team_say.py (+16 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 22 significant file(s) lose their only recent owner: src/agentscope/tts/_dashscope/_realtime_model.py, scripts/model_examples/dashscope_multimodal.py, scripts/model_examples/openai_chat_multimodal.py, scripts/model_examples/anthropic_multimodal.py, scripts/model_examples/_utils.py, scripts/model_examples/gemini_multimodal.py, scripts/model_examples/moonshot_multimodal.py, src/agentscope/middleware/_tracing/_converter.py (+14 more). Pair on, review, or document these before any departure.
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 src/agentscope/middleware/_rag.py:526 — `debug` at line 526 is called with an argument built by `[ranked[i].chunk.source for i in ids]` (line 528), 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 src/agentscope/realtime/_gemini/_model.py:420 — `debug` at line 420 is called with an argument built by `list(data)` (line 420), 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.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×2
  • Silent fallback default on parse failure src/agentscope/app/channel/_dingtalk/_card.py:262 — `_json_object` returns `{}` when `(json.JSONDecodeError, 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 src/agentscope/tui/_messages.py:49 — `_elapsed` 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.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 6 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 (52 single-owned of 353 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; 353 of the 545 production source files in this repository met that bar). They are anonymized user #3 (1 file(s)), anonymized user #4 (1 file(s)), anonymized user #5 (1 file(s)), anonymized user #6 (1 file(s)), anonymized user #7 (1 file(s)), anonymized user #8 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: src/agentscope/middleware/_longterm_memory/_reme/_config.py, src/agentscope/tts/_gemini/_model.py, src/agentscope/tool/_builtin/_powershell.py, src/agentscope/app/middleware/_protocol/_base.py, src/agentscope/app/_manager/_chat_run_registry.py, src/agentscope/rag/_parser/_pdf.py.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 1 of 1 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `(repository root)` (113975 LoC, 953 module-visible types across 119 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D34 · Knowledge Freshness · Orphaned files with no living knowledge · ×1
  • Orphaned files with no living knowledge — 1 of 353 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; 353 of the 545 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: src/agentscope/workspace/_k8s/_k8s_backend.py. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D34 · Knowledge Freshness · Orphaned file · ×1
  • Orphaned file src/agentscope/workspace/_k8s/_k8s_backend.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.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • 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.
M2 · Architecture documentation · No architecture diagram/doc · ×1
  • No architecture diagram/doc — No C4/Structurizr/PlantUML/Mermaid/Graphviz/D2 diagram, no drawn diagram named for the architecture, no file named `architecture` or `design` in any markup this check reads, and nothing in the README, docs or contributor guides that announces the shape — no `## Architecture` heading, no "architecture overview"/"high-level design" phrasing, no "the architecture is …" introduction, no guided code tour. A shape laid out in prose that never names itself as the architecture is not visible to this check, and neither is one kept outside the repository, so this row reports the absence of a re-findable shape document — not evidence that nobody wrote the shape down.
P3 · Security & performance tooling · No SAST · ×1
  • 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 45656 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 automation exists but no readiness/liveness probes, rolling-update strategy, lifecycle hooks or migration job were evidenced — a bad release is harder to detect and reverse.
P4 · Deployment & Rollback · No release approval gate · ×1
  • No release approval gate — Deployment is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever reaches the release trigger goes to production unreviewed, so a mistaken merge or tag is live before anyone can stop it.
P6 · Release Hygiene · Changelog looks stale/thin · ×1
  • Changelog looks stale/thin — The changelog this check read carries 1 versioned entry, against a bar of 3. Counted as either the distinct `x.y.z` versions it names (a link's target is not counted) or its version-shaped section headings (`## [1.2.0]`, `## V14.x.x`, `## Updates in 8.0.x`), whichever is the larger — so a log sectioned by minor series counts its sections, not its individual patch numbers. Entries recorded somewhere this check does not read — release notes generated at tag time from a generator config it did not recognise, or a log kept outside the repository — are not counted here, and this row is about what is re-findable in the tree rather than about how often you release.
Minor — 1 finding(s)
D12 · Dependency Hygiene · Dependency hygiene PARTLY measured · ×1
  • Dependency hygiene PARTLY measured — Python dependencies read, no exact pin to grade for currency — This repository's Python dependencies were read: 7 shipped distribution(s) across 1 manifest(s) (39 development or optional declaration(s) excluded, because a consumer does not install them). Whether any of them is behind its current release is the dependency-CURRENCY question, and no declaration here carries an EXACT pin to ask it about — every one is a floor or a range, which installs the newest release it admits and therefore cannot be behind one. That is a healthy declaration style, NOT a defect and NOT a gap in this analyzer; there is simply no currency question to answer. This is NOT a finding that these dependencies are current or healthy. Lockfiles are deliberately not read (poetry.lock, uv.lock, Pipfile.lock, pdm.lock): the four disagree about dev/optional membership, and misreading one would charge a test-only package a consumer never receives. Known CVEs in the same dependency graph are a separate question, reported under D30.

Appendix B — Reproduction & audit trail

Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-2eb2a30d89914c1698d0ed1b45a99353/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-2eb2a30d89914c1698d0ed1b45a99353/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off .37artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update0artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .8artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—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) — `src/agentscope/realtime/_dashscope/_audio_model.py` — so the PII/GDPR sweep did not cover them at all.0—
D37 · Vulnerability-disclosure Policydisclosure—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.0—
D40 · Network Egress Confinementruntime-hardening—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.0—
D41 · Kernel & Syscall Confinementruntime-hardening—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.0—
D42 · Runtime Threat Enforcementruntime-hardening—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.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update0artifacts/raw/trivy-fs.json

Run 01a15a16-5f86-7384-8e2c-06b3616a3832 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

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.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md