Public report of agentscope-ai/agentscope, published 16 November 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey → Signed and filed in the standard's public register, 16 November 2026, 00:40 UTC · Survey ID cd_becbf12e86b24b8681a6f687217543df

agentscope-ai/agentscope

Measured 16 November 2026, 00:40 UTC, at code version 27d8359

CAI score 62out of 100 At risk Down 5 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: 161,682 lines of product code in 1 project, tests not counted · Estimated rebuild effort: about 2.4 person-years · Weakest lens: Production Readiness, 50

Findings by how serious they are

59 critical 791 serious 66 minor

17 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.

This survey was produced by

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
16 November 2026, 00:40 UTC

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

A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.

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

51of 51 dimensions measured by tools.
902of 916 findings point to an exact file and line, so you can open each one in the code. The other 14 concern the repository as a whole, such as missing documentation.
51dimensions across 7 lenses, read from 161,682 lines of product code in 1 project.
Chapters

Executive summary

agentscope-ai/agentscope is rated At risk because critical security findings are open, most of them in the build pipeline. Its score is held back in part because we found no automated security scanning of the code, its secrets or its dependencies. It scores 62 out of 100, which the At risk rating leaves unchanged.

Production Readiness, at 50, is the weakest lens and counts most in the score. The best first step is adding automated security scanning, worth about 7 points. Moving to versioned database migrations comes next, worth about 5 points. Raising Production Readiness to 70 would lift the score to about 69.

Thirty-two pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Twenty-four known security holes in the packages the code depends on can be used by attackers, and two secrets can leak from the build pipeline. Pinning each tool to an exact version, updating the vulnerable packages and limiting each secret to its own step would close these risks. The part of the code nobody has worked on for a long time needs someone to learn and document it before anyone changes it.

The product code is 161,682 lines, about €350,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.
Production Readiness 50 · counts for 46%Maturity 62 · counts for 25%Code Health 71 · counts for 14%Security and Compliance 82 · counts for 8%Architecture 99 · counts for 4%Domain Modelling 100 · counts for 2%Performance 100 · counts for 1%

If Production Readiness rose from 50 to 70, the lowest score rated Strong, the score would rise from 62 to about 69.

Code composition: what the lines of code are
Product code 52%Tests 48%
New since the last survey: 235 findings

These 235 critical or serious findings weren't in the previous survey, on 3 November 2026. The first 100 are listed here, and the findings file in the download package lists them all.

  • Cyclomatic Complexity · RealtimeAgent._drive_client_delegation (cyclomatic 44) src/agentscope/agent/_realtime/_agent.py
  • Cyclomatic Complexity · GeminiChatModel._call_api (cyclomatic 28) src/agentscope/model/_gemini/_model.py
  • Cyclomatic Complexity · GeminiRealtimeModel._parse (cyclomatic 23) src/agentscope/realtime/_gemini/_model.py
  • Cyclomatic Complexity · _toolkit.get_toolkit (cyclomatic 20) src/agentscope/app/_service/_toolkit.py
  • Cyclomatic Complexity · _console._ask_user (cyclomatic 18) src/agentscope/console/_console.py
  • Cyclomatic Complexity · GeminiChatModel._parse_stream_response (cyclomatic 18) src/agentscope/model/_gemini/_model.py
  • Cyclomatic Complexity · _realtime._create_realtime_offer (cyclomatic 17) src/agentscope/app/_router/_realtime.py
  • Cyclomatic Complexity · RealtimeService.create_agent (cyclomatic 17) src/agentscope/app/_service/_realtime.py
  • Cyclomatic Complexity · OpenAILiveModel._parse (cyclomatic 17) src/agentscope/realtime/_openai_live/_model.py
  • Cyclomatic Complexity · RealtimeAgent._run_tool (cyclomatic 16) src/agentscope/agent/_realtime/_agent.py
  • Cyclomatic Complexity · _client_external_tool._iter_schema_nodes (cyclomatic 16) src/agentscope/app/_client_external_tool.py
  • Cognitive Complexity · RealtimeAgent._drive_client_delegation (cognitive 72) src/agentscope/agent/_realtime/_agent.py
  • Cognitive Complexity · GeminiChatModel._call_api (cognitive 42) src/agentscope/model/_gemini/_model.py
  • Cognitive Complexity · _console._ask_user (cognitive 36) src/agentscope/console/_console.py
  • Cognitive Complexity · _client_external_tool._iter_schema_nodes (cognitive 26) src/agentscope/app/_client_external_tool.py
  • Cognitive Complexity · GeminiRealtimeModel._parse (cognitive 25) src/agentscope/realtime/_gemini/_model.py
  • Cognitive Complexity · GeminiTTSModel._parse_response (cognitive 24) src/agentscope/tts/_gemini/_model.py
  • Cognitive Complexity · RealtimeAgent.send (cognitive 22) src/agentscope/agent/_realtime/_agent.py
  • Cognitive Complexity · _console.launch_console (cognitive 22) src/agentscope/console/_console.py
  • Cognitive Complexity · FormatterBase._split_agent_messages_at_hints (cognitive 21) src/agentscope/formatter/_formatter_base.py
  • Cognitive Complexity · OpenAILiveModel._parse (cognitive 21) src/agentscope/realtime/_openai_live/_model.py
  • Cognitive Complexity · _model._openai_response_block_error (cognitive 20) src/agentscope/model/_openai_response/_model.py
  • Cognitive Complexity · MiniMaxTTSModel._stream (cognitive 20) src/agentscope/tts/_minimax/_model.py
  • Cognitive Complexity · ChatModelBase.__call__ (cognitive 19) src/agentscope/model/_base.py
  • Cognitive Complexity · RealtimeService.create_agent (cognitive 18) src/agentscope/app/_service/_realtime.py
  • Cognitive Complexity · RealtimeAgent._sync_delegation_state (cognitive 17) src/agentscope/agent/_realtime/_agent.py
  • Cognitive Complexity · _realtime._create_realtime_offer (cognitive 17) src/agentscope/app/_router/_realtime.py
  • Cognitive Complexity · EmbeddingModelBase.__call__ (cognitive 17) src/agentscope/embedding/_embedding_base.py
  • Cognitive Complexity · MoonshotChatModel._parse_completion_response (cognitive 17) src/agentscope/model/_moonshot/_model.py
  • Cognitive Complexity · RealtimeAgent._run_tools (cognitive 16) src/agentscope/agent/_realtime/_agent.py
  • Cognitive Complexity · GitHubMCPHub._from_remote (cognitive 16) src/agentscope/app/hub/_mcp/_github_hub.py
  • Cognitive Complexity · OllamaMultiAgentFormatter.format (cognitive 16) src/agentscope/formatter/_ollama_formatter.py
  • Cognitive Complexity · DeepSeekChatModel._parse_completion_response (cognitive 16) src/agentscope/model/_deepseek/_model.py
  • Cognitive Complexity · GeminiChatModel._prepare_gemini_4_config (cognitive 16) src/agentscope/model/_gemini/_model.py
  • God Classes · TooManyMethods: RedisMessageBus src/agentscope/app/message_bus/_redis_message_bus.py
  • God Classes · FileTooLong: _gemini/_model.py src/agentscope/model/_gemini/_model.py
  • Code Duplication · Near-duplicate member family (5 members, 41 shared lines) src/agentscope/model/_dashscope/_model.py
  • Code Duplication · Near-duplicate member family (4 members, 28 shared lines) src/agentscope/model/_dashscope/_model.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/app/storage/_sql/_alembic/versions/0001_initial.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/realtime/_dashscope/_model.py
  • Code Duplication · Edited copy of a member (124 corresponding lines) src/agentscope/tts/_dashscope/_cosyvoice_utils.py
  • Code Duplication · Edited copy of a member (92 corresponding lines) src/agentscope/realtime/_dashscope/_model.py
  • Code Duplication · Edited copy of a member (76 corresponding lines) src/agentscope/app/channel/_dingtalk/_channel.py
  • Code Duplication · Edited copy of a member (79 corresponding lines) src/agentscope/embedding/_dashscope/_model.py
  • Code Duplication · Edited copy of a member (68 corresponding lines) src/agentscope/model/_model_card.py
  • Code Duplication · Edited copy of a member (74 corresponding lines) src/agentscope/model/_deepseek/_model.py
  • Code Duplication · Edited copy of a member (80 corresponding lines) src/agentscope/app/middleware/_sop_step_middleware.py
  • Code Duplication · Edited copy of a member (70 corresponding lines) src/agentscope/app/storage/_redis_storage.py
  • Code Duplication · Edited copy of a member (71 corresponding lines) src/agentscope/embedding/_gemini/_model.py
  • Code Duplication · Edited copy of a member (73 corresponding lines) src/agentscope/tts/_dashscope/_model.py
  • Code Duplication · Edited copy of a member (49 corresponding lines) src/agentscope/app/storage/_redis_storage.py
  • Code Duplication · Edited copy of a member (43 corresponding lines) src/agentscope/app/_router/_hub.py
  • Code Duplication · Edited copy of a member (54 corresponding lines) src/agentscope/embedding/_dashscope/_model.py
  • Code Duplication · Edited copy of a member (41 corresponding lines) src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py
  • Code Duplication · Edited copy of a member (44 corresponding lines) src/agentscope/workspace/_base.py
  • Code Duplication · Edited copy of a member (64 corresponding lines) src/agentscope/app/channel/worker/__init__.py
  • Code Duplication · Edited copy of a member (53 corresponding lines) src/agentscope/model/_ollama/_model.py
  • Code Duplication · Edited copy of a member (41 corresponding lines) src/agentscope/workspace/_local_workspace.py
  • Code Duplication · Edited copy of a member (29 corresponding lines) src/agentscope/app/storage/_redis_storage.py
  • Code Duplication · Edited copy of a member (35 corresponding lines) src/agentscope/agent/_agent.py
  • Code Duplication · Edited copy of a member (46 corresponding lines) src/agentscope/app/middleware/_sop_step_middleware.py
  • Code Duplication · Edited copy of a member (90 corresponding lines) src/agentscope/permission/_engine.py
  • Code Duplication · Edited copies of one member (3 members, 63+ corresponding lines) src/agentscope/app/workspace_manager/_daytona_workspace_manager.py
  • Code Duplication · Edited copies of one member (3 members, 34+ corresponding lines) src/agentscope/formatter/_dashscope_formatter.py
  • Code Duplication · Edited copy of a member (31 corresponding lines) src/agentscope/workspace/_local_workspace.py
  • Code Duplication · Edited copy of a member (58 corresponding lines) src/agentscope/workspace/_daytona/_daytona_workspace.py
  • Code Duplication · Edited copy of a member (42 corresponding lines) src/agentscope/embedding/_dashscope/_model.py
  • Code Duplication · Edited copies of one member (6 members, 33+ corresponding lines) src/agentscope/formatter/_anthropic_formatter.py
  • Code Duplication · Edited copy of a member (28 corresponding lines) src/agentscope/formatter/_ollama_formatter.py
  • Code Duplication · Edited copy of a member (23 corresponding lines) src/agentscope/realtime/_openai/_model.py
  • Code Duplication · Edited copy of a member (31 corresponding lines) src/agentscope/tts/_openai/_voice_cloning_client.py
  • Code Duplication · Edited copies of one member (3 members, 36+ corresponding lines) src/agentscope/formatter/_dashscope_formatter.py
  • Code Duplication · Edited copy of a member (23 corresponding lines) src/agentscope/app/channel/_feishu/_channel.py
  • Code Duplication · Edited copy of a member (49 corresponding lines) src/agentscope/workspace/_local_workspace.py
  • Code Duplication · Edited copy of a member (35 corresponding lines) src/agentscope/app/channel/_feishu/_channel.py
  • Code Duplication · Edited copies of one member (5 members, 38+ corresponding lines) src/agentscope/formatter/_dashscope_formatter.py
  • Code Duplication · Edited copy of a member (49 corresponding lines) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py
  • Code Duplication · Edited copy of a member (21 corresponding lines) src/agentscope/app/storage/_redis_storage.py
  • Code Duplication · Edited copies of one member (3 members, 40+ corresponding lines) src/agentscope/embedding/_embedding_base.py
  • Code Duplication · Edited copy of a member (20 corresponding lines) src/agentscope/app/storage/_sql/_storage.py
  • Code Duplication · Edited copy of a member (21 corresponding lines) src/agentscope/workspace/_docker/_docker_backend.py
  • Code Duplication · Edited copy of a member (38 corresponding lines) src/agentscope/app/storage/_redis_storage.py
  • Code Duplication · Edited copies of one member (4 members, 17+ corresponding lines) src/agentscope/realtime/_dashscope/_model.py
  • Code Duplication · Edited copies of one member (7 members, 51+ corresponding lines) src/agentscope/model/_anthropic/_model.py
  • Code Duplication · Edited copy of a member (32 corresponding lines) src/agentscope/model/_model_response.py
  • Code Duplication · Edited copy of a member (18 corresponding lines) src/agentscope/workspace/_k8s/_k8s_workspace.py
  • Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) src/agentscope/app/storage/_redis_storage.py
  • Code Duplication · Edited copy of a member (28 corresponding lines) src/agentscope/realtime/_dashscope/_audio_model.py
  • Code Duplication · Edited copy of a member (13 corresponding lines) src/agentscope/app/storage/_sql/_storage.py
  • Code Duplication · Edited copy of a member (38 corresponding lines) src/agentscope/model/_moonshot/_model.py
  • Code Duplication · Edited copy of a member (47 corresponding lines) src/agentscope/embedding/_dashscope/_model.py
  • Code Duplication · Edited copies of one member (4 members, 46+ corresponding lines) src/agentscope/app/_router/_chat.py
  • Code Duplication · Edited copy of a member (15 corresponding lines) src/agentscope/app/storage/_redis_storage.py
  • Code Duplication · Edited copies of one member (3 members, 20+ corresponding lines) src/agentscope/app/storage/_redis_storage.py
  • Code Duplication · Edited copy of a member (12 corresponding lines) src/agentscope/tui/_ask_user.py
  • Code Duplication · Edited copy of a member (37 corresponding lines) src/agentscope/tts/_dashscope/_cosyvoice_model.py
  • Code Duplication · Edited copies of one member (3 members, 19+ corresponding lines) src/agentscope/app/storage/_sql/_storage.py

We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.

Fixed since the last survey: 31 findings

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

  • Cyclomatic Complexity · AnthropicMultiAgentFormatter._format_agent_message (cyclomatic 16) src/agentscope/formatter/_anthropic_formatter.py
  • Code Duplication · Near-duplicate member family (5 members, 40 shared lines) src/agentscope/model/_dashscope/_model.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/realtime/_dashscope/_model.py
  • Code Duplication · Duplicated block (27–40 lines × 2) src/agentscope/embedding/_gemini/_model.py
  • Code Duplication · Duplicated block (23–24 lines × 2) src/agentscope/formatter/_anthropic_formatter.py
  • Code Duplication · Duplicated block (17–18 lines × 2) src/agentscope/embedding/_embedding_base.py
  • Code Duplication · Duplicated block (17 lines × 4) src/agentscope/model/_deepseek/_model.py
  • Code Duplication · Duplicated block (16 lines × 5) src/agentscope/model/_dashscope/_model.py
  • Code Duplication · Duplicated block (14–16 lines × 2) src/agentscope/formatter/_xai_formatter.py
  • Code Duplication · Duplicated block (13–14 lines × 3) src/agentscope/formatter/_xai_formatter.py
  • Code Duplication · Duplicated block (12–13 lines × 2) .github/scripts/update_news.py
  • Code Duplication · Duplicated block (10 lines × 2) src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py
  • Code Duplication · Duplicated block (10 lines × 2) src/agentscope/formatter/_xai_formatter.py
  • Code Duplication · Duplicated block (9 lines × 2) src/agentscope/tts/_openai/_voice_cloning_client.py
  • Code Duplication · Duplicated block (6–8 lines × 6) src/agentscope/model/_dashscope/_model.py
  • Code Duplication · Duplicated block (2–7 lines × 4) src/agentscope/app/storage/_sql/_alembic/versions/0002_mcps_skills.py
  • Code Duplication · Duplicated block (6 lines × 7) src/agentscope/model/_dashscope/_model.py
  • Churn × Complexity Hotspots · Hotspot: src/agentscope/app/_tool/_agent_invite.py src/agentscope/app/_tool/_agent_invite.py
  • Churn × Complexity Hotspots · Hotspot: examples/web_ui/frontend/src/components/chat/ConfirmCard.tsx examples/web_ui/frontend/src/components/chat/ConfirmCard.tsx
  • Churn × Complexity Hotspots · Hotspot: src/agentscope/app/middleware/_protocol/_agui.py src/agentscope/app/middleware/_protocol/_agui.py
  • Churn × Complexity Hotspots · Hotspot: src/agentscope/embedding/_file_cache.py src/agentscope/embedding/_file_cache.py
  • Churn × Complexity Hotspots · Hotspot: src/agentscope/tool/_toolkit.py src/agentscope/tool/_toolkit.py
  • Async correctness · Task from `asyncio.ensure_future` is not kept src/agentscope/app/_manager/_background_task_manager.py
  • Exception handling · Swallowed exception (empty catch) src/agentscope/app/message_bus/_redis_message_bus.py
  • Exception handling · Swallowed exception (empty catch) src/agentscope/app/message_bus/_redis_message_bus.py
  • Exception handling · Swallowed exception (empty catch) src/agentscope/app/channel/_dispatcher.py
  • Exception handling · Swallowed exception (empty catch) src/agentscope/app/channel/_stream.py
  • Exception handling · Swallowed exception (caught, then discarded) src/agentscope/agent/_agent.py
Rebuild cost: about €350,000 · Estimate
Cost to rebuild€120,000 to €580,000, for 1,922 to 6,096 hours of work, about 2.4 person-years for 1 to 5 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.8 at a score of 62. 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: 161,682 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.

1
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 7 points · Medium effort · Security & performance tooling
2
Turn off SQLAlchemy create_all() in production and let the versioned migrations own the schema.
Raises the score by about 5 points · Medium effort · Schema migrations
3
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 5 points · Medium effort · Architecture documentation

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 €350,000 to build again, about 2.4 person-years of work. Its weakest lens is Production Readiness, at 50 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
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. 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 6.0 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 11% on every change. The history of the code shows how much it changes: about 166,009 lines over the last 90 days, which is about 673,259 lines a year. At that pace, the extra work comes to an estimated 85.9 to 515.7 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture: 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.

417 modules, with 809 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; 377 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 app.channel._base2 app.message_bus._base3 app.storage._model._base4 app.workspace_manager._base5 credential._base6 mcp._mcp_client7 message._base8 message._block9 middleware._base10 model._model_response11 permission._context12 permission._decision13 tool._builtin._backend14 app.storage._model._agent15 app.storage._model._channel16 credential._dashscope17 credential._openai18 event._event19 model._base20 realtime._base21 state._state22 tool._base23 tool._response24 agent._agent25 agent._realtime._agent26 app._manager._background_task_manager27 app.channel._dingtalk._tools._base28 app.channel._feishu._tools._base29 app.storage._model._session30 app.storage._base31 app._manager._scheduler._scheduler_manager32 app._service._access33 app._service._sop34 app.storage._redis_storage35 app.storage._sql._storage36 app._service37 app._service._chat38 app._service._realtime39 app40 app._router
1 app.channel._base
2 app.message_bus._base
3 app.storage._model._base
4 app.workspace_manager._base
5 credential._base
6 mcp._mcp_client
7 message._base
8 message._block
9 middleware._base
10 model._model_response
11 permission._context
12 permission._decision
13 tool._builtin._backend
14 app.storage._model._agent1
15 app.storage._model._channel1
16 credential._dashscope1
17 credential._openai1
18 event._event21
19 model._base11
20 realtime._base11
21 state._state1
22 tool._base11
23 tool._response1
24 agent._agent1411111
25 agent._realtime._agent12111
26 app._manager._background_task_manager1111
27 app.channel._dingtalk._tools._base1111
28 app.channel._feishu._tools._base1111
29 app.storage._model._session11
30 app.storage._base111112
31 app._manager._scheduler._scheduler_manager1111
32 app._service._access211
33 app._service._sop212
34 app.storage._redis_storage1111121
35 app.storage._sql._storage1111121
36 app._service111111115215
37 app._service._chat11111111111
38 app._service._realtime111111111
39 app221211111
40 app._router131111113110121
Uses a module listed above itPart of a loopThe module itself
1 app.channel._base2 app.message_bus._base3 app.storage._model._base4 app.workspace_manager._base5 credential._base6 mcp._mcp_client7 message._base8 message._block9 middleware._base10 model._model_response11 permission._context12 permission._decision13 tool._builtin._backend14 app.storage._model._agent15 app.storage._model._channel16 credential._dashscope17 credential._openai18 event._event19 model._base20 realtime._base21 state._state22 tool._base23 tool._response24 agent._agent25 agent._realtime._agent26 app._manager._background_task_manager27 app.channel._dingtalk._tools._base28 app.channel._feishu._tools._base29 app.storage._model._session30 app.storage._base31 app._manager._scheduler._scheduler_manager32 app._service._access33 app._service._sop34 app.storage._redis_storage35 app.storage._sql._storage36 app._service37 app._service._chat38 app._service._realtime39 app40 app._routerapp.channel._base1app.message_bus._base2app.storage._model._base3app.workspace_manager._base4credential._base5mcp._mcp_client6message._base7message._block8middleware._base9model._model_response10permission._context11permission._decision12tool._builtin._backend13app.storage._model._agent14app.storage._model._channel15credential._dashscope16credential._openai17event._event18model._base19realtime._base20state._state21tool._base22tool._response23agent._agent24agent._realtime._agent25app._manager._background_task_manager26app.channel._dingtalk._tools._base27app.channel._feishu._tools._base28app.storage._model._session29app.storage._base30app._manager._scheduler._scheduler_manager31app._service._access32app._service._sop33app.storage._redis_storage34app.storage._sql._storage35app._service36app._service._chat37app._service._realtime38app39app._router40111121111111111411111121111111111111111111111211112112121111121111112111111111521511111111111111111111221211111131111113110121+377 more modules (most-connected shown)

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

At a glance — Architecture · 99% · Exemplary ·

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

At a glance — Readiness · 50% · Weak · gated by P3, P8 ·

At a glance — Security · 82% · 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
A03:2025 — Software Supply Chain Failures47High / Critical
A05:2025 — Injection36High / Critical
A02:2025 — Security Misconfiguration8Medium

Roadmap

Top priorities: 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; Turn off SQLAlchemy create_all() in production and let the versioned migrations own the schema; 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.

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

Do thisHelpsEffortDimension
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.+7.1 ptsMediumSecurity & performance tooling
Turn off SQLAlchemy create_all() in production and let the versioned migrations own the schema.+4.9 ptsMediumSchema migrations
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.+4.7 ptsMediumArchitecture documentation
Resolve the 1 Orphaned knowledge finding(s) in Knowledge Freshness — start with _bubblewrap_backend.py.+1.7 ptsLowKnowledge Freshness
Add readiness/liveness probes and a rolling-update (or blue/green) strategy so a bad release is caught and rolled back automatically.+3.1 ptsMediumDeployment & Rollback
Swallowed exception (caught, then discarded)+1.2 ptsMediumException handling
Keep the changelog current — add a versioned entry (Keep-a-Changelog ## [x.y.z]) for each release so the history isn't a stub.+1.0 ptsMediumRelease Hygiene
Resolve the 5 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED.+0.4 ptsLowSupply-chain Provenance & Signing

File quality

Per-file score 0–10 — a quality signature. Of 207 files carrying findings, judged against the Production bar: 3% slop · 66% mixed · 31% near-clean.

FileScoreBandWorst signal
REDACTED0.0SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED3.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/_realtime/_agent.py6.0MixedExplicit Debt: TodoComment
src/agentscope/agent/_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

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

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

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

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

Could not be resolved — 17

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 51 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.

Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.

What we checked — 51 dimensions across the health lenses
D1D2D3D4D6D11D13D14D15D16D17D19D27D28D29D30D31D34D35D36D43D44AX10AX3AX4AX6C2DM6M1M2M3M4P1P10P2P3P4P6P7P8PF3X1X12X17X23X24X25X27X28X3X30

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, 902 of 916 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 or a scanner, 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
Canine Code Analyzer 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

Every finding is locatable in findings.md. Run 01a1e1cb-fdbc-76ae-9055-6fa39e07aaa3.

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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT READ here — but this repository measures it: a coverage step in CI (`coverage run`) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.py), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored.
  • 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 8 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.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
  • D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is an ADMISSION gap, not an environment fault: it declares a published package (pyproject.toml), but no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict. For npm the surface is what a published package.json's entry points (exports, main, module, types) export, followed through the source; an entry that names build output the tree does not commit (dist/, build/) is not followed back to source, because only a tsconfig outDir/rootDir pair states that mapping and a bundler's input lives in executable configuration this engine does not evaluate.
  • D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D26 Project Cohesion — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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.
  • D26 Project Cohesion — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `(repository root)` (128664 LoC, 1048 module-visible types across 122 directories) is over its size bounds, and whether one unit is a coherent whole or a grab-bag is read from its type references: the parts of it that reach the rest only through its shared core. Those are read over the C#/VB code model, which this unit's source did not supply. Its size alone is no verdict on its cohesion, so none is published.
  • D27 Navigability — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Tracing effort is measured over resolved call sites, and all 1031 sampled here came from .py files. This repository's .tsx source is a material share of its production lines and contributed none, so the score above is a verdict about the part that was read. Not a finding that the unread half navigates well — it is unmeasured.
  • D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in src/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.
  • AXB2 Runtime readiness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. The image build failed, and its output does not match a cause we recognise. (rule: unrecognised-build-failure). The renderer reported: docker build failed (exit 1) — #1 DONE 0.0s REDACTED:1 -------------------- 1 | >>> COPY --from=node_stage /usr/local/bin/node /usr/local/bin/node 2 | COPY --from=node_stage /usr/local/lib/node_modules /usr/local/lib/node_modules 3 | RUN ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \ -------------------- ERROR: failed to solve: no build stage in current context; likely cause (not identified): the image build failed, and its output does not match a cause we recognise; runtime evidence skipped.
  • AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via Dockerfile (REDACTED). docker build failed (exit 1) — #1 DONE 0.0s REDACTED:1 -------------------- 1 | >>> COPY --from=node_stage /usr/local/bin/node /usr/local/bin/node 2 | COPY --from=node_stage /usr/local/lib/node_modules /usr/local/lib/node_modules 3 | RUN ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \ -------------------- ERROR: failed to solve: no build stage in current context; likely cause (not identified): the image build failed, and its output does not match a cause we recognise; runtime evidence skipped.
  • C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
  • GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby, Scala and Rust source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby, Scala or Rust 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby, Scala and Rust source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby, Scala or Rust 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.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala, Kotlin and Rust source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala, Kotlin or Rust 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala, PHP and Rust source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala, PHP or Rust 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.
  • X27 Collection changed while being enumerated — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
  • X29 Per-element action decided by a fixed element — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript (Vue and Svelte components included), 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 — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 5 further occurrence(s) are not listed individually; the score already reflects all 45.
  • X4 Structured logging — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, PHP, Dart, Ruby, Scala, Rust, Go, Swift, Erlang, F# and Visual Basic 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax 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, Kotlin source, and Rust 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

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • 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.
  • D11 Test Reliability: Flakiness is inferred from history/markers — we run 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 publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
  • 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: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity5.8 / 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 5.8 / 10 · rule-coverage 100% · ceiling Prevented

93 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was ChatService._run_impl at 88. 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 88)src/agentscope/app/_service/_chat.py:908
Msg.append_event (cyclomatic 61)src/agentscope/message/_base.py:247
BashCommandParser.check_sed_constraints (cyclomatic 60)src/agentscope/tool/_builtin/_bash_parser.py:726
DeepSeekChatFormatter.format (cyclomatic 46)src/agentscope/formatter/_deepseek_formatter.py:45
RealtimeAgent._drive_client_delegation (cyclomatic 44)src/agentscope/agent/_realtime/_agent.py:1417

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

What to do

  1. Bring the 2 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with ChatService._run_impl (cyclomatic 88), Msg.append_event (cyclomatic 61). — 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 2 together lifts Cyclomatic Complexity from 5.8 to about 6.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.

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

D2 · Cognitive Complexity2.0 / 10Critical✓ 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.0 / 10 · rule-coverage 100% · ceiling Prevented

191 method(s) exceeded the cognitive complexity threshold of 15; the worst was ChatService._run_impl at 161.

ChatService._run_impl (cognitive 161)src/agentscope/app/_service/_chat.py:908
_AnthropicFormatterBase._format_messages (cognitive 149)src/agentscope/formatter/_anthropic_formatter.py:34
DeepSeekChatFormatter.format (cognitive 132)src/agentscope/formatter/_deepseek_formatter.py:45
MoonshotChatFormatter.format (cognitive 129)src/agentscope/formatter/_moonshot_formatter.py:126
GeminiChatFormatter.format (cognitive 117)src/agentscope/formatter/_gemini_formatter.py:158

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

What to do

  1. Bring the 4 bodies over 120 down to 120 or less in Cognitive Complexity — start with ChatService._run_impl (cognitive 161), _AnthropicFormatterBase._format_messages (cognitive 149), DeepSeekChatFormatter.format (cognitive 132). — 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 4 together lifts Cognitive Complexity from 2.0 to about 2.6/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.

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

D3 · God Classes9.4 / 10Stronggated by 26 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.4 / 10 · rule-coverage 100% · ceiling Prevented

26 god class(es) detected.

FileTooLong: agent/_agent.py · ×17src/agentscope/agent/_agent.py
TooManyMethods: RedisStorage · ×9src/agentscope/app/storage/_redis_storage.py:57

What to do

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

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

D4 · Code Duplication6.3 / 10Adequate✓ Tool-verified

What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.

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

184 duplicated block group(s) detected. 9.4 % of the production lines (15,149 of 161,682) are in a reported copy. A further 133 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 32 of the 317 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population. Measured on part of this repository only: .tsx (16% 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 (13 lines × 2) · ×6src/agentscope/app/channel/_discord/_channel.py:325
Edited copy of a member (13 corresponding lines) · ×5src/agentscope/app/storage/_sql/_storage.py:1188
Duplicated block (15 lines × 2) · ×5src/agentscope/app/storage/_redis_storage.py:2530
Edited copy of a member (28 corresponding lines) · ×4src/agentscope/formatter/_ollama_formatter.py:73
Edited copy of a member (10 corresponding lines) · ×4src/agentscope/tui/_chat.py:474

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

What to do

  1. Resolve the 6 Duplicated block (13 lines × 2) finding(s) in Code Duplication — start with _model.py (2), _channel.py, _redis_storage.py. — One of this dimension's main actionable groups (6 warning-level).
  2. Resolve the 5 Edited copy of a member (13 corresponding lines) finding(s) in Code Duplication — start with _storage.py (3), _redis_storage.py, _meta.py. — One of this dimension's main actionable groups (5 warning-level).
  3. 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).

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

Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.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, 228 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 62 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 8 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (54 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. 2 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.5 / 10Stronggated by 78 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.5 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: src/agentscope/app/_service/_chat.py (18×88=1584); examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx (10×106=1060); src/agentscope/agent/_agent.py (25×41=1025) Repeated repair below the complexity floor: src/agentscope/workspace/_base.py (9 of 9 changes were fixes); src/agentscope/_utils/_common.py (8 of 8 changes were fixes); src/agentscope/mcp/_mcp_client.py (7 of 9 changes were fixes)

Hotspot: src/agentscope/app/_service/_chat.py · ×44src/agentscope/app/_service/_chat.py:908
Repeated repair: src/agentscope/workspace/_base.py · ×34src/agentscope/workspace/_base.py:851

What to do

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

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

D16 · Bus Factor9.4 / 10Exemplary✓ Tool-verified

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

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

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

25 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is scripts/issue_triage.py. Counted over 386 of the 574 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)

✓ On the Gold path — maintain.

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 161682 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 · ×10src/agentscope/workspace/_base.py:1230

What to do

  1. Resolve the 10 TodoComment finding(s) in Explicit Debt — start with _agent.py (2), _base.py, _rag.py. — One of this dimension's main actionable groups (10 warning-level).

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

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the project's documentation is clear, complete, and useful.

Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.

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

1 of 1 documentation facets pass in full. 5 document(s) read across 1 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D27 · Navigability10.0 / 10Exemplary✓ Tool-verified

What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.

Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.

Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.

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

71 % of calls cross a namespace and 0 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated. Measured over the .py source only — this repository's .tsx was not sampled for call sites, so this score covers part of the tree, not all of it.

✓ On the Gold path — maintain.

Detailed fixes: d27_recommendation.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.4 / 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.4 / 10 · rule-coverage 100% · ceiling Documented

36 finding(s): 0 critical, 34 high, 2 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 2 file(s) — `examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx` (line 1039), `src/agentscope/realtime/_dashscope/_audio_model.py` — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 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

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 / 10Adequategated by 24 critical findings○ 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. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

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

34 finding(s): 4 critical, 20 high, 7 medium, 3 low.

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 20 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (20). — One of this dimension's main actionable groups (20 issue-level).
  2. Resolve the 3 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (3). — One of this dimension's main actionable groups (3 issue-level).
  3. Resolve the 1 Critical vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).

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

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 / 10Adequategated by 1 critical finding✓ 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 386 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/_bubblewrap/_bubblewrap_backend.py. Counted over 386 of the 574 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledgesrc/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:1

What to do

  1. Resolve the 1 Orphaned knowledge finding(s) in Knowledge Freshness — start with _bubblewrap_backend.py. — One of this dimension's main actionable groups (1 issue-level).

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. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

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

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 segregation9.8 / 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.

  • `MessageBus` declares 20 abstract methods: `queue_push`, `queue_drain`, `queue_delete`, `log_append`, `log_read`, `log_trim`, `publish`, `subscribe`, `acquire_lock`, `is_locked`, `try_lock`, `unlock`, `registry_set`, `registry_set_if`, `registry_pop`, `registry_del`, `registry_exists`, `registry_getall`, `registry_get`, `registry_drop`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — src/agentscope/app/message_bus/_base.py:55
  • `StorageBase` declares 57 abstract methods: `upsert_credential`, `list_credentials`, `get_credential`, `delete_credential`, `upsert_mcp`, `list_mcps`, `get_mcp`, `get_mcp_by_name`, `delete_mcp`, `upsert_skill`, `list_skills`, `get_skill`, `get_skill_by_name`, `delete_skill`, `upsert_agent`, `list_agents`, `get_agent`, `delete_agent`, `upsert_session`, `set_session_team_id`, `update_session_state`, `list_sessions`, `delete_session`, `get_session`, `list_sessions_by_schedule`, `list_sessions_by_channel`, `upsert_schedule`, `get_schedule`, `list_schedules`, `delete_schedule`, `list_all_schedules`, `upsert_message`, `delete_message`, `get_message`, `list_messages`, `upsert_team`, `get_team`, `list_teams`, `delete_team`, `upsert_knowledge_base`, and 17 more. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — src/agentscope/app/storage/_base.py:33

What to do

  • Split fat interfaces into focused role-interfaces so clients depend only on what they use.
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)8.0 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.

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

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 repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.

Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.

M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.

Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.

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's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

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 14 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. — REDACTED:18
  • `examples/web_ui/backend/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — examples/web_ui/backend/package.json:10

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. — REDACTED:54
  • 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. — REDACTED:54

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 migrations3.0 / 10Weak✓ Tool-verified

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.

  • This repository versions its schema (Alembic), but SQLAlchemy create_all() here builds or alters the schema from the model as well, outside that history — the two paths can disagree about the shape, and a change made this way is never a reviewed migration. Turn it off and let Alembic own the schema. (×3) — src/agentscope/app/storage/_sql/_storage.py:134, src/agentscope/app/storage/_sql/_storage.py:216, src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:10

What to do

  • Turn off SQLAlchemy create_all() in production and let the versioned migrations own the schema.
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 each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

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. (×2) — src/agentscope/middleware/_longterm_memory/_mem0/_middleware.py:741, src/agentscope/app/middleware/_tool_offload_middleware.py:436

What to do

  • Task from `asyncio.create_task` 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.

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.
X23 · Unguarded diagnostic materialisation6.3 / 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 556 is called with an argument built by `list(data)` (line 556), 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:556
  • `debug` at line 563 is called with an argument built by `[ranked[i].chunk.source for i in ids]` (line 565), 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:563

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.

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.4 / 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/workspace/_gateway_client.py:537, src/agentscope/workspace/_sandboxed_base.py:529, src/agentscope/workspace/_bubblewrap/_bubblewrap_workspace.py:647, …
  • 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/workspace/_gateway_client.py:721, src/agentscope/workspace/_gateway_client.py:750, src/agentscope/workspace/_k8s/_k8s_workspace.py:235, …
  • 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/workspace/_sandboxed_base.py:228, src/agentscope/tts/_dashscope/_cosyvoice_model.py:236, src/agentscope/tts/_dashscope/_realtime_model.py:292
  • `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:669
  • 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/_applecontainer_workspace_manager.py:247, src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:229, src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:288, …

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 Health71%Adequate — gated by D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture99%ExemplarySolid.
Maturity62%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness50%Weak — gated by P3, P8Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security82%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 — 36 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 8 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 — 63 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.
  • 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) — #1 DONE 0.0s REDACTED:1 -------------------- 1 | >>> COPY --from=node_stage /usr/local/bin/node /usr/local/bin/node 2 | COPY --from=node_stage /usr/local/lib/node_modules /usr/local/lib/node_modules 3 | RUN ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \ -------------------- ERROR: failed to solve: no build stage in current context; likely cause (not identified): the image build failed, and its output does not match a cause we recognise; 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 — ~150179 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.
  • D21 Naming Consistency — Naming consistency does not read html yet; not measured.
  • D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Aggregate roots were found in only one source directory (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 — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only; comments in this repository's .py source were not judged.
  • D25 ADR Conformance — no ADRs to check
  • D26 Project Cohesion — project cohesion not measured for .tsx
  • 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.
  • 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, Scala and Rust, 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 — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
  • 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 scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • 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.
  • X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • 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
  • X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • 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.
  • X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • 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 — 59 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.
D30 · Dependency Vulnerabilities · High CVE · ×20
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Critical CVE · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Critical vulnerability · ×1
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×1
  • Orphaned knowledge src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Serious — 791 finding(s)
D15 · Churn × Complexity Hotspots · Hotspot · ×44
  • Hotspot: src/agentscope/app/_service/_chat.py src/agentscope/app/_service/_chat.py:908 — src/agentscope/app/_service/_chat.py changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 88 in ChatService._run_impl at line 908. 4 of those changes were fix/bug commits, and the other 14 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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: examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx:193 — examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 106 in ChatViewport.ChatViewport at line 193. 1 of those changes was a fix/bug commit, and the other 9 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/agent/_agent.py src/agentscope/agent/_agent.py:1051 — src/agentscope/agent/_agent.py changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in Agent._reply_impl at line 1051. 15 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/components/chat/TextInput.tsx examples/web_ui/frontend/src/components/chat/TextInput.tsx:162 — examples/web_ui/frontend/src/components/chat/TextInput.tsx changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 119 in TextInput.TextInput at line 162. 2 of those changes were fix/bug commits, 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/message/_base.py src/agentscope/message/_base.py:247 — src/agentscope/message/_base.py changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 61 in Msg.append_event at line 247. 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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: examples/web_ui/frontend/src/components/popover/ModelParametersPopover.tsx examples/web_ui/frontend/src/components/popover/ModelParametersPopover.tsx:618 — examples/web_ui/frontend/src/components/popover/ModelParametersPopover.tsx changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 71 in ModelParametersPopover.ModelParametersPopover at line 618. 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/_openai_response/_model.py src/agentscope/model/_openai_response/_model.py:397 — src/agentscope/model/_openai_response/_model.py changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in OpenAIResponseModel._parse_stream_response at line 397. 9 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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: src/agentscope/tool/_builtin/_bash_parser.py src/agentscope/tool/_builtin/_bash_parser.py:726 — src/agentscope/tool/_builtin/_bash_parser.py changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 60 in BashCommandParser.check_sed_constraints at line 726. 8 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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: src/agentscope/formatter/_gemini_formatter.py src/agentscope/formatter/_gemini_formatter.py:158 — src/agentscope/formatter/_gemini_formatter.py changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in GeminiChatFormatter.format at line 158. 10 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/model/_anthropic/_model.py src/agentscope/model/_anthropic/_model.py:483 — src/agentscope/model/_anthropic/_model.py changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in AnthropicChatModel._parse_anthropic_stream_completion_response at line 483. 9 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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:887 — src/agentscope/agent/_realtime/_agent.py changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in RealtimeAgent._on_model_event at line 887. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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: examples/web_ui/frontend/src/hooks/useMessages.ts examples/web_ui/frontend/src/hooks/useMessages.ts:232 — examples/web_ui/frontend/src/hooks/useMessages.ts changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in useMessages.useMessages.processEvent at line 232. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/formatter/_moonshot_formatter.py src/agentscope/formatter/_moonshot_formatter.py:126 — src/agentscope/formatter/_moonshot_formatter.py changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in MoonshotChatFormatter.format at line 126. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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: src/agentscope/formatter/_anthropic_formatter.py src/agentscope/formatter/_anthropic_formatter.py:34 — src/agentscope/formatter/_anthropic_formatter.py changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in _AnthropicFormatterBase._format_messages at line 34. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/formatter/_anthropic_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:159 — examples/web_ui/frontend/src/components/chat/ChatContent.tsx changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in ChatContent.ChatContentComponent at line 159. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/formatter/_openai_formatter.py src/agentscope/formatter/_openai_formatter.py:304 — src/agentscope/formatter/_openai_formatter.py changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in OpenAIChatFormatter.format at line 304. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/formatter/_openai_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/_ollama_formatter.py src/agentscope/formatter/_ollama_formatter.py:118 — src/agentscope/formatter/_ollama_formatter.py changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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: src/agentscope/formatter/_xai_formatter.py src/agentscope/formatter/_xai_formatter.py:129 — src/agentscope/formatter/_xai_formatter.py changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in XAIChatFormatter.format at line 129. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/app/_app.py src/agentscope/app/_app.py:116 — src/agentscope/app/_app.py changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in _app.create_app at line 116. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/model/_gemini/_model.py src/agentscope/model/_gemini/_model.py:420 — src/agentscope/model/_gemini/_model.py changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in GeminiChatModel._call_api at line 420. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/rag/_parser/_word.py src/agentscope/rag/_parser/_word.py:394 — src/agentscope/rag/_parser/_word.py changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in WordParser.parse at line 394. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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: src/agentscope/model/_openai_chat/_model.py src/agentscope/model/_openai_chat/_model.py:341 — src/agentscope/model/_openai_chat/_model.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in OpenAIChatModel._parse_stream_response at line 341. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/model/_openai_chat/_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/_openai_response_formatter.py src/agentscope/formatter/_openai_response_formatter.py:187 — src/agentscope/formatter/_openai_response_formatter.py changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in OpenAIResponseFormatter.format at line 187. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/pipeline/_goal_pipeline.py src/agentscope/pipeline/_goal_pipeline.py:112 — src/agentscope/pipeline/_goal_pipeline.py changed 5 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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: examples/web_ui/frontend/src/pages/chat/index.tsx examples/web_ui/frontend/src/pages/chat/index.tsx:93 — examples/web_ui/frontend/src/pages/chat/index.tsx changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in index.ChatPageInner at line 93. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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.
  • + 19 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Repeated repair · ×34
  • Repeated repair: src/agentscope/workspace/_base.py src/agentscope/workspace/_base.py:851 — src/agentscope/workspace/_base.py changed 9 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is WorkspaceBase._enforce_mcp_capacity at line 851), AT OR 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): honor an explicit max_live_stateful_mcps of 0 (#2741)”; “fix(workspace): validate SKILL.md front matter in the shared installers (#3370)”; “fix(workspace): read SKILL.md as utf-8-sig in every skill path (#3177)”; “fix(workspace): read the persisted .mcp file as utf-8-sig (#3338)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/_utils/_common.py src/agentscope/_utils/_common.py:111 — src/agentscope/_utils/_common.py changed 8 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is _common._json_loads_with_repair at line 111), AT OR 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(_utils): keep nested arguments that schema-guided repair drops (#2712)”; “fix(utils): remove dangling discriminators when flattening schemas (#3618)”; “fix(schema): decode escaped definition reference names (#3000)”; “fix(utils): apply the NaN guard on the schema-less parse path too (#3626)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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:158 — src/agentscope/mcp/_mcp_client.py changed 9 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is MCPClient.model_post_init at line 158), AT OR 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): fence discovery responses after tool list invalidation (#3889)”; “fix(mcp): reject overlapping stateful connection attempts (#3795)”; “fix(mcp): refresh cached tools on tools/list_changed notification (#3734)”; “fix(mcp): support mcp 2.x Python SDK, unpin mcp<2.0.0 (#2216)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/rag/_parser/_excel.py src/agentscope/rag/_parser/_excel.py:87 — src/agentscope/rag/_parser/_excel.py changed 8 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is _excel._restore_native_excel_errors at line 87), AT OR 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(rag): reject negative column indices when naming excel columns (#3874)”; “fix(rag): preserve native Excel error cells (#3204)”; “fix(rag): preserve duplicate and blank Excel headers (#2948)”; “fix(rag): keep text and NA-like values intact in ExcelParser (#2893)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/rag/_parser/_excel.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:237 — src/agentscope/embedding/_dashscope/_model.py changed 7 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is DashScopeEmbeddingModel._split_multimodal_batches at line 237), AT OR 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): honor configured DashScope text parameters (#3367)”; “fix(embedding): preserve DashScope response input order (#3564)”; “fix(embedding): honor per-call api_key on the DashScope text path (#3465)”; “fix(embedding): deep-copy DashScope multimodal cache identifier (#3533)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/tool/_builtin/_read.py src/agentscope/tool/_builtin/_read.py:501 — src/agentscope/tool/_builtin/_read.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 Read._read_text_file at line 501), AT OR 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): keep Edit from rewriting non-UTF-8 files lossily (#3322)”; “fix(tool): validate read offset and limit at runtime (#3297)”; “fix(tool): report deferred PDF read failures (#3057)”; “fix(tool): isolate default Read input media types (#3161)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/middleware/_longterm_memory/_agentic_memory/_middleware.py src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:574 — src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py changed 6 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is AgenticMemoryMiddleware.on_reply at line 574), AT OR 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: add lower bounds to middleware and MCP config fields (#3783)”; “fix(memory): extend the frontmatter read to the closing fence when the byte cap cuts it off (#3617)”; “fix(message): return an empty string when no text blocks are present (#3565)”; “fix(memory): keep frontmatter when the closing fence ends the text (#3345)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/rag/_vdb/_qdrant.py src/agentscope/rag/_vdb/_qdrant.py:417 — src/agentscope/rag/_vdb/_qdrant.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 6 (its worst body is QdrantStore.list_chunks at line 417), AT OR 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(rag): normalize scores using the Qdrant collection metric (#3958)”; “fix(rag): support null Qdrant metadata filters (#3055)”; “fix(rag): enforce knowledge base scope during document deletion (#3222)”; “fix(rag): support float metadata filters in Qdrant (#2783)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/rag/_vdb/_qdrant.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/rag/_knowledge.py src/agentscope/rag/_knowledge.py:197 — src/agentscope/rag/_knowledge.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 12 (its worst body is KnowledgeBase.search at line 197), AT OR 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(rag): reject a non-positive top_k in search (#3876)”; “fix(rag): avoid mutating chunks during document insertion (#2897)”; “fix(rag): enforce knowledge base scope during document deletion (#3222)”; “fix(rag): serialize knowledge base collection initialization (#2853)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/rag/_knowledge.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 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 10 (its worst body is Write.call at line 235), AT OR 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 Write failures as error chunks (#3627)”; “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)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/_utils.py src/agentscope/tool/_utils.py:127 — src/agentscope/tool/_utils.py changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is _utils._remove_title_field at line 127), AT OR 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): infer default names for callable objects (#3963)”; “fix(tool): keep resolvable annotations when one hint fails (#3484)”; “fix(tool): preserve annotations and docstrings for partial functions (#3257)”; “fix(tool): omit injected state from inferred function schemas (#3090)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/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 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is BackendBase._find_entries at line 603), AT OR 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): resolve local search paths from the workspace directory (#2637)”; “fix(tool): prevent CPython startup hangs in exec_shell on Windows (#3642)”; “fix(tool): unlink local symbolic links without following targets (#3006)”; “fix(tool): clarify Windows asyncio subprocess error in LocalBackend (#2837)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/workspace/_local_workspace.py src/agentscope/workspace/_local_workspace.py:166 — src/agentscope/workspace/_local_workspace.py changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is LocalWorkspace.initialize at line 166), AT OR 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): resolve local search paths from the workspace directory (#2637)”; “fix(workspace): drain cancelled skill copies before releasing lock (#3844)”; “fix(workspace): read SKILL.md as utf-8-sig in every skill path (#3177)”; “fix(workspace): resolve case-insensitive skill directory collisions (#3075)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/workspace/_local_workspace.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/agentscope/app/_router/_schedule.py src/agentscope/app/_router/_schedule.py:67 — src/agentscope/app/_router/_schedule.py changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is _schedule.create_schedule at line 67), AT OR 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(schedule): respect selected start times when creating schedules (#3610)”; “fix(schedule): respect selected end dates when creating schedules (#3547)”; “fix(app): anchor a schedule's default start time to an absolute instant (#3101)”; “fix(scheduler): validate cron before persistence (#2442)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/app/message_bus/_redis_message_bus.py src/agentscope/app/message_bus/_redis_message_bus.py:679 — src/agentscope/app/message_bus/_redis_message_bus.py changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is RedisMessageBus.subscribe at line 679), AT OR 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(message-bus): refresh in-memory queue ttl on push (#3420)”; “fix(message-bus): trim the redis replay log exactly when a cursor is given (#3409)”; “fix(app): protect Redis subscription cleanup from cancellation (#3158)”; “fix(app): drain the wake-up queue atomically (#2476)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/app/message_bus/_redis_message_bus.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 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is ToolContext.cache_file at line 90), AT OR 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/app/workspace_manager/_docker_workspace_manager.py src/agentscope/app/workspace_manager/_docker_workspace_manager.py:150 — src/agentscope/app/workspace_manager/_docker_workspace_manager.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 7 (its worst body is DockerWorkspaceManager._workdir_for at line 150), AT OR 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): accept workdirs under a filesystem-root basedir (#3966)”; “fix(deps): upgrade certifi, pip, uv and node to drop distrusted CAs (#3410)”; “fix(workspace): clean up failed Docker initialization (#3098)”; “fix(scheduler): bind a real workspace to scheduled sessions (#2410)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/app/workspace_manager/_docker_workspace_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/tool/_base.py src/agentscope/tool/_base.py:403 — src/agentscope/tool/_base.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 5 (its worst body is ToolBase._path_in_allowed_working_path at line 403), AT OR 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): recognise paths below a configured filesystem root (#3719)”; “fix(tool): match Bash permission rules against every subcommand of a compound command (#3513)”; “fix(tool): resolve symlinks before the dangerous-path check (#3033)”; “fix(tool): only validate external result metadata on success (#2623)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/tool/_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/rag/_vdb/_milvus_lite.py src/agentscope/rag/_vdb/_milvus_lite.py:433 — src/agentscope/rag/_vdb/_milvus_lite.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 8 (its worst body is MilvusLiteStore._query_all_rows at line 433), AT OR 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(rag): load milvus collection before reads (#3433)”; “fix(rag): reject nonpositive Milvus batch sizes (#3343)”; “fix(rag): enforce knowledge base scope during document deletion (#3222)”; “fix(rag): normalize distance scores so higher means more relevant (#2486)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/rag/_vdb/_milvus_lite.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 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 11 (its worst body is _extractor._get_tool_definitions at line 109), AT OR 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(middleware): preserve top_p=0 in tracing request attributes (#3520)”; “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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +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/tool/_builtin/_bash.py src/agentscope/tool/_builtin/_bash.py:204 — src/agentscope/tool/_builtin/_bash.py changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is Bash.check_permissions at line 204), AT OR 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): reject Bash/PowerShell timeout below 1ms (#3309)”; “fix(tool): require every subcommand to be a filesystem command for ACCEPT_EDITS auto-allow (#3519)”; “fix(tool): match Bash permission rules against every subcommand of a compound command (#3513)”; “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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/tool/_builtin/_bash.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/agentscope/embedding/_embedding_base.py src/agentscope/embedding/_embedding_base.py:201 — src/agentscope/embedding/_embedding_base.py changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is EmbeddingModelBase.__call__ at line 201), AT OR 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): reject nonpositive batch sizes (#3451)”; “fix(embedding): join sibling batches after failure (#3148)”; “fix(embedding): report the maximum batch time instead of the sum (#2967)”; “fix(embedding): report cache source for fully cached multi-batch merges (#2690)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/embedding/_embedding_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/embedding/_file_cache.py src/agentscope/embedding/_file_cache.py:170 — src/agentscope/embedding/_file_cache.py changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is FileEmbeddingCache._maintain_cache_dir at line 170), AT OR 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): make the file cache key independent of dict order (#2936)”; “fix(embedding): reject negative file cache budgets (#3582)”; “fix(embedding): enforce a zero cache file limit (#2962)”; “fix(embedding): keep the cache when a batch cannot fit its size limit (#2790)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/embedding/_file_cache.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/agentscope/embedding/_gemini/_model.py src/agentscope/embedding/_gemini/_model.py:225 — src/agentscope/embedding/_gemini/_model.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 11 (its worst body is GeminiEmbeddingModel._split_multimodal_batches at line 225), AT OR 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): honor embedding_cache on the Gemini multimodal path (#3529)”; “fix(embedding): honor configured Gemini text parameters (#3361)”; “fix(embedding): avoid blocking the event loop (#2703)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/embedding/_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.
  • Repeated repair: src/agentscope/app/_service/_index_worker.py src/agentscope/app/_service/_index_worker.py:46 — src/agentscope/app/_service/_index_worker.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 9 (its worst body is _index_worker._build_parser_registry at line 46), AT OR 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): ignore duplicate index tasks for ready documents (#3658)”; “fix(app): normalize document content types before parser lookup (#2992)”; “fix(app): clean up index worker tasks on cancellation (#2220)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 17:12:22 +08:00' --until='2026-11-13 17:12:22 +08:00' --full-history --no-merges -- src/agentscope/app/_service/_index_worker.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.
  • + 9 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (empty catch) · ×23
  • Swallowed exception (empty catch) src/agentscope/workspace/_gateway_client.py:721 — 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:750 — 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:228 — 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/_k8s/_k8s_workspace.py:235 — 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.
  • Swallowed exception (empty catch) src/agentscope/workspace/_docker/_docker_workspace.py:228 — 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:236 — 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:244 — 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/middleware/_longterm_memory/_reme/_middleware.py:372 — 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/_agentic_memory/_middleware.py:636 — 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/mcp/_mcp_client.py:414 — 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/_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/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/_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/_docker_workspace_manager.py:452 — 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/_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/_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.
D3 · God Classes · FileTooLong · ×17
  • FileTooLong: agent/_agent.py src/agentscope/agent/_agent.py — FileTooLong — 2407 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1907 over it, 4.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: _realtime/_agent.py src/agentscope/agent/_realtime/_agent.py — FileTooLong — 1960 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1460 over it, 3.92× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: storage/_redis_storage.py src/agentscope/app/storage/_redis_storage.py — FileTooLong — 1630 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1130 over it, 3.26× 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 — 1062 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 562 over it, 2.12× 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: _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 — 818 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 318 over it, 1.64× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: 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: app/_bus_ops.py src/agentscope/app/_bus_ops.py — FileTooLong — 707 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 207 over it, 1.41× 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: _manager/_chat_input_queue.py src/agentscope/app/_manager/_chat_input_queue.py — FileTooLong — 698 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 198 over it, 1.40× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: _agentic_memory/_middleware.py src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py — FileTooLong — 614 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 114 over it, 1.23× 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: workspace/_local_workspace.py src/agentscope/workspace/_local_workspace.py — FileTooLong — 559 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 59 over it, 1.12× 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 — 551 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 51 over it, 1.10× 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 — 547 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 47 over it, 1.09× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: _router/_session.py src/agentscope/app/_router/_session.py — FileTooLong — 528 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 28 over it, 1.06× 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: _gemini/_model.py src/agentscope/model/_gemini/_model.py — FileTooLong — 504 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4 over it, 1.01× 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.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×17
  • Swallowed exception (caught, then discarded) src/agentscope/workspace/_gateway_client.py:537 — `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:529 — `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:647 — `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:84 — `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:629 — `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:247 — `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:511 — `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/middleware/_steering.py:162 — `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:315 — `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:460 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:669 — `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:782 — `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:952 — `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:1001 — `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.
D17 · Explicit Debt · TodoComment · ×10
  • TodoComment src/agentscope/workspace/_base.py:1230 — # 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.
  • TodoComment src/agentscope/middleware/_rag.py:944 — # 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/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/agent/_agent.py:2523 — # 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/_config.py:447 — # TODO: remove this line after PR #1564 is merged, where the ChatModel
  • TodoComment src/agentscope/agent/_realtime/_agent.py:335 — # 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 examples/web_ui/frontend/src/components/popover/ModelParametersPopover.tsx:216 — // 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 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/api/types.ts:184 — // 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.
D3 · God Classes · TooManyMethods · ×9
  • TooManyMethods: RedisStorage src/agentscope/app/storage/_redis_storage.py:57 — TooManyMethods — 87 methods. The bar is 30 methods; this is 57 over it, 2.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RealtimeAgent src/agentscope/agent/_realtime/_agent.py:148 — TooManyMethods — 75 methods. The bar is 30 methods; this is 45 over it, 2.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MessageBus src/agentscope/app/message_bus/_base.py:55 — TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Agent src/agentscope/agent/_agent.py:130 — 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: MessageBusKeys src/agentscope/app/message_bus/_keys.py:19 — TooManyMethods — 41 methods. The bar is 30 methods; this is 11 over it, 1.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: WorkspaceBase src/agentscope/workspace/_base.py:261 — 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.
  • TooManyMethods: RedisMessageBus src/agentscope/app/message_bus/_redis_message_bus.py:70 — 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.
D31 · IaC & Container Security · Medium IaC · ×8
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Medium CVE · ×6
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×6
  • 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:568-580 — 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/model/_dashscope/_model.py:354 — src/agentscope/model/_dashscope/_model.py:354-366 | src/agentscope/model/_dashscope/_model.py:518-530 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) src/agentscope/model/_deepseek/_model.py:286 — src/agentscope/model/_deepseek/_model.py:286-298 | src/agentscope/model/_deepseek/_model.py:411-423 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) src/agentscope/model/_model_card.py:156 — src/agentscope/model/_model_card.py:156-169 | src/agentscope/tts/_tts_model_card.py:125-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/model/_model_card.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.
  • Duplicated block (13 lines × 2) src/agentscope/workspace/_local_workspace.py:713 — src/agentscope/workspace/_local_workspace.py:713-725 | src/agentscope/workspace/_sandboxed_base.py:348-360 — 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.
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×5
  • Edited copy of a member (13 corresponding lines) src/agentscope/app/storage/_sql/_storage.py:1188 — src/agentscope/app/storage/_sql/_storage.py:1188-1202 | src/agentscope/app/storage/_sql/_storage.py:1295-1307 — These two members are one piece of code written twice and then edited apart: 13 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.
  • Edited copy of a member (13 corresponding lines) src/agentscope/app/storage/_redis_storage.py:421 — src/agentscope/app/storage/_redis_storage.py:421-442 | src/agentscope/app/storage/_redis_storage.py:2661-2673 — These two members are one piece of code written twice and then edited apart: 13 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.
  • Edited copy of a member (13 corresponding lines) src/agentscope/app/storage/_sql/_storage.py:844 — src/agentscope/app/storage/_sql/_storage.py:844-856 | src/agentscope/app/storage/_sql/_storage.py:920-932 — These two members are one piece of code written twice and then edited apart: 13 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.
  • Edited copy of a member (13 corresponding lines) src/agentscope/tool/_builtin/_meta.py:61 — src/agentscope/tool/_builtin/_meta.py:61-77 | src/agentscope/tool/_toolkit.py:622-634 — These two members are one piece of code written twice and then edited apart: 13 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.
  • Edited copy of a member (13 corresponding lines) src/agentscope/app/storage/_sql/_storage.py:1717 — src/agentscope/app/storage/_sql/_storage.py:1717-1729 | src/agentscope/app/storage/_sql/_storage.py:2032-2045 — These two members are one piece of code written twice and then edited apart: 13 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 · 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:366 — src/agentscope/embedding/_dashscope/_model.py:366-380 | src/agentscope/embedding/_dashscope/_model.py:455-469 — 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:366` 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:319 — src/agentscope/formatter/_dashscope_formatter.py:319-333 | src/agentscope/formatter/_dashscope_formatter.py:381-395 — 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:776 — src/agentscope/tool/_builtin/_bash.py:776-793 | src/agentscope/tool/_builtin/_powershell.py:278-292 — 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:278` 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 · Edited copy of a member (28 corresponding lines) · ×4
  • Edited copy of a member (28 corresponding lines) src/agentscope/formatter/_ollama_formatter.py:73 — src/agentscope/formatter/_ollama_formatter.py:73-100 | src/agentscope/formatter/_openai_formatter.py:242-282 — These two members are one piece of code written twice and then edited apart: 28 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.
  • Edited copy of a member (28 corresponding lines) src/agentscope/realtime/_dashscope/_audio_model.py:231 — src/agentscope/realtime/_dashscope/_audio_model.py:231-258 | src/agentscope/realtime/_openai/_model.py:231-281 — These two members are one piece of code written twice and then edited apart: 28 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.
  • Edited copy of a member (28 corresponding lines) src/agentscope/app/_router/_background_task.py:71 — src/agentscope/app/_router/_background_task.py:71-98 | src/agentscope/app/_router/_session.py:732-774 — These two members are one piece of code written twice and then edited apart: 28 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.
  • Edited copy of a member (28 corresponding lines) src/agentscope/app/_router/_agent.py:316 — src/agentscope/app/_router/_agent.py:316-344 | src/agentscope/app/_router/_session.py:405-432 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×4
  • Edited copy of a member (10 corresponding lines) src/agentscope/tui/_chat.py:474 — src/agentscope/tui/_chat.py:474-485 | src/agentscope/tui/_launcher.py:68-77 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) src/agentscope/console/_renderer.py:338 — src/agentscope/console/_renderer.py:338-347 | src/agentscope/tui/_messages.py:80-90 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) src/agentscope/tts/_dashscope/_cosyvoice_utils.py:29 — src/agentscope/tts/_dashscope/_cosyvoice_utils.py:29-38 | src/agentscope/tts/_minimax/_model.py:336-345 — These two members are one piece of code written twice and then edited apart: 10 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.
  • Edited copy of a member (10 corresponding lines) src/agentscope/app/_service/_index_task_consumer.py:206 — src/agentscope/app/_service/_index_task_consumer.py:206-216 | src/agentscope/app/_service/_webrtc_session.py:128-137 — These two members are one piece of code written twice and then edited apart: 10 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 · Duplicated block (16 lines × 2) · ×4
  • Duplicated block (16 lines × 2) src/agentscope/embedding/_gemini/_model.py:373 — src/agentscope/embedding/_gemini/_model.py:373-388 | src/agentscope/embedding/_gemini/_model.py:476-491 — 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/_gemini/_model.py:373` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) src/agentscope/tts/_dashscope/_cosyvoice_model.py:366 — src/agentscope/tts/_dashscope/_cosyvoice_model.py:366-381 | 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:366` 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:382` 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) 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 (12 lines × 2) · ×4
  • Duplicated block (12 lines × 2) src/agentscope/agent/_agent.py:872 — src/agentscope/agent/_agent.py:872-883 | src/agentscope/agent/_agent.py:2099-2110 — 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:872` 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/tool/_adapters.py:309 — src/agentscope/tool/_adapters.py:309-325 | 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 (11 lines × 2) · ×4
  • Duplicated block (11 lines × 2) src/agentscope/app/_lifespan.py:168 — src/agentscope/app/_lifespan.py:168-178 | src/agentscope/app/_lifespan.py:185-195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) 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:2096 — src/agentscope/app/storage/_sql/_storage.py:2096-2106 | src/agentscope/app/storage/_sql/_storage.py:2134-2144 — 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:2096` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) src/agentscope/formatter/_gemini_formatter.py:89 — src/agentscope/formatter/_gemini_formatter.py:89-99 | src/agentscope/formatter/_openai_formatter.py:212-222 — 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) · ×4
  • 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/formatter/_gemini_formatter.py:88 — src/agentscope/formatter/_gemini_formatter.py:88-93 | src/agentscope/formatter/_ollama_formatter.py:85-90 — 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/_gemini_formatter.py:88` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) src/agentscope/tts/_gemini/_model.py:298 — src/agentscope/tts/_gemini/_model.py:298-304 | src/agentscope/tts/_gemini/_model.py:378-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.
  • 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 (5 lines × 2) · ×4
  • Duplicated block (5 lines × 2) src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:31 — src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:31-35 | src/agentscope/app/storage/_sql/_alembic/versions/0003_channels.py:34-38 — 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/storage/_sql/_alembic/versions/0001_initial.py:31` 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 (5 lines × 2) src/agentscope/asr/_dashscope/_realtime_model.py:24 — src/agentscope/asr/_dashscope/_realtime_model.py:24-28 | src/agentscope/realtime/_dashscope/_model.py:23-27 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) src/agentscope/app/storage/_sql/_alembic/versions/0003_channels.py:59 — src/agentscope/app/storage/_sql/_alembic/versions/0003_channels.py:59-63 | src/agentscope/app/storage/_sql/_alembic/versions/0005_voice_profiles.py:41-45 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) examples/realtime/local_mic.py:76 — examples/realtime/local_mic.py:76-80 | examples/realtime/openai_live_local.py:66-70 — 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 · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:31 — src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:31-318 | src/agentscope/app/storage/_sql/_alembic/versions/0002_mcps_skills.py:26-49 | src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:24-75 | src/agentscope/app/storage/_sql/_alembic/versions/0005_voice_profiles.py:21-37 — 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/formatter/_dashscope_formatter.py:572 — src/agentscope/formatter/_dashscope_formatter.py:572-633 | src/agentscope/formatter/_moonshot_formatter.py:471-506 | src/agentscope/formatter/_openai_formatter.py:577-639 | src/agentscope/formatter/_openai_response_formatter.py:520-565 — 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:296 — src/agentscope/realtime/_dashscope/_model.py:296-310 | src/agentscope/realtime/_gemini/_model.py:412-426 | 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 · Edited copy of a member (49 corresponding lines) · ×3
  • Edited copy of a member (49 corresponding lines) src/agentscope/app/storage/_redis_storage.py:445 — src/agentscope/app/storage/_redis_storage.py:445-501 | src/agentscope/app/storage/_redis_storage.py:584-632 — These two members are one piece of code written twice and then edited apart: 49 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.
  • Edited copy of a member (49 corresponding lines) src/agentscope/workspace/_local_workspace.py:339 — src/agentscope/workspace/_local_workspace.py:339-387 | src/agentscope/workspace/_local_workspace.py:634-684 — These two members are one piece of code written twice and then edited apart: 49 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.
  • Edited copy of a member (49 corresponding lines) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:65 — src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:65-113 | src/agentscope/app/workspace_manager/_docker_workspace_manager.py:81-146 — These two members are one piece of code written twice and then edited apart: 49 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (41 corresponding lines) · ×3
  • Edited copy of a member (41 corresponding lines) src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:130 — src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:130-170 | src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:342-383 — These two members are one piece of code written twice and then edited apart: 41 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.
  • Edited copy of a member (41 corresponding lines) src/agentscope/workspace/_local_workspace.py:693 — src/agentscope/workspace/_local_workspace.py:693-733 | src/agentscope/workspace/_sandboxed_base.py:325-372 — These two members are one piece of code written twice and then edited apart: 41 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.
  • Edited copy of a member (41 corresponding lines) src/agentscope/classifier/_jev/_model.py:130 — src/agentscope/classifier/_jev/_model.py:130-170 | src/agentscope/classifier/_openai/_model.py:184-224 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×3
  • Edited copy of a member (23 corresponding lines) src/agentscope/realtime/_openai/_model.py:108 — src/agentscope/realtime/_openai/_model.py:108-137 | src/agentscope/realtime/_xai/_model.py:100-122 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) src/agentscope/app/channel/_feishu/_channel.py:917 — src/agentscope/app/channel/_feishu/_channel.py:917-939 | src/agentscope/app/channel/_feishu/_channel.py:1074-1105 — These two members are one piece of code written twice and then edited apart: 23 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.
  • Edited copy of a member (23 corresponding lines) src/agentscope/middleware/_longterm_memory/_mem0/_middleware.py:643 — src/agentscope/middleware/_longterm_memory/_mem0/_middleware.py:643-666 | src/agentscope/middleware/_longterm_memory/_reme/_middleware.py:540-562 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×3
  • Edited copy of a member (21 corresponding lines) src/agentscope/app/storage/_redis_storage.py:2518 — src/agentscope/app/storage/_redis_storage.py:2518-2554 | src/agentscope/app/storage/_redis_storage.py:2560-2580 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) src/agentscope/workspace/_docker/_docker_backend.py:173 — src/agentscope/workspace/_docker/_docker_backend.py:173-193 | src/agentscope/workspace/_k8s/_k8s_backend.py:261-298 — These two members are one piece of code written twice and then edited apart: 21 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.
  • Edited copy of a member (21 corresponding lines) src/agentscope/permission/_engine.py:699 — src/agentscope/permission/_engine.py:699-719 | src/agentscope/permission/_engine.py:726-746 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×3
  • Edited copy of a member (18 corresponding lines) src/agentscope/workspace/_k8s/_k8s_workspace.py:331 — src/agentscope/workspace/_k8s/_k8s_workspace.py:331-348 | src/agentscope/workspace/_k8s/_k8s_workspace.py:570-588 — These two members are one piece of code written twice and then edited apart: 18 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.
  • Edited copy of a member (18 corresponding lines) src/agentscope/app/channel/_feishu/_channel.py:462 — src/agentscope/app/channel/_feishu/_channel.py:462-479 | src/agentscope/app/channel/_feishu/_channel.py:501-525 — These two members are one piece of code written twice and then edited apart: 18 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.
  • Edited copy of a member (18 corresponding lines) src/agentscope/app/_service/_knowledge_base.py:309 — src/agentscope/app/_service/_knowledge_base.py:309-326 | src/agentscope/app/_service/_knowledge_base.py:582-615 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 19+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 19+ corresponding lines) src/agentscope/app/storage/_sql/_storage.py:1314 — src/agentscope/app/storage/_sql/_storage.py:1314-1332 | src/agentscope/app/storage/_sql/_storage.py:1375-1393 | src/agentscope/app/storage/_sql/_storage.py:1400-1433 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 19+ corresponding lines) src/agentscope/app/message_bus/_redis_message_bus.py:293 — src/agentscope/app/message_bus/_redis_message_bus.py:293-322 | src/agentscope/app/message_bus/_redis_message_bus.py:329-347 | src/agentscope/app/message_bus/_redis_message_bus.py:439-467 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 19+ corresponding lines) scripts/model_examples/dashscope_call.py:28 — scripts/model_examples/dashscope_call.py:28-48 | scripts/model_examples/deepseek_call.py:35-55 | scripts/model_examples/volcengine_call.py:26-44 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (17 corresponding lines) · ×3
  • Edited copy of a member (17 corresponding lines) src/agentscope/app/storage/_redis_storage.py:976 — src/agentscope/app/storage/_redis_storage.py:976-992 | src/agentscope/app/storage/_redis_storage.py:1913-1944 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) src/agentscope/app/channel/_dingtalk/_tools/_list_users.py:54 — src/agentscope/app/channel/_dingtalk/_tools/_list_users.py:54-76 | src/agentscope/app/channel/_feishu/_tools/_list_chat_members.py:37-53 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) src/agentscope/agent/_a2a_agent.py:306 — src/agentscope/agent/_a2a_agent.py:306-322 | src/agentscope/agent/_agent.py:333-370 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×3
  • Edited copy of a member (27 corresponding lines) src/agentscope/app/channel/_dingtalk/_tools/_send_file.py:38 — src/agentscope/app/channel/_dingtalk/_tools/_send_file.py:38-64 | src/agentscope/app/channel/_dingtalk/_tools/_send_image.py:37-63 — These two members are one piece of code written twice and then edited apart: 27 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.
  • Edited copy of a member (27 corresponding lines) src/agentscope/app/channel/_feishu/_channel.py:1010 — src/agentscope/app/channel/_feishu/_channel.py:1010-1037 | src/agentscope/app/channel/_feishu/_channel.py:1045-1071 — These two members are one piece of code written twice and then edited apart: 27 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.
  • Edited copy of a member (27 corresponding lines) src/agentscope/formatter/_ollama_formatter.py:36 — src/agentscope/formatter/_ollama_formatter.py:36-69 | src/agentscope/formatter/_gemini_formatter.py:37-63 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×3
  • Edited copy of a member (14 corresponding lines) src/agentscope/app/storage/_sql/_storage.py:1273 — src/agentscope/app/storage/_sql/_storage.py:1273-1286 | src/agentscope/app/storage/_sql/_storage.py:2159-2179 — These two members are one piece of code written twice and then edited apart: 14 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.
  • Edited copy of a member (14 corresponding lines) src/agentscope/workspace/_daytona/_daytona_backend.py:154 — src/agentscope/workspace/_daytona/_daytona_backend.py:154-167 | src/agentscope/workspace/_e2b/_e2b_backend.py:150-163 — These two members are one piece of code written twice and then edited apart: 14 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.
  • Edited copy of a member (14 corresponding lines) src/agentscope/formatter/_anthropic_formatter.py:579 — src/agentscope/formatter/_anthropic_formatter.py:579-593 | src/agentscope/formatter/_ollama_formatter.py:555-568 — These two members are one piece of code written twice and then edited apart: 14 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 · Duplicated block (28 lines × 2) · ×3
  • Duplicated block (28 lines × 2) src/agentscope/model/_anthropic/_model.py:709 — src/agentscope/model/_anthropic/_model.py:709-736 | src/agentscope/model/_gemini/_model.py:781-810 — 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 5 separate duplicated blocks between them, totalling at least 163 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/storage/_sql/_alembic/versions/0004_sops.py:24 — src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:24-40 | src/agentscope/app/storage/_sql/_alembic/versions/0005_voice_profiles.py:21-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (17 lines × 2) src/agentscope/app/_router/_model.py:24 — src/agentscope/app/_router/_model.py:24-40 | src/agentscope/app/_router/_tts_model.py:24-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. 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 `body` to `ListModelsRequest = Depends()` in one and `ListTTSModelsRequest = Depends()` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (17 lines × 2) 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 (10 lines × 2) · ×3
  • Duplicated block (10 lines × 2) src/agentscope/model/_moonshot/_model.py:463 — src/agentscope/model/_moonshot/_model.py:463-472 | src/agentscope/model/_ollama/_model.py:334-343 — 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:463` 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:669 — src/agentscope/workspace/_base.py:669-678 | src/agentscope/workspace/_sandboxed_base.py:288-297 — 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:446 — src/agentscope/app/workspace_manager/_docker_workspace_manager.py:446-455 | 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 109 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 (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 56 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:42 — src/agentscope/tts/_dashscope/_model.py:42-49 | 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:31 — 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.
P8 · Schema migrations · Schema created by SQLAlchemy create_all() outside the migrations · ×3
  • Schema created by SQLAlchemy create_all() outside the migrations src/agentscope/app/storage/_sql/_storage.py:134 — This repository versions its schema (Alembic), but SQLAlchemy create_all() here builds or alters the schema from the model as well, outside that history — the two paths can disagree about the shape, and a change made this way is never a reviewed migration. Turn it off and let Alembic own the schema.
  • Schema created by SQLAlchemy create_all() outside the migrations src/agentscope/app/storage/_sql/_storage.py:216 — This repository versions its schema (Alembic), but SQLAlchemy create_all() here builds or alters the schema from the model as well, outside that history — the two paths can disagree about the shape, and a change made this way is never a reviewed migration. Turn it off and let Alembic own the schema.
  • Schema created by SQLAlchemy create_all() outside the migrations src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:10 — This repository versions its schema (Alembic), but SQLAlchemy create_all() here builds or alters the schema from the model as well, outside that history — the two paths can disagree about the shape, and a change made this way is never a reviewed migration. Turn it off and let Alembic own the schema.
D36 · Supply-chain Provenance & Signing · REDACTED
  • 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:283-344 | 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:478-492 | 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 · Edited copy of a member (35 corresponding lines) · ×2
  • Edited copy of a member (35 corresponding lines) src/agentscope/agent/_agent.py:1689 — src/agentscope/agent/_agent.py:1689-1723 | src/agentscope/agent/_agent.py:2780-2828 — These two members are one piece of code written twice and then edited apart: 35 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.
  • Edited copy of a member (35 corresponding lines) src/agentscope/app/channel/_feishu/_channel.py:1118 — src/agentscope/app/channel/_feishu/_channel.py:1118-1157 | src/agentscope/app/channel/_feishu/_channel.py:1220-1254 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (31 corresponding lines) · ×2
  • Edited copy of a member (31 corresponding lines) src/agentscope/workspace/_local_workspace.py:742 — src/agentscope/workspace/_local_workspace.py:742-772 | src/agentscope/workspace/_sandboxed_base.py:381-418 — These two members are one piece of code written twice and then edited apart: 31 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.
  • Edited copy of a member (31 corresponding lines) src/agentscope/tts/_openai/_voice_cloning_client.py:70 — src/agentscope/tts/_openai/_voice_cloning_client.py:70-100 | src/agentscope/tts/_openai/_voice_cloning_client.py:110-145 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 33+ corresponding lines) · ×2
  • Edited copies of one member (6 members, 33+ corresponding lines) src/agentscope/formatter/_anthropic_formatter.py:445 — src/agentscope/formatter/_anthropic_formatter.py:445-477 | src/agentscope/formatter/_deepseek_formatter.py:274-306 | src/agentscope/formatter/_gemini_formatter.py:384-416 | src/agentscope/formatter/_moonshot_formatter.py:392-438 | src/agentscope/formatter/_ollama_formatter.py:412-449 | src/agentscope/formatter/_openai_response_formatter.py:439-478 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 33 lines, 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 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. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
  • Edited copies of one member (6 members, 33+ corresponding lines) scripts/model_examples/anthropic_call.py:151 — scripts/model_examples/anthropic_call.py:151-185 | scripts/model_examples/gemini_call.py:151-185 | scripts/model_examples/minimax_call.py:153-185 | scripts/model_examples/openai_chat_call.py:151-185 | scripts/model_examples/openai_response_call.py:159-193 | scripts/model_examples/xai_call.py:155-189 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 33 lines, 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 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. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 36+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 36+ corresponding lines) src/agentscope/formatter/_dashscope_formatter.py:68 — src/agentscope/formatter/_dashscope_formatter.py:68-118 | src/agentscope/formatter/_openai_formatter.py:63-109 | src/agentscope/formatter/_volcengine_formatter.py:44-79 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 36 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 36+ corresponding lines) src/agentscope/app/channel/_tools/_list_wiki_nodes.py:50 — src/agentscope/app/channel/_tools/_list_wiki_nodes.py:50-87 | src/agentscope/app/channel/_tools/_list_wiki_spaces.py:45-80 | src/agentscope/app/channel/_tools/_read_wiki_document.py:49-95 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 36 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (38 corresponding lines) · ×2
  • Edited copy of a member (38 corresponding lines) src/agentscope/app/storage/_redis_storage.py:2039 — src/agentscope/app/storage/_redis_storage.py:2039-2076 | src/agentscope/app/storage/_redis_storage.py:2236-2283 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (38 corresponding lines) src/agentscope/model/_moonshot/_model.py:513 — src/agentscope/model/_moonshot/_model.py:513-550 | src/agentscope/model/_openai_chat/_model.py:645-684 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×2
  • Edited copy of a member (15 corresponding lines) src/agentscope/app/storage/_redis_storage.py:1202 — src/agentscope/app/storage/_redis_storage.py:1202-1216 | src/agentscope/app/storage/_redis_storage.py:1331-1345 — These two members are one piece of code written twice and then edited apart: 15 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.
  • Edited copy of a member (15 corresponding lines) src/agentscope/app/_manager/_scheduler/_scheduler_manager.py:515 — src/agentscope/app/_manager/_scheduler/_scheduler_manager.py:515-537 | src/agentscope/app/channel/_dispatcher.py:188-202 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 20+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 20+ corresponding lines) src/agentscope/app/storage/_redis_storage.py:1877 — src/agentscope/app/storage/_redis_storage.py:1877-1905 | src/agentscope/app/storage/_redis_storage.py:2107-2139 | src/agentscope/app/storage/_redis_storage.py:2635-2654 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 20+ corresponding lines) src/agentscope/app/_service/_access.py:415 — src/agentscope/app/_service/_access.py:415-435 | src/agentscope/app/_service/_access.py:459-478 | src/agentscope/app/_service/_access.py:485-510 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×2
  • Edited copy of a member (19 corresponding lines) src/agentscope/realtime/_openai/_model.py:78 — src/agentscope/realtime/_openai/_model.py:78-96 | src/agentscope/realtime/_xai/_model.py:70-88 — These two members are one piece of code written twice and then edited apart: 19 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.
  • Edited copy of a member (19 corresponding lines) src/agentscope/app/_service/_knowledge_base.py:535 — src/agentscope/app/_service/_knowledge_base.py:535-574 | src/agentscope/app/storage/_redis_storage.py:2304-2322 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (6 corresponding lines) · ×2
  • Edited copy of a member (6 corresponding lines) src/agentscope/asr/_dashscope/_realtime_model.py:24 — src/agentscope/asr/_dashscope/_realtime_model.py:24-29 | src/agentscope/realtime/_dashscope/_model.py:23-28 — These two members are one piece of code written twice and then edited apart: 6 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.
  • Edited copy of a member (6 corresponding lines) src/agentscope/console/_renderer.py:54 — src/agentscope/console/_renderer.py:54-60 | src/agentscope/tui/_messages.py:61-66 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 10+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 10+ corresponding lines) src/agentscope/app/_router/_asr.py:66 — src/agentscope/app/_router/_asr.py:66-88 | src/agentscope/app/_router/_embedding_model.py:26-50 | src/agentscope/app/_router/_realtime.py:52-61 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) src/agentscope/model/_dashscope/_model.py:207 — src/agentscope/model/_dashscope/_model.py:207-219 | src/agentscope/model/_moonshot/_model.py:186-196 | src/agentscope/model/_openai_chat/_model.py:221-230 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×2
  • Edited copy of a member (24 corresponding lines) src/agentscope/app/hub/_mcp/_github_hub.py:122 — src/agentscope/app/hub/_mcp/_github_hub.py:122-145 | src/agentscope/app/hub/_skill/_claw_hub.py:101-130 — These two members are one piece of code written twice and then edited apart: 24 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.
  • Edited copy of a member (24 corresponding lines) scripts/model_examples/anthropic_call.py:28 — scripts/model_examples/anthropic_call.py:28-51 | scripts/model_examples/gemini_call.py:28-51 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×2
  • Edited copy of a member (9 corresponding lines) src/agentscope/app/_bus_ops.py:187 — src/agentscope/app/_bus_ops.py:187-208 | src/agentscope/app/message_bus/_base.py:737-745 — These two members are one piece of code written twice and then edited apart: 9 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.
  • Edited copy of a member (9 corresponding lines) src/agentscope/tts/_dashscope/_cosyvoice_model.py:240 — src/agentscope/tts/_dashscope/_cosyvoice_model.py:240-249 | src/agentscope/tts/_dashscope/_realtime_model.py:296-304 — These two members are one piece of code written twice and then edited apart: 9 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 · Duplicated block (29–32 lines × 2) · ×2
  • 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.
  • Duplicated block (29–32 lines × 2) src/agentscope/embedding/_embedding_model_card.py:142 — src/agentscope/embedding/_embedding_model_card.py:142-170 | src/agentscope/model/_model_card.py:137-168 — 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 (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:274-302 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_volcengine_formatter.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 130 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:607 — src/agentscope/formatter/_dashscope_formatter.py:607-633 | src/agentscope/formatter/_openai_formatter.py:613-639 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 329 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:607` 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:389 — src/agentscope/realtime/_dashscope/_model.py:389-413 | 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 58 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:389` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (24 lines × 2) · ×2
  • 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.
  • Duplicated block (24 lines × 2) src/agentscope/embedding/_dashscope/_model.py:382 — src/agentscope/embedding/_dashscope/_model.py:382-405 | src/agentscope/embedding/_dashscope/_model.py:471-494 — 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:382` 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–22 lines × 2) · ×2
  • Duplicated block (21–22 lines × 2) src/agentscope/formatter/_anthropic_formatter.py:543 — src/agentscope/formatter/_anthropic_formatter.py:543-564 | src/agentscope/formatter/_ollama_formatter.py:512-532 — 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:543` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (21–22 lines × 2) src/agentscope/workspace/_local_workspace.py:218 — src/agentscope/workspace/_local_workspace.py:218-239 | src/agentscope/workspace/_local_workspace.py:833-853 — 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 (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:196 — src/agentscope/formatter/_volcengine_formatter.py:196-217 | src/agentscope/formatter/_volcengine_formatter.py:259-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (19 lines × 6) · ×2
  • Duplicated block (19 lines × 6) src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:38 — src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:38-56 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:74-92 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:100-118 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:142-160 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:181-199 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:233-251 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:38` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 6) src/agentscope/formatter/_dashscope_formatter.py:514 — src/agentscope/formatter/_dashscope_formatter.py:514-532 | src/agentscope/formatter/_deepseek_formatter.py:282-300 | src/agentscope/formatter/_gemini_formatter.py:392-410 | src/agentscope/formatter/_moonshot_formatter.py:413-431 | src/agentscope/formatter/_openai_formatter.py:519-537 | src/agentscope/formatter/_volcengine_formatter.py:387-405 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_deepseek_formatter.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 91 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:514` 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–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/formatter/_anthropic_formatter.py:365 — src/agentscope/formatter/_anthropic_formatter.py:365-382 | src/agentscope/formatter/_gemini_formatter.py:95-111 — 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:365` 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 lines × 2) · ×2
  • Duplicated block (18 lines × 2) src/agentscope/formatter/_moonshot_formatter.py:181 — src/agentscope/formatter/_moonshot_formatter.py:181-198 | src/agentscope/formatter/_moonshot_formatter.py:240-257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) src/agentscope/model/_moonshot/_model.py:352 — src/agentscope/model/_moonshot/_model.py:352-369 | src/agentscope/model/_openai_chat/_model.py:391-408 — `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 158 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 (16–17 lines × 2) · ×2
  • Duplicated block (16–17 lines × 2) src/agentscope/formatter/_dashscope_formatter.py:572 — src/agentscope/formatter/_dashscope_formatter.py:572-587 | src/agentscope/formatter/_openai_formatter.py:577-593 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16–17 lines × 2) src/agentscope/tool/_builtin/_edit.py:398 — src/agentscope/tool/_builtin/_edit.py:398-414 | src/agentscope/tool/_builtin/_write.py:299-314 — before extracting anything, compare `src/agentscope/tool/_builtin/_edit.py` and `src/agentscope/tool/_builtin/_write.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 163 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/tool/_builtin/_edit.py:398` 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 (16 lines × 3) · ×2
  • Duplicated block (16 lines × 3) src/agentscope/model/_deepseek/_model.py:229 — src/agentscope/model/_deepseek/_model.py:229-244 | src/agentscope/model/_moonshot/_model.py:295-310 | src/agentscope/model/_volcengine/_model.py:266-281 — `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 10 separate duplicated blocks between them, totalling at least 204 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 (16 lines × 3) src/agentscope/model/_moonshot/_model.py:471 — src/agentscope/model/_moonshot/_model.py:471-486 | src/agentscope/model/_openai_chat/_model.py:603-618 | src/agentscope/model/_volcengine/_model.py:439-454 — `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 158 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:471` 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 lines × 7) · ×2
  • Duplicated block (15 lines × 7) src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:43 — src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:43-57 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:79-93 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:105-119 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:147-161 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:186-200 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:238-252 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:294-308 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (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:478-492 | 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 (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:323 — src/agentscope/model/_volcengine/_model.py:323-335 | src/agentscope/model/_volcengine/_model.py:448-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.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×2
  • Duplicated block (11 lines × 4) src/agentscope/model/_dashscope/_model.py:491 — src/agentscope/model/_dashscope/_model.py:491-501 | src/agentscope/model/_deepseek/_model.py:384-394 | src/agentscope/model/_moonshot/_model.py:453-463 | src/agentscope/model/_volcengine/_model.py:421-431 — `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 10 separate duplicated blocks between them, totalling at least 213 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 (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 · Duplicated block (10 lines × 8) · ×2
  • Duplicated block (10 lines × 8) src/agentscope/formatter/_anthropic_formatter.py:452 — src/agentscope/formatter/_anthropic_formatter.py:452-461 | src/agentscope/formatter/_dashscope_formatter.py:513-522 | src/agentscope/formatter/_deepseek_formatter.py:281-290 | src/agentscope/formatter/_gemini_formatter.py:391-400 | src/agentscope/formatter/_moonshot_formatter.py:412-421 | src/agentscope/formatter/_ollama_formatter.py:419-428 | src/agentscope/formatter/_openai_formatter.py:518-527 | src/agentscope/formatter/_volcengine_formatter.py:386-395 — 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:452` 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:401-415 | 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:226-235 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_volcengine_formatter.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 130 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 (8 lines × 3) · ×2
  • Duplicated block (8 lines × 3) src/agentscope/formatter/_anthropic_formatter.py:363 — src/agentscope/formatter/_anthropic_formatter.py:363-370 | src/agentscope/formatter/_gemini_formatter.py:94-101 | src/agentscope/formatter/_openai_formatter.py:267-274 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_anthropic_formatter.py:363` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 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 (7 lines × 4) · ×2
  • Duplicated block (7 lines × 4) src/agentscope/formatter/_dashscope_formatter.py:303 — src/agentscope/formatter/_dashscope_formatter.py:303-309 | src/agentscope/formatter/_deepseek_formatter.py:68-74 | src/agentscope/formatter/_openai_formatter.py:331-337 | src/agentscope/formatter/_volcengine_formatter.py:179-185 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_deepseek_formatter.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 91 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:582 — src/agentscope/formatter/_dashscope_formatter.py:582-589 | src/agentscope/formatter/_moonshot_formatter.py:478-484 | src/agentscope/formatter/_openai_formatter.py:588-595 | src/agentscope/formatter/_openai_response_formatter.py:538-544 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 163 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 8 separate duplicated blocks between them, totalling at least 152 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 (29 lines × 3) · ×2
  • Duplicated block (29 lines × 3) src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py:498 — src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py:498-526 | src/agentscope/workspace/_e2b/_e2b_workspace.py:332-368 | src/agentscope/workspace/_opensandbox/_opensandbox_workspace.py:351-397 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (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 (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/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.
  • Task from `asyncio.create_task` is not kept src/agentscope/app/middleware/_tool_offload_middleware.py:436 — 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 88) · ×1
  • ChatService._run_impl (cyclomatic 88) src/agentscope/app/_service/_chat.py:908 — ChatService._run_impl has cyclomatic complexity 88 (threshold 15). To reduce it, separate the cases: extract each independent 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 61) · ×1
  • Msg.append_event (cyclomatic 61) src/agentscope/message/_base.py:247 — Msg.append_event has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BashCommandParser.check_sed_constraints (cyclomatic 60) · ×1
  • BashCommandParser.check_sed_constraints (cyclomatic 60) src/agentscope/tool/_builtin/_bash_parser.py:726 — 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 · 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 · RealtimeAgent._drive_client_delegation (cyclomatic 44) · ×1
  • RealtimeAgent._drive_client_delegation (cyclomatic 44) src/agentscope/agent/_realtime/_agent.py:1417 — RealtimeAgent._drive_client_delegation 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:126 — 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:154 — 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 · Agent._reply_impl (cyclomatic 41) · ×1
  • Agent._reply_impl (cyclomatic 41) src/agentscope/agent/_agent.py:1051 — Agent._reply_impl has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _AnthropicFormatterBase._format_messages (cyclomatic 41) · ×1
  • _AnthropicFormatterBase._format_messages (cyclomatic 41) src/agentscope/formatter/_anthropic_formatter.py:34 — _AnthropicFormatterBase._format_messages has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DashScopeChatFormatter.format (cyclomatic 40) · ×1
  • DashScopeChatFormatter.format (cyclomatic 40) src/agentscope/formatter/_dashscope_formatter.py:276 — 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 · OpenAIChatModel._parse_stream_response (cyclomatic 40) · ×1
  • OpenAIChatModel._parse_stream_response (cyclomatic 40) src/agentscope/model/_openai_chat/_model.py:341 — OpenAIChatModel._parse_stream_response 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 · OpenAIResponseModel._parse_stream_response (cyclomatic 40) · ×1
  • OpenAIResponseModel._parse_stream_response (cyclomatic 40) src/agentscope/model/_openai_response/_model.py:397 — OpenAIResponseModel._parse_stream_response 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 · OllamaChatFormatter.format (cyclomatic 39) · ×1
  • OllamaChatFormatter.format (cyclomatic 39) src/agentscope/formatter/_ollama_formatter.py:118 — OllamaChatFormatter.format 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 · GeminiChatFormatter.format (cyclomatic 36) · ×1
  • GeminiChatFormatter.format (cyclomatic 36) src/agentscope/formatter/_gemini_formatter.py:158 — GeminiChatFormatter.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 · OpenAIChatFormatter.format (cyclomatic 36) · ×1
  • OpenAIChatFormatter.format (cyclomatic 36) src/agentscope/formatter/_openai_formatter.py:304 — 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:1392 — 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 · AnthropicChatModel._parse_anthropic_stream_completion_response (cyclomatic 35) · ×1
  • AnthropicChatModel._parse_anthropic_stream_completion_response (cyclomatic 35) src/agentscope/model/_anthropic/_model.py:483 — AnthropicChatModel._parse_anthropic_stream_completion_response 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 · OpenAIResponseFormatter.format (cyclomatic 33) · ×1
  • OpenAIResponseFormatter.format (cyclomatic 33) src/agentscope/formatter/_openai_response_formatter.py:187 — 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 · DashScopeChatModel._parse_stream_response (cyclomatic 33) · ×1
  • DashScopeChatModel._parse_stream_response (cyclomatic 33) src/agentscope/model/_dashscope/_model.py:311 — DashScopeChatModel._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 · Grep.call (cyclomatic 33) · ×1
  • Grep.call (cyclomatic 33) src/agentscope/tool/_builtin/_grep.py:329 — Grep.call 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 · RealtimeAgent._on_model_event (cyclomatic 32) · ×1
  • RealtimeAgent._on_model_event (cyclomatic 32) src/agentscope/agent/_realtime/_agent.py:887 — RealtimeAgent._on_model_event has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Agent._execute_tool_call (cyclomatic 31) · ×1
  • Agent._execute_tool_call (cyclomatic 31) src/agentscope/agent/_agent.py:2457 — Agent._execute_tool_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 · ChatInputQueue._drain_chat_inputs_locked (cyclomatic 30) · ×1
  • ChatInputQueue._drain_chat_inputs_locked (cyclomatic 30) src/agentscope/app/_manager/_chat_input_queue.py:414 — ChatInputQueue._drain_chat_inputs_locked has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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 · 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 · GeminiChatModel._call_api (cyclomatic 28) · ×1
  • GeminiChatModel._call_api (cyclomatic 28) src/agentscope/model/_gemini/_model.py:420 — GeminiChatModel._call_api has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · XAIChatFormatter.format (cyclomatic 27) · ×1
  • XAIChatFormatter.format (cyclomatic 27) src/agentscope/formatter/_xai_formatter.py:129 — XAIChatFormatter.format has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GitHubMCPHub._to_card (cyclomatic 26) · ×1
  • GitHubMCPHub._to_card (cyclomatic 26) src/agentscope/app/hub/_mcp/_github_hub.py:325 — 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 · TTSMiddleware.on_reply (cyclomatic 26) · ×1
  • TTSMiddleware.on_reply (cyclomatic 26) src/agentscope/middleware/_tts_middleware.py:67 — TTSMiddleware.on_reply 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 · _model._sanitize_schema_for_gemini (cyclomatic 26) · ×1
  • _model._sanitize_schema_for_gemini (cyclomatic 26) src/agentscope/model/_gemini/_model.py:106 — _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 · OpenAIResponseModel._parse_completion_response (cyclomatic 26) · ×1
  • OpenAIResponseModel._parse_completion_response (cyclomatic 26) src/agentscope/model/_openai_response/_model.py:629 — OpenAIResponseModel._parse_completion_response has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GeminiRealtimeModel._parse_content (cyclomatic 26) · ×1
  • GeminiRealtimeModel._parse_content (cyclomatic 26) src/agentscope/realtime/_gemini/_model.py:559 — GeminiRealtimeModel._parse_content 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 · Agent._compress_context_impl (cyclomatic 25) · ×1
  • Agent._compress_context_impl (cyclomatic 25) src/agentscope/agent/_agent.py:485 — Agent._compress_context_impl has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RealtimeAgent.connect (cyclomatic 25) · ×1
  • RealtimeAgent.connect (cyclomatic 25) src/agentscope/agent/_realtime/_agent.py:308 — RealtimeAgent.connect has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MoonshotChatModel._parse_stream_response (cyclomatic 25) · ×1
  • MoonshotChatModel._parse_stream_response (cyclomatic 25) src/agentscope/model/_moonshot/_model.py:314 — MoonshotChatModel._parse_stream_response has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAIChatModel._parse_completion_response (cyclomatic 25) · ×1
  • OpenAIChatModel._parse_completion_response (cyclomatic 25) src/agentscope/model/_openai_chat/_model.py:514 — OpenAIChatModel._parse_completion_response has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · VolcengineChatModel._parse_stream_response (cyclomatic 25) · ×1
  • VolcengineChatModel._parse_stream_response (cyclomatic 25) src/agentscope/model/_volcengine/_model.py:285 — VolcengineChatModel._parse_stream_response has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DashScopeRealtimeModel._parse (cyclomatic 25) · ×1
  • DashScopeRealtimeModel._parse (cyclomatic 25) src/agentscope/realtime/_dashscope/_model.py:348 — 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 · 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 · DeepSeekChatModel._parse_stream_response (cyclomatic 24) · ×1
  • DeepSeekChatModel._parse_stream_response (cyclomatic 24) src/agentscope/model/_deepseek/_model.py:248 — DeepSeekChatModel._parse_stream_response has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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:2935 — 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:116 — _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 · GeminiRealtimeModel._parse (cyclomatic 23) · ×1
  • GeminiRealtimeModel._parse (cyclomatic 23) src/agentscope/realtime/_gemini/_model.py:479 — GeminiRealtimeModel._parse has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Agent._limit_context_images (cyclomatic 22) · ×1
  • Agent._limit_context_images (cyclomatic 22) src/agentscope/agent/_agent.py:802 — 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 · WakeupDispatcher._dispatch_one (cyclomatic 22) · ×1
  • WakeupDispatcher._dispatch_one (cyclomatic 22) src/agentscope/app/_manager/_wakeup_dispatcher.py:310 — WakeupDispatcher._dispatch_one 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 · WebRTCSession._run (cyclomatic 22) · ×1
  • WebRTCSession._run (cyclomatic 22) src/agentscope/app/_service/_webrtc_session.py:187 — WebRTCSession._run 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:394 — 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:1725 — 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 · AnthropicChatModel._parse_anthropic_completion_response (cyclomatic 21) · ×1
  • AnthropicChatModel._parse_anthropic_completion_response (cyclomatic 21) src/agentscope/model/_anthropic/_model.py:360 — AnthropicChatModel._parse_anthropic_completion_response has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
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:3919 — 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 · _toolkit.get_toolkit (cyclomatic 20) · ×1
  • _toolkit.get_toolkit (cyclomatic 20) src/agentscope/app/_service/_toolkit.py:46 — _toolkit.get_toolkit 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 · ChatModelBase.generate_structured_output (cyclomatic 20) · ×1
  • ChatModelBase.generate_structured_output (cyclomatic 20) src/agentscope/model/_base.py:529 — ChatModelBase.generate_structured_output 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._call_api (cyclomatic 20) · ×1
  • MoonshotChatModel._call_api (cyclomatic 20) src/agentscope/model/_moonshot/_model.py:198 — MoonshotChatModel._call_api 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:206 — 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 · Glob.call (cyclomatic 20) · ×1
  • Glob.call (cyclomatic 20) src/agentscope/tool/_builtin/_glob.py:224 — Glob.call has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Agent._next_action (cyclomatic 19) · ×1
  • Agent._next_action (cyclomatic 19) src/agentscope/agent/_agent.py:3657 — 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:441 — 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 · ToolResponse.append_chunk (cyclomatic 19) · ×1
  • ToolResponse.append_chunk (cyclomatic 19) src/agentscope/tool/_response.py:74 — ToolResponse.append_chunk 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 · SchedulerManager.validate_schedule (cyclomatic 18) · ×1
  • SchedulerManager.validate_schedule (cyclomatic 18) src/agentscope/app/_manager/_scheduler/_scheduler_manager.py:336 — SchedulerManager.validate_schedule 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 · _console._ask_user (cyclomatic 18) · ×1
  • _console._ask_user (cyclomatic 18) src/agentscope/console/_console.py:157 — _console._ask_user 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 · GeminiChatModel._parse_stream_response (cyclomatic 18) · ×1
  • GeminiChatModel._parse_stream_response (cyclomatic 18) src/agentscope/model/_gemini/_model.py:561 — GeminiChatModel._parse_stream_response has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DashScopeAudioRealtimeModel.replay_history (cyclomatic 18) · ×1
  • DashScopeAudioRealtimeModel.replay_history (cyclomatic 18) src/agentscope/realtime/_dashscope/_audio_model.py:109 — 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:307 — 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:506 — 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 · _realtime._create_realtime_offer (cyclomatic 17) · ×1
  • _realtime._create_realtime_offer (cyclomatic 17) src/agentscope/app/_router/_realtime.py:114 — _realtime._create_realtime_offer 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 · RealtimeService.create_agent (cyclomatic 17) · ×1
  • RealtimeService.create_agent (cyclomatic 17) src/agentscope/app/_service/_realtime.py:111 — RealtimeService.create_agent 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 · 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 · OllamaMultiAgentFormatter._format_agent_message (cyclomatic 17) · ×1
  • OllamaMultiAgentFormatter._format_agent_message (cyclomatic 17) src/agentscope/formatter/_ollama_formatter.py:476 — OllamaMultiAgentFormatter._format_agent_message 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 · OpenAILiveModel._parse (cyclomatic 17) · ×1
  • OpenAILiveModel._parse (cyclomatic 17) src/agentscope/realtime/_openai_live/_model.py:413 — OpenAILiveModel._parse 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 · 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:133 — 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 · RealtimeAgent._run_tool (cyclomatic 16) · ×1
  • RealtimeAgent._run_tool (cyclomatic 16) src/agentscope/agent/_realtime/_agent.py:2451 — RealtimeAgent._run_tool 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 · _client_external_tool._iter_schema_nodes (cyclomatic 16) · ×1
  • _client_external_tool._iter_schema_nodes (cyclomatic 16) src/agentscope/app/_client_external_tool.py:61 — _client_external_tool._iter_schema_nodes 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 · 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 · ReMeMiddleware.on_reply (cyclomatic 16) · ×1
  • ReMeMiddleware.on_reply (cyclomatic 16) src/agentscope/middleware/_longterm_memory/_reme/_middleware.py:322 — 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:672 — 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:190 — 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.
D2 · Cognitive Complexity · ChatService._run_impl (cognitive 161) · ×1
  • ChatService._run_impl (cognitive 161) src/agentscope/app/_service/_chat.py:908 — ChatService._run_impl has cognitive complexity 161 (threshold 15). Drivers by points: if/else 48 (100 pts), error handling 8 (19 pts), boolean chains 16, loops 5 (13 pts), ternaries 9 (13 pts) (nesting depth added 75). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _AnthropicFormatterBase._format_messages (cognitive 149) · ×1
  • _AnthropicFormatterBase._format_messages (cognitive 149) src/agentscope/formatter/_anthropic_formatter.py:34 — _AnthropicFormatterBase._format_messages has cognitive complexity 149 (threshold 15). Drivers by points: if/else 29 (114 pts), ternaries 4 (19 pts), loops 4 (13 pts), boolean chains 3 (nesting depth added 109). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the 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 · 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:126 — 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 · GeminiChatFormatter.format (cognitive 117) · ×1
  • GeminiChatFormatter.format (cognitive 117) src/agentscope/formatter/_gemini_formatter.py:158 — GeminiChatFormatter.format has cognitive complexity 117 (threshold 15). Drivers by points: if/else 19 (80 pts), ternaries 5 (22 pts), loops 4 (13 pts), boolean chains 2 (nesting depth added 87). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · OllamaChatFormatter.format (cognitive 117) · ×1
  • OllamaChatFormatter.format (cognitive 117) src/agentscope/formatter/_ollama_formatter.py:118 — OllamaChatFormatter.format has cognitive complexity 117 (threshold 15). Drivers by points: if/else 22 (90 pts), loops 4 (13 pts), ternaries 2 (8 pts), boolean chains 6 (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 · DashScopeChatFormatter.format (cognitive 114) · ×1
  • DashScopeChatFormatter.format (cognitive 114) src/agentscope/formatter/_dashscope_formatter.py:276 — 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:154 — 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 · BashCommandParser.check_sed_constraints (cognitive 109) · ×1
  • BashCommandParser.check_sed_constraints (cognitive 109) src/agentscope/tool/_builtin/_bash_parser.py:726 — 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:304 — 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:187 — 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 89) · ×1
  • Agent._reply_impl (cognitive 89) src/agentscope/agent/_agent.py:1051 — Agent._reply_impl has cognitive complexity 89 (threshold 15). Drivers by points: if/else 27 (62 pts), loops 8 (22 pts), boolean chains 2, match/switch 1 (2 pts), error handling 1 (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Msg.append_event (cognitive 86) · ×1
  • Msg.append_event (cognitive 86) src/agentscope/message/_base.py:247 — Msg.append_event has cognitive complexity 86 (threshold 15). Drivers by points: if/else 26 (57 pts), loops 5 (11 pts), ternaries 3 (10 pts), boolean chains 7, match/switch 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIResponseModel._parse_stream_response (cognitive 84) · ×1
  • OpenAIResponseModel._parse_stream_response (cognitive 84) src/agentscope/model/_openai_response/_model.py:397 — OpenAIResponseModel._parse_stream_response has cognitive complexity 84 (threshold 15). Drivers by points: if/else 15 (47 pts), ternaries 5 (16 pts), boolean chains 11, loops 3 (10 pts) (nesting depth added 50). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the 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 · 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 · RealtimeAgent._drive_client_delegation (cognitive 72) · ×1
  • RealtimeAgent._drive_client_delegation (cognitive 72) src/agentscope/agent/_realtime/_agent.py:1417 — RealtimeAgent._drive_client_delegation has cognitive complexity 72 (threshold 15). Drivers by points: if/else 30 (57 pts), boolean chains 11, error handling 2 (3 pts), loops 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 · OpenAIChatModel._parse_stream_response (cognitive 70) · ×1
  • OpenAIChatModel._parse_stream_response (cognitive 70) src/agentscope/model/_openai_chat/_model.py:341 — OpenAIChatModel._parse_stream_response has cognitive complexity 70 (threshold 15). Drivers by points: if/else 17 (39 pts), boolean chains 19, ternaries 3 (9 pts), loops 2 (3 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · XAIChatFormatter.format (cognitive 69) · ×1
  • XAIChatFormatter.format (cognitive 69) src/agentscope/formatter/_xai_formatter.py:129 — XAIChatFormatter.format has cognitive complexity 69 (threshold 15). Drivers by points: if/else 17 (61 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 48). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the 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._execute_tool_call (cognitive 67) · ×1
  • Agent._execute_tool_call (cognitive 67) src/agentscope/agent/_agent.py:2457 — Agent._execute_tool_call has cognitive complexity 67 (threshold 15). Drivers by points: if/else 16 (41 pts), loops 5 (13 pts), boolean chains 5, error handling 4, ternaries 1 (4 pts) (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Agent._inject_runtime_state (cognitive 65) · ×1
  • Agent._inject_runtime_state (cognitive 65) src/agentscope/agent/_agent.py:1392 — 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 · DashScopeChatModel._parse_stream_response (cognitive 62) · ×1
  • DashScopeChatModel._parse_stream_response (cognitive 62) src/agentscope/model/_dashscope/_model.py:311 — DashScopeChatModel._parse_stream_response has cognitive complexity 62 (threshold 15). Drivers by points: if/else 17 (39 pts), boolean chains 14, ternaries 2 (6 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 · 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 · ChatInputQueue._drain_chat_inputs_locked (cognitive 57) · ×1
  • ChatInputQueue._drain_chat_inputs_locked (cognitive 57) src/agentscope/app/_manager/_chat_input_queue.py:414 — ChatInputQueue._drain_chat_inputs_locked has cognitive complexity 57 (threshold 15). Drivers by points: if/else 11 (24 pts), error handling 7 (18 pts), boolean chains 7, ternaries 2 (5 pts), loops 2 (3 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordParser.parse (cognitive 55) · ×1
  • WordParser.parse (cognitive 55) src/agentscope/rag/_parser/_word.py:394 — 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 · AnthropicChatModel._parse_anthropic_stream_completion_response (cognitive 50) · ×1
  • AnthropicChatModel._parse_anthropic_stream_completion_response (cognitive 50) src/agentscope/model/_anthropic/_model.py:483 — AnthropicChatModel._parse_anthropic_stream_completion_response has cognitive complexity 50 (threshold 15). Drivers by points: if/else 10 (32 pts), boolean chains 13, loops 2 (5 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatModelBase.generate_structured_output (cognitive 50) · ×1
  • ChatModelBase.generate_structured_output (cognitive 50) src/agentscope/model/_base.py:529 — ChatModelBase.generate_structured_output has cognitive complexity 50 (threshold 15). Drivers by points: if/else 13 (38 pts), loops 3 (5 pts), error handling 1 (3 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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 · TTSMiddleware.on_reply (cognitive 45) · ×1
  • TTSMiddleware.on_reply (cognitive 45) src/agentscope/middleware/_tts_middleware.py:67 — TTSMiddleware.on_reply has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (28 pts), error handling 5 (9 pts), boolean chains 4, loops 2 (3 pts), ternaries 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 · Grep.call (cognitive 45) · ×1
  • Grep.call (cognitive 45) src/agentscope/tool/_builtin/_grep.py:329 — Grep.call has cognitive complexity 45 (threshold 15). Drivers by points: if/else 22 (33 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 · 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:109 — 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 · Agent._limit_context_images (cognitive 43) · ×1
  • Agent._limit_context_images (cognitive 43) src/agentscope/agent/_agent.py:802 — 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 · GeminiChatModel._parse_stream_response (cognitive 43) · ×1
  • GeminiChatModel._parse_stream_response (cognitive 43) src/agentscope/model/_gemini/_model.py:561 — GeminiChatModel._parse_stream_response has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (33 pts), boolean chains 6, loops 2 (4 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _model._sanitize_schema_for_gemini (cognitive 43) · ×1
  • _model._sanitize_schema_for_gemini (cognitive 43) src/agentscope/model/_gemini/_model.py:106 — _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 · GeminiChatModel._call_api (cognitive 42) · ×1
  • GeminiChatModel._call_api (cognitive 42) src/agentscope/model/_gemini/_model.py:420 — GeminiChatModel._call_api has cognitive complexity 42 (threshold 15). Drivers by points: if/else 20 (33 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIChatModel._parse_completion_response (cognitive 42) · ×1
  • OpenAIChatModel._parse_completion_response (cognitive 42) src/agentscope/model/_openai_chat/_model.py:514 — OpenAIChatModel._parse_completion_response has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (29 pts), boolean chains 9, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Agent._handle_incoming_event (cognitive 41) · ×1
  • Agent._handle_incoming_event (cognitive 41) src/agentscope/agent/_agent.py:1953 — 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 · MoonshotChatModel._parse_stream_response (cognitive 41) · ×1
  • MoonshotChatModel._parse_stream_response (cognitive 41) src/agentscope/model/_moonshot/_model.py:314 — MoonshotChatModel._parse_stream_response has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 11, ternaries 3 (9 pts), loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VolcengineChatModel._parse_stream_response (cognitive 41) · ×1
  • VolcengineChatModel._parse_stream_response (cognitive 41) src/agentscope/model/_volcengine/_model.py:285 — VolcengineChatModel._parse_stream_response has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 11, ternaries 3 (9 pts), loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Agent._compress_context_impl (cognitive 40) · ×1
  • Agent._compress_context_impl (cognitive 40) src/agentscope/agent/_agent.py:485 — Agent._compress_context_impl has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 6, error handling 3 (5 pts), loops 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Agent._call_model (cognitive 39) · ×1
  • Agent._call_model (cognitive 39) src/agentscope/agent/_agent.py:3393 — Agent._call_model has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (32 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatModelBase.count_tokens (cognitive 39) · ×1
  • ChatModelBase.count_tokens (cognitive 39) src/agentscope/model/_base.py:441 — 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:206 — 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 · DeepSeekChatModel._parse_stream_response (cognitive 38) · ×1
  • DeepSeekChatModel._parse_stream_response (cognitive 38) src/agentscope/model/_deepseek/_model.py:248 — DeepSeekChatModel._parse_stream_response has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 11, ternaries 2 (6 pts), 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 · OpenAIResponseModel._parse_completion_response (cognitive 38) · ×1
  • OpenAIResponseModel._parse_completion_response (cognitive 38) src/agentscope/model/_openai_response/_model.py:629 — OpenAIResponseModel._parse_completion_response has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 8, loops 3 (7 pts), ternaries 2 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiTTSModel._parse_stream_into_async_generator (cognitive 38) · ×1
  • GeminiTTSModel._parse_stream_into_async_generator (cognitive 38) src/agentscope/tts/_gemini/_model.py:346 — GeminiTTSModel._parse_stream_into_async_generator has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 3 (6 pts), boolean chains 3 (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 · 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 · RealtimeAgent.connect (cognitive 36) · ×1
  • RealtimeAgent.connect (cognitive 36) src/agentscope/agent/_realtime/_agent.py:308 — RealtimeAgent.connect has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (2 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RealtimeAgent._on_model_event (cognitive 36) · ×1
  • RealtimeAgent._on_model_event (cognitive 36) src/agentscope/agent/_realtime/_agent.py:887 — RealtimeAgent._on_model_event has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (29 pts), boolean chains 4, ternaries 1 (2 pts), match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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 · _console._ask_user (cognitive 36) · ×1
  • _console._ask_user (cognitive 36) src/agentscope/console/_console.py:157 — _console._ask_user has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (17 pts), ternaries 3 (7 pts), loops 4 (6 pts), boolean chains 3, error handling 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Agent._handle_incoming_messages (cognitive 35) · ×1
  • Agent._handle_incoming_messages (cognitive 35) src/agentscope/agent/_agent.py:2062 — 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 · 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:506 — 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 · 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 · _app.create_app (cognitive 33) · ×1
  • _app.create_app (cognitive 33) src/agentscope/app/_app.py:116 — _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 · AnthropicMultiAgentFormatter._format_agent_message (cognitive 33) · ×1
  • AnthropicMultiAgentFormatter._format_agent_message (cognitive 33) src/agentscope/formatter/_anthropic_formatter.py:497 — AnthropicMultiAgentFormatter._format_agent_message has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:2935 — 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 · _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 · _word._extract_table_data (cognitive 31) · ×1
  • _word._extract_table_data (cognitive 31) src/agentscope/rag/_parser/_word.py:194 — _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 · SessionService.delete_agent (cognitive 30) · ×1
  • SessionService.delete_agent (cognitive 30) src/agentscope/app/_service/_session.py:484 — 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:325 — 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 · _utils._extract_input_schema (cognitive 30) · ×1
  • _utils._extract_input_schema (cognitive 30) src/agentscope/tool/_utils.py:194 — _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:307 — 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 · WakeupDispatcher._dispatch_one (cognitive 29) · ×1
  • WakeupDispatcher._dispatch_one (cognitive 29) src/agentscope/app/_manager/_wakeup_dispatcher.py:310 — WakeupDispatcher._dispatch_one has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 6, ternaries 3 (4 pts), error handling 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · XAIMultiAgentFormatter.format (cognitive 29) · ×1
  • XAIMultiAgentFormatter.format (cognitive 29) src/agentscope/formatter/_xai_formatter.py:349 — XAIMultiAgentFormatter.format has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (24 pts), loops 2 (4 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 · GeminiRealtimeModel._parse_content (cognitive 29) · ×1
  • GeminiRealtimeModel._parse_content (cognitive 29) src/agentscope/realtime/_gemini/_model.py:559 — GeminiRealtimeModel._parse_content has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 12, 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 · _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:3116 — 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 · OllamaMultiAgentFormatter._format_agent_message (cognitive 28) · ×1
  • OllamaMultiAgentFormatter._format_agent_message (cognitive 28) src/agentscope/formatter/_ollama_formatter.py:476 — OllamaMultiAgentFormatter._format_agent_message has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Agent._reasoning_impl (cognitive 27) · ×1
  • Agent._reasoning_impl (cognitive 27) src/agentscope/agent/_agent.py:1725 — 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 · WebRTCSession._run (cognitive 27) · ×1
  • WebRTCSession._run (cognitive 27) src/agentscope/app/_service/_webrtc_session.py:187 — WebRTCSession._run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 8, 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 · 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 · MoonshotChatModel._call_api (cognitive 27) · ×1
  • MoonshotChatModel._call_api (cognitive 27) src/agentscope/model/_moonshot/_model.py:198 — MoonshotChatModel._call_api has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 3, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _client_external_tool._iter_schema_nodes (cognitive 26) · ×1
  • _client_external_tool._iter_schema_nodes (cognitive 26) src/agentscope/app/_client_external_tool.py:61 — _client_external_tool._iter_schema_nodes has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 2 (6 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _toolkit.get_toolkit (cognitive 26) · ×1
  • _toolkit.get_toolkit (cognitive 26) src/agentscope/app/_service/_toolkit.py:46 — _toolkit.get_toolkit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 6, ternaries 1 (3 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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 · GeminiChatModel._parse_completion_response (cognitive 26) · ×1
  • GeminiChatModel._parse_completion_response (cognitive 26) src/agentscope/model/_gemini/_model.py:655 — GeminiChatModel._parse_completion_response has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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 25) · ×1
  • RealtimeAgent._run_tool (cognitive 25) src/agentscope/agent/_realtime/_agent.py:2451 — RealtimeAgent._run_tool has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 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 · _voice_profile.list_available_engines (cognitive 25) · ×1
  • _voice_profile.list_available_engines (cognitive 25) src/agentscope/app/_router/_voice_profile.py:128 — _voice_profile.list_available_engines has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 3 (7 pts), loops 3, boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiRealtimeModel._parse (cognitive 25) · ×1
  • GeminiRealtimeModel._parse (cognitive 25) src/agentscope/realtime/_gemini/_model.py:479 — GeminiRealtimeModel._parse has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 9 (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.
D2 · Cognitive Complexity · GeminiMultiAgentFormatter._format_agent_message (cognitive 24) · ×1
  • GeminiMultiAgentFormatter._format_agent_message (cognitive 24) src/agentscope/formatter/_gemini_formatter.py:444 — 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 · ToolResponse.append_chunk (cognitive 24) · ×1
  • ToolResponse.append_chunk (cognitive 24) src/agentscope/tool/_response.py:74 — ToolResponse.append_chunk has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 7, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiTTSModel._parse_response (cognitive 24) · ×1
  • GeminiTTSModel._parse_response (cognitive 24) src/agentscope/tts/_gemini/_model.py:273 — GeminiTTSModel._parse_response has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkspaceBase._enforce_mcp_capacity (cognitive 24) · ×1
  • WorkspaceBase._enforce_mcp_capacity (cognitive 24) src/agentscope/workspace/_base.py:851 — 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:3657 — 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 · 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:672 — 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 · _excel._restore_native_excel_errors (cognitive 23) · ×1
  • _excel._restore_native_excel_errors (cognitive 23) src/agentscope/rag/_parser/_excel.py:87 — _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:300 — 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 · RealtimeAgent.send (cognitive 22) · ×1
  • RealtimeAgent.send (cognitive 22) src/agentscope/agent/_realtime/_agent.py:622 — RealtimeAgent.send has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 1 (2 pts), loops 1 (2 pts), ternaries 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ChatInputQueue._recover_pending_chat_inputs_locked (cognitive 22) · ×1
  • ChatInputQueue._recover_pending_chat_inputs_locked (cognitive 22) src/agentscope/app/_manager/_chat_input_queue.py:203 — ChatInputQueue._recover_pending_chat_inputs_locked has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 2 (5 pts), boolean chains 4, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _console.launch_console (cognitive 22) · ×1
  • _console.launch_console (cognitive 22) src/agentscope/console/_console.py:243 — _console.launch_console has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 3 (8 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DashScopeMultiAgentFormatter._format_agent_message (cognitive 22) · ×1
  • DashScopeMultiAgentFormatter._format_agent_message (cognitive 22) src/agentscope/formatter/_dashscope_formatter.py:567 — 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:572 — 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 · RealtimeAgent.reply_stream (cognitive 21) · ×1
  • RealtimeAgent.reply_stream (cognitive 21) src/agentscope/agent/_realtime/_agent.py:507 — RealtimeAgent.reply_stream has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 4, ternaries 1 (3 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:191 — 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 · FormatterBase._split_agent_messages_at_hints (cognitive 21) · ×1
  • FormatterBase._split_agent_messages_at_hints (cognitive 21) src/agentscope/formatter/_formatter_base.py:235 — FormatterBase._split_agent_messages_at_hints has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _word._extract_text_from_paragraph (cognitive 21) · ×1
  • _word._extract_text_from_paragraph (cognitive 21) src/agentscope/rag/_parser/_word.py:44 — _word._extract_text_from_paragraph has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAILiveModel._parse (cognitive 21) · ×1
  • OpenAILiveModel._parse (cognitive 21) src/agentscope/realtime/_openai_live/_model.py:413 — OpenAILiveModel._parse has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:190 — 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:191 — 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 · DashScopeVoiceCloningClient.create_voice (cognitive 21) · ×1
  • DashScopeVoiceCloningClient.create_voice (cognitive 21) src/agentscope/tts/_dashscope/_voice_cloning_client.py:60 — DashScopeVoiceCloningClient.create_voice has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 3, 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 · 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:3919 — 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 · ChatInputQueue._claim_chat_input (cognitive 20) · ×1
  • ChatInputQueue._claim_chat_input (cognitive 20) src/agentscope/app/_manager/_chat_input_queue.py:653 — ChatInputQueue._claim_chat_input has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SchedulerManager.validate_schedule (cognitive 20) · ×1
  • SchedulerManager.validate_schedule (cognitive 20) src/agentscope/app/_manager/_scheduler/_scheduler_manager.py:336 — SchedulerManager.validate_schedule has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, ternaries 3 (4 pts), error handling 1, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:170 — 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:972 — 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 · SteeringMiddleware._consume (cognitive 20) · ×1
  • SteeringMiddleware._consume (cognitive 20) src/agentscope/middleware/_steering.py:122 — SteeringMiddleware._consume has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 5 (8 pts), loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnthropicChatModel._parse_anthropic_completion_response (cognitive 20) · ×1
  • AnthropicChatModel._parse_anthropic_completion_response (cognitive 20) src/agentscope/model/_anthropic/_model.py:360 — AnthropicChatModel._parse_anthropic_completion_response has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (7 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 · DashScopeChatModel._parse_completion_response (cognitive 20) · ×1
  • DashScopeChatModel._parse_completion_response (cognitive 20) src/agentscope/model/_dashscope/_model.py:471 — DashScopeChatModel._parse_completion_response has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _model._openai_response_block_error (cognitive 20) · ×1
  • _model._openai_response_block_error (cognitive 20) src/agentscope/model/_openai_response/_model.py:76 — _model._openai_response_block_error has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 2 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _word._extract_image_blocks (cognitive 20) · ×1
  • _word._extract_image_blocks (cognitive 20) src/agentscope/rag/_parser/_word.py:247 — _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 · Glob.call (cognitive 20) · ×1
  • Glob.call (cognitive 20) src/agentscope/tool/_builtin/_glob.py:224 — Glob.call has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 4 (5 pts), boolean chains 4, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
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 · MiniMaxTTSModel._stream (cognitive 20) · ×1
  • MiniMaxTTSModel._stream (cognitive 20) src/agentscope/tts/_minimax/_model.py:264 — MiniMaxTTSModel._stream has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 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 · 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 · 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:172 — 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 · ChatModelBase.__call__ (cognitive 19) · ×1
  • ChatModelBase.__call__ (cognitive 19) src/agentscope/model/_base.py:234 — ChatModelBase.__call__ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 2 (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 · XAIChatModel._parse_stream_response (cognitive 19) · ×1
  • XAIChatModel._parse_stream_response (cognitive 19) src/agentscope/model/_xai/_model.py:300 — 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 · _asr.transcribe_realtime (cognitive 18) · ×1
  • _asr.transcribe_realtime (cognitive 18) src/agentscope/app/_router/_asr.py:236 — _asr.transcribe_realtime has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 6, ternaries 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RealtimeService.create_agent (cognitive 18) · ×1
  • RealtimeService.create_agent (cognitive 18) src/agentscope/app/_service/_realtime.py:111 — RealtimeService.create_agent has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (8 pts), if/else 5 (6 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
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 · _xai_formatter._xai_user_args_from_blocks (cognitive 18) · ×1
  • _xai_formatter._xai_user_args_from_blocks (cognitive 18) src/agentscope/formatter/_xai_formatter.py:33 — _xai_formatter._xai_user_args_from_blocks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 4, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:776 — 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 · VolcengineChatModel._parse_completion_response (cognitive 18) · ×1
  • VolcengineChatModel._parse_completion_response (cognitive 18) src/agentscope/model/_volcengine/_model.py:402 — VolcengineChatModel._parse_completion_response has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KnowledgeBase.search (cognitive 18) · ×1
  • KnowledgeBase.search (cognitive 18) src/agentscope/rag/_knowledge.py:197 — KnowledgeBase.search has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 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 · MCPTool._stream_call (cognitive 18) · ×1
  • MCPTool._stream_call (cognitive 18) src/agentscope/tool/_adapters.py:359 — MCPTool._stream_call has cognitive complexity 18 (threshold 15). Drivers by points: error handling 3 (7 pts), if/else 5 (6 pts), boolean chains 2, loops 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Bash.call (cognitive 18) · ×1
  • Bash.call (cognitive 18) src/agentscope/tool/_builtin/_bash.py:708 — Bash.call has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (16 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 · 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:127 — _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:166 — 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 · RealtimeAgent._sync_delegation_state (cognitive 17) · ×1
  • RealtimeAgent._sync_delegation_state (cognitive 17) src/agentscope/agent/_realtime/_agent.py:1786 — RealtimeAgent._sync_delegation_state has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _realtime._create_realtime_offer (cognitive 17) · ×1
  • _realtime._create_realtime_offer (cognitive 17) src/agentscope/app/_router/_realtime.py:114 — _realtime._create_realtime_offer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), error handling 4, boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
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 · EmbeddingModelBase.__call__ (cognitive 17) · ×1
  • EmbeddingModelBase.__call__ (cognitive 17) src/agentscope/embedding/_embedding_base.py:201 — EmbeddingModelBase.__call__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 2 (4 pts), loops 2 (4 pts), boolean chains 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 · AgenticMemoryMiddleware._list_md_files (cognitive 17) · ×1
  • AgenticMemoryMiddleware._list_md_files (cognitive 17) src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:935 — AgenticMemoryMiddleware._list_md_files has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 3, error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DashScopeChatModel._format_tools (cognitive 17) · ×1
  • DashScopeChatModel._format_tools (cognitive 17) src/agentscope/model/_dashscope/_model.py:543 — 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 · ModelCard.from_yaml (cognitive 17) · ×1
  • ModelCard.from_yaml (cognitive 17) src/agentscope/model/_model_card.py:86 — ModelCard.from_yaml has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MoonshotChatModel._parse_completion_response (cognitive 17) · ×1
  • MoonshotChatModel._parse_completion_response (cognitive 17) src/agentscope/model/_moonshot/_model.py:434 — MoonshotChatModel._parse_completion_response has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DashScopeRealtimeModel._parse (cognitive 17) · ×1
  • DashScopeRealtimeModel._parse (cognitive 17) src/agentscope/realtime/_dashscope/_model.py:348 — 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.check_permissions (cognitive 17) · ×1
  • Bash.check_permissions (cognitive 17) src/agentscope/tool/_builtin/_bash.py:204 — Bash.check_permissions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Read._read_text_file (cognitive 17) · ×1
  • Read._read_text_file (cognitive 17) src/agentscope/tool/_builtin/_read.py:501 — Read._read_text_file has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:638 — 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:2215 — 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._run_tools (cognitive 16) · ×1
  • RealtimeAgent._run_tools (cognitive 16) src/agentscope/agent/_realtime/_agent.py:2406 — RealtimeAgent._run_tools has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, error handling 1, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _tts_model._validate_voice_binding (cognitive 16) · ×1
  • _tts_model._validate_voice_binding (cognitive 16) src/agentscope/app/_service/_tts_model.py:241 — _tts_model._validate_voice_binding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GitHubMCPHub._from_remote (cognitive 16) · ×1
  • GitHubMCPHub._from_remote (cognitive 16) src/agentscope/app/hub/_mcp/_github_hub.py:210 — GitHubMCPHub._from_remote has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, loops 4 (5 pts), if/else 2 (3 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · GitHubMCPHub._from_package (cognitive 16) · ×1
  • GitHubMCPHub._from_package (cognitive 16) src/agentscope/app/hub/_mcp/_github_hub.py:269 — 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:466 — 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 · OllamaMultiAgentFormatter.format (cognitive 16) · ×1
  • OllamaMultiAgentFormatter.format (cognitive 16) src/agentscope/formatter/_ollama_formatter.py:411 — OllamaMultiAgentFormatter.format has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgenticMemoryMiddleware.on_reply (cognitive 16) · ×1
  • AgenticMemoryMiddleware.on_reply (cognitive 16) src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:574 — 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:322 — 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:902 — 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 · ChatModelBase._validate_tool_choice (cognitive 16) · ×1
  • ChatModelBase._validate_tool_choice (cognitive 16) src/agentscope/model/_base.py:388 — 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 · DeepSeekChatModel._parse_completion_response (cognitive 16) · ×1
  • DeepSeekChatModel._parse_completion_response (cognitive 16) src/agentscope/model/_deepseek/_model.py:365 — DeepSeekChatModel._parse_completion_response has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent 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._prepare_gemini_4_config (cognitive 16) · ×1
  • GeminiChatModel._prepare_gemini_4_config (cognitive 16) src/agentscope/model/_gemini/_model.py:373 — GeminiChatModel._prepare_gemini_4_config has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:245 — 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 · TeamPipeline._run_assignments (cognitive 16) · ×1
  • TeamPipeline._run_assignments (cognitive 16) src/agentscope/pipeline/_team_pipeline.py:289 — TeamPipeline._run_assignments has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (7 pts), if/else 2 (5 pts), error handling 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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 · _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
D30 · Dependency Vulnerabilities · Medium vulnerability · ×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, 41 shared lines) · ×1
  • Near-duplicate member family (5 members, 41 shared lines) src/agentscope/model/_dashscope/_model.py:316 — src/agentscope/model/_dashscope/_model.py:316-469 | src/agentscope/model/_deepseek/_model.py:253-363 | src/agentscope/model/_moonshot/_model.py:319-432 | src/agentscope/model/_openai_chat/_model.py:346-512 | src/agentscope/model/_volcengine/_model.py:290-400 — These 5 members are variants of one another: a block of 41 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 28 shared lines) · ×1
  • Near-duplicate member family (4 members, 28 shared lines) src/agentscope/model/_dashscope/_model.py:476 — src/agentscope/model/_dashscope/_model.py:476-541 | src/agentscope/model/_deepseek/_model.py:370-434 | src/agentscope/model/_moonshot/_model.py:439-506 | src/agentscope/model/_volcengine/_model.py:407-469 — These 4 members are variants of one another: a block of 28 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 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 · 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:130-330 — 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:280 — src/agentscope/formatter/_dashscope_formatter.py:280-460 | src/agentscope/formatter/_openai_formatter.py:308-476 — 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:158-347 — 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 · Edited copy of a member (124 corresponding lines) · ×1
  • Edited copy of a member (124 corresponding lines) src/agentscope/tts/_dashscope/_cosyvoice_utils.py:42 — src/agentscope/tts/_dashscope/_cosyvoice_utils.py:42-165 | src/agentscope/tts/_dashscope/_realtime_model.py:31-181 — These two members are one piece of code written twice and then edited apart: 124 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (92 corresponding lines) · ×1
  • Edited copy of a member (92 corresponding lines) src/agentscope/realtime/_dashscope/_model.py:349 — src/agentscope/realtime/_dashscope/_model.py:349-465 | src/agentscope/realtime/_xai/_model.py:288-379 — These two members are one piece of code written twice and then edited apart: 92 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (76 corresponding lines) · ×1
  • Edited copy of a member (76 corresponding lines) src/agentscope/app/channel/_dingtalk/_channel.py:306 — src/agentscope/app/channel/_dingtalk/_channel.py:306-397 | src/agentscope/app/channel/_feishu/_channel.py:659-734 — These two members are one piece of code written twice and then edited apart: 76 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (79 corresponding lines) · ×1
  • Edited copy of a member (79 corresponding lines) src/agentscope/embedding/_dashscope/_model.py:331 — src/agentscope/embedding/_dashscope/_model.py:331-409 | src/agentscope/embedding/_dashscope/_model.py:420-500 — These two members are one piece of code written twice and then edited apart: 79 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (68 corresponding lines) · ×1
  • Edited copy of a member (68 corresponding lines) src/agentscope/model/_model_card.py:91 — src/agentscope/model/_model_card.py:91-177 | src/agentscope/tts/_tts_model_card.py:77-144 — These two members are one piece of code written twice and then edited apart: 68 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (74 corresponding lines) · ×1
  • Edited copy of a member (74 corresponding lines) src/agentscope/model/_deepseek/_model.py:173 — src/agentscope/model/_deepseek/_model.py:173-246 | src/agentscope/model/_volcengine/_model.py:210-283 — These two members are one piece of code written twice and then edited apart: 74 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (80 corresponding lines) · ×1
  • Edited copy of a member (80 corresponding lines) src/agentscope/app/middleware/_sop_step_middleware.py:90 — src/agentscope/app/middleware/_sop_step_middleware.py:90-169 | src/agentscope/app/middleware/_team_member_middleware.py:119-220 — These two members are one piece of code written twice and then edited apart: 80 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (70 corresponding lines) · ×1
  • Edited copy of a member (70 corresponding lines) src/agentscope/app/storage/_redis_storage.py:898 — src/agentscope/app/storage/_redis_storage.py:898-967 | src/agentscope/app/storage/_redis_storage.py:1056-1143 — These two members are one piece of code written twice and then edited apart: 70 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (71 corresponding lines) · ×1
  • Edited copy of a member (71 corresponding lines) src/agentscope/embedding/_gemini/_model.py:318 — src/agentscope/embedding/_gemini/_model.py:318-388 | src/agentscope/embedding/_gemini/_model.py:399-491 — These two members are one piece of code written twice and then edited apart: 71 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (73 corresponding lines) · ×1
  • Edited copy of a member (73 corresponding lines) src/agentscope/tts/_dashscope/_model.py:194 — src/agentscope/tts/_dashscope/_model.py:194-266 | src/agentscope/tts/_gemini/_model.py:349-435 — These two members are one piece of code written twice and then edited apart: 73 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (43 corresponding lines) · ×1
  • Edited copy of a member (43 corresponding lines) src/agentscope/app/_router/_hub.py:147 — src/agentscope/app/_router/_hub.py:147-203 | src/agentscope/app/_router/_hub.py:247-289 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (54 corresponding lines) · ×1
  • Edited copy of a member (54 corresponding lines) src/agentscope/embedding/_dashscope/_model.py:241 — src/agentscope/embedding/_dashscope/_model.py:241-294 | src/agentscope/embedding/_gemini/_model.py:229-282 — These two members are one piece of code written twice and then edited apart: 54 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (44 corresponding lines) · ×1
  • Edited copy of a member (44 corresponding lines) src/agentscope/workspace/_base.py:650 — src/agentscope/workspace/_base.py:650-698 | src/agentscope/workspace/_sandboxed_base.py:273-316 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (64 corresponding lines) · ×1
  • Edited copy of a member (64 corresponding lines) src/agentscope/app/channel/worker/__init__.py:74 — src/agentscope/app/channel/worker/__init__.py:74-137 | src/agentscope/app/rag/index_worker/__init__.py:94-203 — These two members are one piece of code written twice and then edited apart: 64 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (53 corresponding lines) · ×1
  • Edited copy of a member (53 corresponding lines) src/agentscope/model/_ollama/_model.py:143 — src/agentscope/model/_ollama/_model.py:143-195 | src/agentscope/model/_openai_response/_model.py:329-395 — These two members are one piece of code written twice and then edited apart: 53 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×1
  • Edited copy of a member (29 corresponding lines) src/agentscope/app/storage/_redis_storage.py:2385 — src/agentscope/app/storage/_redis_storage.py:2385-2433 | src/agentscope/app/storage/_redis_storage.py:2484-2512 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (46 corresponding lines) · ×1
  • Edited copy of a member (46 corresponding lines) src/agentscope/app/middleware/_sop_step_middleware.py:37 — src/agentscope/app/middleware/_sop_step_middleware.py:37-82 | src/agentscope/app/middleware/_team_member_middleware.py:51-111 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (90 corresponding lines) · ×1
  • Edited copy of a member (90 corresponding lines) src/agentscope/permission/_engine.py:400 — src/agentscope/permission/_engine.py:400-489 | src/agentscope/permission/_engine.py:496-591 — These two members are one piece of code written twice and then edited apart: 90 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 63+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 63+ corresponding lines) src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:66 — src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:66-128 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:84-150 | src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:79-158 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 63 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 34+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 34+ corresponding lines) src/agentscope/formatter/_dashscope_formatter.py:490 — src/agentscope/formatter/_dashscope_formatter.py:490-539 | src/agentscope/formatter/_openai_formatter.py:511-544 | src/agentscope/formatter/_volcengine_formatter.py:379-412 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 34 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (58 corresponding lines) · ×1
  • Edited copy of a member (58 corresponding lines) src/agentscope/workspace/_daytona/_daytona_workspace.py:100 — src/agentscope/workspace/_daytona/_daytona_workspace.py:100-169 | src/agentscope/workspace/_e2b/_e2b_workspace.py:95-152 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (42 corresponding lines) · ×1
  • Edited copy of a member (42 corresponding lines) src/agentscope/embedding/_dashscope/_model.py:188 — src/agentscope/embedding/_dashscope/_model.py:188-235 | src/agentscope/embedding/_gemini/_model.py:182-223 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 38+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 38+ corresponding lines) src/agentscope/formatter/_dashscope_formatter.py:125 — src/agentscope/formatter/_dashscope_formatter.py:125-162 | src/agentscope/formatter/_dashscope_formatter.py:169-208 | src/agentscope/formatter/_dashscope_formatter.py:215-262 | src/agentscope/formatter/_gemini_formatter.py:70-111 | src/agentscope/formatter/_openai_formatter.py:116-162 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 38 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 40+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 40+ corresponding lines) src/agentscope/embedding/_embedding_base.py:448 — src/agentscope/embedding/_embedding_base.py:448-490 | src/agentscope/model/_base.py:189-232 | src/agentscope/tts/_tts_base.py:155-194 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 40 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (20 corresponding lines) · ×1
  • Edited copy of a member (20 corresponding lines) src/agentscope/app/storage/_sql/_storage.py:2093 — src/agentscope/app/storage/_sql/_storage.py:2093-2120 | src/agentscope/app/storage/_sql/_storage.py:2131-2150 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 17+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 17+ corresponding lines) src/agentscope/realtime/_dashscope/_model.py:317 — src/agentscope/realtime/_dashscope/_model.py:317-338 | src/agentscope/realtime/_gemini/_model.py:429-448 | src/agentscope/realtime/_openai/_model.py:301-317 | src/agentscope/realtime/_xai/_model.py:268-284 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 51+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 51+ corresponding lines) src/agentscope/model/_anthropic/_model.py:136 — src/agentscope/model/_anthropic/_model.py:136-186 | src/agentscope/model/_dashscope/_model.py:135-185 | src/agentscope/model/_deepseek/_model.py:94-144 | src/agentscope/model/_moonshot/_model.py:113-164 | src/agentscope/model/_openai_chat/_model.py:140-199 | src/agentscope/model/_openai_response/_model.py:231-284 | src/agentscope/model/_volcengine/_model.py:98-149 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 51 lines, 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 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. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (32 corresponding lines) · ×1
  • Edited copy of a member (32 corresponding lines) src/agentscope/model/_model_response.py:90 — src/agentscope/model/_model_response.py:90-121 | src/agentscope/model/_model_response.py:130-164 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 18+ corresponding lines) src/agentscope/app/storage/_redis_storage.py:550 — src/agentscope/app/storage/_redis_storage.py:550-577 | src/agentscope/app/storage/_redis_storage.py:691-721 | src/agentscope/app/storage/_redis_storage.py:1673-1690 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (47 corresponding lines) · ×1
  • Edited copy of a member (47 corresponding lines) src/agentscope/embedding/_dashscope/_model.py:121 — src/agentscope/embedding/_dashscope/_model.py:121-167 | src/agentscope/embedding/_gemini/_model.py:118-171 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 46+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 46+ corresponding lines) src/agentscope/app/_router/_chat.py:157 — src/agentscope/app/_router/_chat.py:157-203 | src/agentscope/app/_router/_chat.py:221-269 | src/agentscope/app/_router/_chat.py:287-336 | src/agentscope/app/_router/_chat.py:361-406 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 46 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×1
  • Edited copy of a member (12 corresponding lines) src/agentscope/tui/_ask_user.py:196 — src/agentscope/tui/_ask_user.py:196-209 | src/agentscope/tui/_chat.py:194-205 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (37 corresponding lines) · ×1
  • Edited copy of a member (37 corresponding lines) src/agentscope/tts/_dashscope/_cosyvoice_model.py:72 — src/agentscope/tts/_dashscope/_cosyvoice_model.py:72-113 | src/agentscope/tts/_dashscope/_realtime_model.py:220-256 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×1
  • Edited copy of a member (25 corresponding lines) src/agentscope/app/_router/_schema/_hub_mcp.py:78 — src/agentscope/app/_router/_schema/_hub_mcp.py:78-102 | src/agentscope/app/_router/_schema/_hub_skill.py:53-79 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (8 members, 18+ corresponding lines) · ×1
  • Edited copies of one member (8 members, 18+ corresponding lines) src/agentscope/app/storage/_redis_storage.py:372 — src/agentscope/app/storage/_redis_storage.py:372-400 | src/agentscope/app/storage/_redis_storage.py:504-525 | src/agentscope/app/storage/_redis_storage.py:635-656 | src/agentscope/app/storage/_redis_storage.py:755-788 | src/agentscope/app/storage/_redis_storage.py:999-1031 | src/agentscope/app/storage/_redis_storage.py:1150-1169 | src/agentscope/app/storage/_redis_storage.py:1176-1195 | src/agentscope/app/storage/_redis_storage.py:1235-1252 — These 8 members are one piece of code written 8 times and then edited apart: every two of them correspond over at least 18 lines, 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 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. Left alone, the next edit has to be made 8 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 22+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 22+ corresponding lines) src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:154 — src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:154-175 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:180-209 | src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:167-197 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×1
  • Edited copy of a member (33 corresponding lines) src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:243 — src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:243-281 | src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:300-332 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 23+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 23+ corresponding lines) src/agentscope/app/storage/_redis_storage.py:728 — src/agentscope/app/storage/_redis_storage.py:728-752 | src/agentscope/app/storage/_redis_storage.py:1821-1846 | src/agentscope/app/storage/_redis_storage.py:2591-2613 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 21+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 21+ corresponding lines) src/agentscope/app/_manager/_cancel_dispatcher.py:134 — src/agentscope/app/_manager/_cancel_dispatcher.py:134-155 | src/agentscope/app/_manager/_cancel_dispatcher.py:202-230 | src/agentscope/app/_manager/_cancel_dispatcher.py:237-257 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×1
  • Edited copy of a member (22 corresponding lines) src/agentscope/app/channel/_feishu/_tools/_send_file.py:56 — src/agentscope/app/channel/_feishu/_tools/_send_file.py:56-78 | src/agentscope/app/channel/_feishu/_tools/_send_image.py:50-71 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 16+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 16+ corresponding lines) src/agentscope/app/storage/_sql/_storage.py:787 — src/agentscope/app/storage/_sql/_storage.py:787-802 | src/agentscope/app/storage/_sql/_storage.py:1465-1480 | src/agentscope/app/storage/_sql/_storage.py:1581-1605 | src/agentscope/app/storage/_sql/_storage.py:1930-1945 | src/agentscope/app/storage/_sql/_storage.py:2007-2024 | src/agentscope/app/storage/_sql/_storage.py:2211-2228 | src/agentscope/app/storage/_sql/_storage.py:2305-2320 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 16 lines, 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 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. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 14+ corresponding lines) src/agentscope/app/storage/_sql/_storage.py:859 — src/agentscope/app/storage/_sql/_storage.py:859-872 | src/agentscope/app/storage/_sql/_storage.py:935-948 | src/agentscope/app/storage/_sql/_storage.py:1080-1093 | src/agentscope/app/storage/_sql/_storage.py:1869-1882 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 13+ corresponding lines) src/agentscope/app/storage/_sql/_storage.py:887 — src/agentscope/app/storage/_sql/_storage.py:887-899 | src/agentscope/app/storage/_sql/_storage.py:967-979 | src/agentscope/app/storage/_sql/_storage.py:1737-1752 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×1
  • Edited copy of a member (16 corresponding lines) src/agentscope/app/channel/_dingtalk/_tools/_base.py:69 — src/agentscope/app/channel/_dingtalk/_tools/_base.py:69-88 | src/agentscope/app/channel/_feishu/_tools/_base.py:64-79 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 30+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 30+ corresponding lines) src/agentscope/rag/_parser/_excel.py:253 — src/agentscope/rag/_parser/_excel.py:253-284 | src/agentscope/rag/_parser/_ppt.py:168-207 | src/agentscope/rag/_parser/_word.py:363-392 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 11+ corresponding lines) src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:184 — src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:184-194 | src/agentscope/app/workspace_manager/_docker_workspace_manager.py:357-382 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:348-377 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×1
  • Edited copy of a member (3 corresponding lines) src/agentscope/rag/_vdb/_elasticsearch.py:392 — src/agentscope/rag/_vdb/_elasticsearch.py:392-394 | src/agentscope/rag/_vdb/_milvus_lite.py:272-288 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×1
  • Edited copy of a member (4 corresponding lines) src/agentscope/tui/_ask_user.py:39 — src/agentscope/tui/_ask_user.py:39-42 | src/agentscope/tui/_chat.py:70-73 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (5 corresponding lines) · ×1
  • Edited copy of a member (5 corresponding lines) src/agentscope/app/_router/_schema/_chat.py:60 — src/agentscope/app/_router/_schema/_chat.py:60-64 | src/agentscope/tool/_builtin/_ask_user.py:99-103 — These two members are one piece of code written twice and then edited apart: 5 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 · 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 (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 5 separate duplicated blocks between them, totalling at least 163 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 (39–44 lines × 4) · ×1
  • Duplicated block (39–44 lines × 4) src/agentscope/model/_dashscope/_model.py:366 — src/agentscope/model/_dashscope/_model.py:366-404 | src/agentscope/model/_deepseek/_model.py:298-341 | src/agentscope/model/_moonshot/_model.py:367-410 | src/agentscope/model/_volcengine/_model.py:335-378 — `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 10 separate duplicated blocks between them, totalling at least 213 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:366` 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 (41–42 lines × 2) · ×1
  • Duplicated block (41–42 lines × 2) src/agentscope/message/_base.py:582 — src/agentscope/message/_base.py:582-623 | src/agentscope/message/_base.py:692-732 — 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 (28–41 lines × 2) · ×1
  • Duplicated block (28–41 lines × 2) src/agentscope/embedding/_gemini/_model.py:344 — src/agentscope/embedding/_gemini/_model.py:344-371 | src/agentscope/embedding/_gemini/_model.py:434-474 — 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/_gemini/_model.py:344` 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–37 lines × 3) · ×1
  • Duplicated block (24–37 lines × 3) src/agentscope/formatter/_dashscope_formatter.py:68 — src/agentscope/formatter/_dashscope_formatter.py:68-104 | src/agentscope/formatter/_openai_formatter.py:63-95 | src/agentscope/formatter/_volcengine_formatter.py:44-67 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 329 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:63` 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 (35–36 lines × 3) · ×1
  • Duplicated block (35–36 lines × 3) src/agentscope/model/_dashscope/_model.py:476 — src/agentscope/model/_dashscope/_model.py:476-511 | src/agentscope/model/_deepseek/_model.py:370-404 | src/agentscope/model/_volcengine/_model.py:407-441 — `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 10 separate duplicated blocks between them, totalling at least 213 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:476` 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 (32–36 lines × 2) · ×1
  • Duplicated block (32–36 lines × 2) src/agentscope/formatter/_anthropic_formatter.py:334 — src/agentscope/formatter/_anthropic_formatter.py:334-369 | src/agentscope/formatter/_openai_formatter.py:242-273 — 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 (36 lines × 2) · ×1
  • Duplicated block (36 lines × 2) src/agentscope/model/_deepseek/_model.py:205 — src/agentscope/model/_deepseek/_model.py:205-240 | src/agentscope/model/_volcengine/_model.py:242-277 — `src/agentscope/model/_deepseek/_model.py` and `src/agentscope/model/_volcengine/_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 15 separate duplicated blocks between them, totalling at least 332 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 (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:148 — src/agentscope/app/message_bus/_redis_message_bus.py:148-182 | 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:223 — src/agentscope/formatter/_ollama_formatter.py:223-257 | src/agentscope/formatter/_openai_formatter.py:398-426 — 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:223` 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–34 lines × 4) · ×1
  • Duplicated block (27–34 lines × 4) src/agentscope/formatter/_dashscope_formatter.py:125 — src/agentscope/formatter/_dashscope_formatter.py:125-151 | src/agentscope/formatter/_dashscope_formatter.py:169-197 | src/agentscope/formatter/_moonshot_formatter.py:31-62 | src/agentscope/formatter/_openai_formatter.py:116-149 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 163 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:63` calls `get`, `raise_for_status`, `b64encode` and `src/agentscope/formatter/_dashscope_formatter.py:152` 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 (17–33 lines × 7) · ×1
  • Duplicated block (17–33 lines × 7) src/agentscope/formatter/_anthropic_formatter.py:445 — src/agentscope/formatter/_anthropic_formatter.py:445-461 | src/agentscope/formatter/_dashscope_formatter.py:490-522 | src/agentscope/formatter/_deepseek_formatter.py:274-290 | src/agentscope/formatter/_gemini_formatter.py:384-400 | src/agentscope/formatter/_ollama_formatter.py:412-428 | src/agentscope/formatter/_openai_formatter.py:511-527 | src/agentscope/formatter/_volcengine_formatter.py:379-395 — 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:445` 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 × 5) · ×1
  • Duplicated block (29–33 lines × 5) src/agentscope/model/_dashscope/_model.py:229 — src/agentscope/model/_dashscope/_model.py:229-257 | src/agentscope/model/_deepseek/_model.py:173-205 | src/agentscope/model/_openai_chat/_model.py:240-272 | src/agentscope/model/_openai_response/_model.py:329-361 | src/agentscope/model/_volcengine/_model.py:210-242 — `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 10 separate duplicated blocks between them, totalling at least 213 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 × 2) · ×1
  • Duplicated block (33 lines × 2) src/agentscope/formatter/_moonshot_formatter.py:207 — src/agentscope/formatter/_moonshot_formatter.py:207-239 | src/agentscope/formatter/_openai_formatter.py:366-398 — before extracting anything, compare `src/agentscope/formatter/_moonshot_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 228 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:207` 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 (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 (31 lines × 5) · ×1
  • Duplicated block (31 lines × 5) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:156 — src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:156-187 | src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:186-220 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:270-315 | src/agentscope/app/workspace_manager/_k8s_workspace_manager.py:180-210 | src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:206-249 — 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 6 separate duplicated blocks between them, totalling at least 124 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–31 lines × 3) · ×1
  • Duplicated block (30–31 lines × 3) src/agentscope/model/_deepseek/_model.py:441 — src/agentscope/model/_deepseek/_model.py:441-470 | src/agentscope/model/_moonshot/_model.py:513-543 | src/agentscope/model/_volcengine/_model.py:476-505 — `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 10 separate duplicated blocks between them, totalling at least 204 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 (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:246-273 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 8 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.
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:689-715 — 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 (26 lines × 3) · ×1
  • Duplicated block (26 lines × 3) src/agentscope/model/_deepseek/_model.py:253 — src/agentscope/model/_deepseek/_model.py:253-278 | src/agentscope/model/_moonshot/_model.py:319-344 | src/agentscope/model/_volcengine/_model.py:290-315 — `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 10 separate duplicated blocks between them, totalling at least 204 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/_deepseek/_model.py:253` 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 (24–26 lines × 2) · ×1
  • Duplicated block (24–26 lines × 2) src/agentscope/agent/_agent.py:3754 — src/agentscope/agent/_agent.py:3754-3779 | src/agentscope/agent/_agent.py:3891-3914 — 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 (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 (25 lines × 3) · ×1
  • Duplicated block (25 lines × 3) src/agentscope/formatter/_dashscope_formatter.py:394 — src/agentscope/formatter/_dashscope_formatter.py:394-418 | src/agentscope/formatter/_moonshot_formatter.py:256-280 | src/agentscope/formatter/_openai_formatter.py:408-432 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 163 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:594 — src/agentscope/formatter/_dashscope_formatter.py:594-617 | src/agentscope/formatter/_gemini_formatter.py:476-500 | src/agentscope/formatter/_openai_formatter.py:600-623 — 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 (23–25 lines × 2) · ×1
  • Duplicated block (23–25 lines × 2) src/agentscope/app/_router/_session.py:337 — src/agentscope/app/_router/_session.py:337-359 | src/agentscope/app/_router/_session.py:532-556 — 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:532` 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–25 lines × 2) · ×1
  • Duplicated block (21–25 lines × 2) src/agentscope/app/_service/_chat.py:1205 — src/agentscope/app/_service/_chat.py:1205-1229 | src/agentscope/app/_service/_realtime.py:328-348 — 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:1205` 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 (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:277-301 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 8 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.
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 (21–24 lines × 6) · ×1
  • Duplicated block (21–24 lines × 6) src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:179 — src/agentscope/app/workspace_manager/_applecontainer_workspace_manager.py:179-200 | src/agentscope/app/workspace_manager/_daytona_workspace_manager.py:212-234 | src/agentscope/app/workspace_manager/_docker_workspace_manager.py:316-339 | src/agentscope/app/workspace_manager/_e2b_workspace_manager.py:307-330 | src/agentscope/app/workspace_manager/_k8s_workspace_manager.py:202-222 | src/agentscope/app/workspace_manager/_opensandbox_workspace_manager.py:241-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 6 separate duplicated blocks between them, totalling at least 124 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:179` 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 (24 lines × 5) · ×1
  • Duplicated block (24 lines × 5) src/agentscope/model/_dashscope/_model.py:398 — src/agentscope/model/_dashscope/_model.py:398-421 | src/agentscope/model/_deepseek/_model.py:335-358 | src/agentscope/model/_moonshot/_model.py:404-427 | src/agentscope/model/_openai_chat/_model.py:484-507 | src/agentscope/model/_volcengine/_model.py:372-395 — `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 10 separate duplicated blocks between them, totalling at least 213 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:398` 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:1078 — src/agentscope/app/_service/_chat.py:1078-1101 | src/agentscope/app/_service/_realtime.py:189-206 — 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:1078` 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–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 (23 lines × 2) · ×1
  • Duplicated block (23 lines × 2) src/agentscope/model/_moonshot/_model.py:480 — src/agentscope/model/_moonshot/_model.py:480-502 | src/agentscope/model/_openai_chat/_model.py:612-634 — `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 158 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 (16–23 lines × 2) · ×1
  • Duplicated block (16–23 lines × 2) src/agentscope/tool/_adapters.py:265 — src/agentscope/tool/_adapters.py:265-287 | 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 (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 lines × 4) · ×1
  • Duplicated block (21 lines × 4) src/agentscope/formatter/_dashscope_formatter.py:519 — src/agentscope/formatter/_dashscope_formatter.py:519-539 | src/agentscope/formatter/_moonshot_formatter.py:418-438 | src/agentscope/formatter/_openai_formatter.py:524-544 | src/agentscope/formatter/_volcengine_formatter.py:392-412 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 163 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 (21 lines × 3) · ×1
  • Duplicated block (21 lines × 3) src/agentscope/model/_moonshot/_model.py:486 — src/agentscope/model/_moonshot/_model.py:486-506 | src/agentscope/model/_openai_chat/_model.py:618-638 | src/agentscope/model/_openai_response/_model.py:735-755 — `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 158 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:486` 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–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:1242-1259 — 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:752 — src/agentscope/workspace/_local_workspace.py:752-772 | src/agentscope/workspace/_sandboxed_base.py:398-418 — 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 (20 lines × 3) · ×1
  • Duplicated block (20 lines × 3) src/agentscope/formatter/_dashscope_formatter.py:332 — src/agentscope/formatter/_dashscope_formatter.py:332-351 | src/agentscope/formatter/_moonshot_formatter.py:197-216 | src/agentscope/formatter/_openai_formatter.py:356-375 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 163 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 (20 lines × 2) · ×1
  • Duplicated block (20 lines × 2) src/agentscope/app/_service/_chat.py:1450 — src/agentscope/app/_service/_chat.py:1450-1473 | src/agentscope/app/_service/_chat.py:1570-1589 — 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–20 lines × 2) · ×1
  • 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.
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:135-153 | src/agentscope/tts/_tts_model_card.py:105-120 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/agentscope/tts/_tts_model_card.py:123` 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:275-293 | src/agentscope/formatter/_openai_formatter.py:427-445 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 8 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/agentscope/formatter/_openai_formatter.py:447` 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 (19 lines × 2) · ×1
  • Duplicated block (19 lines × 2) src/agentscope/rag/_parser/_word.py:259 — src/agentscope/rag/_parser/_word.py:259-277 | src/agentscope/rag/_parser/_word.py:281-299 — 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 (15–19 lines × 2) · ×1
  • Duplicated block (15–19 lines × 2) src/agentscope/tool/_builtin/_bash.py:796 — src/agentscope/tool/_builtin/_bash.py:796-814 | src/agentscope/tool/_builtin/_powershell.py:269-283 — 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 (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) src/agentscope/model/_openai_response/_model.py:574 — src/agentscope/model/_openai_response/_model.py:574-591 | src/agentscope/model/_openai_response/_model.py:729-744 — 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 × 5) · ×1
  • Duplicated block (17 lines × 5) src/agentscope/model/_dashscope/_model.py:339 — src/agentscope/model/_dashscope/_model.py:339-355 | src/agentscope/model/_deepseek/_model.py:271-287 | src/agentscope/model/_moonshot/_model.py:337-353 | src/agentscope/model/_openai_chat/_model.py:376-392 | src/agentscope/model/_volcengine/_model.py:308-324 — `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 10 separate duplicated blocks between them, totalling at least 213 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:337` calls `_generate_id` and `src/agentscope/model/_deepseek/_model.py:269` 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 (17 lines × 4) · ×1
  • Duplicated block (17 lines × 4) src/agentscope/model/_dashscope/_model.py:503 — src/agentscope/model/_dashscope/_model.py:503-519 | src/agentscope/model/_deepseek/_model.py:396-412 | src/agentscope/model/_moonshot/_model.py:465-481 | src/agentscope/model/_volcengine/_model.py:433-449 — `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 10 separate duplicated blocks between them, totalling at least 213 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:482` calls `getattr` and `src/agentscope/model/_deepseek/_model.py:413` 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 (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 (13–17 lines × 2) · ×1
  • Duplicated block (13–17 lines × 2) src/agentscope/tool/_builtin/_backend.py:827 — src/agentscope/tool/_builtin/_backend.py:827-843 | 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 × 4) · ×1
  • Duplicated block (16 lines × 4) src/agentscope/model/_moonshot/_model.py:352 — src/agentscope/model/_moonshot/_model.py:352-367 | src/agentscope/model/_moonshot/_model.py:480-495 | src/agentscope/model/_openai_chat/_model.py:391-406 | src/agentscope/model/_openai_chat/_model.py:612-627 — `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 158 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 (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:187-202 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 8 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. 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 (13–15 lines × 4) · ×1
  • Duplicated block (13–15 lines × 4) src/agentscope/model/_dashscope/_model.py:508 — src/agentscope/model/_dashscope/_model.py:508-520 | src/agentscope/model/_moonshot/_model.py:470-482 | src/agentscope/model/_openai_chat/_model.py:600-614 | src/agentscope/model/_volcengine/_model.py:438-450 — `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 8 separate duplicated blocks between them, totalling at least 146 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:600` 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 × 4) · ×1
  • Duplicated block (15 lines × 4) src/agentscope/realtime/_dashscope/_model.py:296 — src/agentscope/realtime/_dashscope/_model.py:296-310 | src/agentscope/realtime/_gemini/_model.py:412-426 | 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 58 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 (15 lines × 3) · ×1
  • Duplicated block (15 lines × 3) src/agentscope/realtime/_openai/_model.py:301 — src/agentscope/realtime/_openai/_model.py:301-315 | src/agentscope/realtime/_openai_live/_model.py:384-398 | src/agentscope/realtime/_xai/_model.py:268-282 — `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 56 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 (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 (11–14 lines × 5) · ×1
  • Duplicated block (11–14 lines × 5) src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:87 — src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:87-97 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:113-123 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:160-170 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:219-229 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:246-259 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.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. 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 after the matched lines, `src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:231` calls `Column`, `String` and `src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:99` 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 (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:331-344 | 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 lines × 7) · ×1
  • Duplicated block (13 lines × 7) src/agentscope/formatter/_dashscope_formatter.py:513 — src/agentscope/formatter/_dashscope_formatter.py:513-525 | src/agentscope/formatter/_deepseek_formatter.py:281-293 | src/agentscope/formatter/_gemini_formatter.py:391-403 | src/agentscope/formatter/_moonshot_formatter.py:412-424 | src/agentscope/formatter/_ollama_formatter.py:419-431 | src/agentscope/formatter/_openai_formatter.py:518-530 | src/agentscope/formatter/_volcengine_formatter.py:386-398 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_deepseek_formatter.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 91 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 (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:212-223 | src/agentscope/formatter/_moonshot_formatter.py:276-288 | src/agentscope/formatter/_openai_formatter.py:371-382 | src/agentscope/formatter/_openai_formatter.py:428-440 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 8 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. 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 (9–13 lines × 5) · ×1
  • Duplicated block (9–13 lines × 5) src/agentscope/model/_dashscope/_model.py:247 — src/agentscope/model/_dashscope/_model.py:247-259 | src/agentscope/model/_deepseek/_model.py:195-207 | src/agentscope/model/_gemini/_model.py:450-458 | src/agentscope/model/_openai_chat/_model.py:262-274 | src/agentscope/model/_volcengine/_model.py:232-244 — `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 10 separate duplicated blocks between them, totalling at least 213 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 (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 (12–13 lines × 2) · ×1
  • Duplicated block (12–13 lines × 2) src/agentscope/formatter/_volcengine_formatter.py:231 — src/agentscope/formatter/_volcengine_formatter.py:231-242 | src/agentscope/formatter/_volcengine_formatter.py:298-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/_volcengine_formatter.py:231` 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 lines × 3) · ×1
  • Duplicated block (12 lines × 3) src/agentscope/embedding/_gemini/_model.py:358 — src/agentscope/embedding/_gemini/_model.py:358-369 | src/agentscope/embedding/_gemini/_model.py:461-472 | src/agentscope/embedding/_openai/_model.py:146-157 — 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 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 × 3) · ×1
  • Duplicated block (11 lines × 3) src/agentscope/formatter/_dashscope_formatter.py:301 — src/agentscope/formatter/_dashscope_formatter.py:301-311 | src/agentscope/formatter/_openai_formatter.py:329-339 | src/agentscope/formatter/_volcengine_formatter.py:177-187 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 329 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:300 — src/agentscope/model/_dashscope/_model.py:300-309 | src/agentscope/model/_deepseek/_model.py:237-246 | src/agentscope/model/_moonshot/_model.py:303-312 | src/agentscope/model/_volcengine/_model.py:274-283 — `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 10 separate duplicated blocks between them, totalling at least 213 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:728 — src/agentscope/model/_anthropic/_model.py:728-737 | src/agentscope/model/_gemini/_model.py:802-811 | src/agentscope/model/_xai/_model.py:270-279 — 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–10 lines × 3) · ×1
  • Duplicated block (9–10 lines × 3) src/agentscope/model/_deepseek/_model.py:202 — src/agentscope/model/_deepseek/_model.py:202-211 | src/agentscope/model/_volcengine/_model.py:239-248 | src/agentscope/model/_xai/_model.py:213-221 — `src/agentscope/model/_deepseek/_model.py` and `src/agentscope/model/_volcengine/_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 15 separate duplicated blocks between them, totalling at least 332 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9 lines × 8) · ×1
  • Duplicated block (9 lines × 8) src/agentscope/formatter/_anthropic_formatter.py:450 — src/agentscope/formatter/_anthropic_formatter.py:450-458 | src/agentscope/formatter/_dashscope_formatter.py:511-519 | src/agentscope/formatter/_deepseek_formatter.py:279-287 | src/agentscope/formatter/_gemini_formatter.py:389-397 | src/agentscope/formatter/_ollama_formatter.py:417-425 | src/agentscope/formatter/_openai_formatter.py:516-524 | src/agentscope/formatter/_openai_response_formatter.py:452-460 | src/agentscope/formatter/_volcengine_formatter.py:384-392 — 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 (2–7 lines × 9) · ×1
  • Duplicated block (2–7 lines × 9) src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:66 — src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:66-72 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:92-98 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:118-124 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:133-139 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:165-171 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:224-230 | src/agentscope/app/storage/_sql/_alembic/versions/0002_mcps_skills.py:31-32 | src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:39-45 | src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:46-47 — there are 9 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 9 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/0001_initial.py:66` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:140` calls `Column`, `String` and `src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:73` 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 (6–7 lines × 5) · ×1
  • Duplicated block (6–7 lines × 5) src/agentscope/formatter/_dashscope_formatter.py:144 — src/agentscope/formatter/_dashscope_formatter.py:144-149 | src/agentscope/formatter/_dashscope_formatter.py:190-195 | src/agentscope/formatter/_dashscope_formatter.py:240-245 | src/agentscope/formatter/_moonshot_formatter.py:55-60 | src/agentscope/formatter/_openai_formatter.py:141-147 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_moonshot_formatter.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 163 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:144` 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 (6 lines × 9) · ×1
  • Duplicated block (6 lines × 9) src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:37 — src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:37-42 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:73-78 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:99-104 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:141-146 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:180-185 | src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:232-237 | src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:29-34 | src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:48-53 | src/agentscope/app/storage/_sql/_alembic/versions/0005_voice_profiles.py:26-31 — there are 9 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 9 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/0001_initial.py:37` 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, `src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:34` calls `Column`, `String` and `src/agentscope/app/storage/_sql/_alembic/versions/0001_initial.py:70` 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 × 7) · ×1
  • Duplicated block (6 lines × 7) src/agentscope/model/_dashscope/_model.py:253 — src/agentscope/model/_dashscope/_model.py:253-260 | src/agentscope/model/_deepseek/_model.py:201-208 | src/agentscope/model/_gemini/_model.py:452-459 | src/agentscope/model/_moonshot/_model.py:236-243 | src/agentscope/model/_openai_chat/_model.py:268-275 | src/agentscope/model/_volcengine/_model.py:238-245 | src/agentscope/model/_xai/_model.py:212-217 — `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 10 separate duplicated blocks between them, totalling at least 213 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/_gemini/_model.py:461` calls `_is_gemini_4` and `src/agentscope/model/_deepseek/_model.py:210` 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 (5 lines × 8) · ×1
  • Duplicated block (5 lines × 8) src/agentscope/formatter/_dashscope_formatter.py:145 — src/agentscope/formatter/_dashscope_formatter.py:145-149 | src/agentscope/formatter/_dashscope_formatter.py:191-195 | src/agentscope/formatter/_dashscope_formatter.py:241-245 | src/agentscope/formatter/_gemini_formatter.py:89-94 | src/agentscope/formatter/_moonshot_formatter.py:56-60 | src/agentscope/formatter/_ollama_formatter.py:86-91 | src/agentscope/formatter/_openai_formatter.py:142-147 | src/agentscope/formatter/_openai_formatter.py:212-217 — 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:385-398 | 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:460-475 | 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 × 3) · ×1
  • Duplicated block (18 lines × 3) src/agentscope/realtime/_dashscope/_model.py:221 — src/agentscope/realtime/_dashscope/_model.py:221-238 | 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 58 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 (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 5 separate duplicated blocks between them, totalling at least 163 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 5 separate duplicated blocks between them, totalling at least 163 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 (8 lines × 4) · ×1
  • Duplicated block (8 lines × 4) 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 | src/agentscope/app/_router/_voice_profile.py:250-266 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. The `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.
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 · Edited copies of one member (3 members, 38+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 38+ corresponding lines) examples/long_term_memory/agentic_memory/main.py:116 — examples/long_term_memory/agentic_memory/main.py:116-153 | examples/long_term_memory/mem0/oss_demo.py:94-152 | examples/long_term_memory/reme/reme_demo.py:128-200 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 38 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 68+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 68+ corresponding lines) scripts/model_examples/anthropic_multiagent_multimodal.py:25 — scripts/model_examples/anthropic_multiagent_multimodal.py:25-95 | scripts/model_examples/dashscope_multiagent_multimodal.py:24-91 | scripts/model_examples/gemini_multiagent_multimodal.py:19-89 | scripts/model_examples/minimax_multiagent_multimodal.py:26-94 | scripts/model_examples/moonshot_multiagent_multimodal.py:20-87 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 68 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 33+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 33+ corresponding lines) scripts/model_examples/anthropic_multimodal.py:28 — scripts/model_examples/anthropic_multimodal.py:28-63 | scripts/model_examples/dashscope_multimodal.py:39-71 | scripts/model_examples/gemini_multimodal.py:27-62 | scripts/model_examples/moonshot_multimodal.py:26-58 | scripts/model_examples/openai_response_multimodal.py:28-60 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 33 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 24+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 24+ corresponding lines) scripts/model_examples/openai_chat_call.py:28 — scripts/model_examples/openai_chat_call.py:28-51 | scripts/model_examples/openai_response_call.py:33-56 | scripts/model_examples/xai_call.py:33-56 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 79+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 79+ corresponding lines) scripts/model_examples/anthropic_multiagent.py:19 — scripts/model_examples/anthropic_multiagent.py:19-101 | scripts/model_examples/dashscope_multiagent.py:19-97 | scripts/model_examples/deepseek_multiagent.py:19-98 | scripts/model_examples/gemini_multiagent.py:19-101 | scripts/model_examples/minimax_multiagent.py:20-104 | scripts/model_examples/moonshot_multiagent.py:19-97 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 79 lines, 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 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. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 67+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 67+ corresponding lines) scripts/model_examples/ollama_multiagent_multimodal.py:21 — scripts/model_examples/ollama_multiagent_multimodal.py:21-87 | scripts/model_examples/openai_chat_multiagent_multimodal.py:20-86 | scripts/model_examples/openai_response_multiagent_multimodal.py:20-86 | scripts/model_examples/xai_multiagent_multimodal.py:23-89 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 67 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 30+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 30+ corresponding lines) scripts/model_examples/dashscope_call.py:148 — scripts/model_examples/dashscope_call.py:148-179 | scripts/model_examples/deepseek_call.py:152-183 | scripts/model_examples/moonshot_call.py:143-174 | scripts/model_examples/ollama_call.py:151-182 | scripts/model_examples/volcengine_call.py:118-147 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 30 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 6+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 6+ corresponding lines) scripts/model_examples/openai_chat_multimodal.py:68 — scripts/model_examples/openai_chat_multimodal.py:68-73 | scripts/model_examples/openai_response_multimodal.py:64-69 | scripts/model_examples/xai_multimodal.py:66-71 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
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 (14 lines × 2) · ×1
  • 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 (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.
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 — 65 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×36
  • 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:1085 — `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:1079 — `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:2586 — `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:368 — `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/_moonshot/_model.py:359 — `getattr( details, "cached_tokens", 0, ) or 0` appears character-identically in 3 files — src/agentscope/model/_moonshot/_model.py, src/agentscope/model/_openai_chat/_model.py, src/agentscope/model/_openai_response/_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:351 — `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:434 — `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/model/_gemini/_model.py:81 — `getattr(response, "candidates", None) or []` appears character-identically in 2 files — src/agentscope/model/_gemini/_model.py, src/agentscope/tts/_gemini/_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:835 — `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:502 — `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:451 — `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:489 — `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/tts/_dashscope/_voice_cloning_client.py:143 — `not isinstance(voice_id, str) or not voice_id` appears character-identically in 2 files — src/agentscope/tts/_dashscope/_voice_cloning_client.py, src/agentscope/tts/_openai/_voice_cloning_client.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/embedding/_gemini/_model.py:98 — `not self.client.vertexai and not os.getenv( "GOOGLE_GENAI_API_VERSION", )` appears character-identically in 2 files — src/agentscope/embedding/_gemini/_model.py, src/agentscope/model/_gemini/_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/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.
  • + 11 more in this group — see findings.md.
X7 · Silent fallback defaults · Silent fallback default in catch · ×6
  • 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:952 — `_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:460 — `_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 src/agentscope/tool/_builtin/_bash_parser.py:511 — `extract_command_prefixes` 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:137 — `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.
D30 · Dependency Vulnerabilities · Low CVE · ×3
  • REDACTED
  • REDACTED
  • REDACTED
AX6 · Interface segregation · Fat interface · ×2
  • Fat interface: MessageBus (20 abstract methods) src/agentscope/app/message_bus/_base.py:55 — `MessageBus` declares 20 abstract methods: `queue_push`, `queue_drain`, `queue_delete`, `log_append`, `log_read`, `log_trim`, `publish`, `subscribe`, `acquire_lock`, `is_locked`, `try_lock`, `unlock`, `registry_set`, `registry_set_if`, `registry_pop`, `registry_del`, `registry_exists`, `registry_getall`, `registry_get`, `registry_drop`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: StorageBase (57 abstract methods) src/agentscope/app/storage/_base.py:33 — `StorageBase` declares 57 abstract methods: `upsert_credential`, `list_credentials`, `get_credential`, `delete_credential`, `upsert_mcp`, `list_mcps`, `get_mcp`, `get_mcp_by_name`, `delete_mcp`, `upsert_skill`, `list_skills`, `get_skill`, `get_skill_by_name`, `delete_skill`, `upsert_agent`, `list_agents`, `get_agent`, `delete_agent`, `upsert_session`, `set_session_team_id`, `update_session_state`, `list_sessions`, `delete_session`, `get_session`, `list_sessions_by_schedule`, `list_sessions_by_channel`, `upsert_schedule`, `get_schedule`, `list_schedules`, `delete_schedule`, `list_all_schedules`, `upsert_message`, `delete_message`, `get_message`, `list_messages`, `upsert_team`, `get_team`, `list_teams`, `delete_team`, `upsert_knowledge_base`, and 17 more. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
D16 · Bus Factor · Off-boarding risk · ×2
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 11 significant file(s) lose their only recent owner: scripts/issue_triage.py, src/agentscope/sop/_schema.py, src/agentscope/app/_tool/_team_say.py, src/agentscope/app/channel/_clients.py, REDACTED, src/agentscope/permission/_types.py, src/agentscope/app/storage/_utils.py, src/agentscope/app/_router/_schema/_agent.py (+3 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 11 significant file(s) lose their only recent owner: scripts/model_examples/openai_response_call.py, scripts/model_examples/deepseek_call.py, scripts/model_examples/xai_call.py, scripts/model_examples/openai_chat_call.py, scripts/model_examples/openai_chat_multimodal.py, scripts/model_examples/moonshot_call.py, scripts/model_examples/_utils.py, src/agentscope/middleware/_tracing/_converter.py (+3 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/realtime/_gemini/_model.py:556 — `debug` at line 556 is called with an argument built by `list(data)` (line 556), 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/middleware/_rag.py:563 — `debug` at line 563 is called with an argument built by `[ranked[i].chunk.source for i in ids]` (line 565), 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) — 3 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (25 single-owned of 386 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 386 of the 574 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)) — 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/asr/_asr_base.py, src/agentscope/app/middleware/_protocol/_base.py, src/agentscope/rag/_parser/_pdf.py.
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 REDACTED:18 — 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 14 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P3 · Security & performance tooling · No dependency-update automation · ×1
  • No dependency-update automation examples/web_ui/backend/package.json:10 — `examples/web_ui/backend/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
P4 · Deployment & Rollback · No rollback/health safety · ×1
  • No rollback/health safety REDACTED:54 — 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 REDACTED:54 — 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: 8 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/canine-gitleaks.toml --log-opts "--full-history --all --skip=0 --max-count=200" --report-format json --report-path /tmp/watchdog-gitleaks-7e6dc766d8e54a508161ae3518e00d47/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=200 --max-count=800" --report-format json --report-path /tmp/watchdog-gitleaks-7e6dc766d8e54a508161ae3518e00d47/history-1.json --exit-code 0 --source .0artifacts/raw/gitleaks-history-1.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=1000 --max-count=339" --report-format json --report-path /tmp/watchdog-gitleaks-7e6dc766d8e54a508161ae3518e00d47/history-2.json --exit-code 0 --source .0artifacts/raw/gitleaks-history-2.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-7e6dc766d8e54a508161ae3518e00d47/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/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt .36artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .34artifacts/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/** .0artifacts/raw/trivy-fs.json

Run 01a1e1cb-fdbc-76ae-9055-6fa39e07aaa3 · 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