Public report of agentscope-ai/agentscope, published 3 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.2). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 3 November 2026, 22:43 UTC · Survey ID cd_9b7f0c55888f4b0491f21ef3954bedae
agentscope-ai/agentscope
Measured 3 November 2026, 22:43 UTC, at code version 9668b4c
CAI scoreAdequate
CriticalWeakAdequateStrongExemplary
Up 2 since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 152,704 lines of product code in 1 project, tests not counted · Estimated rebuild effort: about 2.4 person-years · Weakest lens: Production Readiness, 61
Findings by how serious they are
34 critical607 serious53 minor
15 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
3 November 2026, 22:43 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.
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 ▸
60of 60 dimensions measured by tools.
676of 694 findings point to an exact file and line, so you can open each one in the code. The other 18 concern the repository as a whole, such as missing documentation.
60dimensions across 7 lenses, read from 152,704 lines of product code in 1 project.
agentscope-ai/agentscope falls short of our standard for production because we found no automated security scanning of the code, its secrets or its dependencies. It scores 67 out of 100 and is rated Adequate, and all 34 of its critical findings are security problems in the build pipeline.
Production Readiness, at 61, is the weakest lens, level with Maturity, and counts most in the score. The best first step is recording design decisions, worth about 5 points. Adding automated security scanning would lift Production Readiness itself, also worth about 5. 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. Two secrets can leak from the build pipeline. Pinning each tool to an exact version and limiting each secret to its own step would close both risks.
The product code is 152,704 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 forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
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: 34 findings
These 34 critical or serious findings were in the previous survey, on 20 October 2026, and are gone from this one.
Exception handling · Swallowed exception (caught, then discarded) src/agentscope/tool/_utils.py
Rebuild cost: about €350,000 · Estimate
Cost to rebuild
€110,000 to €580,000, for 1,912 to 6,064 hours of work, about 2.4 person-years for 1 to 5 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.9 at a score of 67. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Large: 152,704 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
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 SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €350,000 to build again, about 2.4 person-years of work. Its weakest lens is Production Readiness, at 61 (Adequate). 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
Record your significant design decisions. Of all the actions in this report, it raises the score most for the work it takes: about 5 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.9 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 3% to 6% on every change. The history of the code shows how much it changes: about 151,546 lines over the last 90 days, which is about 614,603 lines a year. At that pace, the extra work comes to an estimated 44.1 to 264.6 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.
409 modules, with 789 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; 369 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.
app.storage._model._agent uses app.storage._model._base, so a change to app.storage._model._base can break app.storage._model._agent, while a change to app.storage._model._agent can't break app.storage._model._base.
Position
Below the diagonal: app.storage._model._agent uses a module listed above it, which is the healthy direction.
app.storage._model._channel uses app.storage._model._base, so a change to app.storage._model._base can break app.storage._model._channel, while a change to app.storage._model._channel can't break app.storage._model._base.
Position
Below the diagonal: app.storage._model._channel uses a module listed above it, which is the healthy direction.
credential._dashscope uses credential._base, so a change to credential._base can break credential._dashscope, while a change to credential._dashscope can't break credential._base.
Position
Below the diagonal: credential._dashscope uses a module listed above it, which is the healthy direction.
event._event uses model._model_response, so a change to model._model_response can break event._event, while a change to event._event can't break model._model_response.
Position
Below the diagonal: event._event uses a module listed above it, which is the healthy direction.
model._base uses model._model_response, so a change to model._model_response can break model._base, while a change to model._base can't break model._model_response.
Position
Below the diagonal: model._base uses a module listed above it, which is the healthy direction.
realtime._base uses credential._base, so a change to credential._base can break realtime._base, while a change to realtime._base can't break credential._base.
Position
Below the diagonal: realtime._base uses a module listed above it, which is the healthy direction.
realtime._base uses message._block, so a change to message._block can break realtime._base, while a change to realtime._base can't break message._block.
Position
Below the diagonal: realtime._base uses a module listed above it, which is the healthy direction.
state._state uses permission._context, so a change to permission._context can break state._state, while a change to state._state can't break permission._context.
Position
Below the diagonal: state._state uses a module listed above it, which is the healthy direction.
tool._base uses permission._context, so a change to permission._context can break tool._base, while a change to tool._base can't break permission._context.
Position
Below the diagonal: tool._base uses a module listed above it, which is the healthy direction.
tool._base uses permission._decision, so a change to permission._decision can break tool._base, while a change to tool._base can't break permission._decision.
Position
Below the diagonal: tool._base uses a module listed above it, which is the healthy direction.
tool._response uses message._block, so a change to message._block can break tool._response, while a change to tool._response can't break message._block.
Position
Below the diagonal: tool._response uses a module listed above it, which is the healthy direction.
workspace._sandboxed_base uses mcp._mcp_client, so a change to mcp._mcp_client can break workspace._sandboxed_base, while a change to workspace._sandboxed_base can't break mcp._mcp_client.
Position
Below the diagonal: workspace._sandboxed_base uses a module listed above it, which is the healthy direction.
agent._agent uses model._model_response, so a change to model._model_response can break agent._agent, while a change to agent._agent can't break model._model_response.
Position
Below the diagonal: agent._agent uses a module listed above it, which is the healthy direction.
agent._agent uses permission._decision, so a change to permission._decision can break agent._agent, while a change to agent._agent can't break permission._decision.
Position
Below the diagonal: agent._agent uses a module listed above it, which is the healthy direction.
agent._realtime._agent uses message._block, so a change to message._block can break agent._realtime._agent, while a change to agent._realtime._agent can't break message._block.
Position
Below the diagonal: agent._realtime._agent uses a module listed above it, which is the healthy direction.
agent._realtime._agent uses realtime._base, so a change to realtime._base can break agent._realtime._agent, while a change to agent._realtime._agent can't break realtime._base.
Position
Below the diagonal: agent._realtime._agent uses a module listed above it, which is the healthy direction.
app._manager._background_task_manager uses permission._context, so a change to permission._context can break app._manager._background_task_manager, while a change to app._manager._background_task_manager can't break permission._context.
Position
Below the diagonal: app._manager._background_task_manager uses a module listed above it, which is the healthy direction.
app._manager._background_task_manager uses permission._decision, so a change to permission._decision can break app._manager._background_task_manager, while a change to app._manager._background_task_manager can't break permission._decision.
Position
Below the diagonal: app._manager._background_task_manager uses a module listed above it, which is the healthy direction.
app._manager._background_task_manager uses tool._base, so a change to tool._base can break app._manager._background_task_manager, while a change to app._manager._background_task_manager can't break tool._base.
Position
Below the diagonal: app._manager._background_task_manager uses a module listed above it, which is the healthy direction.
app._manager._background_task_manager uses tool._response, so a change to tool._response can break app._manager._background_task_manager, while a change to app._manager._background_task_manager can't break tool._response.
Position
Below the diagonal: app._manager._background_task_manager uses a module listed above it, which is the healthy direction.
app.channel._dingtalk._tools._base uses permission._context, so a change to permission._context can break app.channel._dingtalk._tools._base, while a change to app.channel._dingtalk._tools._base can't break permission._context.
Position
Below the diagonal: app.channel._dingtalk._tools._base uses a module listed above it, which is the healthy direction.
app.channel._dingtalk._tools._base uses permission._decision, so a change to permission._decision can break app.channel._dingtalk._tools._base, while a change to app.channel._dingtalk._tools._base can't break permission._decision.
Position
Below the diagonal: app.channel._dingtalk._tools._base uses a module listed above it, which is the healthy direction.
app.channel._dingtalk._tools._base uses tool._builtin._backend, so a change to tool._builtin._backend can break app.channel._dingtalk._tools._base, while a change to app.channel._dingtalk._tools._base can't break tool._builtin._backend.
Position
Below the diagonal: app.channel._dingtalk._tools._base uses a module listed above it, which is the healthy direction.
app.channel._dingtalk._tools._base uses tool._base, so a change to tool._base can break app.channel._dingtalk._tools._base, while a change to app.channel._dingtalk._tools._base can't break tool._base.
Position
Below the diagonal: app.channel._dingtalk._tools._base uses a module listed above it, which is the healthy direction.
app.channel._feishu._tools._base uses permission._context, so a change to permission._context can break app.channel._feishu._tools._base, while a change to app.channel._feishu._tools._base can't break permission._context.
Position
Below the diagonal: app.channel._feishu._tools._base uses a module listed above it, which is the healthy direction.
app.channel._feishu._tools._base uses permission._decision, so a change to permission._decision can break app.channel._feishu._tools._base, while a change to app.channel._feishu._tools._base can't break permission._decision.
Position
Below the diagonal: app.channel._feishu._tools._base uses a module listed above it, which is the healthy direction.
app.channel._feishu._tools._base uses tool._builtin._backend, so a change to tool._builtin._backend can break app.channel._feishu._tools._base, while a change to app.channel._feishu._tools._base can't break tool._builtin._backend.
Position
Below the diagonal: app.channel._feishu._tools._base uses a module listed above it, which is the healthy direction.
app.channel._feishu._tools._base uses tool._base, so a change to tool._base can break app.channel._feishu._tools._base, while a change to app.channel._feishu._tools._base can't break tool._base.
Position
Below the diagonal: app.channel._feishu._tools._base uses a module listed above it, which is the healthy direction.
app.storage._model._session uses app.storage._model._base, so a change to app.storage._model._base can break app.storage._model._session, while a change to app.storage._model._session can't break app.storage._model._base.
Position
Below the diagonal: app.storage._model._session uses a module listed above it, which is the healthy direction.
app.storage._model._session uses state._state, so a change to state._state can break app.storage._model._session, while a change to app.storage._model._session can't break state._state.
Position
Below the diagonal: app.storage._model._session uses a module listed above it, which is the healthy direction.
app.storage._base uses credential._base, so a change to credential._base can break app.storage._base, while a change to app.storage._base can't break credential._base.
Position
Below the diagonal: app.storage._base uses a module listed above it, which is the healthy direction.
app.storage._base uses message._base, so a change to message._base can break app.storage._base, while a change to app.storage._base can't break message._base.
Position
Below the diagonal: app.storage._base uses a module listed above it, which is the healthy direction.
app.storage._base uses app.storage._model._agent, so a change to app.storage._model._agent can break app.storage._base, while a change to app.storage._base can't break app.storage._model._agent.
Position
Below the diagonal: app.storage._base uses a module listed above it, which is the healthy direction.
app.storage._base uses app.storage._model._channel, so a change to app.storage._model._channel can break app.storage._base, while a change to app.storage._base can't break app.storage._model._channel.
Position
Below the diagonal: app.storage._base uses a module listed above it, which is the healthy direction.
app.storage._base uses state._state, so a change to state._state can break app.storage._base, while a change to app.storage._base can't break state._state.
Position
Below the diagonal: app.storage._base uses a module listed above it, which is the healthy direction.
app.storage._base uses app.storage._model._session, so a change to app.storage._model._session can break app.storage._base, while a change to app.storage._base can't break app.storage._model._session.
Position
Below the diagonal: app.storage._base uses a module listed above it, which is the healthy direction.
app._manager._scheduler._scheduler_manager uses app.message_bus._base, so a change to app.message_bus._base can break app._manager._scheduler._scheduler_manager, while a change to app._manager._scheduler._scheduler_manager can't break app.message_bus._base.
Position
Below the diagonal: app._manager._scheduler._scheduler_manager uses a module listed above it, which is the healthy direction.
app._manager._scheduler._scheduler_manager uses app.workspace_manager._base, so a change to app.workspace_manager._base can break app._manager._scheduler._scheduler_manager, while a change to app._manager._scheduler._scheduler_manager can't break app.workspace_manager._base.
Position
Below the diagonal: app._manager._scheduler._scheduler_manager uses a module listed above it, which is the healthy direction.
app._manager._scheduler._scheduler_manager uses app.storage._model._session, so a change to app.storage._model._session can break app._manager._scheduler._scheduler_manager, while a change to app._manager._scheduler._scheduler_manager can't break app.storage._model._session.
Position
Below the diagonal: app._manager._scheduler._scheduler_manager uses a module listed above it, which is the healthy direction.
app._manager._scheduler._scheduler_manager uses app.storage._base, so a change to app.storage._base can break app._manager._scheduler._scheduler_manager, while a change to app._manager._scheduler._scheduler_manager can't break app.storage._base.
Position
Below the diagonal: app._manager._scheduler._scheduler_manager uses a module listed above it, which is the healthy direction.
app._service._access uses app.storage._model._agent, so a change to app.storage._model._agent can break app._service._access, while a change to app._service._access can't break app.storage._model._agent.
Position
Below the diagonal: app._service._access uses a module listed above it, which is the healthy direction.
app._service._access uses app.storage._model._session, so a change to app.storage._model._session can break app._service._access, while a change to app._service._access can't break app.storage._model._session.
Position
Below the diagonal: app._service._access uses a module listed above it, which is the healthy direction.
app._service._access uses app.storage._base, so a change to app.storage._base can break app._service._access, while a change to app._service._access can't break app.storage._base.
Position
Below the diagonal: app._service._access uses a module listed above it, which is the healthy direction.
app._service._sop uses app.message_bus._base, so a change to app.message_bus._base can break app._service._sop, while a change to app._service._sop can't break app.message_bus._base.
Position
Below the diagonal: app._service._sop uses a module listed above it, which is the healthy direction.
app._service._sop uses app.workspace_manager._base, so a change to app.workspace_manager._base can break app._service._sop, while a change to app._service._sop can't break app.workspace_manager._base.
Position
Below the diagonal: app._service._sop uses a module listed above it, which is the healthy direction.
app._service._sop uses app.storage._base, so a change to app.storage._base can break app._service._sop, while a change to app._service._sop can't break app.storage._base.
Position
Below the diagonal: app._service._sop uses a module listed above it, which is the healthy direction.
app.storage._redis_storage uses credential._base, so a change to credential._base can break app.storage._redis_storage, while a change to app.storage._redis_storage can't break credential._base.
Position
Below the diagonal: app.storage._redis_storage uses a module listed above it, which is the healthy direction.
app.storage._redis_storage uses message._base, so a change to message._base can break app.storage._redis_storage, while a change to app.storage._redis_storage can't break message._base.
Position
Below the diagonal: app.storage._redis_storage uses a module listed above it, which is the healthy direction.
app.storage._redis_storage uses app.storage._model._agent, so a change to app.storage._model._agent can break app.storage._redis_storage, while a change to app.storage._redis_storage can't break app.storage._model._agent.
Position
Below the diagonal: app.storage._redis_storage uses a module listed above it, which is the healthy direction.
app.storage._redis_storage uses app.storage._model._channel, so a change to app.storage._model._channel can break app.storage._redis_storage, while a change to app.storage._redis_storage can't break app.storage._model._channel.
Position
Below the diagonal: app.storage._redis_storage uses a module listed above it, which is the healthy direction.
app.storage._redis_storage uses state._state, so a change to state._state can break app.storage._redis_storage, while a change to app.storage._redis_storage can't break state._state.
Position
Below the diagonal: app.storage._redis_storage uses a module listed above it, which is the healthy direction.
app.storage._redis_storage uses app.storage._model._session, so a change to app.storage._model._session can break app.storage._redis_storage, while a change to app.storage._redis_storage can't break app.storage._model._session.
Position
Below the diagonal: app.storage._redis_storage uses a module listed above it, which is the healthy direction.
app.storage._redis_storage uses app.storage._base, so a change to app.storage._base can break app.storage._redis_storage, while a change to app.storage._redis_storage can't break app.storage._base.
Position
Below the diagonal: app.storage._redis_storage uses a module listed above it, which is the healthy direction.
app.storage._sql._storage uses credential._base, so a change to credential._base can break app.storage._sql._storage, while a change to app.storage._sql._storage can't break credential._base.
Position
Below the diagonal: app.storage._sql._storage uses a module listed above it, which is the healthy direction.
app.storage._sql._storage uses message._base, so a change to message._base can break app.storage._sql._storage, while a change to app.storage._sql._storage can't break message._base.
Position
Below the diagonal: app.storage._sql._storage uses a module listed above it, which is the healthy direction.
app.storage._sql._storage uses app.storage._model._agent, so a change to app.storage._model._agent can break app.storage._sql._storage, while a change to app.storage._sql._storage can't break app.storage._model._agent.
Position
Below the diagonal: app.storage._sql._storage uses a module listed above it, which is the healthy direction.
app.storage._sql._storage uses app.storage._model._channel, so a change to app.storage._model._channel can break app.storage._sql._storage, while a change to app.storage._sql._storage can't break app.storage._model._channel.
Position
Below the diagonal: app.storage._sql._storage uses a module listed above it, which is the healthy direction.
app.storage._sql._storage uses state._state, so a change to state._state can break app.storage._sql._storage, while a change to app.storage._sql._storage can't break state._state.
Position
Below the diagonal: app.storage._sql._storage uses a module listed above it, which is the healthy direction.
app.storage._sql._storage uses app.storage._model._session, so a change to app.storage._model._session can break app.storage._sql._storage, while a change to app.storage._sql._storage can't break app.storage._model._session.
Position
Below the diagonal: app.storage._sql._storage uses a module listed above it, which is the healthy direction.
app.storage._sql._storage uses app.storage._base, so a change to app.storage._base can break app.storage._sql._storage, while a change to app.storage._sql._storage can't break app.storage._base.
Position
Below the diagonal: app.storage._sql._storage uses a module listed above it, which is the healthy direction.
app._service uses app.message_bus._base, so a change to app.message_bus._base can break app._service, while a change to app._service can't break app.message_bus._base.
Position
Below the diagonal: app._service uses a module listed above it, which is the healthy direction.
app._service uses app.workspace_manager._base, so a change to app.workspace_manager._base can break app._service, while a change to app._service can't break app.workspace_manager._base.
Position
Below the diagonal: app._service uses a module listed above it, which is the healthy direction.
app._service uses credential._base, so a change to credential._base can break app._service, while a change to app._service can't break credential._base.
Position
Below the diagonal: app._service uses a module listed above it, which is the healthy direction.
app._service uses app.storage._model._agent, so a change to app.storage._model._agent can break app._service, while a change to app._service can't break app.storage._model._agent.
Position
Below the diagonal: app._service uses a module listed above it, which is the healthy direction.
app._service uses app._manager._background_task_manager, so a change to app._manager._background_task_manager can break app._service, while a change to app._service can't break app._manager._background_task_manager.
Position
Below the diagonal: app._service uses a module listed above it, which is the healthy direction.
app._service uses app.storage._model._session, so a change to app.storage._model._session can break app._service, while a change to app._service can't break app.storage._model._session.
Position
Below the diagonal: app._service uses a module listed above it, which is the healthy direction.
app._service uses app.storage._base, so a change to app.storage._base can break app._service, while a change to app._service can't break app.storage._base.
Position
Below the diagonal: app._service uses a module listed above it, which is the healthy direction.
app._service uses app._manager._scheduler._scheduler_manager, so a change to app._manager._scheduler._scheduler_manager can break app._service, while a change to app._service can't break app._manager._scheduler._scheduler_manager.
Position
Below the diagonal: app._service uses a module listed above it, which is the healthy direction.
app._service uses app._service._access, so a change to app._service._access can break app._service, while a change to app._service can't break app._service._access.
Position
Below the diagonal: app._service uses a module listed above it, which is the healthy direction.
app._service._chat uses app.message_bus._base, so a change to app.message_bus._base can break app._service._chat, while a change to app._service._chat can't break app.message_bus._base.
Position
Below the diagonal: app._service._chat uses a module listed above it, which is the healthy direction.
app._service._chat uses app.workspace_manager._base, so a change to app.workspace_manager._base can break app._service._chat, while a change to app._service._chat can't break app.workspace_manager._base.
Position
Below the diagonal: app._service._chat uses a module listed above it, which is the healthy direction.
app._service._chat uses message._base, so a change to message._base can break app._service._chat, while a change to app._service._chat can't break message._base.
Position
Below the diagonal: app._service._chat uses a module listed above it, which is the healthy direction.
app._service._chat uses app.storage._model._agent, so a change to app.storage._model._agent can break app._service._chat, while a change to app._service._chat can't break app.storage._model._agent.
Position
Below the diagonal: app._service._chat uses a module listed above it, which is the healthy direction.
app._service._chat uses model._base, so a change to model._base can break app._service._chat, while a change to app._service._chat can't break model._base.
Position
Below the diagonal: app._service._chat uses a module listed above it, which is the healthy direction.
app._service._chat uses agent._agent, so a change to agent._agent can break app._service._chat, while a change to app._service._chat can't break agent._agent.
Position
Below the diagonal: app._service._chat uses a module listed above it, which is the healthy direction.
app._service._chat uses app._manager._background_task_manager, so a change to app._manager._background_task_manager can break app._service._chat, while a change to app._service._chat can't break app._manager._background_task_manager.
Position
Below the diagonal: app._service._chat uses a module listed above it, which is the healthy direction.
app._service._chat uses app.storage._model._session, so a change to app.storage._model._session can break app._service._chat, while a change to app._service._chat can't break app.storage._model._session.
Position
Below the diagonal: app._service._chat uses a module listed above it, which is the healthy direction.
app._service._chat uses app.storage._base, so a change to app.storage._base can break app._service._chat, while a change to app._service._chat can't break app.storage._base.
Position
Below the diagonal: app._service._chat uses a module listed above it, which is the healthy direction.
app._service._chat uses app._manager._scheduler._scheduler_manager, so a change to app._manager._scheduler._scheduler_manager can break app._service._chat, while a change to app._service._chat can't break app._manager._scheduler._scheduler_manager.
Position
Below the diagonal: app._service._chat uses a module listed above it, which is the healthy direction.
app._service._chat uses app._service._access, so a change to app._service._access can break app._service._chat, while a change to app._service._chat can't break app._service._access.
Position
Below the diagonal: app._service._chat uses a module listed above it, which is the healthy direction.
app._service._realtime uses app.message_bus._base, so a change to app.message_bus._base can break app._service._realtime, while a change to app._service._realtime can't break app.message_bus._base.
Position
Below the diagonal: app._service._realtime uses a module listed above it, which is the healthy direction.
app._service._realtime uses app.workspace_manager._base, so a change to app.workspace_manager._base can break app._service._realtime, while a change to app._service._realtime can't break app.workspace_manager._base.
Position
Below the diagonal: app._service._realtime uses a module listed above it, which is the healthy direction.
app._service._realtime uses realtime._base, so a change to realtime._base can break app._service._realtime, while a change to app._service._realtime can't break realtime._base.
Position
Below the diagonal: app._service._realtime uses a module listed above it, which is the healthy direction.
app._service._realtime uses agent._realtime._agent, so a change to agent._realtime._agent can break app._service._realtime, while a change to app._service._realtime can't break agent._realtime._agent.
Position
Below the diagonal: app._service._realtime uses a module listed above it, which is the healthy direction.
app._service._realtime uses app._manager._background_task_manager, so a change to app._manager._background_task_manager can break app._service._realtime, while a change to app._service._realtime can't break app._manager._background_task_manager.
Position
Below the diagonal: app._service._realtime uses a module listed above it, which is the healthy direction.
app._service._realtime uses app.storage._model._session, so a change to app.storage._model._session can break app._service._realtime, while a change to app._service._realtime can't break app.storage._model._session.
Position
Below the diagonal: app._service._realtime uses a module listed above it, which is the healthy direction.
app._service._realtime uses app.storage._base, so a change to app.storage._base can break app._service._realtime, while a change to app._service._realtime can't break app.storage._base.
Position
Below the diagonal: app._service._realtime uses a module listed above it, which is the healthy direction.
app._service._realtime uses app._manager._scheduler._scheduler_manager, so a change to app._manager._scheduler._scheduler_manager can break app._service._realtime, while a change to app._service._realtime can't break app._manager._scheduler._scheduler_manager.
Position
Below the diagonal: app._service._realtime uses a module listed above it, which is the healthy direction.
app._service._realtime uses app._service._access, so a change to app._service._access can break app._service._realtime, while a change to app._service._realtime can't break app._service._access.
Position
Below the diagonal: app._service._realtime uses a module listed above it, which is the healthy direction.
app uses app.workspace_manager._base, so a change to app.workspace_manager._base can break app, while a change to app can't break app.workspace_manager._base.
Position
Below the diagonal: app uses a module listed above it, which is the healthy direction.
app uses app._manager._background_task_manager, so a change to app._manager._background_task_manager can break app, while a change to app can't break app._manager._background_task_manager.
Position
Below the diagonal: app uses a module listed above it, which is the healthy direction.
app uses app._manager._scheduler._scheduler_manager, so a change to app._manager._scheduler._scheduler_manager can break app, while a change to app can't break app._manager._scheduler._scheduler_manager.
Position
Below the diagonal: app uses a module listed above it, which is the healthy direction.
app._router uses app.channel._base, so a change to app.channel._base can break app._router, while a change to app._router can't break app.channel._base.
Position
Below the diagonal: app._router uses a module listed above it, which is the healthy direction.
app._router uses app.message_bus._base, so a change to app.message_bus._base can break app._router, while a change to app._router can't break app.message_bus._base.
Position
Below the diagonal: app._router uses a module listed above it, which is the healthy direction.
app._router uses app.workspace_manager._base, so a change to app.workspace_manager._base can break app._router, while a change to app._router can't break app.workspace_manager._base.
Position
Below the diagonal: app._router uses a module listed above it, which is the healthy direction.
app._router uses app.storage._model._channel, so a change to app.storage._model._channel can break app._router, while a change to app._router can't break app.storage._model._channel.
Position
Below the diagonal: app._router uses a module listed above it, which is the healthy direction.
app._router uses app.storage._model._session, so a change to app.storage._model._session can break app._router, while a change to app._router can't break app.storage._model._session.
Position
Below the diagonal: app._router uses a module listed above it, which is the healthy direction.
app._router uses app.storage._base, so a change to app.storage._base can break app._router, while a change to app._router can't break app.storage._base.
Position
Below the diagonal: app._router uses a module listed above it, which is the healthy direction.
app._router uses app._manager._scheduler._scheduler_manager, so a change to app._manager._scheduler._scheduler_manager can break app._router, while a change to app._router can't break app._manager._scheduler._scheduler_manager.
Position
Below the diagonal: app._router uses a module listed above it, which is the healthy direction.
app._router uses app._service._access, so a change to app._service._access can break app._router, while a change to app._router can't break app._service._access.
Position
Below the diagonal: app._router uses a module listed above it, which is the healthy direction.
app._router uses app._service._sop, so a change to app._service._sop can break app._router, while a change to app._router can't break app._service._sop.
Position
Below the diagonal: app._router uses a module listed above it, which is the healthy direction.
app._router uses app._service._chat, so a change to app._service._chat can break app._router, while a change to app._router can't break app._service._chat.
Position
Below the diagonal: app._router uses a module listed above it, which is the healthy direction.
app._router uses app._service._realtime, so a change to app._service._realtime can break app._router, while a change to app._router can't break app._service._realtime.
Position
Below the diagonal: app._router uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 73% · Adequate · gated by D2 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
36
High / Critical
A03:2025 — Software Supply Chain Failures
13
Medium
A02:2025 — Security Misconfiguration
8
Medium
Roadmap
Top priorities: 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 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; Add readiness/liveness probes and a rolling-update (or blue/green) strategy so a bad release is caught and rolled back automatically.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
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 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.
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 34
A definite problem that already costs you something and drags the score down: a
missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here
tends to cause failures elsewhere.
Serious — 607
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 — 53
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 15
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
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 60 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 — 60 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 676 of 694 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT READ here — but this repository measures it: a coverage step in CI (`coverage run`) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.py), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored. To have the real number read, produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
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 deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
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 — 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. Project size and spread are measured over build units whose source a code model reads. This repository's .tsx source is a material share of its production lines and was read by none, so the score is a verdict about the units that were read. Not a finding that the unread source is cohesive — it is unmeasured.
D27 Navigability — 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 1032 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.
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; 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.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby or Scala was found, and this repository's Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
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 and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala or Kotlin was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X18 Disposal-pattern correctness — not measured this run — 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 and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala or PHP was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X29 Per-element action decided by a fixed element — not measured this run — 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 and Rust source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP log through no library that carries a message's values as fields (pino, winston, bunyan, tslog, LogTape, roarr; Python's logging, structlog; PHP's PSR-3 loggers), so its log calls cannot be judged, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X5 Nullable reference types — not measured this run — 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, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
Repo exclusion declarations: 34 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.
Limitations & what we did not check
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.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D11 Test Reliability: Flakiness is inferred from history/markers — 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.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
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.
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.
83 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.
+ 78 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
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.9 to about 6.4/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 163 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 5 bodies over 120 down to 120 or less in Cognitive Complexity — start with ChatService._run_impl (cognitive 161), _AnthropicFormatterBase._format_messages (cognitive 145), XAIChatFormatter.format (cognitive 140). — 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 5 together lifts Cognitive Complexity from 2.3 to about 3.0/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes9.4 / 10Stronggated by 24 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.
Resolve the 16 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 (16 warning-level).
Resolve the 8 TooManyMethods finding(s) in God Classes — start with _base.py (2), _agent.py (2), _channel.py (2). — One of this dimension's main actionable groups (8 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
180 duplicated block group(s) detected. A further 10 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 20 of the 190 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 (15% of production source) was not exposed to THIS dimension's token comparison and is not in this count; duplication there is measured by R10 Code Duplication, the frontend lens's card running the same clone algorithm over the JS/TS token stream.
+ 131 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
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).
Resolve the 5 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 (5 warning-level).
Resolve the 5 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with 0004_sops.py, _xai_formatter.py, _model.py. — One of this dimension's main actionable groups (5 warning-level).
Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 3 Low cohesion finding(s) in Cohesion (LCOM4) — start with _backend.py, _chat.py, _in_memory_message_bus.py. — One of this dimension's main actionable groups (3 warning-level).
Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D9 · Test Distribution9.9 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
3442 test methods: 3428 unit, 0 integration, 0 BDD, 14 e2e. The Python suite contributes 3442 test function(s) across 214 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
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.
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.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 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.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Top hotspots: src/agentscope/app/_service/_chat.py (20×88=1760); src/agentscope/agent/_agent.py (23×41=943); examples/web_ui/frontend/src/components/chat/TextInput.tsx (6×112=672) Repeated repair below the complexity floor: src/agentscope/workspace/_base.py (8 of 11 changes were fixes); src/agentscope/_utils/_common.py (7 of 7 changes were fixes); src/agentscope/embedding/_dashscope/_model.py (7 of 7 changes were fixes)
Resolve the 42 Hotspot finding(s) in Churn × Complexity Hotspots — start with _model.py (6), _agent.py (2), _chat.py. — One of this dimension's main actionable groups (42 warning-level).
Resolve the 23 Repeated repair finding(s) in Churn × Complexity Hotspots — start with _base.py (2), _model.py (2), _common.py. — One of this dimension's main actionable groups (23 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor8.9 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
42 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is src/agentscope/app/_service/_workspace.py. Counted over 373 of the 565 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Off-boarding risk: anonymized user #1 · ×2
Further sole-owners (lower concentration)
What to do
Resolve the 2 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (2 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
10 deducted task-comment markers across 152704 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
Resolve the 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).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
1 of 1 build units (Python) flagged as possibly oversized/incoherent. This repository's .tsx source was read by no build unit, so this covers part of the tree, not all of it.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.
Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
78 % 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.
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.
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).
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 1 file(s) — `src/agentscope/realtime/_dashscope/_audio_model.py` — so no absence of findings in them is evidence of anything, and nothing in them was analysed. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 1 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
What to do
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).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
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.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
Resolve the 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.
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.
1 of 373 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is src/agentscope/workspace/_k8s/_k8s_backend.py. Counted over 373 of the 565 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
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.
+ 3 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
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).
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).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 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.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.
Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.
Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain aggregate fused to a persistence ORM (Django/SQLAlchemy) on its own declaration (active-record) couples the domain to infrastructure. The clean-architecture dependency rule.
Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.
Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
Add a README to the 2 of 3 project(s) that lack one — worth up to 1.3 pts.
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.
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.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
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 46863 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.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
Deployment automation exists but no readiness/liveness probes, rolling-update strategy, lifecycle hooks or migration job were evidenced — a bad release is harder to detect and reverse.
Deployment is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever reaches the release trigger goes to production unreviewed, so a mistaken merge or tag is live before anyone can stop it.
What to do
Add readiness/liveness probes and a rolling-update (or blue/green) strategy so a bad release is caught and rolled back automatically.
Add an approval/environment gate (required reviewers / protection rules) before production promotion.
Do you agree with this assessment?
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.
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.
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.
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.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception. (×3) — src/agentscope/middleware/_longterm_memory/_mem0/_middleware.py:741, src/agentscope/app/middleware/_tool_offload_middleware.py:356, src/agentscope/app/_manager/_background_task_manager.py:321
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.
Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.
Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document3.5 / 10Weak✓ Tool-verified
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.
`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.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back. Also whether a `finally` that gives the primitive back unconditionally can run in a state where the method does not hold it: after a timed wait whose result was discarded, after an acquire inside the `try` that can fail, after the body already released it, or never, because a `return` left between the acquire and the `try`.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
`debug` at line 420 is called with an argument built by `list(data)` (line 420), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — src/agentscope/realtime/_gemini/_model.py:420
`debug` at line 526 is called with an argument built by `[ranked[i].chunk.source for i in ids]` (line 528), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — src/agentscope/middleware/_rag.py:526
What to do
In Python, put the construction behind the logger's own check (`if logger.isEnabledFor(logging.DEBUG):`), or pass the collection itself with a `%s` placeholder (`logger.debug("Items %s", items)`) so the logging module renders it only when the record is emitted. The placeholder alone is not the fix when the argument is still built first: it defers the formatting, not a `json.dumps`, a `join` or a comprehension in the argument, and an f-string defers nothing at all.
Do you agree with this assessment?
X24 · Document value interpolated into markup 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.
Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.
Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.
Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
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:665
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)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
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.
Unscored — 3 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 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 — 57 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — docker build failed (exit 1) — #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; 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 — ~130594 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 is measured on C# and TypeScript only; JavaScript, Python, html not measured.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Aggregate roots were found in only one source directory (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
D32 Data Compliance (PII/GDPR) — 1 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D5 Coupling — Not applicable — this Python build ships 1 production module(s), so there is no coupling BETWEEN modules to measure. (Its test and non-production modules are not part of the shipped graph.)
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage not included — suite not readable by the collector
ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for a pytest-benchmark or pytest-codspeed dependency with tests taking the `benchmark` fixture, an asv.conf.json with its `time_`/`mem_`/`peakmem_` benchmarks, or a pyperf Runner, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
PF2 Allocation hygiene — Not applicable: Python runs on a garbage-collected runtime that gives a program no allocation-control idiom to choose on a hot path — no pools, stack allocation or value types — so allocation awareness is not something this code can be rated on.
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X16 Unfloored truncation loop — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X18 Disposal-pattern correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X2 Cancellation propagation — no C# was loaded; this repository's Python was read, and no request in it can be cancelled by a caller — a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X29 Per-element action decided by a fixed element — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
Hotspot: src/agentscope/app/_service/_chat.py src/agentscope/app/_service/_chat.py:895— src/agentscope/app/_service/_chat.py changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 88 in ChatService._run_impl at line 895. 5 of those changes were fix/bug commits, and the other 15 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +08:00' --full-history --no-merges -- src/agentscope/app/_service/_chat.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/agentscope/agent/_agent.py src/agentscope/agent/_agent.py:1046— src/agentscope/agent/_agent.py changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in Agent._reply_impl at line 1046. 14 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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:160— examples/web_ui/frontend/src/components/chat/TextInput.tsx changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 112 in TextInput.TextInput at line 160. 1 of those changes was a fix/bug commit, and the other 5 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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: 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 9 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 8 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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: examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx:181— examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 79 in ChatViewport.ChatViewport at line 181. 1 of those changes was a fix/bug commit, and the other 7 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +08:00' --full-history --no-merges -- examples/web_ui/frontend/src/pages/chat/ChatViewport.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/agentscope/message/_base.py src/agentscope/message/_base.py: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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +08:00' --full-history --no-merges -- src/agentscope/message/_base.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/agentscope/tool/_builtin/_bash_parser.py src/agentscope/tool/_builtin/_bash_parser.py: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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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:157— src/agentscope/formatter/_gemini_formatter.py changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in GeminiChatFormatter.format at line 157. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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:436— src/agentscope/model/_anthropic/_model.py changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in AnthropicChatModel._parse_anthropic_stream_completion_response at line 436. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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: examples/web_ui/frontend/src/hooks/useMessages.ts examples/web_ui/frontend/src/hooks/useMessages.ts:223— 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 40 in useMessages.useMessages.processEvent at line 223. 2 of those changes were fix/bug commits, 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/_xai_formatter.py src/agentscope/formatter/_xai_formatter.py:128— src/agentscope/formatter/_xai_formatter.py changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in XAIChatFormatter.format at line 128. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +08:00' --full-history --no-merges -- src/agentscope/formatter/_xai_formatter.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/agentscope/formatter/_moonshot_formatter.py src/agentscope/formatter/_moonshot_formatter.py:126— src/agentscope/formatter/_moonshot_formatter.py changed 7 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/model/_openai_response/_model.py src/agentscope/model/_openai_response/_model.py:260— src/agentscope/model/_openai_response/_model.py changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in OpenAIResponseModel._parse_stream_response at line 260. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/app/_app.py src/agentscope/app/_app.py:115— src/agentscope/app/_app.py changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in _app.create_app at line 115. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/agent/_realtime/_agent.py src/agentscope/agent/_realtime/_agent.py:693— src/agentscope/agent/_realtime/_agent.py changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in RealtimeAgent._on_model_event at line 693. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +08:00' --full-history --no-merges -- src/agentscope/agent/_realtime/_agent.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/agentscope/formatter/_openai_formatter.py src/agentscope/formatter/_openai_formatter.py:304— src/agentscope/formatter/_openai_formatter.py changed 7 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +08:00' --full-history --no-merges -- src/agentscope/rag/_parser/_word.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: examples/web_ui/frontend/src/pages/chat/index.tsx examples/web_ui/frontend/src/pages/chat/index.tsx:92— examples/web_ui/frontend/src/pages/chat/index.tsx changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in index.ChatPageInner at line 92. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +08:00' --full-history --no-merges -- examples/web_ui/frontend/src/pages/chat/index.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: examples/web_ui/frontend/src/components/chat/ChatContent.tsx examples/web_ui/frontend/src/components/chat/ChatContent.tsx:143— 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 26 in ChatContent.ChatContentComponent at line 143. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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_response_formatter.py src/agentscope/formatter/_openai_response_formatter.py:187— src/agentscope/formatter/_openai_response_formatter.py changed 6 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +08:00' --full-history --no-merges -- src/agentscope/pipeline/_goal_pipeline.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/agentscope/model/_gemini/_model.py src/agentscope/model/_gemini/_model.py:33— src/agentscope/model/_gemini/_model.py changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in _model._sanitize_schema_for_gemini at line 33. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/realtime/_dashscope/_model.py src/agentscope/realtime/_dashscope/_model.py:348— src/agentscope/realtime/_dashscope/_model.py changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in DashScopeRealtimeModel._parse at line 348. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +08:00' --full-history --no-merges -- src/agentscope/realtime/_dashscope/_model.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/agentscope/app/_manager/_scheduler/_scheduler_manager.py src/agentscope/app/_manager/_scheduler/_scheduler_manager.py:336— src/agentscope/app/_manager/_scheduler/_scheduler_manager.py changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in SchedulerManager.validate_schedule at line 336. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +08:00' --full-history --no-merges -- src/agentscope/app/_manager/_scheduler/_scheduler_manager.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/agentscope/model/_moonshot/_model.py src/agentscope/model/_moonshot/_model.py:290— src/agentscope/model/_moonshot/_model.py changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in MoonshotChatModel._parse_stream_response at line 290. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +08:00' --full-history --no-merges -- src/agentscope/model/_moonshot/_model.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src/agentscope/workspace/_base.py src/agentscope/workspace/_base.py:848— src/agentscope/workspace/_base.py changed 11 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is WorkspaceBase._enforce_mcp_capacity at line 848), 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): 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)”; “fix(workspace): append nothing when offloading an empty context batch (#3254)”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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:95— src/agentscope/_utils/_common.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 13 (its worst body is _common._json_loads_with_repair at line 95), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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)”; “fix(tool): run a no-argument tool call on an empty argument payload (#3095)”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/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), 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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), 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/mcp/_mcp_client.py src/agentscope/mcp/_mcp_client.py:152— src/agentscope/mcp/_mcp_client.py changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is MCPClient.model_post_init at line 152), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mcp): support mcp 2.x Python SDK, unpin mcp<2.0.0 (#2216)”; “fix(mcp): build the owned streamable-HTTP client through the SDK factory (#3010)”; “fix(mcp): clean up cancelled MCP connections (#2499)”; “fix(mcp): detect SSE transport by URL path so query strings work (#2311)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/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), 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/state/_state.py src/agentscope/state/_state.py:90— src/agentscope/state/_state.py changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is ToolContext.cache_file at line 90), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(state): skip oversized read-cache entries (#2534)”; “fix(tool): make read cache backend-aware so Read->Edit works in workspaces (#2092)”; “fix(state): preserve LRU cache under concurrent hits (#2457)”; “fix(state): refresh read file cache recency on access (#1811)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/middleware/_longterm_memory/_agentic_memory/_middleware.py src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:570— src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.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 AgenticMemoryMiddleware.on_reply at line 570), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(memory): 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)”; “fix(memory): deduplicate selected files before limiting retrieval (#2776)”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/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), 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/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), 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/rag/_knowledge.py src/agentscope/rag/_knowledge.py:197— src/agentscope/rag/_knowledge.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 KnowledgeBase.search at line 197), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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)”; “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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/_utils.py src/agentscope/tool/_utils.py:127— src/agentscope/tool/_utils.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 13 (its worst body is _utils._remove_title_field at line 127), 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 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)”; “fix(tool): resolve PEP 563 lazy annotations when extracting tool schemas (#2371)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/workspace/_local_workspace.py src/agentscope/workspace/_local_workspace.py:164— src/agentscope/workspace/_local_workspace.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 12 (its worst body is LocalWorkspace.initialize at line 164), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(workspace): read SKILL.md as utf-8-sig in every skill path (#3177)”; “fix(workspace): resolve case-insensitive skill directory collisions (#3075)”; “fix(workspace): return the registered client from add_mcp (#2781)”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/rag/_vdb/_mongodb.py src/agentscope/rag/_vdb/_mongodb.py:208— src/agentscope/rag/_vdb/_mongodb.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is MongoDBStore._wait_for_index_ready at line 208), 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): preserve literal metadata values in MongoDB listings (#3591)”; “fix(rag): enforce knowledge base scope during document deletion (#3222)”; “fix(rag): bound MongoDB search candidates (#3316)”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +08:00' --full-history --no-merges -- src/agentscope/rag/_vdb/_mongodb.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/_budget.py src/agentscope/middleware/_budget.py:191— src/agentscope/middleware/_budget.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is ReplyBudgetControlMiddleware.on_reasoning at line 191), 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): retire the budget hint at a new reply boundary (#3599)”; “fix(middleware): don't block structured output when the budget is spent (#3027)”; “fix(middleware): prevent KeyError in budget middleware when ReplyEndEvent is swallowed (#2419)”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +08:00' --full-history --no-merges -- src/agentscope/middleware/_budget.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:404— src/agentscope/rag/_vdb/_milvus_lite.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is MilvusLiteStore._query_all_rows at line 404), 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 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/tool/_base.py src/agentscope/tool/_base.py:403— src/agentscope/tool/_base.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is ToolBase._path_in_allowed_working_path at line 403), 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): 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/embedding/_gemini/_model.py src/agentscope/embedding/_gemini/_model.py:211— src/agentscope/embedding/_gemini/_model.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is GeminiEmbeddingModel._split_multimodal_batches at line 211), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/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 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is DockerWorkspaceManager._workdir_for at line 150), 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(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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/rag/_vdb/_qdrant.py src/agentscope/rag/_vdb/_qdrant.py:399— src/agentscope/rag/_vdb/_qdrant.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is QdrantStore.list_chunks at line 399), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(rag): enforce knowledge base scope during document deletion (#3222)”; “fix(rag): support float metadata filters in Qdrant (#2783)”; “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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/tool/_builtin/_bash.py src/agentscope/tool/_builtin/_bash.py:204— src/agentscope/tool/_builtin/_bash.py changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is Bash.check_permissions at line 204), 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): 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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/app/_manager/_scheduler/_tools/_schedule_create.py src/agentscope/app/_manager/_scheduler/_tools/_schedule_create.py:164— src/agentscope/app/_manager/_scheduler/_tools/_schedule_create.py changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is ScheduleCreate.__call__ at line 164), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(app): anchor a schedule's default start time to an absolute instant (#3101)”; “fix(scheduler): validate cron before persistence (#2442)”; “fix(scheduler): let one node own the timers (#2477)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +08:00' --full-history --no-merges -- src/agentscope/app/_manager/_scheduler/_tools/_schedule_create.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src/agentscope/tool/_builtin/_backend.py src/agentscope/tool/_builtin/_backend.py:603— src/agentscope/tool/_builtin/_backend.py changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is BackendBase._find_entries at line 603), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(tool): unlink local symbolic links without following targets (#3006)”; “fix(tool): clarify Windows asyncio subprocess error in LocalBackend (#2837)”; “fix(tool): pick the shell by the backend OS instead of the host OS in Bash (#2366)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 18:13:37 +08:00' --until='2026-11-03 18:13:37 +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.
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:362— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:632— 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:386— 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:419— 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.
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:665— `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:778— `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:948— `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:997— `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.
FileTooLong: agent/_agent.py src/agentscope/agent/_agent.py— FileTooLong — 2359 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1859 over it, 4.72× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: storage/_redis_storage.py src/agentscope/app/storage/_redis_storage.py— FileTooLong — 1636 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1136 over it, 3.27× 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 — 1049 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 549 over it, 2.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: _realtime/_agent.py src/agentscope/agent/_realtime/_agent.py— FileTooLong — 934 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 434 over it, 1.87× 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 — 816 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 316 over it, 1.63× 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 — 684 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 184 over it, 1.37× 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 — 678 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 178 over it, 1.36× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: _agentic_memory/_middleware.py src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py— FileTooLong — 610 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 110 over it, 1.22× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: 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: _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: workspace/_local_workspace.py src/agentscope/workspace/_local_workspace.py— FileTooLong — 542 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 42 over it, 1.08× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: middleware/_rag.py src/agentscope/middleware/_rag.py— FileTooLong — 527 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 27 over it, 1.05× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: _router/_session.py src/agentscope/app/_router/_session.py— FileTooLong — 520 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 20 over it, 1.04× 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.
TodoComment src/agentscope/workspace/_base.py:1227— # 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:901— # TODO: one message should embed into one vector; the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment src/agentscope/middleware/_tracing/_extractor.py:144— # TODO: Currently only supports "function" type tools. If other tool — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment src/agentscope/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:2518— # 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:418— # TODO: remove this line after PR #1564 is merged, where the ChatModel
TodoComment src/agentscope/agent/_realtime/_agent.py:249— # 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.
TooManyMethods: RedisStorage src/agentscope/app/storage/_redis_storage.py:57— TooManyMethods — 88 methods. The bar is 30 methods; this is 58 over it, 2.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MessageBus src/agentscope/app/message_bus/_base.py:55— TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: RealtimeAgent src/agentscope/agent/_realtime/_agent.py:102— TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Agent src/agentscope/agent/_agent.py:119— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× 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 — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: 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.
Duplicated block (15 lines × 2) src/agentscope/app/storage/_redis_storage.py:2536— src/agentscope/app/storage/_redis_storage.py:2536-2550 | src/agentscope/app/storage/_redis_storage.py:2567-2581 — 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:761— src/agentscope/tool/_builtin/_bash.py:761-778 | src/agentscope/tool/_builtin/_powershell.py:262-276 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/tool/_builtin/_powershell.py:262` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) examples/long_term_memory/mem0/oss_demo.py:76— examples/long_term_memory/mem0/oss_demo.py:76-90 | examples/long_term_memory/reme/reme_demo.py:110-124 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
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:865— src/agentscope/app/storage/_redis_storage.py:865-877 | 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:327— src/agentscope/model/_dashscope/_model.py:327-339 | src/agentscope/model/_dashscope/_model.py:473-485 — 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:276— src/agentscope/model/_deepseek/_model.py:276-288 | src/agentscope/model/_deepseek/_model.py:383-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 (13 lines × 2) src/agentscope/workspace/_local_workspace.py:711— src/agentscope/workspace/_local_workspace.py:711-723 | 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.
Duplicated block (10 lines × 2) src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:31— src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:31-40 | src/agentscope/app/storage/_sql/_alembic/versions/0005_voice_profiles.py:28-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:31` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) src/agentscope/formatter/_xai_formatter.py:241— src/agentscope/formatter/_xai_formatter.py:241-250 | src/agentscope/formatter/_xai_formatter.py:309-318 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_xai_formatter.py:241` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) src/agentscope/model/_moonshot/_model.py:420— src/agentscope/model/_moonshot/_model.py:420-429 | src/agentscope/model/_ollama/_model.py:322-331 — 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:420` 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:666— src/agentscope/workspace/_base.py:666-675 | 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:413— src/agentscope/app/workspace_manager/_docker_workspace_manager.py:413-422 | 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.
Duplicated block (16 lines × 2) src/agentscope/embedding/_gemini/_model.py:358— src/agentscope/embedding/_gemini/_model.py:358-373 | src/agentscope/embedding/_gemini/_model.py:460-475 — 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:358` 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.
Duplicated block (12 lines × 2) src/agentscope/agent/_agent.py:864— src/agentscope/agent/_agent.py:864-875 | src/agentscope/agent/_agent.py:2094-2105 — 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:864` 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:308— src/agentscope/tool/_adapters.py:308-324 | 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.
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:87— src/agentscope/formatter/_gemini_formatter.py:87-92 | 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: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.
Duplicated block (6 lines × 2) src/agentscope/tts/_gemini/_model.py:206— src/agentscope/tts/_gemini/_model.py:206-212 | src/agentscope/tts/_gemini/_model.py:275-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (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.
Duplicated block (28 lines × 2) src/agentscope/model/_anthropic/_model.py:635— src/agentscope/model/_anthropic/_model.py:635-662 | src/agentscope/model/_gemini/_model.py:547-576 — 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.
Duplicated block (17–18 lines × 2) src/agentscope/app/channel/_feishu/_channel.py:922— src/agentscope/app/channel/_feishu/_channel.py:922-939 | src/agentscope/app/channel/_feishu/_channel.py:1089-1105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17–18 lines × 2) src/agentscope/embedding/_embedding_base.py:338— src/agentscope/embedding/_embedding_base.py:338-354 | src/agentscope/model/_base.py:226-243 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/embedding/_embedding_base.py:338` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/agentscope/model/_base.py:243` calls `warning` and `src/agentscope/embedding/_embedding_base.py:355` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17–18 lines × 2) src/agentscope/formatter/_anthropic_formatter.py:363— src/agentscope/formatter/_anthropic_formatter.py:363-380 | src/agentscope/formatter/_gemini_formatter.py:94-110 — 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: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. 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 (17 lines × 2) src/agentscope/realtime/_openai/_model.py:301— src/agentscope/realtime/_openai/_model.py:301-317 | src/agentscope/realtime/_xai/_model.py:268-284 — `src/agentscope/realtime/_openai/_model.py` and `src/agentscope/realtime/_xai/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) 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.
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:88— src/agentscope/formatter/_gemini_formatter.py:88-98 | 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.
Duplicated block (9 lines × 2) src/agentscope/app/storage/_redis_storage.py:484— src/agentscope/app/storage/_redis_storage.py:484-492 | src/agentscope/app/storage/_redis_storage.py:619-627 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) src/agentscope/formatter/_deepseek_formatter.py:112— src/agentscope/formatter/_deepseek_formatter.py:112-120 | src/agentscope/formatter/_volcengine_formatter.py:174-183 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_volcengine_formatter.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_deepseek_formatter.py:112` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src/agentscope/tts/_openai/_voice_cloning_client.py:82— src/agentscope/tts/_openai/_voice_cloning_client.py:82-90 | src/agentscope/tts/_openai/_voice_cloning_client.py:127-135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/tts/_openai/_voice_cloning_client.py:82` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py:319— src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py:319-326 | src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py:400-407 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py:319` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src/agentscope/realtime/_openai/_model.py:140— src/agentscope/realtime/_openai/_model.py:140-147 | src/agentscope/realtime/_xai/_model.py:125-132 — `src/agentscope/realtime/_openai/_model.py` and `src/agentscope/realtime/_xai/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (8 lines × 2) src/agentscope/tts/_dashscope/_model.py: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.
Duplicated block (5 lines × 2) src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:24— src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:24-28 | src/agentscope/app/storage/_sql/_alembic/versions/0005_voice_profiles.py:21-25 — 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/0004_sops.py:24` 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.
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.
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:250-311 | 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:445-459 | 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· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (4 members, 50+ identical tokens) src/agentscope/formatter/_dashscope_formatter.py:551— src/agentscope/formatter/_dashscope_formatter.py:551-612 | src/agentscope/formatter/_moonshot_formatter.py:450-485 | src/agentscope/formatter/_openai_formatter.py:556-618 | src/agentscope/formatter/_openai_response_formatter.py:500-545 — 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:319-333 | src/agentscope/realtime/_openai/_model.py:284-298 | src/agentscope/realtime/_xai/_model.py:251-265 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Duplicated block (29 lines × 2) src/agentscope/formatter/_deepseek_formatter.py:168— src/agentscope/formatter/_deepseek_formatter.py:168-196 | src/agentscope/formatter/_volcengine_formatter.py:222-250 — before extracting anything, compare `src/agentscope/formatter/_deepseek_formatter.py` and `src/agentscope/formatter/_volcengine_formatter.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_deepseek_formatter.py:168` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29 lines × 2) src/agentscope/tool/_builtin/_glob.py:193— src/agentscope/tool/_builtin/_glob.py:193-222 | src/agentscope/tool/_builtin/_grep.py:229-257 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (27 lines × 2) src/agentscope/formatter/_dashscope_formatter.py:586— src/agentscope/formatter/_dashscope_formatter.py:586-612 | src/agentscope/formatter/_openai_formatter.py:592-618 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_dashscope_formatter.py:586` 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.
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 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/realtime/_dashscope/_model.py: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.
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.
Duplicated block (22 lines × 2) src/agentscope/formatter/_deepseek_formatter.py:86— src/agentscope/formatter/_deepseek_formatter.py:86-107 | src/agentscope/formatter/_deepseek_formatter.py:153-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) src/agentscope/formatter/_volcengine_formatter.py:144— src/agentscope/formatter/_volcengine_formatter.py:144-165 | src/agentscope/formatter/_volcengine_formatter.py:207-228 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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:327— src/agentscope/model/_moonshot/_model.py:327-344 | src/agentscope/model/_openai_chat/_model.py:356-373 — `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 10 separate duplicated blocks between them, totalling at least 174 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (17 lines × 4) src/agentscope/model/_dashscope/_model.py:458— src/agentscope/model/_dashscope/_model.py:458-474 | src/agentscope/model/_deepseek/_model.py:368-384 | src/agentscope/model/_moonshot/_model.py:422-438 | src/agentscope/model/_volcengine/_model.py:371-387 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 179 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:439` calls `getattr` and `src/agentscope/model/_deepseek/_model.py:385` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 4) src/agentscope/model/_deepseek/_model.py:258— src/agentscope/model/_deepseek/_model.py:258-274 | src/agentscope/model/_moonshot/_model.py:309-325 | src/agentscope/model/_openai_chat/_model.py:338-354 | src/agentscope/model/_volcengine/_model.py:261-277 — `src/agentscope/model/_deepseek/_model.py` and `src/agentscope/model/_moonshot/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 201 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:329` calls `getattr` and `src/agentscope/model/_deepseek/_model.py:278` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16–17 lines × 2) src/agentscope/formatter/_dashscope_formatter.py:551— src/agentscope/formatter/_dashscope_formatter.py:551-566 | src/agentscope/formatter/_openai_formatter.py:556-572 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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.
Duplicated block (16 lines × 3) src/agentscope/model/_deepseek/_model.py:220— src/agentscope/model/_deepseek/_model.py:220-235 | src/agentscope/model/_moonshot/_model.py:271-286 | src/agentscope/model/_volcengine/_model.py:223-238 — `src/agentscope/model/_deepseek/_model.py` and `src/agentscope/model/_moonshot/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 201 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:428— src/agentscope/model/_moonshot/_model.py:428-443 | src/agentscope/model/_openai_chat/_model.py:537-552 | src/agentscope/model/_volcengine/_model.py:377-392 — `src/agentscope/model/_moonshot/_model.py` and `src/agentscope/model/_openai_chat/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 174 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:428` 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–13 lines × 2) .github/scripts/update_news.py:107— .github/scripts/update_news.py:107-118 | .github/scripts/update_news.py:123-135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `.github/scripts/update_news.py:123` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–13 lines × 2) src/agentscope/formatter/_volcengine_formatter.py:179— src/agentscope/formatter/_volcengine_formatter.py:179-190 | src/agentscope/formatter/_volcengine_formatter.py:246-258 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_volcengine_formatter.py:179` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11–13 lines × 2) src/agentscope/app/storage/_redis_storage.py:2427— src/agentscope/app/storage/_redis_storage.py:2427-2439 | src/agentscope/app/storage/_redis_storage.py:2471-2481 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–13 lines × 2) src/agentscope/model/_volcengine/_model.py:279— src/agentscope/model/_volcengine/_model.py:279-291 | src/agentscope/model/_volcengine/_model.py:386-396 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 8) src/agentscope/formatter/_anthropic_formatter.py:450— src/agentscope/formatter/_anthropic_formatter.py:450-459 | src/agentscope/formatter/_dashscope_formatter.py:513-522 | src/agentscope/formatter/_deepseek_formatter.py:281-290 | src/agentscope/formatter/_gemini_formatter.py:383-392 | src/agentscope/formatter/_moonshot_formatter.py:412-421 | src/agentscope/formatter/_ollama_formatter.py:373-382 | src/agentscope/formatter/_openai_formatter.py:518-527 | src/agentscope/formatter/_volcengine_formatter.py:329-338 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 8 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_anthropic_formatter.py:450` 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:368-382 | 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.
Duplicated block (8 lines × 3) src/agentscope/formatter/_anthropic_formatter.py:361— src/agentscope/formatter/_anthropic_formatter.py:361-368 | src/agentscope/formatter/_gemini_formatter.py:93-100 | 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:361` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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.
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:127-133 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_deepseek_formatter.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 4) src/agentscope/formatter/_dashscope_formatter.py:561— src/agentscope/formatter/_dashscope_formatter.py:561-568 | src/agentscope/formatter/_moonshot_formatter.py:457-463 | src/agentscope/formatter/_openai_formatter.py:567-574 | src/agentscope/formatter/_openai_response_formatter.py:518-524 — before extracting anything, compare `src/agentscope/formatter/_dashscope_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 132 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/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.
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.
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:356— The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
ChatService._run_impl (cyclomatic 88) src/agentscope/app/_service/_chat.py:895— 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.
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.
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.
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.
XAIChatFormatter.format (cyclomatic 44) src/agentscope/formatter/_xai_formatter.py:128— XAIChatFormatter.format has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
VolcengineChatFormatter.format (cyclomatic 42) src/agentscope/formatter/_volcengine_formatter.py:102— VolcengineChatFormatter.format has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Agent._reply_impl (cyclomatic 41) src/agentscope/agent/_agent.py:1046— 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.
_AnthropicFormatterBase._format_messages (cyclomatic 40) src/agentscope/formatter/_anthropic_formatter.py:33— _AnthropicFormatterBase._format_messages has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
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.
OllamaChatFormatter.format (cyclomatic 37) src/agentscope/formatter/_ollama_formatter.py:118— OllamaChatFormatter.format has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
OpenAIChatModel._parse_stream_response (cyclomatic 36) src/agentscope/model/_openai_chat/_model.py:307— OpenAIChatModel._parse_stream_response has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Agent._inject_runtime_state (cyclomatic 35) src/agentscope/agent/_agent.py:1387— 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.
GeminiChatFormatter.format (cyclomatic 35) src/agentscope/formatter/_gemini_formatter.py:157— GeminiChatFormatter.format 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.
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.
AnthropicChatModel._parse_anthropic_stream_completion_response (cyclomatic 32) src/agentscope/model/_anthropic/_model.py:436— AnthropicChatModel._parse_anthropic_stream_completion_response 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.
OpenAIResponseModel._parse_stream_response (cyclomatic 32) src/agentscope/model/_openai_response/_model.py:260— OpenAIResponseModel._parse_stream_response 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.
DashScopeChatModel._parse_stream_response (cyclomatic 31) src/agentscope/model/_dashscope/_model.py:285— DashScopeChatModel._parse_stream_response has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Grep.call (cyclomatic 31) src/agentscope/tool/_builtin/_grep.py:320— Grep.call has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
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.
Agent._execute_tool_call (cyclomatic 28) src/agentscope/agent/_agent.py:2452— Agent._execute_tool_call has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ChatInputQueue._drain_chat_inputs_locked (cyclomatic 28) src/agentscope/app/_manager/_chat_input_queue.py:398— ChatInputQueue._drain_chat_inputs_locked 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.
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.
RealtimeAgent._on_model_event (cyclomatic 27) src/agentscope/agent/_realtime/_agent.py:693— RealtimeAgent._on_model_event 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.
GitHubMCPHub._to_card (cyclomatic 26) src/agentscope/app/hub/_mcp/_github_hub.py:299— GitHubMCPHub._to_card has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
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.
_model._sanitize_schema_for_gemini (cyclomatic 26) src/agentscope/model/_gemini/_model.py:33— _model._sanitize_schema_for_gemini has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
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.
RealtimeAgent.connect (cyclomatic 24) src/agentscope/agent/_realtime/_agent.py:227— RealtimeAgent.connect has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
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.
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.
Agent._split_context_for_compression (cyclomatic 23) src/agentscope/agent/_agent.py:2911— 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.
_app.create_app (cyclomatic 23) src/agentscope/app/_app.py:115— _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.
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.
MoonshotChatModel._parse_stream_response (cyclomatic 23) src/agentscope/model/_moonshot/_model.py:290— MoonshotChatModel._parse_stream_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.
OpenAIResponseModel._parse_completion_response (cyclomatic 23) src/agentscope/model/_openai_response/_model.py:455— OpenAIResponseModel._parse_completion_response has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VolcengineChatModel._parse_stream_response (cyclomatic 23) src/agentscope/model/_volcengine/_model.py:242— VolcengineChatModel._parse_stream_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.
Agent._limit_context_images (cyclomatic 22) src/agentscope/agent/_agent.py:794— 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.
DeepSeekChatModel._parse_stream_response (cyclomatic 22) src/agentscope/model/_deepseek/_model.py:239— DeepSeekChatModel._parse_stream_response 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.
OpenAIChatModel._parse_completion_response (cyclomatic 22) src/agentscope/model/_openai_chat/_model.py:465— OpenAIChatModel._parse_completion_response 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.
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.
Agent._reasoning_impl (cyclomatic 21) src/agentscope/agent/_agent.py:1720— 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.
Agent._convert_chat_response_to_event (cyclomatic 20) src/agentscope/agent/_agent.py:3852— 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.
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.
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.
MoonshotChatModel._call_api (cyclomatic 20) src/agentscope/model/_moonshot/_model.py:174— 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.
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.
Agent._compress_context_impl (cyclomatic 19) src/agentscope/agent/_agent.py:492— Agent._compress_context_impl has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Agent._next_action (cyclomatic 19) src/agentscope/agent/_agent.py:3590— 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.
ChatModelBase.count_tokens (cyclomatic 19) src/agentscope/model/_base.py:379— 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.
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.
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.
WakeupDispatcher._dispatch_one (cyclomatic 18) src/agentscope/app/_manager/_wakeup_dispatcher.py:279— WakeupDispatcher._dispatch_one 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.
WebRTCSession._run (cyclomatic 18) src/agentscope/app/_service/_webrtc_session.py:124— WebRTCSession._run has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
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.
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.
AnthropicChatModel._parse_anthropic_completion_response (cyclomatic 18) src/agentscope/model/_anthropic/_model.py:328— AnthropicChatModel._parse_anthropic_completion_response 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.
ChatModelBase.generate_structured_output (cyclomatic 18) src/agentscope/model/_base.py:467— ChatModelBase.generate_structured_output has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
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.
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.
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.
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.
GeminiRealtimeModel._parse_content (cyclomatic 17) src/agentscope/realtime/_gemini/_model.py:423— GeminiRealtimeModel._parse_content has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
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.
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.
Agent.__init__ (cyclomatic 16) src/agentscope/agent/_agent.py:122— 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.
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.
AnthropicMultiAgentFormatter._format_agent_message (cyclomatic 16) src/agentscope/formatter/_anthropic_formatter.py:473— AnthropicMultiAgentFormatter._format_agent_message has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OllamaMultiAgentFormatter._format_agent_message (cyclomatic 16) src/agentscope/formatter/_ollama_formatter.py:405— OllamaMultiAgentFormatter._format_agent_message has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ReMeMiddleware.on_reply (cyclomatic 16) src/agentscope/middleware/_longterm_memory/_reme/_middleware.py:312— ReMeMiddleware.on_reply has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ChatModelBase._call_api_with_structured_output (cyclomatic 16) src/agentscope/model/_base.py:605— 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.
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.
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.
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.
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.
Glob.call (cyclomatic 16) src/agentscope/tool/_builtin/_glob.py:224— Glob.call has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ChatService._run_impl (cognitive 161) src/agentscope/app/_service/_chat.py:895— 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.
_AnthropicFormatterBase._format_messages (cognitive 145) src/agentscope/formatter/_anthropic_formatter.py:33— _AnthropicFormatterBase._format_messages has cognitive complexity 145 (threshold 15). Drivers by points: if/else 28 (110 pts), ternaries 4 (19 pts), loops 4 (13 pts), boolean chains 3 (nesting depth added 106). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
XAIChatFormatter.format (cognitive 140) src/agentscope/formatter/_xai_formatter.py:128— XAIChatFormatter.format has cognitive complexity 140 (threshold 15). Drivers by points: if/else 27 (114 pts), loops 6 (24 pts), boolean chains 2 (nesting depth added 105). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
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.
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.
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.
GeminiChatFormatter.format (cognitive 113) src/agentscope/formatter/_gemini_formatter.py:157— GeminiChatFormatter.format has cognitive complexity 113 (threshold 15). Drivers by points: if/else 19 (80 pts), ternaries 4 (18 pts), loops 4 (13 pts), boolean chains 2 (nesting depth added 84). 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.
VolcengineChatFormatter.format (cognitive 113) src/agentscope/formatter/_volcengine_formatter.py:102— VolcengineChatFormatter.format has cognitive complexity 113 (threshold 15). Drivers by points: if/else 22 (90 pts), loops 4 (13 pts), boolean chains 10 (nesting depth added 77). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
OllamaChatFormatter.format (cognitive 111) src/agentscope/formatter/_ollama_formatter.py:118— OllamaChatFormatter.format has cognitive complexity 111 (threshold 15). Drivers by points: if/else 20 (85 pts), loops 4 (13 pts), ternaries 2 (8 pts), boolean chains 5 (nesting depth added 80). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
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.
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.
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.
Agent._reply_impl (cognitive 89) src/agentscope/agent/_agent.py:1046— 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.
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.
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.
OpenAIResponseModel._parse_stream_response (cognitive 67) src/agentscope/model/_openai_response/_model.py:260— OpenAIResponseModel._parse_stream_response has cognitive complexity 67 (threshold 15). Drivers by points: if/else 10 (33 pts), ternaries 5 (16 pts), loops 3 (10 pts), boolean chains 8 (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Agent._inject_runtime_state (cognitive 65) src/agentscope/agent/_agent.py:1387— 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.
Agent._execute_tool_call (cognitive 64) src/agentscope/agent/_agent.py:2452— Agent._execute_tool_call has cognitive complexity 64 (threshold 15). Drivers by points: if/else 15 (40 pts), loops 5 (13 pts), boolean chains 5, ternaries 1 (4 pts), error handling 2 (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.
OpenAIChatModel._parse_stream_response (cognitive 64) src/agentscope/model/_openai_chat/_model.py:307— OpenAIChatModel._parse_stream_response has cognitive complexity 64 (threshold 15). Drivers by points: if/else 15 (35 pts), boolean chains 17, ternaries 3 (9 pts), loops 2 (3 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DashScopeChatModel._parse_stream_response (cognitive 59) src/agentscope/model/_dashscope/_model.py:285— DashScopeChatModel._parse_stream_response has cognitive complexity 59 (threshold 15). Drivers by points: if/else 16 (37 pts), boolean chains 13, ternaries 2 (6 pts), loops 2 (3 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
ChatInputQueue._drain_chat_inputs_locked (cognitive 55) src/agentscope/app/_manager/_chat_input_queue.py:398— ChatInputQueue._drain_chat_inputs_locked has cognitive complexity 55 (threshold 15). Drivers by points: if/else 11 (24 pts), error handling 7 (18 pts), boolean chains 5, 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.
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.
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.
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.
AnthropicChatModel._parse_anthropic_stream_completion_response (cognitive 45) src/agentscope/model/_anthropic/_model.py:436— AnthropicChatModel._parse_anthropic_stream_completion_response has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (29 pts), boolean chains 11, loops 2 (5 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.
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.
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.
Grep.call (cognitive 44) src/agentscope/tool/_builtin/_grep.py:320— Grep.call has cognitive complexity 44 (threshold 15). Drivers by points: if/else 21 (32 pts), boolean chains 5, loops 3 (5 pts), error handling 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Agent._limit_context_images (cognitive 43) src/agentscope/agent/_agent.py:794— 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.
_model._sanitize_schema_for_gemini (cognitive 43) src/agentscope/model/_gemini/_model.py:33— _model._sanitize_schema_for_gemini has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Agent._handle_incoming_event (cognitive 41) src/agentscope/agent/_agent.py:1948— 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.
ChatModelBase.generate_structured_output (cognitive 40) src/agentscope/model/_base.py:467— ChatModelBase.generate_structured_output has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 3 (5 pts), error handling 1 (3 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatModelBase.count_tokens (cognitive 39) src/agentscope/model/_base.py:379— 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.
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.
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.
MoonshotChatModel._parse_stream_response (cognitive 38) src/agentscope/model/_moonshot/_model.py:290— MoonshotChatModel._parse_stream_response has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 10, ternaries 3 (9 pts), loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VolcengineChatModel._parse_stream_response (cognitive 38) src/agentscope/model/_volcengine/_model.py:242— VolcengineChatModel._parse_stream_response has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 10, ternaries 3 (9 pts), loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAIChatModel._parse_completion_response (cognitive 37) src/agentscope/model/_openai_chat/_model.py:465— OpenAIChatModel._parse_completion_response has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 8, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
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.
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.
Agent._handle_incoming_messages (cognitive 35) src/agentscope/agent/_agent.py:2057— 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.
DeepSeekChatModel._parse_stream_response (cognitive 35) src/agentscope/model/_deepseek/_model.py:239— DeepSeekChatModel._parse_stream_response has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 10, ternaries 2 (6 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
RealtimeAgent.connect (cognitive 34) src/agentscope/agent/_realtime/_agent.py:227— RealtimeAgent.connect has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (2 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
OpenAIResponseModel._parse_completion_response (cognitive 34) src/agentscope/model/_openai_response/_model.py:455— OpenAIResponseModel._parse_completion_response has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 8, loops 3 (7 pts), 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.
GeminiTTSModel._parse_stream_into_async_generator (cognitive 34) src/agentscope/tts/_gemini/_model.py:243— GeminiTTSModel._parse_stream_into_async_generator has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_app.create_app (cognitive 33) src/agentscope/app/_app.py:115— _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.
AnthropicMultiAgentFormatter._format_agent_message (cognitive 33) src/agentscope/formatter/_anthropic_formatter.py:473— AnthropicMultiAgentFormatter._format_agent_message has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GeminiChatModel._parse_stream_response (cognitive 33) src/agentscope/model/_gemini/_model.py:344— GeminiChatModel._parse_stream_response has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (24 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
Agent._split_context_for_compression (cognitive 32) src/agentscope/agent/_agent.py:2911— 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.
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.
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.
_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.
_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.
Agent._compress_context_impl (cognitive 30) src/agentscope/agent/_agent.py:492— Agent._compress_context_impl has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (20 pts), error handling 3 (5 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
GitHubMCPHub._to_card (cognitive 30) src/agentscope/app/hub/_mcp/_github_hub.py:299— GitHubMCPHub._to_card has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 13, if/else 5 (8 pts), ternaries 4, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_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.
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.
RealtimeAgent._on_model_event (cognitive 29) src/agentscope/agent/_realtime/_agent.py:693— RealtimeAgent._on_model_event has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 4, ternaries 1 (2 pts), match/switch 1 (nesting depth added 12). 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.
_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.
Agent._split_tool_result_for_compression (cognitive 28) src/agentscope/agent/_agent.py:3092— 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.
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.
Agent._reasoning_impl (cognitive 27) src/agentscope/agent/_agent.py:1720— 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.
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.
MoonshotChatModel._call_api (cognitive 27) src/agentscope/model/_moonshot/_model.py:174— 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.
OllamaMultiAgentFormatter._format_agent_message (cognitive 26) src/agentscope/formatter/_ollama_formatter.py:405— OllamaMultiAgentFormatter._format_agent_message has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
WakeupDispatcher._dispatch_one (cognitive 25) src/agentscope/app/_manager/_wakeup_dispatcher.py:279— WakeupDispatcher._dispatch_one has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 3 (4 pts), error handling 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.
_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.
RealtimeAgent._run_tool (cognitive 24) src/agentscope/agent/_realtime/_agent.py:1194— RealtimeAgent._run_tool has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (7 pts), boolean chains 2, error handling 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GeminiMultiAgentFormatter._format_agent_message (cognitive 24) src/agentscope/formatter/_gemini_formatter.py:416— 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.
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.
WorkspaceBase._enforce_mcp_capacity (cognitive 24) src/agentscope/workspace/_base.py:848— 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.
Agent._next_action (cognitive 23) src/agentscope/agent/_agent.py:3590— 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.
WebRTCSession._run (cognitive 23) src/agentscope/app/_service/_webrtc_session.py:124— WebRTCSession._run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 6, error handling 3 (5 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
ChatModelBase._call_api_with_structured_output (cognitive 23) src/agentscope/model/_base.py:605— 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.
GeminiChatModel._parse_completion_response (cognitive 23) src/agentscope/model/_gemini/_model.py:426— GeminiChatModel._parse_completion_response has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_excel._restore_native_excel_errors (cognitive 23) src/agentscope/rag/_parser/_excel.py:79— _excel._restore_native_excel_errors has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
ChatInputQueue._recover_pending_chat_inputs_locked (cognitive 22) src/agentscope/app/_manager/_chat_input_queue.py:198— 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.
DashScopeMultiAgentFormatter._format_agent_message (cognitive 22) src/agentscope/formatter/_dashscope_formatter.py:546— 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.
OpenAIMultiAgentFormatter._format_agent_message (cognitive 22) src/agentscope/formatter/_openai_formatter.py:551— 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.
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.
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.
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.
RealtimeAgent.reply_stream (cognitive 21) src/agentscope/agent/_realtime/_agent.py:394— RealtimeAgent.reply_stream has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 2 (5 pts), loops 4, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
FormatterBase._group_messages (cognitive 21) src/agentscope/formatter/_formatter_base.py:190— FormatterBase._group_messages has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_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.
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.
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.
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.
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.
Agent._convert_chat_response_to_event (cognitive 20) src/agentscope/agent/_agent.py:3852— 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.
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.
_toolkit.get_toolkit (cognitive 20) src/agentscope/app/_service/_toolkit.py:40— _toolkit.get_toolkit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
FileEmbeddingCache._maintain_cache_dir (cognitive 20) src/agentscope/embedding/_file_cache.py:162— 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.
RAGMiddleware.on_reasoning (cognitive 20) src/agentscope/middleware/_rag.py:929— RAGMiddleware.on_reasoning has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
_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.
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.
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.
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.
_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.
Agent._call_model (cognitive 19) src/agentscope/agent/_agent.py:3369— Agent._call_model has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
ToolOffloadMiddleware.on_acting (cognitive 19) src/agentscope/app/middleware/_tool_offload_middleware.py:105— ToolOffloadMiddleware.on_acting has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (5 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
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.
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.
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.
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.
ChatInputQueue._claim_chat_input (cognitive 18) src/agentscope/app/_manager/_chat_input_queue.py:628— ChatInputQueue._claim_chat_input has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_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.
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.
XAIMultiAgentFormatter.format (cognitive 18) src/agentscope/formatter/_xai_formatter.py:396— XAIMultiAgentFormatter.format has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_xai_formatter._xai_user_args_from_blocks (cognitive 18) src/agentscope/formatter/_xai_formatter.py:32— _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.
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.
DashScopeChatModel._parse_completion_response (cognitive 18) src/agentscope/model/_dashscope/_model.py:434— DashScopeChatModel._parse_completion_response has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, 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.
GeminiChatModel._format_tools (cognitive 18) src/agentscope/model/_gemini/_model.py:542— 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.
MCPTool._stream_call (cognitive 18) src/agentscope/tool/_adapters.py:358— 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.
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.
_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.
LocalWorkspace.initialize (cognitive 18) src/agentscope/workspace/_local_workspace.py:164— LocalWorkspace.initialize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3 (5 pts), error handling 1 (2 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
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.
AgenticMemoryMiddleware._list_md_files (cognitive 17) src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:931— 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.
AnthropicChatModel._parse_anthropic_completion_response (cognitive 17) src/agentscope/model/_anthropic/_model.py:328— AnthropicChatModel._parse_anthropic_completion_response has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (6 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DashScopeChatModel._format_tools (cognitive 17) src/agentscope/model/_dashscope/_model.py:498— 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.
KnowledgeBase.search (cognitive 17) src/agentscope/rag/_knowledge.py:197— KnowledgeBase.search has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
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.
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.
Bash.call (cognitive 17) src/agentscope/tool/_builtin/_bash.py:708— Bash.call has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Glob.call (cognitive 17) src/agentscope/tool/_builtin/_glob.py:224— Glob.call has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 5 (6 pts), boolean chains 2, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
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.
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.
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.
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.
Agent._execute_concurrent_tool_calls (cognitive 16) src/agentscope/agent/_agent.py:2210— 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.
_tts_model._validate_voice_binding (cognitive 16) src/agentscope/app/_service/_tts_model.py:239— _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.
GitHubMCPHub._from_package (cognitive 16) src/agentscope/app/hub/_mcp/_github_hub.py:243— GitHubMCPHub._from_package has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RedisStorage.delete_agent (cognitive 16) src/agentscope/app/storage/_redis_storage.py:810— 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.
MoonshotMultiAgentFormatter._format_agent_message (cognitive 16) src/agentscope/formatter/_moonshot_formatter.py:445— 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.
AgenticMemoryMiddleware.on_reply (cognitive 16) src/agentscope/middleware/_longterm_memory/_agentic_memory/_middleware.py:570— 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.
ReMeMiddleware.on_reply (cognitive 16) src/agentscope/middleware/_longterm_memory/_reme/_middleware.py:312— ReMeMiddleware.on_reply has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, boolean chains 6, error handling 1 (2 pts), loops 1 (nesting depth added 1). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RAGMiddleware.on_reply (cognitive 16) src/agentscope/middleware/_rag.py:859— RAGMiddleware.on_reply has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatModelBase._validate_tool_choice (cognitive 16) src/agentscope/model/_base.py:326— 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.
ModelCard.from_yaml (cognitive 16) src/agentscope/model/_model_card.py:80— ModelCard.from_yaml has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
VolcengineChatModel._parse_completion_response (cognitive 16) src/agentscope/model/_volcengine/_model.py:348— VolcengineChatModel._parse_completion_response has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
GeminiRealtimeModel._parse_content (cognitive 16) src/agentscope/realtime/_gemini/_model.py:423— GeminiRealtimeModel._parse_content has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
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.
_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.
D4 · Code Duplication· Near-duplicate member family (5 members, 40 shared lines) · ×1
Near-duplicate member family (5 members, 40 shared lines) src/agentscope/model/_dashscope/_model.py:290— src/agentscope/model/_dashscope/_model.py:290-432 | src/agentscope/model/_deepseek/_model.py:244-343 | src/agentscope/model/_moonshot/_model.py:295-397 | src/agentscope/model/_openai_chat/_model.py:312-463 | src/agentscope/model/_volcengine/_model.py:247-346 — These 5 members are variants of one another: a block of 40 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
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.
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.
Near-duplicate member pair (45 shared lines) src/agentscope/formatter/_deepseek_formatter.py:49— src/agentscope/formatter/_deepseek_formatter.py:49-247 | src/agentscope/formatter/_volcengine_formatter.py:106-295 — These two members are variants of one another: 45 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (91 corresponding lines) · ×1
Edited copy of a member (91 corresponding lines) src/agentscope/permission/_engine.py:122— src/agentscope/permission/_engine.py:122-212 | src/agentscope/permission/_engine.py:302-393 — These two members are one piece of code written twice and then edited apart: 91 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
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.
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.
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.
Duplicated block (27–40 lines × 2) src/agentscope/embedding/_gemini/_model.py:330— src/agentscope/embedding/_gemini/_model.py:330-356 | src/agentscope/embedding/_gemini/_model.py:419-458 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/embedding/_gemini/_model.py:330` 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 (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:31-54 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_openai_formatter.py: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.
Duplicated block (32–36 lines × 2) src/agentscope/formatter/_anthropic_formatter.py:332— src/agentscope/formatter/_anthropic_formatter.py:332-367 | 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.
Duplicated block (36 lines × 2) src/agentscope/model/_deepseek/_model.py:196— src/agentscope/model/_deepseek/_model.py:196-231 | src/agentscope/model/_volcengine/_model.py:199-234 — `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 316 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (30–35 lines × 4) src/agentscope/model/_dashscope/_model.py:339— src/agentscope/model/_dashscope/_model.py:339-368 | src/agentscope/model/_deepseek/_model.py:288-322 | src/agentscope/model/_moonshot/_model.py:342-376 | src/agentscope/model/_volcengine/_model.py:291-325 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 179 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:339` 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 (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.
Duplicated block (30–35 lines × 2) src/agentscope/app/message_bus/_redis_message_bus.py:141— src/agentscope/app/message_bus/_redis_message_bus.py:141-175 | src/agentscope/app/storage/_redis_storage.py:224-253 — 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 (29–35 lines × 2) src/agentscope/formatter/_ollama_formatter.py:208— src/agentscope/formatter/_ollama_formatter.py:208-242 | src/agentscope/formatter/_openai_formatter.py: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:208` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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 8 separate duplicated blocks between them, totalling at least 132 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.
Duplicated block (17–33 lines × 7) src/agentscope/formatter/_anthropic_formatter.py:443— src/agentscope/formatter/_anthropic_formatter.py:443-459 | src/agentscope/formatter/_dashscope_formatter.py:490-522 | src/agentscope/formatter/_deepseek_formatter.py:274-290 | src/agentscope/formatter/_gemini_formatter.py:376-392 | src/agentscope/formatter/_ollama_formatter.py:366-382 | src/agentscope/formatter/_openai_formatter.py:511-527 | src/agentscope/formatter/_volcengine_formatter.py:322-338 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 7 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_anthropic_formatter.py:443` 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 (29–33 lines × 6) src/agentscope/model/_dashscope/_model.py:203— src/agentscope/model/_dashscope/_model.py:203-231 | src/agentscope/model/_deepseek/_model.py:164-196 | src/agentscope/model/_gemini/_model.py:268-296 | src/agentscope/model/_openai_chat/_model.py:211-243 | src/agentscope/model/_openai_response/_model.py:192-224 | src/agentscope/model/_volcengine/_model.py:167-199 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 179 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 (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 11 separate duplicated blocks between them, totalling at least 197 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.
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 (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.
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.
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.
Duplicated block (30–31 lines × 3) src/agentscope/model/_deepseek/_model.py:413— src/agentscope/model/_deepseek/_model.py:413-442 | src/agentscope/model/_moonshot/_model.py:470-500 | src/agentscope/model/_volcengine/_model.py:414-443 — `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 201 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (27–30 lines × 2) src/agentscope/embedding/_embedding_model_card.py:142— src/agentscope/embedding/_embedding_model_card.py:142-168 | src/agentscope/model/_model_card.py:131-160 — 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.
Duplicated block (27–28 lines × 3) src/agentscope/model/_dashscope/_model.py:439— src/agentscope/model/_dashscope/_model.py:439-466 | src/agentscope/model/_deepseek/_model.py:350-376 | src/agentscope/model/_volcengine/_model.py:353-379 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 179 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:439` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–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.
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 7 separate duplicated blocks between them, totalling at least 133 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (27 lines × 3) src/agentscope/model/_deepseek/_model.py:244— src/agentscope/model/_deepseek/_model.py:244-270 | src/agentscope/model/_moonshot/_model.py:295-321 | src/agentscope/model/_volcengine/_model.py:247-273 — `src/agentscope/model/_deepseek/_model.py` and `src/agentscope/model/_moonshot/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 201 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 (25–27 lines × 2) src/agentscope/app/storage/_redis_storage.py:283— src/agentscope/app/storage/_redis_storage.py:283-307 | 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.
Duplicated block (24–26 lines × 2) src/agentscope/agent/_agent.py:3687— src/agentscope/agent/_agent.py:3687-3712 | src/agentscope/agent/_agent.py:3824-3847 — 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 (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.
Duplicated block (18–26 lines × 2) src/agentscope/app/storage/_redis_storage.py:2391— src/agentscope/app/storage/_redis_storage.py:2391-2416 | src/agentscope/app/storage/_redis_storage.py:2450-2467 — 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 (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 8 separate duplicated blocks between them, totalling at least 132 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 (24–25 lines × 3) src/agentscope/formatter/_dashscope_formatter.py:573— src/agentscope/formatter/_dashscope_formatter.py:573-596 | src/agentscope/formatter/_gemini_formatter.py:448-472 | src/agentscope/formatter/_openai_formatter.py:579-602 — 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.
Duplicated block (23–25 lines × 2) src/agentscope/app/_router/_session.py:336— src/agentscope/app/_router/_session.py:336-358 | src/agentscope/app/_router/_session.py:531-555 — 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:531` 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 (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.
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 7 separate duplicated blocks between them, totalling at least 133 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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.
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:283-306 | 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.
Duplicated block (24 lines × 5) src/agentscope/model/_dashscope/_model.py:362— src/agentscope/model/_dashscope/_model.py:362-385 | src/agentscope/model/_deepseek/_model.py:316-339 | src/agentscope/model/_moonshot/_model.py:370-393 | src/agentscope/model/_openai_chat/_model.py:436-459 | src/agentscope/model/_volcengine/_model.py:319-342 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 179 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:362` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18–24 lines × 2) src/agentscope/app/_service/_chat.py:1062— src/agentscope/app/_service/_chat.py:1062-1085 | src/agentscope/app/_service/_realtime.py:86-103 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/_service/_chat.py:1062` 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 (23–24 lines × 2) src/agentscope/formatter/_anthropic_formatter.py:519— src/agentscope/formatter/_anthropic_formatter.py:519-542 | src/agentscope/formatter/_ollama_formatter.py:441-463 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_anthropic_formatter.py:519` 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–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.
Duplicated block (23 lines × 2) src/agentscope/model/_moonshot/_model.py:437— src/agentscope/model/_moonshot/_model.py:437-459 | src/agentscope/model/_openai_chat/_model.py:546-568 — `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 10 separate duplicated blocks between them, totalling at least 174 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 (16–23 lines × 2) src/agentscope/tool/_adapters.py:264— src/agentscope/tool/_adapters.py:264-286 | 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.
Duplicated block (22 lines × 7) src/agentscope/formatter/_dashscope_formatter.py:513— src/agentscope/formatter/_dashscope_formatter.py:513-534 | src/agentscope/formatter/_deepseek_formatter.py:281-302 | src/agentscope/formatter/_gemini_formatter.py:383-404 | src/agentscope/formatter/_moonshot_formatter.py:412-433 | src/agentscope/formatter/_ollama_formatter.py:373-394 | src/agentscope/formatter/_openai_formatter.py:518-539 | src/agentscope/formatter/_volcengine_formatter.py:329-350 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_deepseek_formatter.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
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.
Duplicated block (21–22 lines × 2) src/agentscope/workspace/_local_workspace.py:216— src/agentscope/workspace/_local_workspace.py:216-237 | src/agentscope/workspace/_local_workspace.py:831-851 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 3) src/agentscope/model/_moonshot/_model.py:443— src/agentscope/model/_moonshot/_model.py:443-463 | src/agentscope/model/_openai_chat/_model.py:552-572 | src/agentscope/model/_openai_response/_model.py:536-556 — `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 10 separate duplicated blocks between them, totalling at least 174 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:443` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (18–21 lines × 2) src/agentscope/app/storage/_redis_storage.py:923— src/agentscope/app/storage/_redis_storage.py:923-943 | 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.
Duplicated block (21 lines × 2) src/agentscope/workspace/_local_workspace.py:750— src/agentscope/workspace/_local_workspace.py:750-770 | 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.
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 8 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 2) src/agentscope/app/_service/_chat.py:1432— src/agentscope/app/_service/_chat.py:1432-1455 | src/agentscope/app/_service/_chat.py:1552-1571 — 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–20 lines × 2) REDACTED:729— REDACTED:729-748 | REDACTED:841-858 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:729` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (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:129-147 | 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.
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 7 separate duplicated blocks between them, totalling at least 133 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/agentscope/formatter/_openai_formatter.py: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.
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.
Duplicated block (15–19 lines × 2) src/agentscope/tool/_builtin/_bash.py:781— src/agentscope/tool/_builtin/_bash.py:781-799 | src/agentscope/tool/_builtin/_powershell.py:253-267 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (16–18 lines × 2) src/agentscope/model/_openai_response/_model.py:401— src/agentscope/model/_openai_response/_model.py:401-418 | src/agentscope/model/_openai_response/_model.py:530-545 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 3) src/agentscope/app/storage/_redis_storage.py:1021— src/agentscope/app/storage/_redis_storage.py:1021-1037 | src/agentscope/app/storage/_redis_storage.py:1159-1175 | src/agentscope/app/storage/_redis_storage.py:1185-1201 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13–17 lines × 2) src/agentscope/tool/_builtin/_backend.py:812— src/agentscope/tool/_builtin/_backend.py:812-828 | src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:145-157 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 5) src/agentscope/model/_dashscope/_model.py:313— src/agentscope/model/_dashscope/_model.py:313-328 | src/agentscope/model/_deepseek/_model.py:262-277 | src/agentscope/model/_moonshot/_model.py:313-328 | src/agentscope/model/_openai_chat/_model.py:342-357 | src/agentscope/model/_volcengine/_model.py:265-280 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 179 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:311` calls `_generate_id` and `src/agentscope/model/_deepseek/_model.py:260` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16 lines × 4) src/agentscope/model/_moonshot/_model.py:327— src/agentscope/model/_moonshot/_model.py:327-342 | src/agentscope/model/_moonshot/_model.py:437-452 | src/agentscope/model/_openai_chat/_model.py:356-371 | src/agentscope/model/_openai_chat/_model.py:546-561 — `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 10 separate duplicated blocks between them, totalling at least 174 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (15–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 7 separate duplicated blocks between them, totalling at least 133 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_deepseek_formatter.py:96` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (14–16 lines × 2) src/agentscope/formatter/_xai_formatter.py:229— src/agentscope/formatter/_xai_formatter.py:229-244 | src/agentscope/formatter/_xai_formatter.py:337-350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_xai_formatter.py:229` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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:445-459 | 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.
Duplicated block (13–15 lines × 4) src/agentscope/model/_dashscope/_model.py:463— src/agentscope/model/_dashscope/_model.py:463-475 | src/agentscope/model/_moonshot/_model.py:427-439 | src/agentscope/model/_openai_chat/_model.py:534-548 | src/agentscope/model/_volcengine/_model.py:376-388 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_moonshot/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 125 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:534` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 4) src/agentscope/realtime/_dashscope/_model.py:296— src/agentscope/realtime/_dashscope/_model.py:296-310 | src/agentscope/realtime/_gemini/_model.py:319-333 | src/agentscope/realtime/_openai/_model.py:284-298 | src/agentscope/realtime/_xai/_model.py:251-265 — `src/agentscope/realtime/_dashscope/_model.py` and `src/agentscope/realtime/_xai/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
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.
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:298-311 | 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.
Duplicated block (13–14 lines × 3) src/agentscope/formatter/_xai_formatter.py:225— src/agentscope/formatter/_xai_formatter.py:225-238 | src/agentscope/formatter/_xai_formatter.py:291-304 | src/agentscope/formatter/_xai_formatter.py:332-344 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (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 7 separate duplicated blocks between them, totalling at least 133 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/formatter/_deepseek_formatter.py:192` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–13 lines × 3) src/agentscope/app/storage/_redis_storage.py:2403— src/agentscope/app/storage/_redis_storage.py:2403-2414 | src/agentscope/app/storage/_redis_storage.py:2454-2465 | src/agentscope/app/storage/_redis_storage.py:2491-2503 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) src/agentscope/embedding/_gemini/_model.py:343— src/agentscope/embedding/_gemini/_model.py:343-354 | src/agentscope/embedding/_gemini/_model.py:445-456 | src/agentscope/embedding/_openai/_model.py:142-153 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/agentscope/embedding/_openai/_model.py:140` calls `setdefault` and `src/agentscope/embedding/_gemini/_model.py:341` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 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:125-135 — before extracting anything, compare `src/agentscope/formatter/_dashscope_formatter.py` and `src/agentscope/formatter/_openai_formatter.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 4) src/agentscope/model/_dashscope/_model.py:274— src/agentscope/model/_dashscope/_model.py:274-283 | src/agentscope/model/_deepseek/_model.py:228-237 | src/agentscope/model/_moonshot/_model.py:279-288 | src/agentscope/model/_volcengine/_model.py:231-240 — `src/agentscope/model/_dashscope/_model.py` and `src/agentscope/model/_deepseek/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 179 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 3) src/agentscope/model/_anthropic/_model.py:654— src/agentscope/model/_anthropic/_model.py:654-663 | src/agentscope/model/_gemini/_model.py:568-577 | 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.
Duplicated block (9–10 lines × 3) src/agentscope/model/_deepseek/_model.py:193— src/agentscope/model/_deepseek/_model.py:193-202 | src/agentscope/model/_volcengine/_model.py:196-205 | 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 316 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.
Duplicated block (9 lines × 8) src/agentscope/formatter/_anthropic_formatter.py:448— src/agentscope/formatter/_anthropic_formatter.py:448-456 | src/agentscope/formatter/_dashscope_formatter.py:511-519 | src/agentscope/formatter/_deepseek_formatter.py:279-287 | src/agentscope/formatter/_gemini_formatter.py:381-389 | src/agentscope/formatter/_ollama_formatter.py:371-379 | src/agentscope/formatter/_openai_formatter.py:516-524 | src/agentscope/formatter/_openai_response_formatter.py:452-460 | src/agentscope/formatter/_volcengine_formatter.py:327-335 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 8 call sites, so a change lands once.
Duplicated block (6–8 lines × 6) src/agentscope/model/_dashscope/_model.py:227— src/agentscope/model/_dashscope/_model.py:227-234 | src/agentscope/model/_deepseek/_model.py:192-199 | src/agentscope/model/_gemini/_model.py:292-299 | src/agentscope/model/_openai_chat/_model.py:239-246 | src/agentscope/model/_volcengine/_model.py:195-202 | 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 9 separate duplicated blocks between them, totalling at least 179 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 (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 8 separate duplicated blocks between them, totalling at least 132 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.
Duplicated block (2–7 lines × 4) src/agentscope/app/storage/_sql/_alembic/versions/0002_mcps_skills.py:33— src/agentscope/app/storage/_sql/_alembic/versions/0002_mcps_skills.py:33-34 | src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:29-34 | src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:48-54 | src/agentscope/app/storage/_sql/_alembic/versions/0005_voice_profiles.py:26-31 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `src/agentscope/app/storage/_sql/_alembic/versions/0004_sops.py:29` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 7) src/agentscope/model/_dashscope/_model.py:227— src/agentscope/model/_dashscope/_model.py:227-234 | src/agentscope/model/_deepseek/_model.py:192-199 | src/agentscope/model/_gemini/_model.py:292-299 | src/agentscope/model/_moonshot/_model.py:212-219 | src/agentscope/model/_openai_chat/_model.py:239-246 | src/agentscope/model/_volcengine/_model.py:195-202 | 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 9 separate duplicated blocks between them, totalling at least 179 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (5 lines × 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:88-93 | 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.
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:352-365 | 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.
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.
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:427-442 | 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.
Duplicated block (18 lines × 4) src/agentscope/realtime/_dashscope/_model.py:221— src/agentscope/realtime/_dashscope/_model.py:221-238 | src/agentscope/realtime/_gemini/_model.py:206-226 | src/agentscope/realtime/_openai/_model.py:185-202 | src/agentscope/realtime/_xai/_model.py:170-187 — `src/agentscope/realtime/_dashscope/_model.py` and `src/agentscope/realtime/_xai/_model.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/agentscope/realtime/_openai/_model.py:182` calls `request_response` and `src/agentscope/realtime/_gemini/_model.py:203` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Duplicated block (78 lines × 3) scripts/model_examples/openai_chat_multiagent.py:19— scripts/model_examples/openai_chat_multiagent.py:19-96 | scripts/model_examples/openai_response_multiagent.py:20-98 | scripts/model_examples/xai_multiagent.py:20-97 — before extracting anything, compare `scripts/model_examples/openai_chat_multiagent.py` and `scripts/model_examples/openai_response_multiagent.py` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
P12 · CI test-gate honesty· Coverage collected but not gated · ×1
Coverage collected but not gated — CI collects a coverage report but no step enforces a minimum — coverage could halve and CI stays green. Add a step that fails the build when coverage drops below a floor (your coverage tool's minimum-threshold flag, or a coverage-gate action) so the number guards something. What was searched, so you can tell an absence from a miss: this repository's CI files AND its coverage configuration — the well-known coverage and test-runner config files, read at the repository root and inside workspace package directories two levels down, so a floor declared beside the tests rather than in the pipeline is credited — matched against the threshold settings this check knows by name. A floor set in your coverage service's web UI rather than in a committed file, or under a setting whose name is not one of those, is not seen here.
X1 · Async correctness· Task from `asyncio.ensure_future` is not kept · ×1
Task from `asyncio.ensure_future` is not kept src/agentscope/app/_manager/_background_task_manager.py:321— The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×1
Recursive walk over a caller-supplied document has no depth cap src/agentscope/app/_service/_mcp_render.py:93— `render_mcp` is public, takes a document from its caller (line 103) and hands it to `_substitute`, which calls itself at line 93 (`_substitute`) with a piece of `node` (and at line 98) — and nowhere in `_substitute` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_substitute` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
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:298— `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:1069— `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:1063— `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:2568— `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:334— `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:324— `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:398— `getattr(delta_audio, "transcript", "") or ""` appears character-identically in 2 files — src/agentscope/model/_dashscope/_model.py, src/agentscope/model/_openai_chat/_model.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/agentscope/tool/_builtin/_glob.py:261— `head_limit is not None and head_limit < 0` appears character-identically in 2 files — src/agentscope/tool/_builtin/_glob.py, src/agentscope/tool/_builtin/_grep.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:61— `host_cache_dir is not None and not host_cache_dir.strip()` appears character-identically in 2 files — src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py, src/agentscope/workspace/_bubblewrap/_bubblewrap_workspace.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/model_examples/_utils.py:54— `isinstance(block, DataBlock) and isinstance( block.source, Base64Source, )` appears character-identically in 3 files — scripts/model_examples/_utils.py, src/agentscope/app/channel/_feishu/_channel.py, src/agentscope/workspace/_base.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/agentscope/agent/_agent.py:827— `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:457— `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:449— `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:468— `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/tui/_ask_user.py:235— `not self.is_mounted or not self._pending` appears character-identically in 2 files — src/agentscope/tui/_ask_user.py, src/agentscope/tui/_chat.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:506— `os.path.islink(path) or not os.path.isdir(path)` appears character-identically in 2 files — src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py, src/agentscope/workspace/_bubblewrap/_bubblewrap_workspace.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/agentscope/asr/_asr_model_card.py:91— `override is None or override.get("hidden")` appears character-identically in 2 files — src/agentscope/asr/_asr_model_card.py, src/agentscope/realtime/_model_card.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Silent fallback default 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:948— `_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:125— `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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 22 significant file(s) lose their only recent owner: src/agentscope/tts/_dashscope/_realtime_model.py, scripts/model_examples/dashscope_multimodal.py, scripts/model_examples/openai_chat_multimodal.py, scripts/model_examples/anthropic_multimodal.py, scripts/model_examples/_utils.py, scripts/model_examples/gemini_multimodal.py, scripts/model_examples/moonshot_multimodal.py, src/agentscope/middleware/_tracing/_converter.py (+14 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 17 significant file(s) lose their only recent owner: src/agentscope/app/_service/_workspace.py, scripts/issue_triage.py, src/agentscope/app/middleware/_tool_offload_middleware.py, src/agentscope/sop/_schema.py, src/agentscope/app/_tool/_team_say.py, src/agentscope/app/channel/_clients.py, src/agentscope/realtime/_base.py, src/agentscope/app/_service/_channel.py (+9 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:420— `debug` at line 420 is called with an argument built by `list(data)` (line 420), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted src/agentscope/middleware/_rag.py:526— `debug` at line 526 is called with an argument built by `[ranked[i].chunk.source for i in ids]` (line 528), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
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 (42 single-owned of 373 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; 373 of the 565 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/tool/_builtin/_powershell.py, src/agentscope/app/middleware/_protocol/_base.py, src/agentscope/rag/_parser/_pdf.py.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 1 of 1 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `(repository root)` (122377 LoC, 1015 module-visible types across 120 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 1 of 373 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 373 of the 565 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: src/agentscope/workspace/_k8s/_k8s_backend.py. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
Orphaned file src/agentscope/workspace/_k8s/_k8s_backend.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
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.
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 46863 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
No 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 — 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.
No release approval gate — Deployment is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever reaches the release trigger goes to production unreviewed, so a mistaken merge or tag is live before anyone can stop it.
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.
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.
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.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a1a394-d4a7-7168-ae3c-af47861da27e · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 34 · Warnings: 607 · Recommendations: 52 · Info: 1 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 03-11-2026 @ 22:43 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.