Public report of openai/openai-python, 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.1). 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, 19:24 UTC · Survey ID cd_a255373741124a86a4a534c4bae16256
openai/openai-python
Measured 3 November 2026, 19:23 UTC, at code version 4bc7f90
CAI scoreAt riskNo change 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: 201,301 lines of product code in 1 project, tests not counted · Estimated rebuild effort: about 2.4 person-years · Weakest lens: Code Health, 57
Findings by how serious they are
237 critical730 serious112 minor
14 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
3 November 2026, 19:23 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
68of 68 dimensions measured by tools.
1068of 1079 findings point to an exact file and line, so you can open each one in the code. The other 11 concern the repository as a whole, such as missing documentation.
68dimensions across 6 lenses, read from 201,301 lines of product code in 1 project.
openai/openai-python is rated At risk because critical security findings are open, most of them leaked passwords or keys. It scores 62 out of 100, which the At risk rating leaves unchanged.
Code Health, at 57, is the weakest lens and counts most in the score. The best first steps are adding type checking and removing the blocking calls, each worth about 4 points. Raising Code Health to 70 would lift the score to about 65.
223 passwords or keys are open to anyone who can read the repository. Four known security holes in the packages the code depends on can be used by attackers, and ten parts of the code are no longer understood by anyone working on it. Replacing each exposed password or key, updating the vulnerable packages and having someone learn the forgotten files would close these risks.
The product code is 201,301 lines, about €340,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Code Health rose from 57 to 70, the lowest score rated Strong, the score would rise from 62 to about 65.
Code composition: what the lines of code are
Product code 65%Tests 35%
New since the last survey: 238 findings
These 238 critical or serious findings weren't in the previous survey, on 20 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 148 findings
These 148 critical or serious findings were in the previous survey, on 20 October 2026, and are gone from this one. The first 100 are listed here.
€110,000 to €570,000, for 1,896 to 6,016 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.8 at a score of 62. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Large: 201,301 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
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Raises the score by about 4 points · Medium effort · Type Safety
2
TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
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 €340,000 to build again, about 2.4 person-years of work. Its weakest lens is Code Health, at 57 (Adequate). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up. Of all the actions in this report, it raises the score most for the work it takes: about 4 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 7.1 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 2% to 5% on every change. The history of the code shows how much it changes: about 383,301 lines over the last 90 days, which is about 1,554,498 lines a year. At that pace, the extra work comes to an estimated 83.9 to 518.2 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.
1782 modules, with 1953 dependencies between them. One loop runs through 131 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 1742 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.
types.beta.agent_session uses _models, so a change to _models can break types.beta.agent_session, while a change to types.beta.agent_session can't break _models.
Position
Below the diagonal: types.beta.agent_session uses a module listed above it, which is the healthy direction.
types.beta.agent_session_environment_state uses _models, so a change to _models can break types.beta.agent_session_environment_state, while a change to types.beta.agent_session_environment_state can't break _models.
Position
Below the diagonal: types.beta.agent_session_environment_state uses a module listed above it, which is the healthy direction.
types.beta.agents.sessions.turn uses _models, so a change to _models can break types.beta.agents.sessions.turn, while a change to types.beta.agents.sessions.turn can't break _models.
Position
Below the diagonal: types.beta.agents.sessions.turn uses a module listed above it, which is the healthy direction.
types.beta.assistant_stream_event uses _models, so a change to _models can break types.beta.assistant_stream_event, while a change to types.beta.assistant_stream_event can't break _models.
Position
Below the diagonal: types.beta.assistant_stream_event uses a module listed above it, which is the healthy direction.
types.beta.beta_response uses _models, so a change to _models can break types.beta.beta_response, while a change to types.beta.beta_response can't break _models.
Position
Below the diagonal: types.beta.beta_response uses a module listed above it, which is the healthy direction.
types.beta.beta_responses_server_event uses _models, so a change to _models can break types.beta.beta_responses_server_event, while a change to types.beta.beta_responses_server_event can't break _models.
Position
Below the diagonal: types.beta.beta_responses_server_event uses a module listed above it, which is the healthy direction.
types.responses.response uses _models, so a change to _models can break types.responses.response, while a change to types.responses.response can't break _models.
Position
Below the diagonal: types.responses.response uses a module listed above it, which is the healthy direction.
types.responses.responses_server_event uses _models, so a change to _models can break types.responses.responses_server_event, while a change to types.responses.responses_server_event can't break _models.
Position
Below the diagonal: types.responses.responses_server_event uses a module listed above it, which is the healthy direction.
resources.admin.organization.groups.groups uses _resource, so a change to _resource can break resources.admin.organization.groups.groups, while a change to resources.admin.organization.groups.groups can't break _resource.
Position
Below the diagonal: resources.admin.organization.groups.groups uses a module listed above it, which is the healthy direction.
resources.admin.organization.projects.projects uses _resource, so a change to _resource can break resources.admin.organization.projects.projects, while a change to resources.admin.organization.projects.projects can't break _resource.
Position
Below the diagonal: resources.admin.organization.projects.projects uses a module listed above it, which is the healthy direction.
resources.admin.organization.usage uses _resource, so a change to _resource can break resources.admin.organization.usage, while a change to resources.admin.organization.usage can't break _resource.
Position
Below the diagonal: resources.admin.organization.usage uses a module listed above it, which is the healthy direction.
resources.audio.audio uses _resource, so a change to _resource can break resources.audio.audio, while a change to resources.audio.audio can't break _resource.
Position
Below the diagonal: resources.audio.audio uses a module listed above it, which is the healthy direction.
resources.beta.agents.sessions.artifacts uses _legacy_response, so a change to _legacy_response can break resources.beta.agents.sessions.artifacts, while a change to resources.beta.agents.sessions.artifacts can't break _legacy_response.
Position
Below the diagonal: resources.beta.agents.sessions.artifacts uses a module listed above it, which is the healthy direction.
resources.beta.agents.sessions.artifacts uses _resource, so a change to _resource can break resources.beta.agents.sessions.artifacts, while a change to resources.beta.agents.sessions.artifacts can't break _resource.
Position
Below the diagonal: resources.beta.agents.sessions.artifacts uses a module listed above it, which is the healthy direction.
resources.beta.realtime.realtime uses types.websocket_connection_options, so a change to types.websocket_connection_options can break resources.beta.realtime.realtime, while a change to resources.beta.realtime.realtime can't break types.websocket_connection_options.
Position
Below the diagonal: resources.beta.realtime.realtime uses a module listed above it, which is the healthy direction.
resources.beta.realtime.realtime uses _resource, so a change to _resource can break resources.beta.realtime.realtime, while a change to resources.beta.realtime.realtime can't break _resource.
Position
Below the diagonal: resources.beta.realtime.realtime uses a module listed above it, which is the healthy direction.
22→36 resources.beta.realtime.realtime uses _clientpart of a loop✕
Connections
2 pairs of types, where a type in resources.beta.realtime.realtime uses a type in _client.
resources.beta.realtime.realtime uses _client, so a change to _client can break resources.beta.realtime.realtime, while a change to resources.beta.realtime.realtime can't break _client.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
resources.beta.responses.responses uses _websocket_connection, so a change to _websocket_connection can break resources.beta.responses.responses, while a change to resources.beta.responses.responses can't break _websocket_connection.
Position
Below the diagonal: resources.beta.responses.responses uses a module listed above it, which is the healthy direction.
resources.beta.responses.responses uses types.websocket_connection_options, so a change to types.websocket_connection_options can break resources.beta.responses.responses, while a change to resources.beta.responses.responses can't break types.websocket_connection_options.
Position
Below the diagonal: resources.beta.responses.responses uses a module listed above it, which is the healthy direction.
resources.beta.responses.responses uses _resource, so a change to _resource can break resources.beta.responses.responses, while a change to resources.beta.responses.responses can't break _resource.
Position
Below the diagonal: resources.beta.responses.responses uses a module listed above it, which is the healthy direction.
resources.beta.responses.responses uses types.beta.beta_response, so a change to types.beta.beta_response can break resources.beta.responses.responses, while a change to resources.beta.responses.responses can't break types.beta.beta_response.
Position
Below the diagonal: resources.beta.responses.responses uses a module listed above it, which is the healthy direction.
23→36 resources.beta.responses.responses uses _clientpart of a loop✕
Connections
2 pairs of types, where a type in resources.beta.responses.responses uses a type in _client.
resources.beta.responses.responses uses _client, so a change to _client can break resources.beta.responses.responses, while a change to resources.beta.responses.responses can't break _client.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
resources.beta.threads.threads uses _resource, so a change to _resource can break resources.beta.threads.threads, while a change to resources.beta.threads.threads can't break _resource.
Position
Below the diagonal: resources.beta.threads.threads uses a module listed above it, which is the healthy direction.
resources.evals.evals uses _resource, so a change to _resource can break resources.evals.evals, while a change to resources.evals.evals can't break _resource.
Position
Below the diagonal: resources.evals.evals uses a module listed above it, which is the healthy direction.
resources.live.live uses _websocket_connection, so a change to _websocket_connection can break resources.live.live, while a change to resources.live.live can't break _websocket_connection.
Position
Below the diagonal: resources.live.live uses a module listed above it, which is the healthy direction.
resources.live.live uses types.websocket_connection_options, so a change to types.websocket_connection_options can break resources.live.live, while a change to resources.live.live can't break types.websocket_connection_options.
Position
Below the diagonal: resources.live.live uses a module listed above it, which is the healthy direction.
resources.live.live uses _resource, so a change to _resource can break resources.live.live, while a change to resources.live.live can't break _resource.
Position
Below the diagonal: resources.live.live uses a module listed above it, which is the healthy direction.
26→36 resources.live.live uses _clientpart of a loop✕
Connections
2 pairs of types, where a type in resources.live.live uses a type in _client.
resources.realtime.translations.translations uses _websocket_connection, so a change to _websocket_connection can break resources.realtime.translations.translations, while a change to resources.realtime.translations.translations can't break _websocket_connection.
Position
Below the diagonal: resources.realtime.translations.translations uses a module listed above it, which is the healthy direction.
resources.realtime.translations.translations uses types.websocket_connection_options, so a change to types.websocket_connection_options can break resources.realtime.translations.translations, while a change to resources.realtime.translations.translations can't break types.websocket_connection_options.
Position
Below the diagonal: resources.realtime.translations.translations uses a module listed above it, which is the healthy direction.
resources.realtime.translations.translations uses _resource, so a change to _resource can break resources.realtime.translations.translations, while a change to resources.realtime.translations.translations can't break _resource.
Position
Below the diagonal: resources.realtime.translations.translations uses a module listed above it, which is the healthy direction.
27→36 resources.realtime.translations.translations uses _clientpart of a loop✕
Connections
2 pairs of types, where a type in resources.realtime.translations.translations uses a type in _client.
resources.realtime.translations.translations uses _client, so a change to _client can break resources.realtime.translations.translations, while a change to resources.realtime.translations.translations can't break _client.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
resources.responses.responses uses _websocket_connection, so a change to _websocket_connection can break resources.responses.responses, while a change to resources.responses.responses can't break _websocket_connection.
Position
Below the diagonal: resources.responses.responses uses a module listed above it, which is the healthy direction.
resources.responses.responses uses types.websocket_connection_options, so a change to types.websocket_connection_options can break resources.responses.responses, while a change to resources.responses.responses can't break types.websocket_connection_options.
Position
Below the diagonal: resources.responses.responses uses a module listed above it, which is the healthy direction.
resources.responses.responses uses _resource, so a change to _resource can break resources.responses.responses, while a change to resources.responses.responses can't break _resource.
Position
Below the diagonal: resources.responses.responses uses a module listed above it, which is the healthy direction.
resources.responses.responses uses types.responses.response, so a change to types.responses.response can break resources.responses.responses, while a change to resources.responses.responses can't break types.responses.response.
Position
Below the diagonal: resources.responses.responses uses a module listed above it, which is the healthy direction.
28→36 resources.responses.responses uses _clientpart of a loop✕
Connections
2 pairs of types, where a type in resources.responses.responses uses a type in _client.
resources.responses.responses uses _client, so a change to _client can break resources.responses.responses, while a change to resources.responses.responses can't break _client.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
resources.videos uses _legacy_response, so a change to _legacy_response can break resources.videos, while a change to resources.videos can't break _legacy_response.
Position
Below the diagonal: resources.videos uses a module listed above it, which is the healthy direction.
resources.webhooks.webhooks uses _resource, so a change to _resource can break resources.webhooks.webhooks, while a change to resources.webhooks.webhooks can't break _resource.
Position
Below the diagonal: resources.webhooks.webhooks uses a module listed above it, which is the healthy direction.
resources.admin.organization.organization uses _resource, so a change to _resource can break resources.admin.organization.organization, while a change to resources.admin.organization.organization can't break _resource.
Position
Below the diagonal: resources.admin.organization.organization uses a module listed above it, which is the healthy direction.
resources.admin.organization.organization uses resources.admin.organization.groups.groups, so a change to resources.admin.organization.groups.groups can break resources.admin.organization.organization, while a change to resources.admin.organization.organization can't break resources.admin.organization.groups.groups.
Position
Below the diagonal: resources.admin.organization.organization uses a module listed above it, which is the healthy direction.
resources.admin.organization.organization uses resources.admin.organization.projects.projects, so a change to resources.admin.organization.projects.projects can break resources.admin.organization.organization, while a change to resources.admin.organization.organization can't break resources.admin.organization.projects.projects.
Position
Below the diagonal: resources.admin.organization.organization uses a module listed above it, which is the healthy direction.
resources.admin.organization.organization uses resources.admin.organization.usage, so a change to resources.admin.organization.usage can break resources.admin.organization.organization, while a change to resources.admin.organization.organization can't break resources.admin.organization.usage.
Position
Below the diagonal: resources.admin.organization.organization uses a module listed above it, which is the healthy direction.
resources.beta.agents.sessions.sessions uses _resource, so a change to _resource can break resources.beta.agents.sessions.sessions, while a change to resources.beta.agents.sessions.sessions can't break _resource.
Position
Below the diagonal: resources.beta.agents.sessions.sessions uses a module listed above it, which is the healthy direction.
resources.beta.agents.sessions.sessions uses types.beta.agent_session, so a change to types.beta.agent_session can break resources.beta.agents.sessions.sessions, while a change to resources.beta.agents.sessions.sessions can't break types.beta.agent_session.
Position
Below the diagonal: resources.beta.agents.sessions.sessions uses a module listed above it, which is the healthy direction.
resources.beta.agents.sessions.sessions uses resources.beta.agents.sessions.artifacts, so a change to resources.beta.agents.sessions.artifacts can break resources.beta.agents.sessions.sessions, while a change to resources.beta.agents.sessions.sessions can't break resources.beta.agents.sessions.artifacts.
Position
Below the diagonal: resources.beta.agents.sessions.sessions uses a module listed above it, which is the healthy direction.
resources.realtime.realtime uses _websocket_connection, so a change to _websocket_connection can break resources.realtime.realtime, while a change to resources.realtime.realtime can't break _websocket_connection.
Position
Below the diagonal: resources.realtime.realtime uses a module listed above it, which is the healthy direction.
resources.realtime.realtime uses types.websocket_connection_options, so a change to types.websocket_connection_options can break resources.realtime.realtime, while a change to resources.realtime.realtime can't break types.websocket_connection_options.
Position
Below the diagonal: resources.realtime.realtime uses a module listed above it, which is the healthy direction.
resources.realtime.realtime uses _resource, so a change to _resource can break resources.realtime.realtime, while a change to resources.realtime.realtime can't break _resource.
Position
Below the diagonal: resources.realtime.realtime uses a module listed above it, which is the healthy direction.
resources.realtime.realtime uses resources.realtime.translations.translations, so a change to resources.realtime.translations.translations can break resources.realtime.realtime, while a change to resources.realtime.realtime can't break resources.realtime.translations.translations.
Position
Below the diagonal: resources.realtime.realtime uses a module listed above it, which is the healthy direction.
33→36 resources.realtime.realtime uses _clientpart of a loop✕
Connections
2 pairs of types, where a type in resources.realtime.realtime uses a type in _client.
resources.realtime.realtime uses _client, so a change to _client can break resources.realtime.realtime, while a change to resources.realtime.realtime can't break _client.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
resources.beta.agents.agents uses _resource, so a change to _resource can break resources.beta.agents.agents, while a change to resources.beta.agents.agents can't break _resource.
Position
Below the diagonal: resources.beta.agents.agents uses a module listed above it, which is the healthy direction.
resources.beta.agents.agents uses resources.beta.agents.sessions.sessions, so a change to resources.beta.agents.sessions.sessions can break resources.beta.agents.agents, while a change to resources.beta.agents.agents can't break resources.beta.agents.sessions.sessions.
Position
Below the diagonal: resources.beta.agents.agents uses a module listed above it, which is the healthy direction.
resources.beta.beta uses _resource, so a change to _resource can break resources.beta.beta, while a change to resources.beta.beta can't break _resource.
Position
Below the diagonal: resources.beta.beta uses a module listed above it, which is the healthy direction.
resources.beta.beta uses resources.beta.realtime.realtime, so a change to resources.beta.realtime.realtime can break resources.beta.beta, while a change to resources.beta.beta can't break resources.beta.realtime.realtime.
Position
Below the diagonal: resources.beta.beta uses a module listed above it, which is the healthy direction.
resources.beta.beta uses resources.beta.responses.responses, so a change to resources.beta.responses.responses can break resources.beta.beta, while a change to resources.beta.beta can't break resources.beta.responses.responses.
Position
Below the diagonal: resources.beta.beta uses a module listed above it, which is the healthy direction.
resources.beta.beta uses resources.beta.threads.threads, so a change to resources.beta.threads.threads can break resources.beta.beta, while a change to resources.beta.beta can't break resources.beta.threads.threads.
Position
Below the diagonal: resources.beta.beta uses a module listed above it, which is the healthy direction.
resources.beta.beta uses resources.beta.agents.agents, so a change to resources.beta.agents.agents can break resources.beta.beta, while a change to resources.beta.beta can't break resources.beta.agents.agents.
Position
Below the diagonal: resources.beta.beta uses a module listed above it, which is the healthy direction.
_client uses resources.audio.audio, so a change to resources.audio.audio can break _client, while a change to _client can't break resources.audio.audio.
Position
Below the diagonal: _client uses a module listed above it, which is the healthy direction.
_client uses resources.evals.evals, so a change to resources.evals.evals can break _client, while a change to _client can't break resources.evals.evals.
Position
Below the diagonal: _client uses a module listed above it, which is the healthy direction.
_client uses resources.responses.responses, so a change to resources.responses.responses can break _client, while a change to _client can't break resources.responses.responses.
Position
Below the diagonal: _client uses a module listed above it, which is the healthy direction.
_client uses resources.webhooks.webhooks, so a change to resources.webhooks.webhooks can break _client, while a change to _client can't break resources.webhooks.webhooks.
Position
Below the diagonal: _client uses a module listed above it, which is the healthy direction.
_client uses resources.realtime.realtime, so a change to resources.realtime.realtime can break _client, while a change to _client can't break resources.realtime.realtime.
Position
Below the diagonal: _client uses a module listed above it, which is the healthy direction.
_module_client uses resources.audio.audio, so a change to resources.audio.audio can break _module_client, while a change to _module_client can't break resources.audio.audio.
Position
Below the diagonal: _module_client uses a module listed above it, which is the healthy direction.
_module_client uses resources.evals.evals, so a change to resources.evals.evals can break _module_client, while a change to _module_client can't break resources.evals.evals.
Position
Below the diagonal: _module_client uses a module listed above it, which is the healthy direction.
_module_client uses resources.live.live, so a change to resources.live.live can break _module_client, while a change to _module_client can't break resources.live.live.
Position
Below the diagonal: _module_client uses a module listed above it, which is the healthy direction.
_module_client uses resources.responses.responses, so a change to resources.responses.responses can break _module_client, while a change to _module_client can't break resources.responses.responses.
Position
Below the diagonal: _module_client uses a module listed above it, which is the healthy direction.
_module_client uses resources.videos, so a change to resources.videos can break _module_client, while a change to _module_client can't break resources.videos.
Position
Below the diagonal: _module_client uses a module listed above it, which is the healthy direction.
_module_client uses resources.webhooks.webhooks, so a change to resources.webhooks.webhooks can break _module_client, while a change to _module_client can't break resources.webhooks.webhooks.
Position
Below the diagonal: _module_client uses a module listed above it, which is the healthy direction.
_module_client uses resources.realtime.realtime, so a change to resources.realtime.realtime can break _module_client, while a change to _module_client can't break resources.realtime.realtime.
Position
Below the diagonal: _module_client uses a module listed above it, which is the healthy direction.
_module_client uses resources.beta.beta, so a change to resources.beta.beta can break _module_client, while a change to _module_client can't break resources.beta.beta.
Position
Below the diagonal: _module_client uses a module listed above it, which is the healthy direction.
lib.responses_tool_runner uses types.responses.response, so a change to types.responses.response can break lib.responses_tool_runner, while a change to lib.responses_tool_runner can't break types.responses.response.
Position
Below the diagonal: lib.responses_tool_runner uses a module listed above it, which is the healthy direction.
lib.responses_tool_runner uses _client, so a change to _client can break lib.responses_tool_runner, while a change to lib.responses_tool_runner can't break _client.
Position
Below the diagonal: lib.responses_tool_runner uses a module listed above it, which is the healthy direction.
lib uses resources.beta.threads.threads, so a change to resources.beta.threads.threads can break lib, while a change to lib can't break resources.beta.threads.threads.
Position
Below the diagonal: lib uses a module listed above it, which is the healthy direction.
lib uses resources.responses.responses, so a change to resources.responses.responses can break lib, while a change to lib can't break resources.responses.responses.
Position
Below the diagonal: lib uses a module listed above it, which is the healthy direction.
lib uses lib.responses_tool_runner, so a change to lib.responses_tool_runner can break lib, while a change to lib can't break lib.responses_tool_runner.
Position
Below the diagonal: lib uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 57% · Adequate · gated by D2, R1 ·
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
A07:2025 — Authentication Failures
224
High / Critical
A03:2025 — Software Supply Chain Failures
7
High / Critical
A02:2025 — Security Misconfiguration
1
Medium
Roadmap
Top priorities: Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up; TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants; Swallowed exception (empty catch).
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
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.
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 — 237
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 — 730
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 — 112
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 14
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 68 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 — 68 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, 1068 of 1079 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 MEASURED: test source is present (.py, .cjs) but the built-in coverage collector has no runner for this repository's ecosystem — so this suite was never executed by it. Not scored — this is a gap in the analyzer's language coverage, not a defect in the repo. To have real coverage read, produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`, or lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`, or lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
D10 Test Quality — measured, with a gap in what it reached — 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. The 9 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 385 test source file(s) (.py) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
D11 Test Reliability — not measured this run — 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. Test source is present (.py, .cjs) and this repository declares a Python test suite (2 distributions), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
D12 Dependency Hygiene — 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. Not scored — 6 shipped Python distribution(s) were read, but the outdated signal needs pypi.org, and no declaration here carries an exact pin to ask about — a floor or a range installs the newest release it admits and cannot be behind one, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its Python distribution dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape 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. This says nothing about whether that surface is consistent.
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.
AX6 Interface segregation — 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 is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing 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 REDACTED (examples/computer-desktop/guest/container/Dockerfile). docker build failed (exit 1) — 6 | chmod 755 /usr/local/bin/chromium 7 | >>> COPY action.py start.py fixture.html bridge.py /opt/desktop/ 8 | USER 0:0 9 | ENV HOME=/home/desktop DISPLAY=:1 -------------------- ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref fc80c456-7d44-422b-ba02-0abbd6fe0a35::6u45985f9t9npxaju29adu7bu: "/start.py": not found; 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 this repository's Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
P5 DR & Backup — 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. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
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.
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 (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
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.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality 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 REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
M4 Documentation accuracy: 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 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 1 body over 120 down to 120 or less in Cyclomatic Complexity — start with check-dependency-security.simple_marker_overlap (cyclomatic 137). — Refactoring it lifts Cyclomatic Complexity from 5.7 to about 5.8/10.
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.
+ 134 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 1 body over 240 down to 240 or less in Cognitive Complexity — start with check-dependency-security.simple_marker_overlap (cognitive 406). — Refactoring it lifts Cognitive Complexity from 3.9 to about 4.5/10.
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.0 / 10Stronggated by 39 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 39 FileTooLong finding(s) in God Classes — start with responses.py (2), realtime.py (2), responses_tool_runner.py. — One of this dimension's main actionable groups (39 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.
300 duplicated block group(s) detected. A further 47 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 5 of the 347 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.
+ 138 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 13 Duplicated block (17 lines × 2) finding(s) in Code Duplication — start with responses.py (4), roles.py (2), spend_alerts.py (2). — One of this dimension's main actionable groups (13 warning-level).
Resolve the 11 Duplicated block (15 lines × 2) finding(s) in Code Duplication — start with responses.py (3), external_keys.py (2), _base_client.py. — One of this dimension's main actionable groups (11 warning-level).
Resolve the 10 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with spend_limit.py (4), responses.py (3), _transform.py. — One of this dimension's main actionable groups (10 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 _client.py (2), _base_client.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 Distribution10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
5504 test methods: 5504 unit, 0 integration, 0 BDD, 0 e2e. The JavaScript/TypeScript suite contributes 9 `it`/`test` case(s) across 2 test file(s) declaring at least one; its tier split is read from package names and paths only. The Python suite contributes 5495 test function(s) across 310 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
1 skipped (1 with a documented reason), 0 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 9 tests. Measured on the JavaScript/TypeScript suite only — at least 385 test source file(s) (.py) went unread, so its test quality is unmeasured and is not in these counts.
Skipped (documented): devcontainer installs the pinned toolchain and bootstraps local toolstests/node-tooling.test.cjs:132
✓ On the Gold path — maintain.
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
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 15 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 6 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (9 reached that way). Requirements it states ONLY under an extra, a PEP 735 dependency group, a Poetry dev group or a dev-named requirements file are excluded: pip does not install any of them for a consumer. ★ This repository commits no dependency lockfile that this pass reads, so each licence is the one PyPI publishes for the distribution's CURRENT release rather than for a pinned version. This repository publishes itself under Apache-2.0, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's Python distribution dependencies and nothing else. The repository also declares package.json, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.
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/openai/_base_client.py (14×26=364); src/openai/lib/responses_websocket/_accumulator.py (3×89=267); src/openai/lib/azure.py (13×16=208) Repeated repair below the complexity floor: src/openai/resources/beta/realtime/realtime.py (10 of 12 changes were fixes); src/openai/lib/_parsing/_responses.py (5 of 6 changes were fixes); src/openai/lib/realtime_translation.py (3 of 3 changes were fixes)
Resolve the 14 Hotspot finding(s) in Churn × Complexity Hotspots — start with bedrock.py (2), _base_client.py, _accumulator.py. — One of this dimension's main actionable groups (14 warning-level).
Resolve the 3 Repeated repair finding(s) in Churn × Complexity Hotspots — start with realtime.py, _responses.py, realtime_translation.py. — One of this dimension's main actionable groups (3 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor9.6 / 10Exemplary✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
21 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is scripts/check-dependency-security.py. Counted over 519 of the 2063 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Off-boarding risk: anonymized user #1 · ×3
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
28 deducted task-comment markers across 201301 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
TodoComment · ×28tests/test_client.py:354
What to do
Resolve the 28 TodoComment finding(s) in Explicit Debt — start with _base_client.py (7), _transform.py (4), test_client.py (2). — One of this dimension's main actionable groups (28 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 (npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.
Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
77 % of calls cross a namespace and 0 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
223 finding(s): 0 critical, 223 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
What to do
Resolve the 223 REDACTED finding(s) in Secrets (history) — start with REDACTED (121), REDACTED (101), REDACTED. — One of this dimension's main actionable groups (223 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
semgrep found no security issues. semgrep hit a parse error in 1 file(s) — `examples/generate_file.sh` — 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.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.
Resolve the 1 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Critical vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
87 of 519 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is src/openai/resources/admin/organization/certificates.py. Counted over 519 of the 2063 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Resolve the 10 Orphaned knowledge finding(s) in Knowledge Freshness — start with roles.py (6), groups.py (2), certificates.py. — One of this dimension's main actionable groups (10 issue-level).
Resolve the 77 Orphaned file finding(s) in Knowledge Freshness — start with spend_limit.py (2), data_retention.py (2), realtime_server_event.py (2). — One of this dimension's main actionable groups (77 recommendation-level).
Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 7 Change coupling finding(s) in Change Coupling — start with beta_responses_client_event_param.py (2), beta_responses_client_event.py (2), forks.py. — One of this dimension's main actionable groups (7 warning-level).
Resolve the 2 Change-coupling hub finding(s) in Change Coupling — start with response_compact_params.py, realtime.py. — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 3 platform declaration(s) and 6 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.
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.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the 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.
`.github/dependabot.yml` schedules updates, but no `package-ecosystem` entry covers `pip`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list. — .github/dependabot.yml:2
What to do
Dependabot is configured but does not watch `pip` — add that `package-ecosystem` entry to .github/dependabot.yml so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
Readiness · 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.
`spawnSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×4) — scripts/steady/test.cjs:40, scripts/steady/test.cjs:48, scripts/steady/test.cjs:50, …
`fs.mkdirSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/steady/test.cjs:42
`fs.copyFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/steady/test.cjs:44
`fs.readFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — scripts/steady/test.cjs:64, scripts/steady/test.cjs:75
`fs.writeFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×6) — scripts/steady/test.cjs:67, scripts/steady/test.cjs:71, scripts/steady/test.cjs:78, …
`fs.appendFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — scripts/steady/test.cjs:68, scripts/steady/test.cjs:76
`fs.existsSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/steady/test.cjs:70
`fs.unlinkSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×3) — scripts/steady/test.cjs:72, scripts/steady/test.cjs:84, scripts/steady/test.cjs:91
`fs.renameSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×4) — scripts/steady/test.cjs:81, scripts/steady/test.cjs:85, scripts/steady/test.cjs:88, …
What to do
TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
Do you agree with this assessment?
R1 · Type Safety0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
0 typed · 8 plain JS — the untyped files are scripts/steady/publication.test.cjs, scripts/steady/publish.cjs, scripts/steady/source-sha256.cjs, scripts/steady/test.cjs, scripts/steady/update.cjs, scripts/utils/node-tooling.cjs (+2 more).
What to do
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Deterministic.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
Do you agree with this assessment?
R3 · Large Files10.0 / 10Exemplary✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
Do you agree with this assessment?
R4 · Test Coverage6.0 / 10Adequate✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×2) — scripts/steady/update.cjs:1, scripts/steady/source-sha256.cjs:1
What to do
Add tests that import the unreached modules (directly or through their public entry).
Do you agree with this assessment?
R6 · Tooling3.4 / 10Weak✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
test ✓ · lint ✗ · typecheck ✗ — read from this repository's package.json scripts and corroborated against its CI workflows. A script counts when its name or command matches the step: `test` for the suite, `lint` or `prettier` for linting, `typecheck`/`type-check`/`tsc` for type checking. ✗ therefore means no script or CI step under those names was found, NOT that the step is absent from your pipeline — a task invoked by a runner this check does not read, or named something else entirely, is not seen and is worth confirming before acting on a cross. A ✓ means the wiring is DECLARED — a script or CI step under those names exists. It is not a statement that the step passes, or that it runs at all: nothing here installs a dependency or executes a suite.
What to do
Add eslint and type checking (adopt TypeScript, or type-check the existing JavaScript with `checkJs`) as package.json scripts and run them in CI.
Do you agree with this assessment?
R7 · Dead Code7.0 / 10Strong✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Unreachable from the 5 application, 1 tooling and 3 test entry point(s) detected in this repo. This repository declares no build, type-check or test script, so nothing here would fail on a wrong deletion — confirm by hand that nothing loads each file (including by a path built at runtime) before removing it. An undetected custom entry would make these reachable.
no import path from any entry point (5 application, 1 tooling, 3 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make — scripts/utils/node-tooling.cjs
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.
Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception. — src/openai/_base_client.py:1617
What to do
Task from `asyncio.get_running_loop().create_task` is not kept
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.
Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.
Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document2.2 / 10Critical✓ Tool-verified
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.
`construct_type` is public and takes `type_: object` from its caller, and it calls itself at line 665 (`construct_type`) with a piece of `type_` (and at line 670, line 682, line 704) — and nowhere in `construct_type` 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 `construct_type` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/openai/_models.py:665
`extract_files` is public, takes a document from its caller (line 41) and hands it to `_extract_items`, which calls itself at line 130 (`_extract_items`) with a piece of `obj` (and at line 143) — and nowhere in `_extract_items` 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 `_extract_items` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/openai/_utils/_utils.py:130
`json_safe` is public and takes `data: object` from its caller, and it calls itself at line 429 (`json_safe`) with a piece of `data` (and at line 432) — and nowhere in `json_safe` 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 `json_safe` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/openai/_utils/_utils.py:429
What to do
Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.
Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back. Also whether a `finally` that gives the primitive back unconditionally can run in a state where the method does not hold it: after a timed wait whose result was discarded, after an acquire inside the `try` that can fail, after the body already released it, or never, because a `return` left between the acquire and the `try`.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X24 · Document value interpolated into markup 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.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×10) — src/openai/_base_client.py:497, src/openai/_models.py:642, src/openai/_websocket_connection.py:607, …
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 `__del__()` 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. (×2) — src/openai/_base_client.py:997, src/openai/_base_client.py:1618
`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. (×10) — src/openai/_base_client.py:2257, src/openai/_base_client.py:2331, src/openai/_base_client.py:2338, …
What to do
Swallowed exception (empty catch)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
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 — 2 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
X10 Duplicated predicate — 18 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 5 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 — 61 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 applicable: this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
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
AX6 Interface segregation — not assessed — interface segregation is computed over a type surface 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) — 6 | chmod 755 /usr/local/bin/chromium 7 | >>> COPY action.py start.py fixture.html bridge.py /opt/desktop/ 8 | USER 0:0 9 | ENV HOME=/home/desktop DISPLAY=:1 -------------------- ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref fc80c456-7d44-422b-ba02-0abbd6fe0a35::6u45985f9t9npxaju29adu7bu: "/start.py": not found; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C2 Access Controls — No access-control surface detected in the analyzed source — this repository registers no route and starts no server another machine can reach (no Flask/FastAPI/Starlette route, Django urlpatterns or class-based view, Tornado handler). Access control is therefore N/A here — a library or command-line tool is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
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.
D11 Test Reliability — Test reliability not included — the .py suite was found but not re-run
D12 Dependency Hygiene — Not scored — 6 shipped Python distribution(s) were read, but the outdated signal needs pypi.org, and no declaration here carries an exact pin to ask about — a floor or a range installs the newest release it admits and cannot be behind one, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
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 — API consistency is measured on C# only; the exposed Python surface was not measured.
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. 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) — 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.
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
DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (2054 value object(s))
ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P2 Observability — This repository's Python source (1 module(s), 2053 file(s) read) declares no entry point and bootstraps no server, and nothing here deploys a service — it is a library, run inside whatever hosts it, so production observability (structured logging, tracing/metrics, health checks) is N/A. If it grows a binary or a service, the dimension reactivates.
P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript, Python source, so there is no service whose uptime a failing dependency could take down
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for a pytest-benchmark or pytest-codspeed dependency with tests taking the `benchmark` fixture, an asv.conf.json with its `time_`/`mem_`/`peakmem_` benchmarks, or a pyperf Runner, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
PF2 Allocation hygiene — Not applicable: Python runs on a garbage-collected runtime that gives a program no allocation-control idiom to choose on a hot path — no pools, stack allocation or value types — so allocation awareness is not something this code can be rated on.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
R5 Dependency Freshness — uses a pnpm lockfile — dependency freshness not measured here; JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
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.
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.
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.
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.
Orphaned knowledge src/openai/resources/admin/organization/certificates.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge src/openai/resources/admin/organization/projects/users/users.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge src/openai/resources/admin/organization/projects/roles.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge src/openai/resources/admin/organization/groups/groups.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge src/openai/resources/admin/organization/roles.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge src/openai/resources/admin/organization/projects/groups/roles.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge src/openai/resources/admin/organization/projects/groups/groups.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge src/openai/resources/admin/organization/projects/users/roles.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge src/openai/resources/admin/organization/groups/roles.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge src/openai/resources/admin/organization/users/roles.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
FileTooLong: lib/responses_tool_runner.py src/openai/lib/responses_tool_runner.py— FileTooLong — 2442 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1942 over it, 4.88× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: scripts/check-dependency-security.py scripts/check-dependency-security.py— FileTooLong — 2231 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1731 over it, 4.46× 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: responses/responses.py src/openai/resources/responses/responses.py— FileTooLong — 2117 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1617 over it, 4.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: openai/_base_client.py src/openai/_base_client.py— FileTooLong — 1776 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1276 over it, 3.55× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: responses/responses.py src/openai/resources/beta/responses/responses.py— FileTooLong — 1589 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1089 over it, 3.18× 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: runs/runs.py src/openai/resources/beta/threads/runs/runs.py— FileTooLong — 1571 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1071 over it, 3.14× 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: lib/browser.py src/openai/lib/browser.py— FileTooLong — 1502 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1002 over it, 3.00× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: openai/_client.py src/openai/_client.py— FileTooLong — 1294 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 794 over it, 2.59× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: completions/completions.py src/openai/resources/chat/completions/completions.py— FileTooLong — 1146 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 646 over it, 2.29× 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: organization/usage.py src/openai/resources/admin/organization/usage.py— FileTooLong — 1095 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 595 over it, 2.19× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: live/live.py src/openai/resources/live/live.py— FileTooLong — 947 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 447 over it, 1.89× 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/realtime.py src/openai/resources/realtime/realtime.py— FileTooLong — 944 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 444 over it, 1.89× 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: threads/threads.py src/openai/resources/beta/threads/threads.py— FileTooLong — 928 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 428 over it, 1.86× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: live/sideband.py src/openai/resources/live/sideband.py— FileTooLong — 870 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 370 over it, 1.74× 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: lib/_client_auth.py src/openai/lib/_client_auth.py— FileTooLong — 855 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 355 over it, 1.71× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: live/forks.py src/openai/resources/live/forks.py— FileTooLong — 855 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 355 over it, 1.71× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: lib/computer.py src/openai/lib/computer.py— FileTooLong — 845 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 345 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: resources/videos.py src/openai/resources/videos.py— FileTooLong — 781 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 281 over it, 1.56× 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: lib/bedrock.py src/openai/lib/bedrock.py— FileTooLong — 765 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 265 over it, 1.53× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: resources/images.py src/openai/resources/images.py— FileTooLong — 728 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 228 over it, 1.46× 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: sessions/sessions.py src/openai/resources/beta/agents/sessions/sessions.py— FileTooLong — 719 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 219 over it, 1.44× 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: webhooks/webhooks.py src/openai/resources/webhooks/webhooks.py— FileTooLong — 707 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 207 over it, 1.41× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: lib/azure.py src/openai/lib/azure.py— FileTooLong — 705 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 205 over it, 1.41× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: translations/translations.py src/openai/resources/realtime/translations/translations.py— FileTooLong — 699 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 199 over it, 1.40× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: openai/_models.py src/openai/_models.py— FileTooLong — 630 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 130 over it, 1.26× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
TodoComment tests/test_client.py:354— # TODO: update — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tests/test_client.py:1904— # TODO: update — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tests/test_models.py:460— # TODO: test mismatched type — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tests/test_models.py:484— # TODO: test mismatched type — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tests/test_required_args.py:81— # TODO: this error message could probably be improved — 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/openai/_base_client.py:175— # TODO: make base page type vars covariant — 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/openai/_base_client.py:280— # TODO: do we have to preprocess params here? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment src/openai/_base_client.py:690— # TODO: report this error to httpx — 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/openai/_base_client.py:706— # TODO: type ignore is required as stringify_items is well typed but we can't be — 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/openai/_base_client.py:1616— # TODO(someday): support non asyncio runtimes here — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment src/openai/_base_client.py:2351— # TODO: untested — 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/openai/_base_client.py:2358— # TODO: untested — 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/openai/_compat.py:70— # TODO: provide an error message here? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment src/openai/_models.py:542— # TODO — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment src/openai/_models.py:922— # TODO: condition is weird — 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/openai/_qs.py:77— # TODO: error if unknown format — 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/openai/pagination.py:98— # TODO emit warning log — 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/openai/pagination.py:131— # TODO emit warning log — 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/openai/lib/_vector_stores.py:386— # TODO: don't poll unless necessary?? — 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/openai/lib/_vector_stores.py:473— # TODO: don't poll unless necessary?? — 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/openai/lib/streaming/chat/_completions.py:609— # TODO: Model incomplete snapshots separately so their annotations reflect this state. — 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/openai/lib/beta/agents/_files.py:215— # TODO: Use API batch uploads when available. Applications can own preflight — 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/openai/_utils/_transform.py:37— # TODO: support for drilling globals() and locals() — 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/openai/_utils/_transform.py:38— # TODO: ensure works correctly with forward references in all cases — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment src/openai/_utils/_transform.py:216— # TODO: there may be edge cases where the same normalized field name will transform to two different names — 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.
Sync-over-async blocking scripts/steady/test.cjs:40— `spawnSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:42— `fs.mkdirSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:44— `fs.copyFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:48— `spawnSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:50— `spawnSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:56— `spawnSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:64— `fs.readFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:67— `fs.writeFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:68— `fs.appendFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:70— `fs.existsSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:71— `fs.writeFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:72— `fs.unlinkSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:75— `fs.readFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:76— `fs.appendFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:78— `fs.writeFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:81— `fs.renameSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:82— `fs.writeFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:84— `fs.unlinkSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:85— `fs.renameSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:88— `fs.renameSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:89— `fs.writeFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:91— `fs.unlinkSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:92— `fs.renameSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/steady/test.cjs:96— `fs.writeFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Hotspot: src/openai/_base_client.py src/openai/_base_client.py:599— src/openai/_base_client.py changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in BaseClient._build_request at line 599. 10 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/_base_client.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/openai/lib/responses_websocket/_accumulator.py src/openai/lib/responses_websocket/_accumulator.py:243— src/openai/lib/responses_websocket/_accumulator.py changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 89 in ResponsesWebSocketAccumulator.add_event at line 243. 1 of those changes was a fix/bug commit, and the other 2 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 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/lib/responses_websocket/_accumulator.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/openai/lib/azure.py src/openai/lib/azure.py:256— src/openai/lib/azure.py changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in AzureOpenAI.__init__ at line 256. 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 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/lib/azure.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/openai/lib/streaming/responses/_responses.py src/openai/lib/streaming/responses/_responses.py:402— src/openai/lib/streaming/responses/_responses.py changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in ResponseStreamState.accumulate_event at line 402. 4 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/lib/streaming/responses/_responses.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/openai/_response.py src/openai/_response.py:129— src/openai/_response.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in BaseAPIResponse._parse at line 129. 2 of those changes were fix/bug commits, and the other 4 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 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/_response.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/openai/lib/streaming/chat/_completions.py src/openai/lib/streaming/chat/_completions.py:362— src/openai/lib/streaming/chat/_completions.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in ChatCompletionStreamState._accumulate_chunk at line 362. 3 of those changes were fix/bug commits, and the other 3 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 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/lib/streaming/chat/_completions.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/openai/lib/bedrock.py src/openai/lib/bedrock.py:535— src/openai/lib/bedrock.py changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in BedrockOpenAI.copy at line 535. 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 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/lib/bedrock.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: examples/realtime/push_to_talk_app.py examples/realtime/push_to_talk_app.py:180— examples/realtime/push_to_talk_app.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in RealtimeApp._receive_realtime_events at line 180. 4 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- examples/realtime/push_to_talk_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/openai/_models.py src/openai/_models.py:608— src/openai/_models.py changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in _models.construct_type at line 608. 3 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 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/_models.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/openai/_websocket_connection.py src/openai/_websocket_connection.py:291— src/openai/_websocket_connection.py changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in WebSocketConnectionBase._reconnect at line 291. 2 of those changes were fix/bug commits, and the other 3 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 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/_websocket_connection.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/openai/_legacy_response.py src/openai/_legacy_response.py:198— src/openai/_legacy_response.py changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in LegacyAPIResponse._parse at line 198. 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 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/_legacy_response.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/openai/_utils/_transform.py src/openai/_utils/_transform.py:154— src/openai/_utils/_transform.py changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in _transform._transform_recursive at line 154. 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 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/_utils/_transform.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/openai/providers/bedrock.py src/openai/providers/bedrock.py:383— src/openai/providers/bedrock.py changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in bedrock.bedrock at line 383. 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 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/providers/bedrock.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/openai/lib/beta/agents/_tools.py src/openai/lib/beta/agents/_tools.py:240— src/openai/lib/beta/agents/_tools.py changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in _tools.function_tool at line 240. 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 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/lib/beta/agents/_tools.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.
Duplicated block (17 lines × 2) src/openai/_base_client.py:1143— src/openai/_base_client.py:1143-1159 | src/openai/_base_client.py:1766-1782 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/openai/_base_client.py:1764` calls `asyncify` and `src/openai/_base_client.py:1142` 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 (17 lines × 2) src/openai/lib/_assistants_runs.py:386— src/openai/lib/_assistants_runs.py:386-402 | src/openai/lib/_assistants_runs.py:749-765 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) src/openai/resources/admin/organization/projects/roles.py:607— src/openai/resources/admin/organization/projects/roles.py:607-623 | src/openai/resources/admin/organization/roles.py:575-591 — before extracting anything, compare `src/openai/resources/admin/organization/projects/roles.py` and `src/openai/resources/admin/organization/roles.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) src/openai/resources/admin/organization/projects/roles.py:628— src/openai/resources/admin/organization/projects/roles.py:628-644 | src/openai/resources/admin/organization/roles.py:596-612 — before extracting anything, compare `src/openai/resources/admin/organization/projects/roles.py` and `src/openai/resources/admin/organization/roles.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) src/openai/resources/admin/organization/projects/spend_alerts.py:648— src/openai/resources/admin/organization/projects/spend_alerts.py:648-664 | src/openai/resources/admin/organization/spend_alerts.py:602-618 — before extracting anything, compare `src/openai/resources/admin/organization/projects/spend_alerts.py` and `src/openai/resources/admin/organization/spend_alerts.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) src/openai/resources/admin/organization/projects/spend_alerts.py:669— src/openai/resources/admin/organization/projects/spend_alerts.py:669-685 | src/openai/resources/admin/organization/spend_alerts.py:623-639 — before extracting anything, compare `src/openai/resources/admin/organization/projects/spend_alerts.py` and `src/openai/resources/admin/organization/spend_alerts.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) src/openai/resources/beta/responses/responses.py:4752— src/openai/resources/beta/responses/responses.py:4752-4768 | src/openai/resources/responses/responses.py:3933-3949 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/responses/responses.py:3951` calls `to_raw_response_wrapper` and `src/openai/resources/beta/responses/responses.py:4770` 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 lines × 2) src/openai/resources/beta/responses/responses.py:4783— src/openai/resources/beta/responses/responses.py:4783-4799 | src/openai/resources/responses/responses.py:3968-3984 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/responses/responses.py:3986` calls `async_to_raw_response_wrapper` and `src/openai/resources/beta/responses/responses.py:4801` 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 lines × 2) src/openai/resources/beta/responses/responses.py:4814— src/openai/resources/beta/responses/responses.py:4814-4830 | src/openai/resources/responses/responses.py:4003-4019 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) src/openai/resources/beta/responses/responses.py:4845— src/openai/resources/beta/responses/responses.py:4845-4861 | src/openai/resources/responses/responses.py:4034-4050 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) src/openai/resources/realtime/realtime.py:683— src/openai/resources/realtime/realtime.py:683-699 | src/openai/resources/realtime/realtime.py:1140-1156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) src/openai/resources/realtime/translations/translations.py:547— src/openai/resources/realtime/translations/translations.py:547-563 | src/openai/resources/realtime/translations/translations.py:971-987 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) examples/mtls_httpx2_async.py:11— examples/mtls_httpx2_async.py:11-27 | examples/mtls_httpx_async.py:11-27 — before extracting anything, compare `examples/mtls_httpx2_async.py` and `examples/mtls_httpx_async.py` as WHOLE FILES: 92% 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. Read the line range as the matched WINDOW rather than a finished unit: at `examples/mtls_httpx2_async.py:11` 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.
Swallowed exception (empty catch) src/openai/_base_client.py:497— 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/openai/_base_client.py:997— 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 `__del__()` 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/openai/_base_client.py:1618— 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 `__del__()` 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/openai/_models.py:642— 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/openai/_websocket_connection.py:607— 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/openai/lib/responses_tool_runner.py:2168— 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/openai/lib/responses_tool_runner.py:2174— 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/openai/lib/responses_tool_runner.py:2180— 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/openai/lib/responses_tool_runner.py:2647— 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/openai/lib/responses_tool_runner.py:2653— 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/openai/lib/responses_tool_runner.py:2659— 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/openai/lib/tool_diagnostics.py:94— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Duplicated block (15 lines × 2) src/openai/_base_client.py:1035— src/openai/_base_client.py:1035-1049 | src/openai/_base_client.py:1656-1670 — both copies are in the same file, so extract the 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/openai/_base_client.py:1035` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) src/openai/lib/_response_resources.py:175— src/openai/lib/_response_resources.py:175-189 | src/openai/lib/_response_resources.py:298-312 — both copies are in the same file, so extract the 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/openai/lib/_response_resources.py:175` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) src/openai/resources/admin/organization/external_keys.py:845— src/openai/resources/admin/organization/external_keys.py:845-859 | src/openai/resources/admin/organization/external_storage.py:514-528 — before extracting anything, compare `src/openai/resources/admin/organization/external_keys.py` and `src/openai/resources/admin/organization/external_storage.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 200 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 (15 lines × 2) src/openai/resources/admin/organization/external_keys.py:866— src/openai/resources/admin/organization/external_keys.py:866-880 | src/openai/resources/admin/organization/external_storage.py:535-549 — before extracting anything, compare `src/openai/resources/admin/organization/external_keys.py` and `src/openai/resources/admin/organization/external_storage.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 200 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 (15 lines × 2) src/openai/resources/audio/transcriptions.py:726— src/openai/resources/audio/transcriptions.py:726-740 | src/openai/resources/audio/transcriptions.py:1416-1430 — both copies are in the same file, so extract the 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/openai/resources/audio/transcriptions.py:726` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) src/openai/resources/beta/agents/sessions/sessions.py:262— src/openai/resources/beta/agents/sessions/sessions.py:262-276 | src/openai/resources/beta/agents/sessions/sessions.py:685-699 — both copies are in the same file, so extract the 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/openai/resources/beta/agents/sessions/sessions.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.
Duplicated block (15 lines × 2) src/openai/resources/beta/responses/responses.py:4894— src/openai/resources/beta/responses/responses.py:4894-4908 | src/openai/resources/responses/responses.py:4083-4097 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: `EventHandlerRegistry` names `...._event_handler` in one and `..._event_handler` 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 (15 lines × 2) src/openai/resources/beta/threads/runs/runs.py:1593— src/openai/resources/beta/threads/runs/runs.py:1593-1607 | src/openai/resources/beta/threads/runs/runs.py:3141-3155 — both copies are in the same file, so extract the 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/openai/resources/beta/threads/runs/runs.py:1593` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) src/openai/resources/beta/threads/threads.py:1128— src/openai/resources/beta/threads/threads.py:1128-1142 | src/openai/resources/beta/threads/threads.py:2211-2225 — both copies are in the same file, so extract the 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/openai/resources/beta/threads/threads.py:1128` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) src/openai/resources/beta/responses/responses.py:2402— src/openai/resources/beta/responses/responses.py:2402-2416 | src/openai/resources/responses/responses.py:1996-2010 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) src/openai/resources/beta/responses/responses.py:4733— src/openai/resources/beta/responses/responses.py:4733-4747 | src/openai/resources/responses/responses.py:3914-3928 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) src/openai/_utils/_transform.py:239— src/openai/_utils/_transform.py:239-249 | src/openai/_utils/_transform.py:407-417 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) src/openai/lib/bedrock.py:486— src/openai/lib/bedrock.py:486-496 | src/openai/lib/bedrock.py:722-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.
Duplicated block (11 lines × 2) src/openai/lib/responses_tool_runner.py:1851— src/openai/lib/responses_tool_runner.py:1851-1861 | src/openai/lib/responses_tool_runner.py:2327-2337 — both copies are in the same file, so extract the 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/openai/resources/beta/responses/responses.py:5073— src/openai/resources/beta/responses/responses.py:5073-5083 | src/openai/resources/responses/responses.py:4262-4272 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: `EventHandlerRegistry` names `...._event_handler` in one and `..._event_handler` 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 (11 lines × 2) src/openai/resources/beta/responses/responses.py:5397— src/openai/resources/beta/responses/responses.py:5397-5407 | src/openai/resources/responses/responses.py:4587-4597 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: `EventHandlerRegistry` names `...._event_handler` in one and `..._event_handler` 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 (11 lines × 2) src/openai/resources/admin/organization/projects/spend_limit.py:325— src/openai/resources/admin/organization/projects/spend_limit.py:325-335 | src/openai/resources/admin/organization/spend_limit.py:263-273 — before extracting anything, compare `src/openai/resources/admin/organization/projects/spend_limit.py` and `src/openai/resources/admin/organization/spend_limit.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) src/openai/resources/admin/organization/projects/spend_limit.py:340— src/openai/resources/admin/organization/projects/spend_limit.py:340-350 | src/openai/resources/admin/organization/spend_limit.py:278-288 — before extracting anything, compare `src/openai/resources/admin/organization/projects/spend_limit.py` and `src/openai/resources/admin/organization/spend_limit.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) src/openai/resources/admin/organization/projects/spend_limit.py:355— src/openai/resources/admin/organization/projects/spend_limit.py:355-365 | src/openai/resources/admin/organization/spend_limit.py:293-303 — before extracting anything, compare `src/openai/resources/admin/organization/projects/spend_limit.py` and `src/openai/resources/admin/organization/spend_limit.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) src/openai/resources/admin/organization/projects/spend_limit.py:370— src/openai/resources/admin/organization/projects/spend_limit.py:370-380 | src/openai/resources/admin/organization/spend_limit.py:308-318 — before extracting anything, compare `src/openai/resources/admin/organization/projects/spend_limit.py` and `src/openai/resources/admin/organization/spend_limit.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) src/openai/resources/beta/responses/responses.py:4928— src/openai/resources/beta/responses/responses.py:4928-4938 | src/openai/resources/responses/responses.py:4117-4127 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `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.
Swallowed exception (caught, then discarded) src/openai/_base_client.py:2257— `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/openai/_base_client.py:2331— `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/openai/_base_client.py:2338— `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/openai/_base_client.py:2345— `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/openai/_models.py:671— `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/openai/_models.py:719— `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/openai/_models.py:726— `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/openai/_websocket_connection.py:334— `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/openai/_websocket_connection.py:561— `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/openai/_utils/_utils.py:410— `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.
Duplicated block (16 lines × 2) src/openai/_websocket_connection.py:292— src/openai/_websocket_connection.py:292-307 | src/openai/_websocket_connection.py:512-527 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) src/openai/lib/_chat_completion_resources.py:142— src/openai/lib/_chat_completion_resources.py:142-157 | src/openai/lib/_chat_completion_resources.py:261-276 — both copies are in the same file, so extract the 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/openai/lib/_chat_completion_resources.py:142` 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 (16 lines × 2) src/openai/lib/browser.py:1565— src/openai/lib/browser.py:1565-1580 | src/openai/lib/browser.py:1829-1844 — both copies are in the same file, so extract the 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/openai/lib/browser.py:1565` 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 (16 lines × 2) src/openai/lib/responses_tool_runner.py:1998— src/openai/lib/responses_tool_runner.py:1998-2013 | src/openai/lib/responses_tool_runner.py:2487-2502 — both copies are in the same file, so extract the 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 (16 lines × 2) src/openai/resources/chat/completions/completions.py:135— src/openai/resources/chat/completions/completions.py:135-190 | src/openai/resources/responses/responses.py:260-275 — before extracting anything, compare `src/openai/resources/chat/completions/completions.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/chat/completions/completions.py:135` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) src/openai/resources/chat/completions/completions.py:264— src/openai/resources/chat/completions/completions.py:264-299 | src/openai/resources/responses/responses.py:404-419 — before extracting anything, compare `src/openai/resources/chat/completions/completions.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/chat/completions/completions.py:264` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) src/openai/resources/chat/completions/completions.py:1938— src/openai/resources/chat/completions/completions.py:1938-1993 | src/openai/resources/responses/responses.py:2178-2193 — before extracting anything, compare `src/openai/resources/chat/completions/completions.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/chat/completions/completions.py:1938` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) src/openai/resources/chat/completions/completions.py:2067— src/openai/resources/chat/completions/completions.py:2067-2102 | src/openai/resources/responses/responses.py:2322-2337 — before extracting anything, compare `src/openai/resources/chat/completions/completions.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/chat/completions/completions.py:2067` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) examples/computer-desktop/exercise_container.py:312— examples/computer-desktop/exercise_container.py:312-327 | examples/computer-desktop/exercise_container.py:404-419 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) src/openai/auth/_x509.py:571— src/openai/auth/_x509.py:571-584 | src/openai/auth/_x509.py:658-671 — both copies are in the same file, so extract the 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/openai/auth/_x509.py:571` 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 × 2) src/openai/lib/azure.py:546— src/openai/lib/azure.py:546-559 | src/openai/lib/azure.py:925-938 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14 lines × 2) src/openai/lib/responses_tool_runner.py:2252— src/openai/lib/responses_tool_runner.py:2252-2265 | src/openai/lib/responses_tool_runner.py:2729-2742 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14 lines × 2) src/openai/resources/admin/organization/certificates.py:315— src/openai/resources/admin/organization/certificates.py:315-328 | src/openai/resources/admin/organization/projects/certificates.py:139-152 — before extracting anything, compare `src/openai/resources/admin/organization/certificates.py` and `src/openai/resources/admin/organization/projects/certificates.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/admin/organization/certificates.py:315` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `CertificateActivateResponse` names `.....types.admin.organization.projects.certificate_activate_response` in one and `....types.admin.organization.certificate_activate_response` 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 (14 lines × 2) src/openai/resources/admin/organization/certificates.py:357— src/openai/resources/admin/organization/certificates.py:357-370 | src/openai/resources/admin/organization/projects/certificates.py:184-197 — before extracting anything, compare `src/openai/resources/admin/organization/certificates.py` and `src/openai/resources/admin/organization/projects/certificates.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/admin/organization/certificates.py:357` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `CertificateDeactivateResponse` names `.....types.admin.organization.projects.certificate_deactivate_response` in one and `....types.admin.organization.certificate_deactivate_response` 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 (14 lines × 2) src/openai/resources/admin/organization/certificates.py:655— src/openai/resources/admin/organization/certificates.py:655-668 | src/openai/resources/admin/organization/projects/certificates.py:310-323 — before extracting anything, compare `src/openai/resources/admin/organization/certificates.py` and `src/openai/resources/admin/organization/projects/certificates.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/admin/organization/certificates.py:655` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `CertificateActivateResponse` names `.....types.admin.organization.projects.certificate_activate_response` in one and `....types.admin.organization.certificate_activate_response` 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 (14 lines × 2) src/openai/resources/admin/organization/certificates.py:697— src/openai/resources/admin/organization/certificates.py:697-710 | src/openai/resources/admin/organization/projects/certificates.py:355-368 — before extracting anything, compare `src/openai/resources/admin/organization/certificates.py` and `src/openai/resources/admin/organization/projects/certificates.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/admin/organization/certificates.py:697` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `CertificateDeactivateResponse` names `.....types.admin.organization.projects.certificate_deactivate_response` in one and `....types.admin.organization.certificate_deactivate_response` 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 (14 lines × 2) src/openai/resources/vector_stores/file_batches.py:324— src/openai/resources/vector_stores/file_batches.py:324-337 | src/openai/resources/vector_stores/files.py:397-410 — before extracting anything, compare `src/openai/resources/vector_stores/file_batches.py` and `src/openai/resources/vector_stores/files.py` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 209 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) src/openai/resources/vector_stores/file_batches.py:655— src/openai/resources/vector_stores/file_batches.py:655-668 | src/openai/resources/vector_stores/files.py:825-838 — before extracting anything, compare `src/openai/resources/vector_stores/file_batches.py` and `src/openai/resources/vector_stores/files.py` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 209 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 lines × 2) src/openai/_utils/_transform.py:220— src/openai/_utils/_transform.py:220-232 | src/openai/_utils/_transform.py:388-400 — both copies are in the same file, so extract the 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 (13 lines × 2) src/openai/_utils/_transform.py:269— src/openai/_utils/_transform.py:269-281 | src/openai/_utils/_transform.py:437-449 — both copies are in the same file, so extract the 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 (13 lines × 2) src/openai/_websocket_connection.py:206— src/openai/_websocket_connection.py:206-218 | src/openai/_websocket_connection.py:438-450 — both copies are in the same file, so extract the 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/openai/lib/_vector_stores.py:66— src/openai/lib/_vector_stores.py:66-78 | src/openai/lib/_vector_stores.py:109-121 — both copies are in the same file, so extract the 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/openai/lib/_vector_stores.py:66` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) src/openai/lib/browser.py:1547— src/openai/lib/browser.py:1547-1559 | src/openai/lib/browser.py:1806-1818 — both copies are in the same file, so extract the 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 (13 lines × 2) src/openai/lib/responses_tool_runner.py:1932— src/openai/lib/responses_tool_runner.py:1932-1944 | src/openai/lib/responses_tool_runner.py:2412-2424 — both copies are in the same file, so extract the 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 (13 lines × 2) src/openai/lib/streaming/_assistants.py:68— src/openai/lib/streaming/_assistants.py:68-80 | src/openai/lib/streaming/_assistants.py:500-512 — both copies are in the same file, so extract the 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/openai/resources/images.py:680— src/openai/resources/images.py:680-692 | src/openai/resources/images.py:1856-1868 — both copies are in the same file, so extract the 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/openai/resources/images.py:680` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) src/openai/resources/beta/threads/runs/runs.py:1820— src/openai/resources/beta/threads/runs/runs.py:1820-1832 | src/openai/resources/uploads/uploads.py:382-403 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) scripts/check-dependency-security.py:687— scripts/check-dependency-security.py:687-696 | scripts/check-dependency-security.py:897-906 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) src/openai/lib/_client_auth.py:288— src/openai/lib/_client_auth.py:288-297 | src/openai/lib/_client_auth.py:754-763 — both copies are in the same file, so extract the 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/openai/lib/_client_auth.py:288` 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/openai/lib/_client_auth.py:335— src/openai/lib/_client_auth.py:335-344 | src/openai/lib/_client_auth.py:804-813 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `_sdk_client.OpenAI` in one and `_sdk_client.AsyncOpenAI` 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 (10 lines × 2) src/openai/lib/_vector_stores.py:54— src/openai/lib/_vector_stores.py:54-63 | src/openai/lib/_vector_stores.py:97-106 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) src/openai/lib/decisions_tool_runner.py:351— src/openai/lib/decisions_tool_runner.py:351-360 | src/openai/lib/decisions_tool_runner.py:470-479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) src/openai/lib/realtime_translation.py:226— src/openai/lib/realtime_translation.py:226-235 | src/openai/lib/realtime_translation.py:275-284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) src/openai/lib/responses_tool_runner.py:2139— src/openai/lib/responses_tool_runner.py:2139-2148 | src/openai/lib/responses_tool_runner.py:2618-2627 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) src/openai/resources/beta/agents/vaults/credentials.py:192— src/openai/resources/beta/agents/vaults/credentials.py:192-203 | src/openai/resources/beta/threads/runs/runs.py:1584-1593 — before extracting anything, compare `src/openai/resources/beta/agents/vaults/credentials.py` and `src/openai/resources/beta/threads/runs/runs.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/vaults/credentials.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. The matched lines also transfer control out of the body holding them, 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/openai/resources/beta/agents/vaults/credentials.py:495— src/openai/resources/beta/agents/vaults/credentials.py:495-506 | src/openai/resources/beta/threads/runs/runs.py:3132-3141 — before extracting anything, compare `src/openai/resources/beta/agents/vaults/credentials.py` and `src/openai/resources/beta/threads/runs/runs.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/vaults/credentials.py:495` 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 (8 lines × 2) src/openai/_legacy_response.py:261— src/openai/_legacy_response.py:261-268 | src/openai/_response.py:195-202 — before extracting anything, compare `src/openai/_legacy_response.py` and `src/openai/_response.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 136 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 × 2) src/openai/lib/beta/agents/_files.py:184— src/openai/lib/beta/agents/_files.py:184-191 | src/openai/lib/beta/agents/_files.py:222-229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) src/openai/resources/beta/realtime/realtime.py:369— src/openai/resources/beta/realtime/realtime.py:369-376 | src/openai/resources/beta/realtime/realtime.py:557-564 — both copies are in the same file, so extract the 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/openai/resources/beta/realtime/realtime.py:369` 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/openai/resources/beta/realtime/realtime.py:400— src/openai/resources/beta/realtime/realtime.py:400-407 | src/openai/resources/beta/realtime/realtime.py:588-595 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) src/openai/resources/admin/organization/data_retention.py:202— src/openai/resources/admin/organization/data_retention.py:202-209 | src/openai/resources/admin/organization/projects/data_retention.py:240-247 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) src/openai/resources/admin/organization/data_retention.py:214— src/openai/resources/admin/organization/data_retention.py:214-221 | src/openai/resources/admin/organization/projects/data_retention.py:252-259 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) src/openai/resources/beta/agents/sessions/subagents/turns/turns.py:321— src/openai/resources/beta/agents/sessions/subagents/turns/turns.py:321-328 | src/openai/resources/beta/agents/sessions/turns/turns.py:295-302 — before extracting anything, compare `src/openai/resources/beta/agents/sessions/subagents/turns/turns.py` and `src/openai/resources/beta/agents/sessions/turns/turns.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) src/openai/resources/beta/agents/sessions/subagents/turns/turns.py:337— src/openai/resources/beta/agents/sessions/subagents/turns/turns.py:337-344 | src/openai/resources/beta/agents/sessions/turns/turns.py:311-318 — before extracting anything, compare `src/openai/resources/beta/agents/sessions/subagents/turns/turns.py` and `src/openai/resources/beta/agents/sessions/turns/turns.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) src/openai/_legacy_response.py:82— src/openai/_legacy_response.py:82-89 | src/openai/_response.py:73-80 — before extracting anything, compare `src/openai/_legacy_response.py` and `src/openai/_response.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 136 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication· Members sharing a duplicated core (10 members, 50+ identical tokens) · ×8
Members sharing a duplicated core (10 members, 50+ identical tokens) src/openai/resources/admin/organization/groups/roles.py:99— src/openai/resources/admin/organization/groups/roles.py:99-125 | src/openai/resources/admin/organization/groups/users.py:99-125 | src/openai/resources/admin/organization/projects/groups/groups.py:119-150 | src/openai/resources/admin/organization/projects/roles.py:111-137 | src/openai/resources/admin/organization/projects/spend_alerts.py:118-146 | src/openai/resources/admin/organization/projects/users/users.py:124-152 | src/openai/resources/admin/organization/users/roles.py:99-125 | src/openai/resources/containers/files/files.py:132-158 | src/openai/resources/evals/runs/runs.py:137-163 | src/openai/resources/skills/versions/versions.py:138-166 — These 10 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 10 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 10 times.
Members sharing a duplicated core (10 members, 50+ identical tokens) src/openai/resources/admin/organization/groups/roles.py:195— src/openai/resources/admin/organization/groups/roles.py:195-221 | src/openai/resources/admin/organization/groups/users.py:196-222 | src/openai/resources/admin/organization/projects/groups/groups.py:220-248 | src/openai/resources/admin/organization/projects/roles.py:265-291 | src/openai/resources/admin/organization/projects/spend_alerts.py:285-313 | src/openai/resources/admin/organization/projects/users/users.py:267-298 | src/openai/resources/admin/organization/users/roles.py:195-221 | src/openai/resources/conversations/items.py:240-268 | src/openai/resources/evals/runs/runs.py:238-264 | src/openai/resources/skills/versions/versions.py:235-263 — These 10 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 10 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 10 times.
Members sharing a duplicated core (10 members, 50+ identical tokens) src/openai/resources/admin/organization/groups/roles.py:297— src/openai/resources/admin/organization/groups/roles.py:297-323 | src/openai/resources/admin/organization/groups/users.py:298-324 | src/openai/resources/admin/organization/projects/groups/groups.py:338-371 | src/openai/resources/admin/organization/projects/roles.py:380-406 | src/openai/resources/admin/organization/projects/spend_alerts.py:406-434 | src/openai/resources/admin/organization/projects/users/users.py:393-421 | src/openai/resources/admin/organization/users/roles.py:297-323 | src/openai/resources/containers/files/files.py:360-386 | src/openai/resources/evals/runs/runs.py:407-433 | src/openai/resources/skills/versions/versions.py:360-388 — These 10 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 10 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 10 times.
Members sharing a duplicated core (10 members, 50+ identical tokens) src/openai/resources/admin/organization/groups/roles.py:393— src/openai/resources/admin/organization/groups/roles.py:393-419 | src/openai/resources/admin/organization/groups/users.py:395-421 | src/openai/resources/admin/organization/projects/groups/groups.py:441-469 | src/openai/resources/admin/organization/projects/roles.py:534-560 | src/openai/resources/admin/organization/projects/spend_alerts.py:573-601 | src/openai/resources/admin/organization/projects/users/users.py:536-567 | src/openai/resources/admin/organization/users/roles.py:393-419 | src/openai/resources/conversations/items.py:483-511 | src/openai/resources/evals/runs/runs.py:508-534 | src/openai/resources/skills/versions/versions.py:457-485 — These 10 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 10 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 10 times.
Members sharing a duplicated core (10 members, 50+ identical tokens) src/openai/resources/beta/agents/agents.py:408— src/openai/resources/beta/agents/agents.py:408-435 | src/openai/resources/beta/agents/automations/automations.py:369-395 | src/openai/resources/beta/agents/sessions/sessions.py:471-500 | src/openai/resources/beta/agents/vaults/vaults.py:287-314 | src/openai/resources/beta/assistants.py:568-593 | src/openai/resources/beta/chatkit/threads.py:159-184 | src/openai/resources/beta/threads/threads.py:430-455 | src/openai/resources/containers/containers.py:231-256 | src/openai/resources/responses/responses.py:1616-1641 | src/openai/resources/vector_stores/vector_stores.py:326-351 — These 10 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 10 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 10 times.
Members sharing a duplicated core (10 members, 50+ identical tokens) src/openai/resources/beta/agents/agents.py:785— src/openai/resources/beta/agents/agents.py:785-812 | src/openai/resources/beta/agents/automations/automations.py:811-837 | src/openai/resources/beta/agents/sessions/sessions.py:894-923 | src/openai/resources/beta/agents/vaults/vaults.py:570-597 | src/openai/resources/beta/assistants.py:1129-1154 | src/openai/resources/beta/chatkit/threads.py:382-407 | src/openai/resources/beta/threads/threads.py:1513-1538 | src/openai/resources/containers/containers.py:456-481 | src/openai/resources/responses/responses.py:3534-3559 | src/openai/resources/vector_stores/vector_stores.py:697-722 — These 10 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 10 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 10 times.
Members sharing a duplicated core (10 members, 50+ identical tokens) src/openai/resources/live/forks.py:181— src/openai/resources/live/forks.py:181-196 | src/openai/resources/live/forks.py:611-626 | src/openai/resources/live/live.py:401-416 | src/openai/resources/live/live.py:824-839 | src/openai/resources/live/sideband.py:186-201 | src/openai/resources/live/sideband.py:625-640 | src/openai/resources/realtime/realtime.py:373-388 | src/openai/resources/realtime/realtime.py:838-853 | src/openai/resources/realtime/translations/translations.py:263-278 | src/openai/resources/realtime/translations/translations.py:691-706 — These 10 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 10 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 10 times.
Members sharing a duplicated core (10 members, 50+ identical tokens) src/openai/resources/live/forks.py:199— src/openai/resources/live/forks.py:199-217 | src/openai/resources/live/forks.py:629-649 | src/openai/resources/live/live.py:419-437 | src/openai/resources/live/live.py:842-862 | src/openai/resources/live/sideband.py:204-222 | src/openai/resources/live/sideband.py:643-663 | src/openai/resources/realtime/realtime.py:391-409 | src/openai/resources/realtime/realtime.py:856-876 | src/openai/resources/realtime/translations/translations.py:281-299 | src/openai/resources/realtime/translations/translations.py:709-729 — These 10 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 10 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 10 times.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×8
Members sharing a duplicated core (4 members, 50+ identical tokens) src/openai/lib/_assistants_runs.py:69— src/openai/lib/_assistants_runs.py:69-108 | src/openai/lib/_assistants_runs.py:437-476 | src/openai/lib/_assistants_threads.py:61-88 | src/openai/lib/_assistants_threads.py:188-217 — 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/openai/resources/admin/organization/groups/roles.py:141— src/openai/resources/admin/organization/groups/roles.py:141-181 | src/openai/resources/admin/organization/projects/groups/roles.py:153-195 | src/openai/resources/admin/organization/projects/users/roles.py:153-195 | src/openai/resources/admin/organization/users/roles.py:141-181 — 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/openai/resources/admin/organization/groups/roles.py:339— src/openai/resources/admin/organization/groups/roles.py:339-379 | src/openai/resources/admin/organization/projects/groups/roles.py:373-415 | src/openai/resources/admin/organization/projects/users/roles.py:373-415 | src/openai/resources/admin/organization/users/roles.py:339-379 — 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/openai/resources/admin/organization/projects/api_keys.py:360— src/openai/resources/admin/organization/projects/api_keys.py:360-425 | src/openai/resources/admin/organization/projects/rate_limits.py:278-331 | src/openai/resources/admin/organization/projects/service_accounts/api_keys.py:143-191 | src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py:468-509 — 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/openai/resources/beta/agents/automations/invocations.py:54— src/openai/resources/beta/agents/automations/invocations.py:54-79 | src/openai/resources/beta/chatkit/sessions.py:123-150 | src/openai/resources/live/sessions.py:204-229 | src/openai/resources/realtime/calls.py:317-342 — 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/openai/resources/beta/agents/automations/invocations.py:217— src/openai/resources/beta/agents/automations/invocations.py:217-242 | src/openai/resources/beta/chatkit/sessions.py:246-273 | src/openai/resources/live/sessions.py:492-517 | src/openai/resources/realtime/calls.py:705-730 — 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/openai/resources/content_provenance_checks.py:54— src/openai/resources/content_provenance_checks.py:54-94 | src/openai/resources/content_provenance_checks.py:128-170 | src/openai/resources/uploads/parts.py:57-102 | src/openai/resources/uploads/parts.py:139-184 — 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/openai/resources/realtime/realtime.py:486— src/openai/resources/realtime/realtime.py:486-513 | src/openai/resources/realtime/realtime.py:951-972 | src/openai/resources/realtime/translations/translations.py:371-398 | src/openai/resources/realtime/translations/translations.py:801-822 — 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.
Change coupling: beta_responses_client_event_param.py ↔ response_create_params.py src/openai/types/beta/beta_responses_client_event_param.py:1— `src/openai/types/beta/beta_responses_client_event_param.py` and `src/openai/types/beta/response_create_params.py` change together 87% of the time (13 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `e8beb1ab` feat(api): add gpt-6.1-terra model identifier (#4180); `2c1ae526` chore(api): document 128-character safety identifiers (#4050); `160b2c02` feat(api): add GPT-6.1 Sol model identifier (#3986) — run `git show` on any of them.
Change coupling: beta_responses_client_event.py ↔ response_create_params.py src/openai/types/beta/beta_responses_client_event.py:1— `src/openai/types/beta/beta_responses_client_event.py` and `src/openai/types/beta/response_create_params.py` change together 87% of the time (13 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `e8beb1ab` feat(api): add gpt-6.1-terra model identifier (#4180); `2c1ae526` chore(api): document 128-character safety identifiers (#4050); `160b2c02` feat(api): add GPT-6.1 Sol model identifier (#3986) — run `git show` on any of them.
Change coupling: forks.py ↔ sideband.py src/openai/resources/live/forks.py:1— `src/openai/resources/live/forks.py` and `src/openai/resources/live/sideband.py` change together 85% of the time (11 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `9abd6569` feat(api): support WebSocket warmup and preserve cleanup cancellation…; `bd61e84c` feat(api): support response format updates and local output types (#4…; `68b962c7` feat(api): improve WebSocket recovery and delivery reporting (#4213) — run `git show` on any of them.
Change coupling: beta_responses_client_event.py ↔ response_compact_params.py src/openai/types/beta/beta_responses_client_event.py:1— `src/openai/types/beta/beta_responses_client_event.py` and `src/openai/types/responses/response_compact_params.py` change together 64% of the time (9 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `e8beb1ab` feat(api): add gpt-6.1-terra model identifier (#4180); `160b2c02` feat(api): add GPT-6.1 Sol model identifier (#3986); `d041d736` feat(api): add GPT-Rosalind research model (#3940) — run `git show` on any of them.
Change coupling: beta_responses_client_event_param.py ↔ response_compact_params.py src/openai/types/beta/beta_responses_client_event_param.py:1— `src/openai/types/beta/beta_responses_client_event_param.py` and `src/openai/types/responses/response_compact_params.py` change together 64% of the time (9 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `e8beb1ab` feat(api): add gpt-6.1-terra model identifier (#4180); `160b2c02` feat(api): add GPT-6.1 Sol model identifier (#3986); `d041d736` feat(api): add GPT-Rosalind research model (#3940) — run `git show` on any of them.
Change coupling: chat_model.py ↔ chat_model.py src/openai/types/shared/chat_model.py:1— `src/openai/types/shared/chat_model.py` and `src/openai/types/shared_params/chat_model.py` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `e8beb1ab` feat(api): add gpt-6.1-terra model identifier (#4180); `e71d781a` feat(api): add response error diagnostics and model notices (#4086); `160b2c02` feat(api): add GPT-6.1 Sol model identifier (#3986) — run `git show` on any of them.
Change coupling: file_batches.py ↔ files.py src/openai/resources/vector_stores/file_batches.py:1— `src/openai/resources/vector_stores/file_batches.py` and `src/openai/resources/vector_stores/files.py` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `7db9d884` chore(api): preserve file and video polling helpers (#4155); `a002ef3c` refactor(api): isolate vector-store polling helpers (#3713); `f161000f` feat(vector store): improve chunking strategy type names (#1690) (at that commit the files were still `src/openai/resources/beta/vector_stores/file_batches.py` and `src/openai/resources/beta/vector_stores/files.py`) — run `git show` on any of them.
Duplicated block (12 lines × 2) src/openai/_utils/_transform.py:251— src/openai/_utils/_transform.py:251-262 | src/openai/_utils/_transform.py:419-430 — both copies are in the same file, so extract the 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/openai/_utils/_transform.py:251` 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 (12 lines × 2) src/openai/lib/computer.py:666— src/openai/lib/computer.py:666-677 | src/openai/lib/computer.py:876-887 — both copies are in the same file, so extract the 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/openai/lib/computer.py:666` 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/openai/lib/responses_websocket/_session.py:488— src/openai/lib/responses_websocket/_session.py:488-499 | src/openai/lib/responses_websocket/_session.py:634-645 — both copies are in the same file, so extract the 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/openai/resources/beta/responses/responses.py:4115— src/openai/resources/beta/responses/responses.py:4115-4126 | src/openai/resources/responses/responses.py:3319-3330 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/responses/responses.py:4115` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) src/openai/resources/chat/completions/completions.py:3455— src/openai/resources/chat/completions/completions.py:3455-3466 | src/openai/resources/completions.py:1125-1158 — 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/openai/resources/chat/completions/completions.py:3455` 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 (12 lines × 2) src/openai/resources/realtime/translations/translations.py:437— src/openai/resources/realtime/translations/translations.py:437-448 | src/openai/resources/realtime/translations/translations.py:861-872 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) src/openai/resources/videos.py:611— src/openai/resources/videos.py:611-622 | src/openai/resources/videos.py:1198-1209 — both copies are in the same file, so extract the 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/openai/resources/videos.py:611` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) src/openai/lib/_assistants_threads.py:67— src/openai/lib/_assistants_threads.py:67-87 | src/openai/lib/_assistants_threads.py:194-214 — both copies are in the same file, so extract the 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/openai/lib/_assistants_threads.py:67` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) src/openai/lib/azure.py:504— src/openai/lib/azure.py:504-524 | src/openai/lib/azure.py:883-903 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (21 lines × 2) src/openai/lib/computer.py:742— src/openai/lib/computer.py:742-762 | src/openai/lib/computer.py:955-975 — both copies are in the same file, so extract the 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 × 2) src/openai/lib/computer.py:765— src/openai/lib/computer.py:765-785 | src/openai/lib/computer.py:977-997 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (21 lines × 2) src/openai/resources/realtime/realtime.py:711— src/openai/resources/realtime/realtime.py:711-731 | src/openai/resources/realtime/realtime.py:1168-1188 — both copies are in the same file, so extract the 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/openai/resources/realtime/realtime.py:711` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) src/openai/resources/skills/skills.py:91— src/openai/resources/skills/skills.py:91-111 | src/openai/resources/skills/skills.py:334-354 — both copies are in the same file, so extract the 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/openai/_send_queue.py:103— src/openai/_send_queue.py:103-120 | src/openai/_send_queue.py:155-172 — both copies are in the same file, so extract the 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 (18 lines × 2) src/openai/lib/_chat_completion_resources.py:334— src/openai/lib/_chat_completion_resources.py:334-351 | src/openai/lib/_chat_completion_resources.py:437-454 — both copies are in the same file, so extract the 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/openai/lib/_response_resources.py:435— src/openai/lib/_response_resources.py:435-452 | src/openai/lib/_response_resources.py:585-602 — both copies are in the same file, so extract the 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/openai/lib/responses_tool_runner.py:1887— src/openai/lib/responses_tool_runner.py:1887-1904 | src/openai/lib/responses_tool_runner.py:2365-2382 — both copies are in the same file, so extract the 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/openai/resources/beta/responses/responses.py:4304— src/openai/resources/beta/responses/responses.py:4304-4321 | src/openai/resources/responses/responses.py:3500-3517 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/responses/responses.py:4304` 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 (18 lines × 2) src/openai/resources/live/sideband.py:468— src/openai/resources/live/sideband.py:468-485 | src/openai/resources/live/sideband.py:903-920 — both copies are in the same file, so extract the 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 (31 lines × 2) src/openai/_legacy_response.py:274— src/openai/_legacy_response.py:274-304 | src/openai/_response.py:209-239 — before extracting anything, compare `src/openai/_legacy_response.py` and `src/openai/_response.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 136 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 (31 lines × 2) src/openai/lib/_assistants_runs.py:151— src/openai/lib/_assistants_runs.py:151-182 | src/openai/lib/_assistants_runs.py:517-547 — both copies are in the same file, so extract the 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 (31 lines × 2) src/openai/resources/beta/responses/responses.py:5136— src/openai/resources/beta/responses/responses.py:5136-5166 | src/openai/resources/responses/responses.py:4325-4355 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `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 (31 lines × 2) src/openai/resources/beta/responses/responses.py:5460— src/openai/resources/beta/responses/responses.py:5460-5490 | src/openai/resources/responses/responses.py:4650-4680 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `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 (31 lines × 2) src/openai/resources/skills/versions/versions.py:81— src/openai/resources/skills/versions/versions.py:81-111 | src/openai/resources/skills/versions/versions.py:303-333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 3) src/openai/resources/beta/agents/automations/invocations.py:109— src/openai/resources/beta/agents/automations/invocations.py:109-122 | src/openai/resources/beta/agents/sessions/artifacts.py:250-263 | src/openai/resources/vector_stores/file_batches.py:167-180 — before extracting anything, compare `src/openai/resources/beta/agents/automations/invocations.py` and `src/openai/resources/beta/agents/sessions/artifacts.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/automations/invocations.py:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 3) src/openai/resources/beta/agents/automations/invocations.py:272— src/openai/resources/beta/agents/automations/invocations.py:272-285 | src/openai/resources/beta/agents/sessions/artifacts.py:484-497 | src/openai/resources/vector_stores/file_batches.py:498-511 — before extracting anything, compare `src/openai/resources/beta/agents/automations/invocations.py` and `src/openai/resources/beta/agents/sessions/artifacts.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/automations/invocations.py:272` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 3) src/openai/resources/live/forks.py:457— src/openai/resources/live/forks.py:457-470 | src/openai/resources/live/live.py:675-688 | src/openai/resources/live/sideband.py:466-479 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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/openai/resources/live/forks.py:457` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 3) src/openai/resources/live/forks.py:883— src/openai/resources/live/forks.py:883-896 | src/openai/resources/live/live.py:1093-1106 | src/openai/resources/live/sideband.py:901-914 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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/openai/resources/live/forks.py:883` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 3) src/openai/resources/admin/organization/admin_api_keys.py:422— src/openai/resources/admin/organization/admin_api_keys.py:422-435 | src/openai/resources/admin/organization/admin_api_keys.py:440-453 | src/openai/resources/admin/organization/projects/api_keys.py:542-555 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `admin_api_keys` to `AdminAPIKeys` in one and `AsyncAdminAPIKeys` 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 (10–11 lines × 2) src/openai/lib/_response_resources.py:390— src/openai/lib/_response_resources.py:390-399 | src/openai/lib/_response_resources.py:558-568 — both copies are in the same file, so extract the 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/openai/lib/_response_resources.py:390` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/lib/_response_resources.py:569` calls `isinstance`, `ValueError` and `src/openai/lib/_response_resources.py:400` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–11 lines × 2) src/openai/lib/beta/agents/_artifacts.py:76— src/openai/lib/beta/agents/_artifacts.py:76-86 | src/openai/lib/beta/agents/_artifacts.py:148-157 — both copies are in the same file, so extract the 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/openai/lib/beta/agents/_artifacts.py:148` 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 (10–11 lines × 2) src/openai/lib/beta/agents/_stream.py:59— src/openai/lib/beta/agents/_stream.py:59-69 | src/openai/lib/beta/agents/_stream.py:113-122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10–11 lines × 2) src/openai/lib/streaming/_assistants.py:322— src/openai/lib/streaming/_assistants.py:322-332 | src/openai/lib/streaming/_assistants.py:755-764 — both copies are in the same file, so extract the 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/openai/lib/streaming/_assistants.py:755` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) src/openai/lib/streaming/agents/_streams.py:192— src/openai/lib/streaming/agents/_streams.py:192-202 | src/openai/lib/streaming/agents/_streams.py:331-340 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) scripts/check-dependency-security.py:804— scripts/check-dependency-security.py:804-810 | scripts/check-dependency-security.py:812-818 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) src/openai/lib/responses_tool_runner.py:2224— src/openai/lib/responses_tool_runner.py:2224-2230 | src/openai/lib/responses_tool_runner.py:2701-2707 — both copies are in the same file, so extract the 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/openai/lib/responses_tool_runner.py:2224` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) src/openai/lib/streaming/agents/_streams.py:123— src/openai/lib/streaming/agents/_streams.py:123-129 | src/openai/lib/streaming/agents/_streams.py:261-267 — both copies are in the same file, so extract the 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/openai/lib/streaming/agents/_streams.py:123` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) src/openai/resources/content_provenance_checks.py:76— src/openai/resources/content_provenance_checks.py:76-82 | src/openai/resources/uploads/parts.py:84-90 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/content_provenance_checks.py:76` 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/openai/resources/uploads/parts.py:83` calls `ValueError` and `src/openai/resources/content_provenance_checks.py:74` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) src/openai/resources/content_provenance_checks.py:150— src/openai/resources/content_provenance_checks.py:150-156 | src/openai/resources/uploads/parts.py:166-172 — 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/openai/resources/content_provenance_checks.py:150` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/openai/resources/uploads/parts.py:165` calls `ValueError` and `src/openai/resources/content_provenance_checks.py:148` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication· Members sharing a duplicated core (14 members, 50+ identical tokens) · ×4
Members sharing a duplicated core (14 members, 50+ identical tokens) src/openai/resources/beta/responses/responses.py:4995— src/openai/resources/beta/responses/responses.py:4995-5007 | src/openai/resources/beta/responses/responses.py:5325-5337 | src/openai/resources/live/forks.py:271-283 | src/openai/resources/live/forks.py:703-715 | src/openai/resources/live/live.py:491-503 | src/openai/resources/live/live.py:916-928 | src/openai/resources/live/sideband.py:278-290 | src/openai/resources/live/sideband.py:719-731 | src/openai/resources/realtime/realtime.py:471-483 | src/openai/resources/realtime/realtime.py:936-948 | src/openai/resources/realtime/translations/translations.py:356-368 | src/openai/resources/realtime/translations/translations.py:786-798 | src/openai/resources/responses/responses.py:4184-4196 | src/openai/resources/responses/responses.py:4515-4527 — These 14 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 14 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 14 times.
Members sharing a duplicated core (14 members, 50+ identical tokens) src/openai/resources/beta/responses/responses.py:5124— src/openai/resources/beta/responses/responses.py:5124-5133 | src/openai/resources/beta/responses/responses.py:5448-5457 | src/openai/resources/live/forks.py:402-411 | src/openai/resources/live/forks.py:828-837 | src/openai/resources/live/live.py:620-629 | src/openai/resources/live/live.py:1038-1047 | src/openai/resources/live/sideband.py:411-420 | src/openai/resources/live/sideband.py:846-855 | src/openai/resources/realtime/realtime.py:608-617 | src/openai/resources/realtime/realtime.py:1067-1076 | src/openai/resources/realtime/translations/translations.py:490-499 | src/openai/resources/realtime/translations/translations.py:914-923 | src/openai/resources/responses/responses.py:4313-4322 | src/openai/resources/responses/responses.py:4638-4647 — These 14 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 14 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 14 times.
Members sharing a duplicated core (14 members, 50+ identical tokens) src/openai/resources/beta/responses/responses.py:5136— src/openai/resources/beta/responses/responses.py:5136-5166 | src/openai/resources/beta/responses/responses.py:5460-5490 | src/openai/resources/live/forks.py:414-452 | src/openai/resources/live/forks.py:840-878 | src/openai/resources/live/live.py:632-670 | src/openai/resources/live/live.py:1050-1088 | src/openai/resources/live/sideband.py:423-461 | src/openai/resources/live/sideband.py:858-896 | src/openai/resources/realtime/realtime.py:620-658 | src/openai/resources/realtime/realtime.py:1079-1117 | src/openai/resources/realtime/translations/translations.py:502-540 | src/openai/resources/realtime/translations/translations.py:926-964 | src/openai/resources/responses/responses.py:4325-4355 | src/openai/resources/responses/responses.py:4650-4680 — These 14 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 14 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 14 times.
Members sharing a duplicated core (14 members, 50+ identical tokens) src/openai/resources/beta/responses/responses.py:5185— src/openai/resources/beta/responses/responses.py:5185-5194 | src/openai/resources/beta/responses/responses.py:5509-5518 | src/openai/resources/live/forks.py:514-528 | src/openai/resources/live/forks.py:940-954 | src/openai/resources/live/live.py:732-741 | src/openai/resources/live/live.py:1150-1159 | src/openai/resources/live/sideband.py:526-540 | src/openai/resources/live/sideband.py:961-975 | src/openai/resources/realtime/realtime.py:742-751 | src/openai/resources/realtime/realtime.py:1199-1208 | src/openai/resources/realtime/translations/translations.py:603-612 | src/openai/resources/realtime/translations/translations.py:1027-1036 | src/openai/resources/responses/responses.py:4374-4383 | src/openai/resources/responses/responses.py:4699-4708 — These 14 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 14 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 14 times.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×4
Members sharing a duplicated core (6 members, 50+ identical tokens) src/openai/_websocket_connection.py:225— src/openai/_websocket_connection.py:225-244 | src/openai/resources/live/forks.py:582-608 | src/openai/resources/live/live.py:795-821 | src/openai/resources/live/sideband.py:596-622 | src/openai/resources/realtime/realtime.py:809-835 | src/openai/resources/realtime/translations/translations.py:662-688 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) src/openai/_websocket_connection.py:453— src/openai/_websocket_connection.py:453-472 | src/openai/resources/live/forks.py:152-178 | src/openai/resources/live/live.py:372-398 | src/openai/resources/live/sideband.py:157-183 | src/openai/resources/realtime/realtime.py:344-370 | src/openai/resources/realtime/translations/translations.py:234-260 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) src/openai/resources/live/forks.py:133— src/openai/resources/live/forks.py:133-149 | src/openai/resources/live/forks.py:563-579 | src/openai/resources/live/live.py:353-369 | src/openai/resources/live/live.py:776-792 | src/openai/resources/live/sideband.py:137-154 | src/openai/resources/live/sideband.py:576-593 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) src/openai/resources/live/forks.py:286— src/openai/resources/live/forks.py:286-313 | src/openai/resources/live/forks.py:718-739 | src/openai/resources/live/live.py:506-533 | src/openai/resources/live/live.py:931-952 | src/openai/resources/live/sideband.py:293-320 | src/openai/resources/live/sideband.py:734-755 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Duplicated block (34 lines × 2) src/openai/lib/responses_tool_runner.py:1946— src/openai/lib/responses_tool_runner.py:1946-1979 | src/openai/lib/responses_tool_runner.py:2426-2459 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2) src/openai/resources/admin/organization/projects/groups/roles.py:210— src/openai/resources/admin/organization/projects/groups/roles.py:210-243 | src/openai/resources/admin/organization/projects/users/roles.py:210-243 — `src/openai/resources/admin/organization/projects/groups/roles.py` and `src/openai/resources/admin/organization/projects/users/roles.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 14 separate duplicated blocks between them, totalling at least 350 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `RoleDeleteResponse` names `......types.admin.organization.projects.groups.role_delete_response` in one and `......types.admin.organization.projects.users.role_delete_response` 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 (34 lines × 2) src/openai/resources/admin/organization/projects/groups/roles.py:430— src/openai/resources/admin/organization/projects/groups/roles.py:430-463 | src/openai/resources/admin/organization/projects/users/roles.py:430-463 — `src/openai/resources/admin/organization/projects/groups/roles.py` and `src/openai/resources/admin/organization/projects/users/roles.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 14 separate duplicated blocks between them, totalling at least 350 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `RoleDeleteResponse` names `......types.admin.organization.projects.groups.role_delete_response` in one and `......types.admin.organization.projects.users.role_delete_response` 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 (34 lines × 2) src/openai/resources/containers/files/files.py:72— src/openai/resources/containers/files/files.py:72-105 | src/openai/resources/containers/files/files.py:300-333 — both copies are in the same file, so extract the 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 (28 lines × 2) src/openai/_utils/_transform.py:182— src/openai/_utils/_transform.py:182-209 | src/openai/_utils/_transform.py:350-377 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (28 lines × 2) src/openai/resources/admin/organization/groups/roles.py:58— src/openai/resources/admin/organization/groups/roles.py:58-85 | src/openai/resources/admin/organization/users/roles.py:58-85 — `src/openai/resources/admin/organization/groups/roles.py` and `src/openai/resources/admin/organization/users/roles.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 14 separate duplicated blocks between them, totalling at least 340 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `RoleCreateResponse` names `.....types.admin.organization.groups.role_create_response` in one and `.....types.admin.organization.users.role_create_response` 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 (28 lines × 2) src/openai/resources/admin/organization/groups/roles.py:256— src/openai/resources/admin/organization/groups/roles.py:256-283 | src/openai/resources/admin/organization/users/roles.py:256-283 — `src/openai/resources/admin/organization/groups/roles.py` and `src/openai/resources/admin/organization/users/roles.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 14 separate duplicated blocks between them, totalling at least 340 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `RoleCreateResponse` names `.....types.admin.organization.groups.role_create_response` in one and `.....types.admin.organization.users.role_create_response` 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 (28 lines × 2) src/openai/resources/realtime/realtime.py:486— src/openai/resources/realtime/realtime.py:486-513 | src/openai/resources/realtime/translations/translations.py:371-398 — before extracting anything, compare `src/openai/resources/realtime/realtime.py` and `src/openai/resources/realtime/translations/translations.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 398 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: `RealtimeErrorEvent` names `....types.realtime.realtime_error_event` in one and `...types.realtime.realtime_error_event` 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 lines × 2) src/openai/_base_client.py:1286— src/openai/_base_client.py:1286-1309 | src/openai/_base_client.py:1908-1931 — both copies are in the same file, so extract the 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 (24 lines × 2) src/openai/lib/_assistants_runs.py:76— src/openai/lib/_assistants_runs.py:76-99 | src/openai/lib/_assistants_runs.py:444-467 — both copies are in the same file, so extract the 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/openai/lib/_assistants_runs.py:76` 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 (24 lines × 2) src/openai/lib/_client_auth.py:436— src/openai/lib/_client_auth.py:436-459 | src/openai/lib/_client_auth.py:909-932 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `_sdk_client.OpenAI` in one and `_sdk_client.AsyncOpenAI` 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 (24 lines × 2) src/openai/resources/beta/agents/sessions/events.py:57— src/openai/resources/beta/agents/sessions/events.py:57-80 | src/openai/resources/beta/agents/sessions/events.py:172-195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/sessions/events.py:57` 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 (20–21 lines × 2) src/openai/lib/computer.py:679— src/openai/lib/computer.py:679-698 | src/openai/lib/computer.py:890-910 — both copies are in the same file, so extract the 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/openai/lib/computer.py:679` 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–21 lines × 2) src/openai/resources/beta/agents/environments/files.py:207— src/openai/resources/beta/agents/environments/files.py:207-227 | src/openai/resources/vector_stores/files.py:101-120 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/environments/files.py:207` 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 (20–21 lines × 2) src/openai/resources/beta/agents/environments/files.py:469— src/openai/resources/beta/agents/environments/files.py:469-489 | src/openai/resources/vector_stores/files.py:529-548 — 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/openai/resources/beta/agents/environments/files.py:469` 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 (20–21 lines × 2) examples/computer-desktop/exercise_container.py:484— examples/computer-desktop/exercise_container.py:484-503 | examples/computer-desktop/exercise_container.py:744-764 — both copies are in the same file, so extract the 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) scripts/check-dependency-security.py:1541— scripts/check-dependency-security.py:1541-1549 | scripts/check-dependency-security.py:1912-1920 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) src/openai/auth/_workload.py:141— src/openai/auth/_workload.py:141-149 | src/openai/auth/_workload.py:188-196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/auth/_workload.py:141` 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/openai/lib/computer.py:610— src/openai/lib/computer.py:610-618 | src/openai/lib/computer.py:820-828 — both copies are in the same file, so extract the 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/openai/lib/computer.py:610` 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 (9 lines × 2) examples/x509_workload_identity.py:14— examples/x509_workload_identity.py:14-22 | examples/x509_workload_identity_async.py:15-23 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) scripts/check-dependency-security.py:797— scripts/check-dependency-security.py:797-802 | scripts/check-dependency-security.py:821-826 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/check-dependency-security.py:797` 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/openai/lib/beta/agents/_files.py:271— src/openai/lib/beta/agents/_files.py:271-276 | src/openai/lib/beta/agents/_files.py:292-297 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6 lines × 2) src/openai/lib/browser.py:691— src/openai/lib/browser.py:691-696 | src/openai/lib/browser.py:724-729 — both copies are in the same file, so extract the 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) examples/computer-desktop/exercise_container.py:523— examples/computer-desktop/exercise_container.py:523-528 | examples/computer-desktop/exercise_container.py:577-582 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 4) src/openai/resources/admin/organization/groups/roles.py:424— src/openai/resources/admin/organization/groups/roles.py:424-437 | src/openai/resources/admin/organization/projects/groups/roles.py:468-481 | src/openai/resources/admin/organization/projects/users/roles.py:468-481 | src/openai/resources/admin/organization/users/roles.py:424-437 — before extracting anything, compare `src/openai/resources/admin/organization/groups/roles.py` and `src/openai/resources/admin/organization/projects/groups/roles.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 4) src/openai/resources/admin/organization/groups/roles.py:442— src/openai/resources/admin/organization/groups/roles.py:442-455 | src/openai/resources/admin/organization/projects/groups/roles.py:486-499 | src/openai/resources/admin/organization/projects/users/roles.py:486-499 | src/openai/resources/admin/organization/users/roles.py:442-455 — before extracting anything, compare `src/openai/resources/admin/organization/groups/roles.py` and `src/openai/resources/admin/organization/projects/groups/roles.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 4) src/openai/resources/admin/organization/groups/roles.py:460— src/openai/resources/admin/organization/groups/roles.py:460-473 | src/openai/resources/admin/organization/projects/groups/roles.py:504-517 | src/openai/resources/admin/organization/projects/users/roles.py:504-517 | src/openai/resources/admin/organization/users/roles.py:460-473 — before extracting anything, compare `src/openai/resources/admin/organization/groups/roles.py` and `src/openai/resources/admin/organization/projects/groups/roles.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 4) src/openai/resources/admin/organization/groups/roles.py:478— src/openai/resources/admin/organization/groups/roles.py:478-491 | src/openai/resources/admin/organization/projects/groups/roles.py:522-535 | src/openai/resources/admin/organization/projects/users/roles.py:522-535 | src/openai/resources/admin/organization/users/roles.py:478-491 — before extracting anything, compare `src/openai/resources/admin/organization/groups/roles.py` and `src/openai/resources/admin/organization/projects/groups/roles.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Repeated repair: src/openai/resources/beta/realtime/realtime.py src/openai/resources/beta/realtime/realtime.py:341— src/openai/resources/beta/realtime/realtime.py changed 12 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is AsyncRealtimeConnectionManager.__aenter__ at line 341), 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(realtime): validate beta WebSocket authentication profiles (#4218)”; “fix(api): honor per-call WebSocket query settings (#4138)”; “fix: preserve client headers in legacy Beta Realtime connections (#4130)”; “fix: clean up failed WebSocket setup and honor native options (#4121)”. 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 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/resources/beta/realtime/realtime.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/openai/lib/_parsing/_responses.py src/openai/lib/_parsing/_responses.py:170— src/openai/lib/_parsing/_responses.py changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is _responses.get_input_tool_by_name at line 170), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(responses): resolve function arguments within their namespace (#4166)”; “fix(lib): treat null message content as empty in parse_response (#3851)”; “fix(parsing): drop TextFormatT parameterization in parse_response to fix memory leak (#3084) (#3088)”; “fix(responses): skip structured parsing for commentary (#3861)”. 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 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/lib/_parsing/_responses.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/openai/lib/realtime_translation.py src/openai/lib/realtime_translation.py:95— src/openai/lib/realtime_translation.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 8 (its worst body is TranslationConnection.send 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(api): honor per-call WebSocket query settings (#4138)”; “fix: honor timed Translation receives during terminal cleanup (#4132)”; “fix: clean up failed WebSocket setup and honor native options (#4121)”. 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 17:58:57 +00:00' --until='2026-11-03 17:58:57 +00:00' --full-history --no-merges -- src/openai/lib/realtime_translation.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.
Duplicated block (29 lines × 2) src/openai/resources/admin/organization/projects/api_keys.py:56— src/openai/resources/admin/organization/projects/api_keys.py:56-84 | src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py:134-162 — before extracting anything, compare `src/openai/resources/admin/organization/projects/api_keys.py` and `src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 183 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/admin/organization/projects/api_keys.py:56` 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 (29 lines × 2) src/openai/resources/admin/organization/projects/api_keys.py:314— src/openai/resources/admin/organization/projects/api_keys.py:314-342 | src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py:422-450 — before extracting anything, compare `src/openai/resources/admin/organization/projects/api_keys.py` and `src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 183 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/admin/organization/projects/api_keys.py:314` 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 (29 lines × 2) src/openai/resources/images.py:648— src/openai/resources/images.py:648-676 | src/openai/resources/images.py:1824-1852 — both copies are in the same file, so extract the 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 (20 lines × 2) src/openai/resources/beta/agents/sessions/artifacts.py:231— src/openai/resources/beta/agents/sessions/artifacts.py:231-250 | src/openai/resources/beta/agents/sessions/artifacts.py:465-484 — both copies are in the same file, so extract the 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/openai/resources/beta/agents/sessions/artifacts.py:231` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) src/openai/resources/live/forks.py:459— src/openai/resources/live/forks.py:459-478 | src/openai/resources/live/live.py:677-696 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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/openai/resources/live/forks.py:459` 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 (20 lines × 2) src/openai/resources/live/forks.py:885— src/openai/resources/live/forks.py:885-904 | src/openai/resources/live/live.py:1095-1114 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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/openai/resources/live/forks.py:885` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) src/openai/lib/_assistants_runs.py:211— src/openai/lib/_assistants_runs.py:211-229 | src/openai/lib/_assistants_runs.py:576-594 — both copies are in the same file, so extract the 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/openai/lib/_assistants_runs.py:211` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) src/openai/lib/_client_auth.py:244— src/openai/lib/_client_auth.py:244-262 | src/openai/lib/_client_auth.py:710-728 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) src/openai/lib/decisions_tool_runner.py:397— src/openai/lib/decisions_tool_runner.py:397-415 | src/openai/lib/decisions_tool_runner.py:516-534 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 4) src/openai/resources/live/forks.py:459— src/openai/resources/live/forks.py:459-474 | src/openai/resources/live/forks.py:885-900 | src/openai/resources/live/live.py:677-692 | src/openai/resources/live/live.py:1095-1110 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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 × 4) src/openai/resources/live/sideband.py:471— src/openai/resources/live/sideband.py:471-486 | src/openai/resources/live/sideband.py:906-921 | src/openai/resources/realtime/realtime.py:685-700 | src/openai/resources/realtime/realtime.py:1142-1157 — before extracting anything, compare `src/openai/resources/live/sideband.py` and `src/openai/resources/realtime/realtime.py` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 4) src/openai/resources/live/forks.py:61— src/openai/resources/live/forks.py:61-76 | src/openai/resources/live/forks.py:93-108 | src/openai/resources/realtime/translations/translations.py:89-104 | src/openai/resources/realtime/translations/translations.py:143-158 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/realtime/translations/translations.py` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 396 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 5) src/openai/resources/live/forks.py:199— src/openai/resources/live/forks.py:199-213 | src/openai/resources/live/live.py:419-433 | src/openai/resources/live/sideband.py:204-218 | src/openai/resources/realtime/realtime.py:391-405 | src/openai/resources/realtime/translations/translations.py:281-295 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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 (15 lines × 5) src/openai/resources/live/forks.py:497— src/openai/resources/live/forks.py:497-511 | src/openai/resources/live/live.py:715-729 | src/openai/resources/live/sideband.py:509-523 | src/openai/resources/realtime/realtime.py:725-739 | src/openai/resources/realtime/translations/translations.py:586-600 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 5) src/openai/resources/live/forks.py:923— src/openai/resources/live/forks.py:923-937 | src/openai/resources/live/live.py:1133-1147 | src/openai/resources/live/sideband.py:944-958 | src/openai/resources/realtime/realtime.py:1182-1196 | src/openai/resources/realtime/translations/translations.py:1010-1024 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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.
Low cohesion: OpenAI (LCOM4 10) src/openai/_client.py:142— OpenAI's methods fall into 10 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 10 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: AsyncOpenAI (LCOM4 9) src/openai/_client.py:669— AsyncOpenAI'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: BaseClient (LCOM4 5) src/openai/_base_client.py:442— BaseClient'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.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×3
Recursive walk over a caller-supplied document has no depth cap src/openai/_models.py:665— `construct_type` is public and takes `type_: object` from its caller, and it calls itself at line 665 (`construct_type`) with a piece of `type_` (and at line 670, line 682, line 704) — and nowhere in `construct_type` 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 `construct_type` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap src/openai/_utils/_utils.py:130— `extract_files` is public, takes a document from its caller (line 41) and hands it to `_extract_items`, which calls itself at line 130 (`_extract_items`) with a piece of `obj` (and at line 143) — and nowhere in `_extract_items` 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 `_extract_items` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap src/openai/_utils/_utils.py:429— `json_safe` is public and takes `data: object` from its caller, and it calls itself at line 429 (`json_safe`) with a piece of `data` (and at line 432) — and nowhere in `json_safe` 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 `json_safe` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
AsyncAPIClient.request (cyclomatic 20) src/openai/_base_client.py:1744— AsyncAPIClient.request 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. This shape REPEATS in the file: one other method here (AsyncAPIClient.request) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncAPIClient.request (cyclomatic 20) src/openai/_base_client.py:1753— AsyncAPIClient.request 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. This shape REPEATS in the file: one other method here (AsyncAPIClient.request) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncAPIClient.request (cognitive 35) src/openai/_base_client.py:1744— AsyncAPIClient.request has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (18 pts), error handling 4 (8 pts), boolean chains 5, ternaries 1 (3 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AsyncAPIClient.request) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncAPIClient.request (cognitive 35) src/openai/_base_client.py:1753— AsyncAPIClient.request has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (18 pts), error handling 4 (8 pts), boolean chains 5, ternaries 1 (3 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AsyncAPIClient.request) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncResponsesConnection.dispatch_events (cognitive 17) src/openai/resources/beta/responses/responses.py:5009— AsyncResponsesConnection.dispatch_events has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AsyncResponsesConnection.dispatch_events (cognitive 17) src/openai/resources/responses/responses.py:4198— AsyncResponsesConnection.dispatch_events has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Change-coupling hub: response_compact_params.py → beta_responses_client_event.py, beta_responses_client_event_param.py, chat_model.py, chat_model.py src/openai/types/beta/response_compact_params.py— `src/openai/types/beta/response_compact_params.py` changes together with 4 other files — `src/openai/types/beta/beta_responses_client_event.py`, `src/openai/types/beta/beta_responses_client_event_param.py`, `src/openai/types/shared/chat_model.py`, `src/openai/types/shared_params/chat_model.py` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
Change-coupling hub: realtime.py → forks.py, live.py, sideband.py src/openai/resources/realtime/realtime.py— `src/openai/resources/realtime/realtime.py` changes together with 3 other files — `src/openai/resources/live/forks.py`, `src/openai/resources/live/live.py`, `src/openai/resources/live/sideband.py` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D4 · Code Duplication· Edited copy of a member (52 corresponding lines) · ×2
Edited copy of a member (52 corresponding lines) src/openai/resources/beta/agents/sessions/subagents/items.py:59— src/openai/resources/beta/agents/sessions/subagents/items.py:59-110 | src/openai/resources/beta/agents/sessions/subagents/turns/items.py:60-114 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (52 corresponding lines) src/openai/resources/beta/agents/sessions/subagents/items.py:148— src/openai/resources/beta/agents/sessions/subagents/items.py:148-199 | src/openai/resources/beta/agents/sessions/subagents/turns/items.py:153-207 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (29 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (29 members, 50+ identical tokens) src/openai/resources/admin/organization/admin_api_keys.py:103— src/openai/resources/admin/organization/admin_api_keys.py:103-129 | src/openai/resources/admin/organization/external_keys.py:282-306 | src/openai/resources/admin/organization/external_storage.py:102-130 | src/openai/resources/admin/organization/groups/groups.py:118-142 | src/openai/resources/admin/organization/invites.py:112-136 | src/openai/resources/admin/organization/projects/data_retention.py:53-77 | src/openai/resources/admin/organization/projects/hosted_tool_permissions.py:53-77 | src/openai/resources/admin/organization/projects/model_permissions.py:54-78 | src/openai/resources/admin/organization/projects/projects.py:269-293 | src/openai/resources/admin/organization/projects/spend_limit.py:54-78 | src/openai/resources/admin/organization/roles.py:107-131 | src/openai/resources/admin/organization/spend_alerts.py:110-134 | src/openai/resources/admin/organization/users/users.py:67-91 | src/openai/resources/audio/voice_consents.py:119-143 | src/openai/resources/batches.py:147-171 | src/openai/resources/chat/completions/completions.py:1680-1706 | src/openai/resources/containers/containers.py:132-156 | src/openai/resources/conversations/conversations.py:124-148 | src/openai/resources/evals/evals.py:144-168 | src/openai/resources/files.py:168-192 | src/openai/resources/files.py:343-367 | src/openai/resources/fine_tuning/jobs/jobs.py:196-222 | src/openai/resources/models.py:54-79 | src/openai/resources/safety/alerts.py:50-76 | src/openai/resources/safety/cases.py:50-76 | src/openai/resources/skills/skills.py:137-161 | src/openai/resources/videos.py:150-174 | src/openai/resources/videos.py:496-520 | src/openai/resources/webhooks/webhooks.py:162-188 — These 29 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 29 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 29 times.
Members sharing a duplicated core (29 members, 50+ identical tokens) src/openai/resources/admin/organization/admin_api_keys.py:300— src/openai/resources/admin/organization/admin_api_keys.py:300-326 | src/openai/resources/admin/organization/external_keys.py:690-714 | src/openai/resources/admin/organization/external_storage.py:343-371 | src/openai/resources/admin/organization/groups/groups.py:356-380 | src/openai/resources/admin/organization/invites.py:316-340 | src/openai/resources/admin/organization/projects/data_retention.py:161-185 | src/openai/resources/admin/organization/projects/hosted_tool_permissions.py:173-197 | src/openai/resources/admin/organization/projects/model_permissions.py:199-223 | src/openai/resources/admin/organization/projects/projects.py:592-616 | src/openai/resources/admin/organization/projects/spend_limit.py:204-228 | src/openai/resources/admin/organization/roles.py:360-384 | src/openai/resources/admin/organization/spend_alerts.py:377-401 | src/openai/resources/admin/organization/users/users.py:280-304 | src/openai/resources/audio/voice_consents.py:371-395 | src/openai/resources/batches.py:389-413 | src/openai/resources/chat/completions/completions.py:3483-3509 | src/openai/resources/containers/containers.py:357-381 | src/openai/resources/conversations/conversations.py:325-349 | src/openai/resources/evals/evals.py:428-452 | src/openai/resources/files.py:509-533 | src/openai/resources/files.py:684-708 | src/openai/resources/fine_tuning/jobs/jobs.py:607-633 | src/openai/resources/models.py:181-206 | src/openai/resources/safety/alerts.py:110-136 | src/openai/resources/safety/cases.py:110-136 | src/openai/resources/skills/skills.py:380-404 | src/openai/resources/videos.py:735-759 | src/openai/resources/videos.py:1083-1107 | src/openai/resources/webhooks/webhooks.py:652-678 — These 29 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 29 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 29 times.
D4 · Code Duplication· Members sharing a duplicated core (23 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (23 members, 50+ identical tokens) src/openai/resources/admin/organization/certificates.py:715— src/openai/resources/admin/organization/certificates.py:715-737 | src/openai/resources/admin/organization/groups/groups.py:519-535 | src/openai/resources/admin/organization/projects/roles.py:565-581 | src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py:616-632 | src/openai/resources/admin/organization/projects/spend_alerts.py:606-622 | src/openai/resources/admin/organization/projects/users/users.py:572-588 | src/openai/resources/admin/organization/roles.py:533-549 | src/openai/resources/admin/organization/spend_alerts.py:560-576 | src/openai/resources/audio/voice_consents.py:531-547 | src/openai/resources/beta/agents/agents.py:817-833 | src/openai/resources/beta/agents/automations/automations.py:925-947 | src/openai/resources/beta/agents/environments/templates.py:723-739 | src/openai/resources/beta/agents/sessions/sessions.py:928-944 | src/openai/resources/beta/agents/vaults/credentials.py:640-656 | src/openai/resources/beta/agents/vaults/vaults.py:602-618 | src/openai/resources/beta/assistants.py:1159-1175 | src/openai/resources/beta/threads/messages.py:634-650 | src/openai/resources/chat/completions/completions.py:3668-3688 | src/openai/resources/evals/evals.py:607-623 | src/openai/resources/skills/skills.py:542-558 | src/openai/resources/vector_stores/files.py:896-915 | src/openai/resources/vector_stores/vector_stores.py:794-813 | src/openai/resources/webhooks/webhooks.py:1027-1049 — These 23 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 23 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 23 times.
Members sharing a duplicated core (23 members, 50+ identical tokens) src/openai/resources/admin/organization/certificates.py:742— src/openai/resources/admin/organization/certificates.py:742-764 | src/openai/resources/admin/organization/groups/groups.py:548-564 | src/openai/resources/admin/organization/projects/roles.py:586-602 | src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py:641-657 | src/openai/resources/admin/organization/projects/spend_alerts.py:627-643 | src/openai/resources/admin/organization/projects/users/users.py:597-613 | src/openai/resources/admin/organization/roles.py:554-570 | src/openai/resources/admin/organization/spend_alerts.py:581-597 | src/openai/resources/audio/voice_consents.py:552-568 | src/openai/resources/beta/agents/agents.py:854-870 | src/openai/resources/beta/agents/automations/automations.py:956-978 | src/openai/resources/beta/agents/environments/templates.py:744-760 | src/openai/resources/beta/agents/sessions/sessions.py:973-989 | src/openai/resources/beta/agents/vaults/credentials.py:661-677 | src/openai/resources/beta/agents/vaults/vaults.py:627-643 | src/openai/resources/beta/assistants.py:1180-1196 | src/openai/resources/beta/threads/messages.py:655-671 | src/openai/resources/chat/completions/completions.py:3700-3720 | src/openai/resources/evals/evals.py:633-649 | src/openai/resources/skills/skills.py:571-587 | src/openai/resources/vector_stores/files.py:920-939 | src/openai/resources/vector_stores/vector_stores.py:826-845 | src/openai/resources/webhooks/webhooks.py:1058-1080 — These 23 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 23 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 23 times.
D4 · Code Duplication· Members sharing a duplicated core (21 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (21 members, 50+ identical tokens) src/openai/resources/admin/organization/admin_api_keys.py:194— src/openai/resources/admin/organization/admin_api_keys.py:194-220 | src/openai/resources/admin/organization/certificates.py:260-286 | src/openai/resources/admin/organization/external_keys.py:369-393 | src/openai/resources/admin/organization/external_storage.py:193-225 | src/openai/resources/admin/organization/groups/groups.py:252-276 | src/openai/resources/admin/organization/invites.py:201-226 | src/openai/resources/admin/organization/projects/model_permissions.py:141-165 | src/openai/resources/admin/organization/projects/spend_limit.py:146-170 | src/openai/resources/admin/organization/roles.py:251-275 | src/openai/resources/admin/organization/spend_alerts.py:264-288 | src/openai/resources/admin/organization/users/users.py:218-242 | src/openai/resources/audio/voice_consents.py:250-274 | src/openai/resources/audio/voices.py:207-238 | src/openai/resources/chat/completions/completions.py:1834-1860 | src/openai/resources/conversations/conversations.py:206-231 | src/openai/resources/evals/evals.py:294-318 | src/openai/resources/files.py:267-291 | src/openai/resources/models.py:119-145 | src/openai/resources/skills/skills.py:268-292 | src/openai/resources/videos.py:242-266 | src/openai/resources/webhooks/webhooks.py:336-362 — These 21 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 21 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 21 times.
Members sharing a duplicated core (21 members, 50+ identical tokens) src/openai/resources/admin/organization/admin_api_keys.py:391— src/openai/resources/admin/organization/admin_api_keys.py:391-417 | src/openai/resources/admin/organization/certificates.py:600-626 | src/openai/resources/admin/organization/external_keys.py:777-801 | src/openai/resources/admin/organization/external_storage.py:434-466 | src/openai/resources/admin/organization/groups/groups.py:490-514 | src/openai/resources/admin/organization/invites.py:405-430 | src/openai/resources/admin/organization/projects/model_permissions.py:286-310 | src/openai/resources/admin/organization/projects/spend_limit.py:296-320 | src/openai/resources/admin/organization/roles.py:504-528 | src/openai/resources/admin/organization/spend_alerts.py:531-555 | src/openai/resources/admin/organization/users/users.py:431-455 | src/openai/resources/audio/voice_consents.py:502-526 | src/openai/resources/audio/voices.py:423-454 | src/openai/resources/chat/completions/completions.py:3637-3663 | src/openai/resources/conversations/conversations.py:409-434 | src/openai/resources/evals/evals.py:578-602 | src/openai/resources/files.py:608-632 | src/openai/resources/models.py:246-272 | src/openai/resources/skills/skills.py:513-537 | src/openai/resources/videos.py:827-851 | src/openai/resources/webhooks/webhooks.py:826-852 — These 21 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 21 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 21 times.
D4 · Code Duplication· Members sharing a duplicated core (9 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (9 members, 50+ identical tokens) src/openai/resources/admin/organization/external_keys.py:406— src/openai/resources/admin/organization/external_keys.py:406-430 | src/openai/resources/admin/organization/external_storage.py:238-266 | src/openai/resources/admin/organization/projects/projects.py:419-445 | src/openai/resources/batches.py:237-264 | src/openai/resources/fine_tuning/jobs/jobs.py:293-317 | src/openai/resources/fine_tuning/jobs/jobs.py:381-405 | src/openai/resources/fine_tuning/jobs/jobs.py:418-442 | src/openai/resources/responses/responses.py:1654-1681 | src/openai/resources/uploads/uploads.py:222-249 — These 9 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 9 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 9 times.
Members sharing a duplicated core (9 members, 50+ identical tokens) src/openai/resources/admin/organization/external_keys.py:814— src/openai/resources/admin/organization/external_keys.py:814-838 | src/openai/resources/admin/organization/external_storage.py:479-507 | src/openai/resources/admin/organization/projects/projects.py:742-768 | src/openai/resources/batches.py:479-506 | src/openai/resources/fine_tuning/jobs/jobs.py:704-728 | src/openai/resources/fine_tuning/jobs/jobs.py:792-816 | src/openai/resources/fine_tuning/jobs/jobs.py:829-853 | src/openai/resources/responses/responses.py:3572-3599 | src/openai/resources/uploads/uploads.py:502-529 — These 9 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 9 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 9 times.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (5 members, 50+ identical tokens) src/openai/resources/beta/agents/sessions/artifacts.py:186— src/openai/resources/beta/agents/sessions/artifacts.py:186-217 | src/openai/resources/beta/agents/vaults/credentials.py:301-332 | src/openai/resources/beta/threads/messages.py:300-327 | src/openai/resources/containers/files/files.py:233-260 | src/openai/resources/vector_stores/files.py:302-335 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) src/openai/resources/beta/agents/sessions/artifacts.py:420— src/openai/resources/beta/agents/sessions/artifacts.py:420-451 | src/openai/resources/beta/agents/vaults/credentials.py:604-635 | src/openai/resources/beta/threads/messages.py:602-629 | src/openai/resources/containers/files/files.py:461-488 | src/openai/resources/vector_stores/files.py:730-763 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Duplicated block (41 lines × 2) src/openai/resources/admin/organization/projects/groups/roles.py:153— src/openai/resources/admin/organization/projects/groups/roles.py:153-193 | src/openai/resources/admin/organization/projects/users/roles.py:153-193 — `src/openai/resources/admin/organization/projects/groups/roles.py` and `src/openai/resources/admin/organization/projects/users/roles.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 14 separate duplicated blocks between them, totalling at least 350 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/openai/resources/admin/organization/projects/groups/roles.py:153` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `RoleListResponse` names `......types.admin.organization.projects.groups.role_list_response` in one and `......types.admin.organization.projects.users.role_list_response` 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 (41 lines × 2) src/openai/resources/admin/organization/projects/groups/roles.py:373— src/openai/resources/admin/organization/projects/groups/roles.py:373-413 | src/openai/resources/admin/organization/projects/users/roles.py:373-413 — `src/openai/resources/admin/organization/projects/groups/roles.py` and `src/openai/resources/admin/organization/projects/users/roles.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 14 separate duplicated blocks between them, totalling at least 350 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/openai/resources/admin/organization/projects/groups/roles.py:373` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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: `RoleListResponse` names `......types.admin.organization.projects.groups.role_list_response` in one and `......types.admin.organization.projects.users.role_list_response` 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 (39 lines × 2) src/openai/resources/admin/organization/groups/roles.py:141— src/openai/resources/admin/organization/groups/roles.py:141-179 | src/openai/resources/admin/organization/users/roles.py:141-179 — `src/openai/resources/admin/organization/groups/roles.py` and `src/openai/resources/admin/organization/users/roles.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 14 separate duplicated blocks between them, totalling at least 340 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/openai/resources/admin/organization/groups/roles.py:141` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `RoleListResponse` names `.....types.admin.organization.groups.role_list_response` in one and `.....types.admin.organization.users.role_list_response` 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 (39 lines × 2) src/openai/resources/admin/organization/groups/roles.py:339— src/openai/resources/admin/organization/groups/roles.py:339-377 | src/openai/resources/admin/organization/users/roles.py:339-377 — `src/openai/resources/admin/organization/groups/roles.py` and `src/openai/resources/admin/organization/users/roles.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 14 separate duplicated blocks between them, totalling at least 340 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/openai/resources/admin/organization/groups/roles.py:339` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `RoleListResponse` names `.....types.admin.organization.groups.role_list_response` in one and `.....types.admin.organization.users.role_list_response` 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 (37 lines × 2) src/openai/_websocket_connection.py:315— src/openai/_websocket_connection.py:315-351 | src/openai/_websocket_connection.py:542-578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (37 lines × 2) src/openai/lib/bedrock.py:448— src/openai/lib/bedrock.py:448-484 | src/openai/lib/bedrock.py:684-720 — both copies are in the same file, so extract the 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 (32–35 lines × 3) src/openai/resources/admin/organization/projects/api_keys.py:244— src/openai/resources/admin/organization/projects/api_keys.py:244-277 | src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py:290-321 | src/openai/resources/fine_tuning/checkpoints/permissions.py:253-287 — before extracting anything, compare `src/openai/resources/admin/organization/projects/api_keys.py` and `src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 183 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/admin/organization/projects/api_keys.py:244` 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–35 lines × 3) src/openai/resources/admin/organization/projects/api_keys.py:502— src/openai/resources/admin/organization/projects/api_keys.py:502-535 | src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py:578-609 | src/openai/resources/fine_tuning/checkpoints/permissions.py:514-548 — before extracting anything, compare `src/openai/resources/admin/organization/projects/api_keys.py` and `src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 183 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/admin/organization/projects/api_keys.py:502` 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 (33 lines × 2) src/openai/lib/_assistants_runs.py:275— src/openai/lib/_assistants_runs.py:275-307 | src/openai/lib/_assistants_runs.py:639-671 — both copies are in the same file, so extract the 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 (33 lines × 2) src/openai/resources/uploads/parts.py:57— src/openai/resources/uploads/parts.py:57-89 | src/openai/resources/uploads/parts.py:139-171 — both copies are in the same file, so extract the 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/openai/resources/uploads/parts.py:57` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26–32 lines × 5) src/openai/resources/beta/agents/sessions/artifacts.py:186— src/openai/resources/beta/agents/sessions/artifacts.py:186-215 | src/openai/resources/beta/agents/vaults/credentials.py:301-330 | src/openai/resources/beta/threads/messages.py:300-325 | src/openai/resources/containers/files/files.py:233-258 | src/openai/resources/vector_stores/files.py:302-333 — before extracting anything, compare `src/openai/resources/beta/agents/sessions/artifacts.py` and `src/openai/resources/beta/agents/vaults/credentials.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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/sessions/artifacts.py:186` 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 (26–32 lines × 5) src/openai/resources/beta/agents/sessions/artifacts.py:420— src/openai/resources/beta/agents/sessions/artifacts.py:420-449 | src/openai/resources/beta/agents/vaults/credentials.py:604-633 | src/openai/resources/beta/threads/messages.py:602-627 | src/openai/resources/containers/files/files.py:461-486 | src/openai/resources/vector_stores/files.py:730-761 — before extracting anything, compare `src/openai/resources/beta/agents/sessions/artifacts.py` and `src/openai/resources/beta/agents/vaults/credentials.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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/sessions/artifacts.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. The matched lines also transfer control out of the body holding them, 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 lines × 3) src/openai/resources/admin/organization/projects/groups/roles.py:103— src/openai/resources/admin/organization/projects/groups/roles.py:103-134 | src/openai/resources/admin/organization/projects/users/roles.py:103-134 | src/openai/resources/evals/runs/output_items.py:59-90 — `src/openai/resources/admin/organization/projects/groups/roles.py` and `src/openai/resources/admin/organization/projects/users/roles.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 14 separate duplicated blocks between them, totalling at least 350 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/openai/resources/admin/organization/projects/groups/roles.py:103` 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 lines × 3) src/openai/resources/admin/organization/projects/groups/roles.py:323— src/openai/resources/admin/organization/projects/groups/roles.py:323-354 | src/openai/resources/admin/organization/projects/users/roles.py:323-354 | src/openai/resources/evals/runs/output_items.py:194-225 — `src/openai/resources/admin/organization/projects/groups/roles.py` and `src/openai/resources/admin/organization/projects/users/roles.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 14 separate duplicated blocks between them, totalling at least 350 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/openai/resources/admin/organization/projects/groups/roles.py:323` 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 (23–31 lines × 21) src/openai/resources/admin/organization/admin_api_keys.py:194— src/openai/resources/admin/organization/admin_api_keys.py:194-218 | src/openai/resources/admin/organization/certificates.py:260-284 | src/openai/resources/admin/organization/external_keys.py:369-391 | src/openai/resources/admin/organization/external_storage.py:193-223 | src/openai/resources/admin/organization/groups/groups.py:252-274 | src/openai/resources/admin/organization/invites.py:201-224 | src/openai/resources/admin/organization/projects/model_permissions.py:141-163 | src/openai/resources/admin/organization/projects/spend_limit.py:146-168 | src/openai/resources/admin/organization/roles.py:251-273 | src/openai/resources/admin/organization/spend_alerts.py:264-286 | src/openai/resources/admin/organization/users/users.py:218-240 | src/openai/resources/audio/voice_consents.py:250-272 | src/openai/resources/audio/voices.py:207-236 | src/openai/resources/chat/completions/completions.py:1834-1858 | src/openai/resources/conversations/conversations.py:206-229 | src/openai/resources/evals/evals.py:294-316 | src/openai/resources/files.py:267-289 | src/openai/resources/models.py:119-143 | src/openai/resources/skills/skills.py:268-290 | src/openai/resources/videos.py:242-264 | src/openai/resources/webhooks/webhooks.py:336-360 — before extracting anything, compare `src/openai/resources/admin/organization/admin_api_keys.py` and `src/openai/resources/admin/organization/external_keys.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 116 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/openai/resources/admin/organization/admin_api_keys.py:194` 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 (23–31 lines × 21) src/openai/resources/admin/organization/admin_api_keys.py:391— src/openai/resources/admin/organization/admin_api_keys.py:391-415 | src/openai/resources/admin/organization/certificates.py:600-624 | src/openai/resources/admin/organization/external_keys.py:777-799 | src/openai/resources/admin/organization/external_storage.py:434-464 | src/openai/resources/admin/organization/groups/groups.py:490-512 | src/openai/resources/admin/organization/invites.py:405-428 | src/openai/resources/admin/organization/projects/model_permissions.py:286-308 | src/openai/resources/admin/organization/projects/spend_limit.py:296-318 | src/openai/resources/admin/organization/roles.py:504-526 | src/openai/resources/admin/organization/spend_alerts.py:531-553 | src/openai/resources/admin/organization/users/users.py:431-453 | src/openai/resources/audio/voice_consents.py:502-524 | src/openai/resources/audio/voices.py:423-452 | src/openai/resources/chat/completions/completions.py:3637-3661 | src/openai/resources/conversations/conversations.py:409-432 | src/openai/resources/evals/evals.py:578-600 | src/openai/resources/files.py:608-630 | src/openai/resources/models.py:246-270 | src/openai/resources/skills/skills.py:513-535 | src/openai/resources/videos.py:827-849 | src/openai/resources/webhooks/webhooks.py:826-850 — before extracting anything, compare `src/openai/resources/admin/organization/admin_api_keys.py` and `src/openai/resources/admin/organization/external_keys.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 116 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/openai/resources/admin/organization/admin_api_keys.py:391` 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 (25–30 lines × 10) src/openai/resources/admin/organization/groups/roles.py:195— src/openai/resources/admin/organization/groups/roles.py:195-219 | src/openai/resources/admin/organization/groups/users.py:196-220 | src/openai/resources/admin/organization/projects/groups/groups.py:220-246 | src/openai/resources/admin/organization/projects/roles.py:265-289 | src/openai/resources/admin/organization/projects/spend_alerts.py:285-311 | src/openai/resources/admin/organization/projects/users/users.py:267-296 | src/openai/resources/admin/organization/users/roles.py:195-219 | src/openai/resources/conversations/items.py:240-266 | src/openai/resources/evals/runs/runs.py:238-262 | src/openai/resources/skills/versions/versions.py:235-261 — before extracting anything, compare `src/openai/resources/admin/organization/groups/roles.py` and `src/openai/resources/admin/organization/groups/users.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 114 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/openai/resources/admin/organization/groups/roles.py:195` 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 (25–30 lines × 10) src/openai/resources/admin/organization/groups/roles.py:393— src/openai/resources/admin/organization/groups/roles.py:393-417 | src/openai/resources/admin/organization/groups/users.py:395-419 | src/openai/resources/admin/organization/projects/groups/groups.py:441-467 | src/openai/resources/admin/organization/projects/roles.py:534-558 | src/openai/resources/admin/organization/projects/spend_alerts.py:573-599 | src/openai/resources/admin/organization/projects/users/users.py:536-565 | src/openai/resources/admin/organization/users/roles.py:393-417 | src/openai/resources/conversations/items.py:483-509 | src/openai/resources/evals/runs/runs.py:508-532 | src/openai/resources/skills/versions/versions.py:457-483 — before extracting anything, compare `src/openai/resources/admin/organization/groups/roles.py` and `src/openai/resources/admin/organization/groups/users.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 114 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/openai/resources/admin/organization/groups/roles.py:393` 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 (29–30 lines × 2) src/openai/resources/beta/agents/automations/automations.py:408— src/openai/resources/beta/agents/automations/automations.py:408-436 | src/openai/resources/beta/agents/automations/automations.py:449-478 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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–30 lines × 2) src/openai/resources/beta/agents/automations/automations.py:850— src/openai/resources/beta/agents/automations/automations.py:850-878 | src/openai/resources/beta/agents/automations/automations.py:891-920 — both copies are in the same file, so extract the 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 (29 lines × 9) src/openai/resources/audio/transcriptions.py:596— src/openai/resources/audio/transcriptions.py:596-723 | src/openai/resources/audio/translations.py:152-215 | src/openai/resources/audio/voice_consents.py:60-94 | src/openai/resources/files.py:76-143 | src/openai/resources/images.py:68-125 | src/openai/resources/videos.py:85-124 | src/openai/resources/videos.py:281-309 | src/openai/resources/videos.py:381-410 | src/openai/resources/videos.py:438-470 — before extracting anything, compare `src/openai/resources/audio/transcriptions.py` and `src/openai/resources/audio/translations.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 312 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/openai/resources/audio/transcriptions.py:596` 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 (29 lines × 9) src/openai/resources/audio/transcriptions.py:1286— src/openai/resources/audio/transcriptions.py:1286-1413 | src/openai/resources/audio/translations.py:340-403 | src/openai/resources/audio/voice_consents.py:312-346 | src/openai/resources/files.py:417-484 | src/openai/resources/images.py:1244-1301 | src/openai/resources/videos.py:670-709 | src/openai/resources/videos.py:866-894 | src/openai/resources/videos.py:968-997 | src/openai/resources/videos.py:1025-1057 — before extracting anything, compare `src/openai/resources/audio/transcriptions.py` and `src/openai/resources/audio/translations.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 312 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/openai/resources/audio/transcriptions.py:1286` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14–28 lines × 10) src/openai/resources/audio/transcriptions.py:699— src/openai/resources/audio/transcriptions.py:699-726 | src/openai/resources/audio/translations.py:200-216 | src/openai/resources/audio/voice_consents.py:81-95 | src/openai/resources/audio/voices.py:165-183 | src/openai/resources/files.py:130-144 | src/openai/resources/images.py:109-126 | src/openai/resources/videos.py:109-125 | src/openai/resources/videos.py:297-310 | src/openai/resources/videos.py:398-411 | src/openai/resources/videos.py:457-471 — before extracting anything, compare `src/openai/resources/audio/transcriptions.py` and `src/openai/resources/audio/translations.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 312 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/openai/resources/audio/transcriptions.py:699` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (14–28 lines × 10) src/openai/resources/audio/transcriptions.py:1389— src/openai/resources/audio/transcriptions.py:1389-1416 | src/openai/resources/audio/translations.py:388-404 | src/openai/resources/audio/voice_consents.py:333-347 | src/openai/resources/audio/voices.py:381-399 | src/openai/resources/files.py:471-485 | src/openai/resources/images.py:1285-1302 | src/openai/resources/videos.py:694-710 | src/openai/resources/videos.py:882-895 | src/openai/resources/videos.py:985-998 | src/openai/resources/videos.py:1044-1058 — before extracting anything, compare `src/openai/resources/audio/transcriptions.py` and `src/openai/resources/audio/translations.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 312 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/openai/resources/audio/transcriptions.py:1389` 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 (24–28 lines × 10) src/openai/resources/beta/agents/agents.py:408— src/openai/resources/beta/agents/agents.py:408-433 | src/openai/resources/beta/agents/automations/automations.py:369-393 | src/openai/resources/beta/agents/sessions/sessions.py:471-498 | src/openai/resources/beta/agents/vaults/vaults.py:287-312 | src/openai/resources/beta/assistants.py:568-591 | src/openai/resources/beta/chatkit/threads.py:159-182 | src/openai/resources/beta/threads/threads.py:430-453 | src/openai/resources/containers/containers.py:231-254 | src/openai/resources/responses/responses.py:1616-1639 | src/openai/resources/vector_stores/vector_stores.py:326-349 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 10 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 10 times. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/agents.py:408` 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–28 lines × 10) src/openai/resources/beta/agents/agents.py:785— src/openai/resources/beta/agents/agents.py:785-810 | src/openai/resources/beta/agents/automations/automations.py:811-835 | src/openai/resources/beta/agents/sessions/sessions.py:894-921 | src/openai/resources/beta/agents/vaults/vaults.py:570-595 | src/openai/resources/beta/assistants.py:1129-1152 | src/openai/resources/beta/chatkit/threads.py:382-405 | src/openai/resources/beta/threads/threads.py:1513-1536 | src/openai/resources/containers/containers.py:456-479 | src/openai/resources/responses/responses.py:3534-3557 | src/openai/resources/vector_stores/vector_stores.py:697-720 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 10 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 10 times. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/agents.py:785` 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 (23–27 lines × 29) src/openai/resources/admin/organization/admin_api_keys.py:103— src/openai/resources/admin/organization/admin_api_keys.py:103-127 | src/openai/resources/admin/organization/external_keys.py:282-304 | src/openai/resources/admin/organization/external_storage.py:102-128 | src/openai/resources/admin/organization/groups/groups.py:118-140 | src/openai/resources/admin/organization/invites.py:112-134 | src/openai/resources/admin/organization/projects/data_retention.py:53-75 | src/openai/resources/admin/organization/projects/hosted_tool_permissions.py:53-75 | src/openai/resources/admin/organization/projects/model_permissions.py:54-76 | src/openai/resources/admin/organization/projects/projects.py:269-291 | src/openai/resources/admin/organization/projects/spend_limit.py:54-76 | src/openai/resources/admin/organization/roles.py:107-129 | src/openai/resources/admin/organization/spend_alerts.py:110-132 | src/openai/resources/admin/organization/users/users.py:67-89 | src/openai/resources/audio/voice_consents.py:119-141 | src/openai/resources/batches.py:147-169 | src/openai/resources/chat/completions/completions.py:1680-1704 | src/openai/resources/containers/containers.py:132-154 | src/openai/resources/conversations/conversations.py:124-146 | src/openai/resources/evals/evals.py:144-166 | src/openai/resources/files.py:168-190 | src/openai/resources/files.py:343-365 | src/openai/resources/fine_tuning/jobs/jobs.py:196-220 | src/openai/resources/models.py:54-77 | src/openai/resources/safety/alerts.py:50-74 | src/openai/resources/safety/cases.py:50-74 | src/openai/resources/skills/skills.py:137-159 | src/openai/resources/videos.py:150-172 | src/openai/resources/videos.py:496-518 | src/openai/resources/webhooks/webhooks.py:162-186 — before extracting anything, compare `src/openai/resources/admin/organization/admin_api_keys.py` and `src/openai/resources/admin/organization/external_keys.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 116 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/openai/resources/admin/organization/admin_api_keys.py:103` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/videos.py:176` calls `deprecated` and `src/openai/resources/admin/organization/admin_api_keys.py:131` 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 (23–27 lines × 29) src/openai/resources/admin/organization/admin_api_keys.py:300— src/openai/resources/admin/organization/admin_api_keys.py:300-324 | src/openai/resources/admin/organization/external_keys.py:690-712 | src/openai/resources/admin/organization/external_storage.py:343-369 | src/openai/resources/admin/organization/groups/groups.py:356-378 | src/openai/resources/admin/organization/invites.py:316-338 | src/openai/resources/admin/organization/projects/data_retention.py:161-183 | src/openai/resources/admin/organization/projects/hosted_tool_permissions.py:173-195 | src/openai/resources/admin/organization/projects/model_permissions.py:199-221 | src/openai/resources/admin/organization/projects/projects.py:592-614 | src/openai/resources/admin/organization/projects/spend_limit.py:204-226 | src/openai/resources/admin/organization/roles.py:360-382 | src/openai/resources/admin/organization/spend_alerts.py:377-399 | src/openai/resources/admin/organization/users/users.py:280-302 | src/openai/resources/audio/voice_consents.py:371-393 | src/openai/resources/batches.py:389-411 | src/openai/resources/chat/completions/completions.py:3483-3507 | src/openai/resources/containers/containers.py:357-379 | src/openai/resources/conversations/conversations.py:325-347 | src/openai/resources/evals/evals.py:428-450 | src/openai/resources/files.py:509-531 | src/openai/resources/files.py:684-706 | src/openai/resources/fine_tuning/jobs/jobs.py:607-631 | src/openai/resources/models.py:181-204 | src/openai/resources/safety/alerts.py:110-134 | src/openai/resources/safety/cases.py:110-134 | src/openai/resources/skills/skills.py:380-402 | src/openai/resources/videos.py:735-757 | src/openai/resources/videos.py:1083-1105 | src/openai/resources/webhooks/webhooks.py:652-676 — before extracting anything, compare `src/openai/resources/admin/organization/admin_api_keys.py` and `src/openai/resources/admin/organization/external_keys.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 116 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/openai/resources/admin/organization/admin_api_keys.py:300` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/videos.py:761` calls `deprecated` and `src/openai/resources/admin/organization/admin_api_keys.py:328` 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 (23–27 lines × 10) src/openai/resources/admin/organization/groups/roles.py:99— src/openai/resources/admin/organization/groups/roles.py:99-121 | src/openai/resources/admin/organization/groups/users.py:99-121 | src/openai/resources/admin/organization/projects/groups/groups.py:119-145 | src/openai/resources/admin/organization/projects/roles.py:111-133 | src/openai/resources/admin/organization/projects/spend_alerts.py:118-142 | src/openai/resources/admin/organization/projects/users/users.py:124-148 | src/openai/resources/admin/organization/users/roles.py:99-121 | src/openai/resources/containers/files/files.py:132-154 | src/openai/resources/evals/runs/runs.py:137-159 | src/openai/resources/skills/versions/versions.py:138-162 — before extracting anything, compare `src/openai/resources/admin/organization/groups/roles.py` and `src/openai/resources/admin/organization/groups/users.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 114 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/openai/resources/admin/organization/groups/roles.py:99` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/admin/organization/projects/groups/groups.py:146` calls `maybe_transform` and `src/openai/resources/admin/organization/groups/roles.py:122` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (23–27 lines × 10) src/openai/resources/admin/organization/groups/roles.py:297— src/openai/resources/admin/organization/groups/roles.py:297-319 | src/openai/resources/admin/organization/groups/users.py:298-320 | src/openai/resources/admin/organization/projects/groups/groups.py:338-364 | src/openai/resources/admin/organization/projects/roles.py:380-402 | src/openai/resources/admin/organization/projects/spend_alerts.py:406-430 | src/openai/resources/admin/organization/projects/users/users.py:393-417 | src/openai/resources/admin/organization/users/roles.py:297-319 | src/openai/resources/containers/files/files.py:360-382 | src/openai/resources/evals/runs/runs.py:407-429 | src/openai/resources/skills/versions/versions.py:360-384 — before extracting anything, compare `src/openai/resources/admin/organization/groups/roles.py` and `src/openai/resources/admin/organization/groups/users.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 114 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/openai/resources/admin/organization/groups/roles.py:297` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/admin/organization/projects/groups/groups.py:365` calls `async_maybe_transform` and `src/openai/resources/admin/organization/groups/roles.py:320` 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 (23–27 lines × 9) src/openai/resources/admin/organization/external_keys.py:406— src/openai/resources/admin/organization/external_keys.py:406-428 | src/openai/resources/admin/organization/external_storage.py:238-264 | src/openai/resources/admin/organization/projects/projects.py:419-443 | src/openai/resources/batches.py:237-262 | src/openai/resources/fine_tuning/jobs/jobs.py:293-315 | src/openai/resources/fine_tuning/jobs/jobs.py:381-403 | src/openai/resources/fine_tuning/jobs/jobs.py:418-440 | src/openai/resources/responses/responses.py:1654-1679 | src/openai/resources/uploads/uploads.py:222-247 — before extracting anything, compare `src/openai/resources/admin/organization/external_keys.py` and `src/openai/resources/admin/organization/external_storage.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 200 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/openai/resources/admin/organization/external_keys.py:406` 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 (23–27 lines × 9) src/openai/resources/admin/organization/external_keys.py:814— src/openai/resources/admin/organization/external_keys.py:814-836 | src/openai/resources/admin/organization/external_storage.py:479-505 | src/openai/resources/admin/organization/projects/projects.py:742-766 | src/openai/resources/batches.py:479-504 | src/openai/resources/fine_tuning/jobs/jobs.py:704-726 | src/openai/resources/fine_tuning/jobs/jobs.py:792-814 | src/openai/resources/fine_tuning/jobs/jobs.py:829-851 | src/openai/resources/responses/responses.py:3572-3597 | src/openai/resources/uploads/uploads.py:502-527 — before extracting anything, compare `src/openai/resources/admin/organization/external_keys.py` and `src/openai/resources/admin/organization/external_storage.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 200 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/openai/resources/admin/organization/external_keys.py:814` 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 lines × 5) src/openai/resources/live/forks.py:152— src/openai/resources/live/forks.py:152-178 | src/openai/resources/live/live.py:372-398 | src/openai/resources/live/sideband.py:157-183 | src/openai/resources/realtime/realtime.py:344-370 | src/openai/resources/realtime/translations/translations.py:234-260 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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 (27 lines × 5) src/openai/resources/live/forks.py:582— src/openai/resources/live/forks.py:582-608 | src/openai/resources/live/live.py:795-821 | src/openai/resources/live/sideband.py:596-622 | src/openai/resources/realtime/realtime.py:809-835 | src/openai/resources/realtime/translations/translations.py:662-688 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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–26 lines × 12) src/openai/resources/beta/agents/agents.py:206— src/openai/resources/beta/agents/agents.py:206-229 | src/openai/resources/beta/agents/environments/environments.py:131-154 | src/openai/resources/beta/agents/sessions/sessions.py:291-314 | src/openai/resources/beta/agents/vaults/vaults.py:121-144 | src/openai/resources/beta/assistants.py:271-292 | src/openai/resources/beta/chatkit/threads.py:57-78 | src/openai/resources/beta/threads/threads.py:331-352 | src/openai/resources/files.py:304-325 | src/openai/resources/live/sessions.py:112-136 | src/openai/resources/skills/content.py:54-75 | src/openai/resources/vector_stores/vector_stores.py:162-183 | src/openai/resources/videos.py:336-361 — before extracting anything, compare `src/openai/resources/beta/agents/agents.py` and `src/openai/resources/beta/agents/environments/environments.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/agents.py:206` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/videos.py:362` calls `maybe_transform` and `src/openai/resources/beta/agents/agents.py:230` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (22–26 lines × 12) src/openai/resources/beta/agents/agents.py:583— src/openai/resources/beta/agents/agents.py:583-606 | src/openai/resources/beta/agents/environments/environments.py:314-337 | src/openai/resources/beta/agents/sessions/sessions.py:714-737 | src/openai/resources/beta/agents/vaults/vaults.py:404-427 | src/openai/resources/beta/assistants.py:832-853 | src/openai/resources/beta/chatkit/threads.py:280-301 | src/openai/resources/beta/threads/threads.py:1414-1435 | src/openai/resources/files.py:645-666 | src/openai/resources/live/sessions.py:400-424 | src/openai/resources/skills/content.py:113-134 | src/openai/resources/vector_stores/vector_stores.py:533-554 | src/openai/resources/videos.py:921-946 — before extracting anything, compare `src/openai/resources/beta/agents/agents.py` and `src/openai/resources/beta/agents/environments/environments.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/agents.py:583` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/videos.py:947` calls `async_maybe_transform` and `src/openai/resources/beta/agents/agents.py:607` 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 (24–26 lines × 4) src/openai/resources/beta/agents/automations/invocations.py:54— src/openai/resources/beta/agents/automations/invocations.py:54-77 | src/openai/resources/beta/chatkit/sessions.py:123-148 | src/openai/resources/live/sessions.py:204-227 | src/openai/resources/realtime/calls.py:317-340 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/automations/invocations.py:54` 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–26 lines × 4) src/openai/resources/beta/agents/automations/invocations.py:217— src/openai/resources/beta/agents/automations/invocations.py:217-240 | src/openai/resources/beta/chatkit/sessions.py:246-271 | src/openai/resources/live/sessions.py:492-515 | src/openai/resources/realtime/calls.py:705-728 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/automations/invocations.py:217` 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 (25 lines × 2) src/openai/_client.py:642— src/openai/_client.py:642-666 | src/openai/_client.py:1169-1193 — both copies are in the same file, so extract the 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 (25 lines × 2) src/openai/lib/responses_tool_runner.py:2103— src/openai/lib/responses_tool_runner.py:2103-2127 | src/openai/lib/responses_tool_runner.py:2584-2608 — both copies are in the same file, so extract the 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 (23 lines × 2) src/openai/lib/_response_resources.py:114— src/openai/lib/_response_resources.py:114-136 | src/openai/lib/_response_resources.py:237-259 — both copies are in the same file, so extract the 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 (23 lines × 2) src/openai/lib/decisions_tool_runner.py:371— src/openai/lib/decisions_tool_runner.py:371-393 | src/openai/lib/decisions_tool_runner.py:490-512 — both copies are in the same file, so extract the 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/openai/lib/decisions_tool_runner.py:371` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (22 lines × 2) src/openai/lib/decisions_tool_runner.py:421— src/openai/lib/decisions_tool_runner.py:421-442 | src/openai/lib/decisions_tool_runner.py:536-557 — both copies are in the same file, so extract the 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/openai/resources/realtime/realtime.py:951— src/openai/resources/realtime/realtime.py:951-972 | src/openai/resources/realtime/translations/translations.py:801-822 — before extracting anything, compare `src/openai/resources/realtime/realtime.py` and `src/openai/resources/realtime/translations/translations.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 398 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: `RealtimeErrorEvent` names `....types.realtime.realtime_error_event` in one and `...types.realtime.realtime_error_event` 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 (20 lines × 5) src/openai/resources/live/forks.py:433— src/openai/resources/live/forks.py:433-452 | src/openai/resources/live/live.py:651-670 | src/openai/resources/live/sideband.py:442-461 | src/openai/resources/realtime/realtime.py:639-658 | src/openai/resources/realtime/translations/translations.py:521-540 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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/openai/resources/live/forks.py:433` 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 (20 lines × 5) src/openai/resources/live/forks.py:859— src/openai/resources/live/forks.py:859-878 | src/openai/resources/live/live.py:1069-1088 | src/openai/resources/live/sideband.py:877-896 | src/openai/resources/realtime/realtime.py:1098-1117 | src/openai/resources/realtime/translations/translations.py:945-964 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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/openai/resources/live/forks.py:859` 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 (20 lines × 3) src/openai/resources/admin/organization/projects/groups/roles.py:59— src/openai/resources/admin/organization/projects/groups/roles.py:59-78 | src/openai/resources/admin/organization/projects/users/roles.py:59-78 | src/openai/resources/admin/organization/projects/users/users.py:167-188 — `src/openai/resources/admin/organization/projects/groups/roles.py` and `src/openai/resources/admin/organization/projects/users/roles.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 14 separate duplicated blocks between them, totalling at least 350 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/openai/resources/admin/organization/projects/groups/roles.py:59` 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 (20 lines × 3) src/openai/resources/admin/organization/projects/groups/roles.py:279— src/openai/resources/admin/organization/projects/groups/roles.py:279-298 | src/openai/resources/admin/organization/projects/users/roles.py:279-298 | src/openai/resources/admin/organization/projects/users/users.py:436-457 — `src/openai/resources/admin/organization/projects/groups/roles.py` and `src/openai/resources/admin/organization/projects/users/roles.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 14 separate duplicated blocks between them, totalling at least 350 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/openai/resources/admin/organization/projects/groups/roles.py:279` 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–19 lines × 3) src/openai/resources/beta/agents/sessions/items.py:86— src/openai/resources/beta/agents/sessions/items.py:86-103 | src/openai/resources/beta/agents/sessions/subagents/items.py:92-110 | src/openai/resources/beta/agents/sessions/subagents/turns/items.py:96-114 — before extracting anything, compare `src/openai/resources/beta/agents/sessions/items.py` and `src/openai/resources/beta/agents/sessions/subagents/items.py` as WHOLE FILES: 82% 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/sessions/items.py:86` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `AgentSessionItem` names `.......types.beta.agent_session_item` in one and `......types.beta.agent_session_item` 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 (18–19 lines × 3) src/openai/resources/beta/agents/sessions/items.py:168— src/openai/resources/beta/agents/sessions/items.py:168-185 | src/openai/resources/beta/agents/sessions/subagents/items.py:181-199 | src/openai/resources/beta/agents/sessions/subagents/turns/items.py:189-207 — before extracting anything, compare `src/openai/resources/beta/agents/sessions/items.py` and `src/openai/resources/beta/agents/sessions/subagents/items.py` as WHOLE FILES: 82% 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/sessions/items.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. Note first that the copies are not typed on the same thing: `AgentSessionItem` names `.......types.beta.agent_session_item` in one and `......types.beta.agent_session_item` 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 (18 lines × 11) src/openai/resources/beta/agents/automations/invocations.py:93— src/openai/resources/beta/agents/automations/invocations.py:93-112 | src/openai/resources/beta/agents/sessions/artifacts.py:76-96 | src/openai/resources/beta/agents/sessions/subagents/subagents.py:79-99 | src/openai/resources/beta/agents/sessions/turns/turns.py:67-87 | src/openai/resources/beta/agents/vaults/credentials.py:124-144 | src/openai/resources/beta/threads/messages.py:134-151 | src/openai/resources/beta/threads/runs/runs.py:1257-1274 | src/openai/resources/containers/files/content.py:55-73 | src/openai/resources/skills/versions/content.py:55-74 | src/openai/resources/vector_stores/file_batches.py:151-170 | src/openai/resources/vector_stores/files.py:136-154 — before extracting anything, compare `src/openai/resources/beta/agents/automations/invocations.py` and `src/openai/resources/beta/agents/sessions/artifacts.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/automations/invocations.py:93` 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 lines × 11) src/openai/resources/beta/agents/automations/invocations.py:256— src/openai/resources/beta/agents/automations/invocations.py:256-275 | src/openai/resources/beta/agents/sessions/artifacts.py:310-330 | src/openai/resources/beta/agents/sessions/subagents/subagents.py:214-234 | src/openai/resources/beta/agents/sessions/turns/turns.py:198-218 | src/openai/resources/beta/agents/vaults/credentials.py:427-447 | src/openai/resources/beta/threads/messages.py:436-453 | src/openai/resources/beta/threads/runs/runs.py:2805-2822 | src/openai/resources/containers/files/content.py:119-137 | src/openai/resources/skills/versions/content.py:119-138 | src/openai/resources/vector_stores/file_batches.py:482-501 | src/openai/resources/vector_stores/files.py:564-582 — before extracting anything, compare `src/openai/resources/beta/agents/automations/invocations.py` and `src/openai/resources/beta/agents/sessions/artifacts.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/automations/invocations.py:256` 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 lines × 6) src/openai/resources/beta/agents/vaults/credentials.py:171— src/openai/resources/beta/agents/vaults/credentials.py:171-196 | src/openai/resources/beta/threads/messages.py:177-201 | src/openai/resources/beta/threads/runs/runs.py:1300-1324 | src/openai/resources/beta/threads/runs/runs.py:1419-1436 | src/openai/resources/vector_stores/file_batches.py:196-217 | src/openai/resources/vector_stores/files.py:180-204 — before extracting anything, compare `src/openai/resources/beta/agents/vaults/credentials.py` and `src/openai/resources/beta/threads/messages.py` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 224 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/vaults/credentials.py:171` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/beta/threads/messages.py:203` calls `maybe_transform` and `src/openai/resources/beta/threads/runs/runs.py:1438` 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 (18 lines × 6) src/openai/resources/beta/agents/vaults/credentials.py:474— src/openai/resources/beta/agents/vaults/credentials.py:474-499 | src/openai/resources/beta/threads/messages.py:479-503 | src/openai/resources/beta/threads/runs/runs.py:2848-2872 | src/openai/resources/beta/threads/runs/runs.py:2967-2984 | src/openai/resources/vector_stores/file_batches.py:527-548 | src/openai/resources/vector_stores/files.py:608-632 — before extracting anything, compare `src/openai/resources/beta/agents/vaults/credentials.py` and `src/openai/resources/beta/threads/messages.py` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 224 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/vaults/credentials.py:474` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/beta/threads/messages.py:505` calls `async_maybe_transform` and `src/openai/resources/beta/threads/runs/runs.py:2986` 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 (18 lines × 4) src/openai/resources/admin/organization/groups/roles.py:164— src/openai/resources/admin/organization/groups/roles.py:164-181 | src/openai/resources/admin/organization/projects/groups/roles.py:178-195 | src/openai/resources/admin/organization/projects/users/roles.py:178-195 | src/openai/resources/admin/organization/users/roles.py:164-181 — before extracting anything, compare `src/openai/resources/admin/organization/groups/roles.py` and `src/openai/resources/admin/organization/projects/groups/roles.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/admin/organization/groups/roles.py:164` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `RoleListResponse` names `......types.admin.organization.projects.groups.role_list_response` in one and `......types.admin.organization.projects.users.role_list_response` 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 (18 lines × 4) src/openai/resources/admin/organization/groups/roles.py:362— src/openai/resources/admin/organization/groups/roles.py:362-379 | src/openai/resources/admin/organization/projects/groups/roles.py:398-415 | src/openai/resources/admin/organization/projects/users/roles.py:398-415 | src/openai/resources/admin/organization/users/roles.py:362-379 — before extracting anything, compare `src/openai/resources/admin/organization/groups/roles.py` and `src/openai/resources/admin/organization/projects/groups/roles.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/admin/organization/groups/roles.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. Note first that the copies are not typed on the same thing: `RoleListResponse` names `......types.admin.organization.projects.groups.role_list_response` in one and `......types.admin.organization.projects.users.role_list_response` 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 (17 lines × 4) src/openai/resources/live/forks.py:629— src/openai/resources/live/forks.py:629-645 | src/openai/resources/live/live.py:842-858 | src/openai/resources/live/sideband.py:643-659 | src/openai/resources/realtime/realtime.py:856-872 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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 (17 lines × 4) src/openai/resources/live/sideband.py:61— src/openai/resources/live/sideband.py:61-77 | src/openai/resources/live/sideband.py:95-111 | src/openai/resources/realtime/realtime.py:129-153 | src/openai/resources/realtime/realtime.py:204-228 — before extracting anything, compare `src/openai/resources/live/sideband.py` and `src/openai/resources/realtime/realtime.py` as WHOLE FILES: this scan already matched 25 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 23) src/openai/resources/admin/organization/certificates.py:717— src/openai/resources/admin/organization/certificates.py:717-731 | src/openai/resources/admin/organization/groups/groups.py:521-535 | src/openai/resources/admin/organization/projects/roles.py:567-581 | src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py:618-632 | src/openai/resources/admin/organization/projects/spend_alerts.py:608-622 | src/openai/resources/admin/organization/projects/users/users.py:574-588 | src/openai/resources/admin/organization/roles.py:535-549 | src/openai/resources/admin/organization/spend_alerts.py:562-576 | src/openai/resources/audio/voice_consents.py:533-547 | src/openai/resources/beta/agents/agents.py:819-833 | src/openai/resources/beta/agents/automations/automations.py:927-941 | src/openai/resources/beta/agents/environments/templates.py:725-739 | src/openai/resources/beta/agents/sessions/sessions.py:930-944 | src/openai/resources/beta/agents/vaults/credentials.py:642-656 | src/openai/resources/beta/agents/vaults/vaults.py:604-618 | src/openai/resources/beta/assistants.py:1161-1175 | src/openai/resources/beta/threads/messages.py:636-650 | src/openai/resources/chat/completions/completions.py:3670-3684 | src/openai/resources/evals/evals.py:609-623 | src/openai/resources/skills/skills.py:544-558 | src/openai/resources/vector_stores/files.py:898-912 | src/openai/resources/vector_stores/vector_stores.py:796-810 | src/openai/resources/webhooks/webhooks.py:1029-1043 — before extracting anything, compare `src/openai/resources/admin/organization/certificates.py` and `src/openai/resources/admin/organization/groups/groups.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py:635` calls `api_keys`, `APIKeysWithRawResponse` and `src/openai/resources/admin/organization/projects/roles.py:584` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 23) src/openai/resources/admin/organization/certificates.py:744— src/openai/resources/admin/organization/certificates.py:744-758 | src/openai/resources/admin/organization/groups/groups.py:550-564 | src/openai/resources/admin/organization/projects/roles.py:588-602 | src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py:643-657 | src/openai/resources/admin/organization/projects/spend_alerts.py:629-643 | src/openai/resources/admin/organization/projects/users/users.py:599-613 | src/openai/resources/admin/organization/roles.py:556-570 | src/openai/resources/admin/organization/spend_alerts.py:583-597 | src/openai/resources/audio/voice_consents.py:554-568 | src/openai/resources/beta/agents/agents.py:856-870 | src/openai/resources/beta/agents/automations/automations.py:958-972 | src/openai/resources/beta/agents/environments/templates.py:746-760 | src/openai/resources/beta/agents/sessions/sessions.py:975-989 | src/openai/resources/beta/agents/vaults/credentials.py:663-677 | src/openai/resources/beta/agents/vaults/vaults.py:629-643 | src/openai/resources/beta/assistants.py:1182-1196 | src/openai/resources/beta/threads/messages.py:657-671 | src/openai/resources/chat/completions/completions.py:3702-3716 | src/openai/resources/evals/evals.py:635-649 | src/openai/resources/skills/skills.py:573-587 | src/openai/resources/vector_stores/files.py:922-936 | src/openai/resources/vector_stores/vector_stores.py:828-842 | src/openai/resources/webhooks/webhooks.py:1060-1074 — before extracting anything, compare `src/openai/resources/admin/organization/certificates.py` and `src/openai/resources/admin/organization/groups/groups.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py:660` calls `api_keys`, `AsyncAPIKeysWithRawResponse` and `src/openai/resources/admin/organization/projects/roles.py:605` 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 (14 lines × 5) src/openai/resources/live/forks.py:181— src/openai/resources/live/forks.py:181-194 | src/openai/resources/live/live.py:401-414 | src/openai/resources/live/sideband.py:186-199 | src/openai/resources/realtime/realtime.py:373-386 | src/openai/resources/realtime/translations/translations.py:263-276 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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 (14 lines × 5) src/openai/resources/live/forks.py:611— src/openai/resources/live/forks.py:611-624 | src/openai/resources/live/live.py:824-837 | src/openai/resources/live/sideband.py:625-638 | src/openai/resources/realtime/realtime.py:838-851 | src/openai/resources/realtime/translations/translations.py:691-704 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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–13 lines × 6) src/openai/_websocket_connection.py:230— src/openai/_websocket_connection.py:230-240 | src/openai/resources/live/forks.py:591-603 | src/openai/resources/live/live.py:804-816 | src/openai/resources/live/sideband.py:605-617 | src/openai/resources/realtime/realtime.py:818-830 | src/openai/resources/realtime/translations/translations.py:671-683 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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/openai/_websocket_connection.py:230` 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 × 6) src/openai/_websocket_connection.py:458— src/openai/_websocket_connection.py:458-468 | src/openai/resources/live/forks.py:161-173 | src/openai/resources/live/live.py:381-393 | src/openai/resources/live/sideband.py:166-178 | src/openai/resources/realtime/realtime.py:353-365 | src/openai/resources/realtime/translations/translations.py:243-255 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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/openai/_websocket_connection.py:458` 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 (13 lines × 3) src/openai/lib/_assistants_runs.py:173— src/openai/lib/_assistants_runs.py:173-185 | src/openai/lib/_assistants_runs.py:393-405 | src/openai/lib/_assistants_threads.py:147-159 — before extracting anything, compare `src/openai/lib/_assistants_runs.py` and `src/openai/lib/_assistants_threads.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 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/openai/lib/_assistants_runs.py:173` 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 (13 lines × 3) src/openai/lib/_assistants_runs.py:538— src/openai/lib/_assistants_runs.py:538-550 | src/openai/lib/_assistants_runs.py:756-768 | src/openai/lib/_assistants_threads.py:275-287 — before extracting anything, compare `src/openai/lib/_assistants_runs.py` and `src/openai/lib/_assistants_threads.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 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/openai/lib/_assistants_runs.py:538` 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 (11 lines × 10) src/openai/resources/live/forks.py:207— src/openai/resources/live/forks.py:207-217 | src/openai/resources/live/forks.py:639-649 | src/openai/resources/live/live.py:427-437 | src/openai/resources/live/live.py:852-862 | src/openai/resources/live/sideband.py:212-222 | src/openai/resources/live/sideband.py:653-663 | src/openai/resources/realtime/realtime.py:399-409 | src/openai/resources/realtime/realtime.py:866-876 | src/openai/resources/realtime/translations/translations.py:289-299 | src/openai/resources/realtime/translations/translations.py:719-729 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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 (11 lines × 10) src/openai/resources/live/forks.py:494— src/openai/resources/live/forks.py:494-504 | src/openai/resources/live/forks.py:920-930 | src/openai/resources/live/live.py:712-722 | src/openai/resources/live/live.py:1130-1140 | src/openai/resources/live/sideband.py:506-516 | src/openai/resources/live/sideband.py:941-951 | src/openai/resources/realtime/realtime.py:722-732 | src/openai/resources/realtime/realtime.py:1179-1189 | src/openai/resources/realtime/translations/translations.py:583-593 | src/openai/resources/realtime/translations/translations.py:1007-1017 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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/openai/resources/live/forks.py:494` 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 × 5) src/openai/resources/live/forks.py:473— src/openai/resources/live/forks.py:473-483 | src/openai/resources/live/live.py:691-701 | src/openai/resources/live/sideband.py:485-495 | src/openai/resources/realtime/realtime.py:699-709 | src/openai/resources/realtime/translations/translations.py:562-572 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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/openai/resources/live/forks.py:473` 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 × 5) src/openai/resources/live/forks.py:899— src/openai/resources/live/forks.py:899-909 | src/openai/resources/live/live.py:1109-1119 | src/openai/resources/live/sideband.py:920-930 | src/openai/resources/realtime/realtime.py:1156-1166 | src/openai/resources/realtime/translations/translations.py:986-996 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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/openai/resources/live/forks.py:899` 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 × 12) src/openai/resources/beta/agents/agents.py:222— src/openai/resources/beta/agents/agents.py:222-231 | src/openai/resources/beta/agents/environments/environments.py:147-156 | src/openai/resources/beta/agents/sessions/events.py:123-132 | src/openai/resources/beta/agents/sessions/sessions.py:307-316 | src/openai/resources/beta/agents/vaults/vaults.py:137-146 | src/openai/resources/beta/assistants.py:285-294 | src/openai/resources/beta/chatkit/threads.py:71-80 | src/openai/resources/beta/threads/threads.py:345-354 | src/openai/resources/files.py:318-327 | src/openai/resources/live/sessions.py:129-138 | src/openai/resources/skills/content.py:68-77 | src/openai/resources/vector_stores/vector_stores.py:176-185 — before extracting anything, compare `src/openai/resources/beta/agents/agents.py` and `src/openai/resources/beta/agents/environments/environments.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/agents.py:222` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/beta/assistants.py:298` calls `deprecated` and `src/openai/resources/beta/agents/agents.py:235` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 12) src/openai/resources/beta/agents/agents.py:599— src/openai/resources/beta/agents/agents.py:599-608 | src/openai/resources/beta/agents/environments/environments.py:330-339 | src/openai/resources/beta/agents/sessions/events.py:238-247 | src/openai/resources/beta/agents/sessions/sessions.py:730-739 | src/openai/resources/beta/agents/vaults/vaults.py:420-429 | src/openai/resources/beta/assistants.py:846-855 | src/openai/resources/beta/chatkit/threads.py:294-303 | src/openai/resources/beta/threads/threads.py:1428-1437 | src/openai/resources/files.py:659-668 | src/openai/resources/live/sessions.py:417-426 | src/openai/resources/skills/content.py:127-136 | src/openai/resources/vector_stores/vector_stores.py:547-556 — before extracting anything, compare `src/openai/resources/beta/agents/agents.py` and `src/openai/resources/beta/agents/environments/environments.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/agents.py:599` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/beta/assistants.py:859` calls `deprecated` and `src/openai/resources/beta/agents/agents.py:612` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 10) src/openai/resources/live/forks.py:187— src/openai/resources/live/forks.py:187-196 | src/openai/resources/live/forks.py:617-626 | src/openai/resources/live/live.py:407-416 | src/openai/resources/live/live.py:830-839 | src/openai/resources/live/sideband.py:192-201 | src/openai/resources/live/sideband.py:631-640 | src/openai/resources/realtime/realtime.py:379-388 | src/openai/resources/realtime/realtime.py:844-853 | src/openai/resources/realtime/translations/translations.py:269-278 | src/openai/resources/realtime/translations/translations.py:697-706 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 10) src/openai/resources/live/forks.py:476— src/openai/resources/live/forks.py:476-485 | src/openai/resources/live/forks.py:902-911 | src/openai/resources/live/live.py:694-703 | src/openai/resources/live/live.py:1112-1121 | src/openai/resources/live/sideband.py:488-497 | src/openai/resources/live/sideband.py:923-932 | src/openai/resources/realtime/realtime.py:702-711 | src/openai/resources/realtime/realtime.py:1159-1168 | src/openai/resources/realtime/translations/translations.py:565-574 | src/openai/resources/realtime/translations/translations.py:989-998 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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/openai/resources/live/forks.py:476` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/realtime/realtime.py:714` calls `is_given` and `src/openai/resources/live/forks.py:487` 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–10 lines × 2) src/openai/resources/beta/responses/responses.py:5021— src/openai/resources/beta/responses/responses.py:5021-5029 | src/openai/resources/beta/responses/responses.py:5348-5357 — both copies are in the same file, so extract the 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–10 lines × 2) src/openai/resources/responses/responses.py:4210— src/openai/resources/responses/responses.py:4210-4218 | src/openai/resources/responses/responses.py:4538-4547 — both copies are in the same file, so extract the 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–9 lines × 13) src/openai/resources/beta/agents/automations/invocations.py:105— src/openai/resources/beta/agents/automations/invocations.py:105-113 | src/openai/resources/beta/agents/sessions/artifacts.py:90-97 | src/openai/resources/beta/agents/sessions/subagents/subagents.py:93-100 | src/openai/resources/beta/agents/sessions/subagents/turns/turns.py:84-92 | src/openai/resources/beta/agents/sessions/turns/turns.py:82-87 | src/openai/resources/beta/agents/vaults/credentials.py:138-145 | src/openai/resources/beta/threads/messages.py:146-151 | src/openai/resources/beta/threads/runs/runs.py:1269-1274 | src/openai/resources/beta/threads/runs/steps.py:85-93 | src/openai/resources/containers/files/content.py:67-74 | src/openai/resources/skills/versions/content.py:69-74 | src/openai/resources/vector_stores/file_batches.py:163-171 | src/openai/resources/vector_stores/files.py:148-155 — before extracting anything, compare `src/openai/resources/beta/agents/automations/invocations.py` and `src/openai/resources/beta/agents/sessions/artifacts.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/automations/invocations.py:105` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/beta/agents/sessions/artifacts.py:99` calls `make_request_options` and `src/openai/resources/beta/agents/automations/invocations.py:113` 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 (6–9 lines × 13) src/openai/resources/beta/agents/automations/invocations.py:268— src/openai/resources/beta/agents/automations/invocations.py:268-276 | src/openai/resources/beta/agents/sessions/artifacts.py:324-331 | src/openai/resources/beta/agents/sessions/subagents/subagents.py:228-235 | src/openai/resources/beta/agents/sessions/subagents/turns/turns.py:228-236 | src/openai/resources/beta/agents/sessions/turns/turns.py:213-218 | src/openai/resources/beta/agents/vaults/credentials.py:441-448 | src/openai/resources/beta/threads/messages.py:448-453 | src/openai/resources/beta/threads/runs/runs.py:2817-2822 | src/openai/resources/beta/threads/runs/steps.py:250-258 | src/openai/resources/containers/files/content.py:131-138 | src/openai/resources/skills/versions/content.py:133-138 | src/openai/resources/vector_stores/file_batches.py:494-502 | src/openai/resources/vector_stores/files.py:576-583 — before extracting anything, compare `src/openai/resources/beta/agents/automations/invocations.py` and `src/openai/resources/beta/agents/sessions/artifacts.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/automations/invocations.py:268` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/beta/agents/sessions/artifacts.py:333` calls `make_request_options` and `src/openai/resources/beta/agents/automations/invocations.py:276` 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 (6–9 lines × 7) src/openai/resources/beta/agents/vaults/credentials.py:190— src/openai/resources/beta/agents/vaults/credentials.py:190-197 | src/openai/resources/beta/threads/messages.py:196-201 | src/openai/resources/beta/threads/runs/runs.py:1319-1324 | src/openai/resources/beta/threads/runs/runs.py:1431-1436 | src/openai/resources/beta/threads/runs/runs.py:1582-1587 | src/openai/resources/vector_stores/file_batches.py:210-218 | src/openai/resources/vector_stores/files.py:198-205 — before extracting anything, compare `src/openai/resources/beta/agents/vaults/credentials.py` and `src/openai/resources/beta/threads/messages.py` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 224 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/vaults/credentials.py:190` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/beta/threads/messages.py:203` calls `maybe_transform` and `src/openai/resources/beta/threads/runs/runs.py:1438` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6–9 lines × 7) src/openai/resources/beta/agents/vaults/credentials.py:493— src/openai/resources/beta/agents/vaults/credentials.py:493-500 | src/openai/resources/beta/threads/messages.py:498-503 | src/openai/resources/beta/threads/runs/runs.py:2867-2872 | src/openai/resources/beta/threads/runs/runs.py:2979-2984 | src/openai/resources/beta/threads/runs/runs.py:3130-3135 | src/openai/resources/vector_stores/file_batches.py:541-549 | src/openai/resources/vector_stores/files.py:626-633 — before extracting anything, compare `src/openai/resources/beta/agents/vaults/credentials.py` and `src/openai/resources/beta/threads/messages.py` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 224 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/vaults/credentials.py:493` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/beta/threads/messages.py:505` calls `async_maybe_transform` and `src/openai/resources/beta/threads/runs/runs.py:2986` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 12) src/openai/resources/beta/realtime/realtime.py:611— src/openai/resources/beta/realtime/realtime.py:611-628 | src/openai/resources/beta/realtime/realtime.py:638-660 | src/openai/resources/beta/realtime/realtime.py:663-674 | src/openai/resources/beta/realtime/realtime.py:706-724 | src/openai/resources/beta/realtime/realtime.py:735-747 | src/openai/resources/beta/realtime/realtime.py:812-823 | src/openai/resources/beta/realtime/realtime.py:845-851 | src/openai/resources/realtime/realtime.py:1228-1253 | src/openai/resources/realtime/realtime.py:1299-1312 | src/openai/resources/realtime/realtime.py:1337-1358 | src/openai/resources/realtime/realtime.py:1369-1381 | src/openai/resources/realtime/realtime.py:1441-1452 — there are 12 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 12 sites; resolving a subset leaves the remainder to drift apart. Note first that the copies are not typed on the same thing: `RealtimeClientEventParam` names `....types.beta.realtime.realtime_client_event_param` in one and `...types.realtime.realtime_client_event_param` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/beta/realtime/realtime.py:631` calls `RealtimeResponseResource` and `src/openai/resources/beta/realtime/realtime.py:749` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 12) src/openai/resources/beta/realtime/realtime.py:863— src/openai/resources/beta/realtime/realtime.py:863-880 | src/openai/resources/beta/realtime/realtime.py:890-912 | src/openai/resources/beta/realtime/realtime.py:915-926 | src/openai/resources/beta/realtime/realtime.py:958-976 | src/openai/resources/beta/realtime/realtime.py:987-999 | src/openai/resources/beta/realtime/realtime.py:1064-1075 | src/openai/resources/beta/realtime/realtime.py:1097-1103 | src/openai/resources/realtime/realtime.py:1477-1502 | src/openai/resources/realtime/realtime.py:1548-1561 | src/openai/resources/realtime/realtime.py:1586-1607 | src/openai/resources/realtime/realtime.py:1618-1630 | src/openai/resources/realtime/realtime.py:1692-1703 — there are 12 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 12 sites; resolving a subset leaves the remainder to drift apart. Note first that the copies are not typed on the same thing: `RealtimeClientEventParam` names `....types.beta.realtime.realtime_client_event_param` in one and `...types.realtime.realtime_client_event_param` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/openai/resources/beta/realtime/realtime.py:883` calls `AsyncRealtimeResponseResource` and `src/openai/resources/beta/realtime/realtime.py:1001` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (33 lines × 10) src/openai/resources/admin/organization/admin_api_keys.py:58— src/openai/resources/admin/organization/admin_api_keys.py:58-90 | src/openai/resources/containers/containers.py:74-119 | src/openai/resources/evals/evals.py:78-131 | src/openai/resources/fine_tuning/alpha/graders.py:56-99 | src/openai/resources/live/live.py:105-140 | src/openai/resources/moderations.py:60-100 | src/openai/resources/realtime/client_secrets.py:52-103 | src/openai/resources/realtime/translations/client_secrets.py:58-104 | src/openai/resources/responses/input_tokens.py:70-161 | src/openai/resources/responses/responses.py:1816-1983 — before extracting anything, compare `src/openai/resources/admin/organization/admin_api_keys.py` and `src/openai/resources/containers/containers.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 390 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/evals/evals.py:78` 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 (33 lines × 10) src/openai/resources/admin/organization/admin_api_keys.py:255— src/openai/resources/admin/organization/admin_api_keys.py:255-287 | src/openai/resources/containers/containers.py:299-344 | src/openai/resources/evals/evals.py:362-415 | src/openai/resources/fine_tuning/alpha/graders.py:175-218 | src/openai/resources/live/live.py:214-249 | src/openai/resources/moderations.py:139-179 | src/openai/resources/realtime/client_secrets.py:138-189 | src/openai/resources/realtime/translations/client_secrets.py:139-185 | src/openai/resources/responses/input_tokens.py:208-299 | src/openai/resources/responses/responses.py:3734-3901 — before extracting anything, compare `src/openai/resources/admin/organization/admin_api_keys.py` and `src/openai/resources/containers/containers.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 390 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/evals/evals.py:362` 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 (12 lines × 3) src/openai/resources/admin/organization/data_retention.py:52— src/openai/resources/admin/organization/data_retention.py:52-63 | src/openai/resources/admin/organization/spend_limit.py:53-64 | src/openai/resources/admin/organization/spend_limit.py:128-139 — 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.
Duplicated block (12 lines × 3) src/openai/resources/admin/organization/data_retention.py:141— src/openai/resources/admin/organization/data_retention.py:141-152 | src/openai/resources/admin/organization/spend_limit.py:172-183 | src/openai/resources/admin/organization/spend_limit.py:247-258 — 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.
Duplicated block (6 lines × 6) src/openai/resources/beta/responses/responses.py:4941— src/openai/resources/beta/responses/responses.py:4941-4946 | src/openai/resources/live/forks.py:220-225 | src/openai/resources/live/live.py:440-445 | src/openai/resources/live/sideband.py:225-230 | src/openai/resources/realtime/translations/translations.py:302-307 | src/openai/resources/responses/responses.py:4130-4135 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/live/forks.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 96 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `event` to `BetaResponsesClientEvent | BetaResponsesClientEventParam` in one and `ForkClientEvent | ForkClientEventParam` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6 lines × 6) src/openai/resources/beta/responses/responses.py:5271— src/openai/resources/beta/responses/responses.py:5271-5276 | src/openai/resources/live/forks.py:652-657 | src/openai/resources/live/live.py:865-870 | src/openai/resources/live/sideband.py:666-671 | src/openai/resources/realtime/translations/translations.py:732-737 | src/openai/resources/responses/responses.py:4461-4466 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/live/forks.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 96 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `event` to `BetaResponsesClientEvent | BetaResponsesClientEventParam` in one and `ForkClientEvent | ForkClientEventParam` 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.
R4 · Test Coverage· No test reaches this file · ×2
No test reaches this file scripts/steady/update.cjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file scripts/steady/source-sha256.cjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
check-dependency-security.simple_marker_overlap (cyclomatic 137) scripts/check-dependency-security.py:571— check-dependency-security.simple_marker_overlap has cyclomatic complexity 137 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ResponsesWebSocketAccumulator.add_event (cyclomatic 89) src/openai/lib/responses_websocket/_accumulator.py:243— ResponsesWebSocketAccumulator.add_event has cyclomatic complexity 89 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
responses_tool_runner._validate_server_item (cyclomatic 83) src/openai/lib/responses_tool_runner.py:133— responses_tool_runner._validate_server_item has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_Run.__init__ (cyclomatic 80) src/openai/lib/responses_tool_runner.py:1031— _Run.__init__ has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ResponsesToolRunner.iterate (cyclomatic 74) src/openai/lib/responses_tool_runner.py:1912— ResponsesToolRunner.iterate has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AsyncResponsesToolRunner.iterate (cyclomatic 71) src/openai/lib/responses_tool_runner.py:2390— AsyncResponsesToolRunner.iterate has cyclomatic complexity 71 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
responses_tool_runner._history_calls (cyclomatic 64) src/openai/lib/responses_tool_runner.py:506— responses_tool_runner._history_calls has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
check-dependency-security.preserves_requirement_source_markers (cyclomatic 55) scripts/check-dependency-security.py:1348— check-dependency-security.preserves_requirement_source_markers has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_client_auth.synccopy (cyclomatic 55) src/openai/lib/_client_auth.py:413— _client_auth.synccopy has cyclomatic complexity 55 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (_client_auth.asynccopy) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_client_auth.asynccopy (cyclomatic 55) src/openai/lib/_client_auth.py:886— _client_auth.asynccopy has cyclomatic complexity 55 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (_client_auth.synccopy) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_Run.validate (cyclomatic 51) src/openai/lib/responses_tool_runner.py:1528— _Run.validate has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
bedrock.bedrock (cyclomatic 44) src/openai/providers/bedrock.py:383— bedrock.bedrock has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
_client_auth.sync__init__ (cyclomatic 43) src/openai/lib/_client_auth.py:99— _client_auth.sync__init__ 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. This shape REPEATS in the file: one other method here (_client_auth.async__init__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_client_auth.async__init__ (cyclomatic 43) src/openai/lib/_client_auth.py:565— _client_auth.async__init__ 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. This shape REPEATS in the file: one other method here (_client_auth.sync__init__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ResponseStreamState.accumulate_event (cyclomatic 41) src/openai/lib/streaming/responses/_responses.py:402— ResponseStreamState.accumulate_event 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.
check-dependency-security.published_reachability (cyclomatic 40) scripts/check-dependency-security.py:320— check-dependency-security.published_reachability 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.
check-dependency-security.marker_options (cyclomatic 39) scripts/check-dependency-security.py:929— check-dependency-security.marker_options has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
browser._read_result (cyclomatic 39) src/openai/lib/browser.py:618— browser._read_result has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AssistantEventHandler._emit_sse_event (cyclomatic 39) src/openai/lib/streaming/_assistants.py:280— AssistantEventHandler._emit_sse_event has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (AsyncAssistantEventHandler._emit_sse_event) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncAssistantEventHandler._emit_sse_event (cyclomatic 39) src/openai/lib/streaming/_assistants.py:712— AsyncAssistantEventHandler._emit_sse_event has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (AssistantEventHandler._emit_sse_event) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_models.construct_type (cyclomatic 37) src/openai/_models.py:608— _models.construct_type 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.
BrowserToolset._dispatch (cyclomatic 37) src/openai/lib/browser.py:1461— BrowserToolset._dispatch 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. This shape REPEATS in the file: one other method here (AsyncBrowserToolset._dispatch) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncBrowserToolset._dispatch (cyclomatic 37) src/openai/lib/browser.py:1718— AsyncBrowserToolset._dispatch 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. This shape REPEATS in the file: one other method here (BrowserToolset._dispatch) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
check-dependency-security.preserves_published_security_bound (cyclomatic 35) scripts/check-dependency-security.py:1687— check-dependency-security.preserves_published_security_bound 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.
ResponsesWebSocketAccumulator._add_rich_event (cyclomatic 33) src/openai/lib/responses_websocket/_accumulator.py:490— ResponsesWebSocketAccumulator._add_rich_event 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.
BedrockOpenAI.copy (cyclomatic 32) src/openai/lib/bedrock.py:535— BedrockOpenAI.copy has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (AsyncBedrockOpenAI.copy) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncBedrockOpenAI.copy (cyclomatic 32) src/openai/lib/bedrock.py:773— AsyncBedrockOpenAI.copy has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (BedrockOpenAI.copy) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
browser._arguments (cyclomatic 32) src/openai/lib/browser.py:1149— browser._arguments has cyclomatic complexity 32 (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.
responses_tool_runner._supplied_result (cyclomatic 32) src/openai/lib/responses_tool_runner.py:960— responses_tool_runner._supplied_result 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.
BaseAPIResponse._parse (cyclomatic 31) src/openai/_response.py:129— BaseAPIResponse._parse 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.
_BrowserBase.__init__ (cyclomatic 31) src/openai/lib/browser.py:1266— _BrowserBase.__init__ 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.
check-dependency-security.uncovered_marker_fragments (cyclomatic 30) scripts/check-dependency-security.py:1066— check-dependency-security.uncovered_marker_fragments has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LegacyAPIResponse._parse (cyclomatic 30) src/openai/_legacy_response.py:198— LegacyAPIResponse._parse has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ChatCompletionStreamState._accumulate_chunk (cyclomatic 30) src/openai/lib/streaming/chat/_completions.py:362— ChatCompletionStreamState._accumulate_chunk has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
bedrock._copy_configuration (cyclomatic 29) src/openai/lib/bedrock.py:209— bedrock._copy_configuration has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
browser._observed_state (cyclomatic 29) src/openai/lib/browser.py:761— browser._observed_state has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
check-dependency-security.marker_version_bounds (cyclomatic 27) scripts/check-dependency-security.py:519— check-dependency-security.marker_version_bounds has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ResponsesWebSocketAccumulator.detailed_snapshot (cyclomatic 27) src/openai/lib/responses_websocket/_accumulator.py:152— ResponsesWebSocketAccumulator.detailed_snapshot 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.
BaseClient._build_request (cyclomatic 26) src/openai/_base_client.py:599— BaseClient._build_request 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.
WebSocketConnectionBase._reconnect (cyclomatic 25) src/openai/_websocket_connection.py:291— WebSocketConnectionBase._reconnect has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
browser._state (cyclomatic 25) src/openai/lib/browser.py:957— browser._state has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ComputerToolset._dispatch (cyclomatic 25) src/openai/lib/computer.py:657— ComputerToolset._dispatch has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (AsyncComputerToolset._dispatch) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncComputerToolset._dispatch (cyclomatic 25) src/openai/lib/computer.py:867— AsyncComputerToolset._dispatch has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (ComputerToolset._dispatch) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
check-dependency-security.replacement_contexts (cyclomatic 24) scripts/check-dependency-security.py:1290— check-dependency-security.replacement_contexts 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.
_transform._transform_recursive (cyclomatic 24) src/openai/_utils/_transform.py:154— _transform._transform_recursive 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. This shape REPEATS in the file: one other method here (_transform._async_transform_recursive) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_transform._async_transform_recursive (cyclomatic 24) src/openai/_utils/_transform.py:322— _transform._async_transform_recursive 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. This shape REPEATS in the file: one other method here (_transform._transform_recursive) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
computer._calls (cyclomatic 24) src/openai/lib/computer.py:341— computer._calls 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.
ResponsesWebSocketAccumulator._add_item (cyclomatic 24) src/openai/lib/responses_websocket/_accumulator.py:596— ResponsesWebSocketAccumulator._add_item has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_deltas.accumulate_delta (cyclomatic 24) src/openai/lib/streaming/_deltas.py:10— _deltas.accumulate_delta 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.
check-dependency-security.preserves_supported_security_branches (cyclomatic 23) scripts/check-dependency-security.py:1535— check-dependency-security.preserves_supported_security_branches 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.
AgentTurnResultCollector.accept (cyclomatic 23) src/openai/lib/beta/agents/_result.py:115— AgentTurnResultCollector.accept 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.
DecisionsToolRunner.run (cyclomatic 23) src/openai/lib/decisions_tool_runner.py:342— DecisionsToolRunner.run 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.
computer._actions (cyclomatic 22) src/openai/lib/computer.py:404— computer._actions 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.
check-dependency-security.reconcile_resolution_domains (cyclomatic 21) scripts/check-dependency-security.py:1155— check-dependency-security.reconcile_resolution_domains has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
check-dependency-security.published_bounds (cyclomatic 21) scripts/check-dependency-security.py:1614— check-dependency-security.published_bounds has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_models._build_discriminated_union_meta (cyclomatic 21) src/openai/_models.py:781— _models._build_discriminated_union_meta has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_tools.function_tool (cyclomatic 21) src/openai/lib/beta/agents/_tools.py:240— _tools.function_tool has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
browser._browser_image (cyclomatic 21) src/openai/lib/browser.py:1030— browser._browser_image has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AsyncDecisionsToolRunner.run (cyclomatic 21) src/openai/lib/decisions_tool_runner.py:461— AsyncDecisionsToolRunner.run has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
check-dependency-security.minimums (cyclomatic 20) scripts/check-dependency-security.py:1227— check-dependency-security.minimums 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.
check-dependency-security.reviewed_additive_protected_contexts (cyclomatic 20) scripts/check-dependency-security.py:2015— check-dependency-security.reviewed_additive_protected_contexts 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.
_Router.dispatch (cyclomatic 20) src/openai/lib/responses_websocket/_session.py:235— _Router.dispatch 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.
check-dependency-security.excludes_affected_published_branch (cyclomatic 19) scripts/check-dependency-security.py:1848— check-dependency-security.excludes_affected_published_branch 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.
SyncAPIClient.request (cyclomatic 19) src/openai/_base_client.py:1135— SyncAPIClient.request 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.
bedrock._legacy_provider (cyclomatic 19) src/openai/lib/bedrock.py:127— bedrock._legacy_provider has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ResponseStreamState.handle_event (cyclomatic 19) src/openai/lib/streaming/responses/_responses.py:276— ResponseStreamState.handle_event has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AsyncStream.__stream__ (cyclomatic 18) src/openai/_streaming.py:178— AsyncStream.__stream__ has cyclomatic complexity 18 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
_x509._retry_delay (cyclomatic 18) src/openai/auth/_x509.py:344— _x509._retry_delay 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.
_Run.select (cyclomatic 18) src/openai/lib/decisions_tool_runner.py:238— _Run.select has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
_Run.context_snapshot (cyclomatic 18) src/openai/lib/responses_tool_runner.py:1233— _Run.context_snapshot has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
responses_tool_runner._mcp_approval_policy (cyclomatic 18) src/openai/lib/responses_tool_runner.py:306— responses_tool_runner._mcp_approval_policy 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.
Stream.__stream__ (cyclomatic 17) src/openai/_streaming.py:63— Stream.__stream__ has cyclomatic complexity 17 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
AsyncWebSocketConnectionBase._attempt_reconnect (cyclomatic 17) src/openai/_websocket_connection.py:535— AsyncWebSocketConnectionBase._attempt_reconnect 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.
_pydantic._ensure_strict_json_schema (cyclomatic 17) src/openai/lib/_pydantic.py:27— _pydantic._ensure_strict_json_schema 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.
computer._valid_native_message (cyclomatic 17) src/openai/lib/computer.py:272— computer._valid_native_message has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_Run.validate_mcp_selection (cyclomatic 17) src/openai/lib/responses_tool_runner.py:1502— _Run.validate_mcp_selection 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.
_Accumulator.add (cyclomatic 17) src/openai/lib/responses_websocket/_session.py:105— _Accumulator.add 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.
ChatCompletionStreamState._build_events (cyclomatic 17) src/openai/lib/streaming/chat/_completions.py:495— ChatCompletionStreamState._build_events 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.
check-dependency-security.preserves_dependency_security_bounds (cyclomatic 16) scripts/check-dependency-security.py:1787— check-dependency-security.preserves_dependency_security_bounds 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.
_multipart.encode_multipart (cyclomatic 16) src/openai/_multipart.py:11— _multipart.encode_multipart 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.
AzureOpenAI.__init__ (cyclomatic 16) src/openai/lib/azure.py:256— AzureOpenAI.__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. This shape REPEATS in the file: one other method here (AsyncAzureOpenAI.__init__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncAzureOpenAI.__init__ (cyclomatic 16) src/openai/lib/azure.py:633— AsyncAzureOpenAI.__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. This shape REPEATS in the file: one other method here (AzureOpenAI.__init__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_tools._tool_output (cyclomatic 16) src/openai/lib/beta/agents/_tools.py:111— _tools._tool_output 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.
browser._state_origin (cyclomatic 16) src/openai/lib/browser.py:859— browser._state_origin 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.
computer._prepare (cyclomatic 16) src/openai/lib/computer.py:125— computer._prepare 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.
_Run.context_input (cyclomatic 16) src/openai/lib/responses_tool_runner.py:1314— _Run.context_input 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.
vertex.vertex (cyclomatic 16) src/openai/providers/vertex.py:171— vertex.vertex 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.
check-dependency-security.simple_marker_overlap (cognitive 406) scripts/check-dependency-security.py:571— check-dependency-security.simple_marker_overlap has cognitive complexity 406 (threshold 15). Drivers by points: if/else 83 (311 pts), loops 10 (34 pts), boolean chains 32, ternaries 6 (24 pts), error handling 1 (5 pts) (nesting depth added 274). 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.
ResponsesToolRunner.iterate (cognitive 171) src/openai/lib/responses_tool_runner.py:1912— ResponsesToolRunner.iterate has cognitive complexity 171 (threshold 15). Drivers by points: if/else 34 (107 pts), ternaries 8 (23 pts), boolean chains 21, error handling 8 (12 pts), loops 4 (8 pts) (nesting depth added 96). 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.
AsyncResponsesToolRunner.iterate (cognitive 160) src/openai/lib/responses_tool_runner.py:2390— AsyncResponsesToolRunner.iterate has cognitive complexity 160 (threshold 15). Drivers by points: if/else 31 (96 pts), ternaries 8 (23 pts), boolean chains 21, error handling 8 (12 pts), loops 4 (8 pts) (nesting depth added 88). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
responses_tool_runner._history_calls (cognitive 133) src/openai/lib/responses_tool_runner.py:506— responses_tool_runner._history_calls has cognitive complexity 133 (threshold 15). Drivers by points: if/else 35 (103 pts), boolean chains 20, error handling 2 (5 pts), loops 2 (5 pts) (nesting depth added 74). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
responses_tool_runner._validate_server_item (cognitive 127) src/openai/lib/responses_tool_runner.py:133— responses_tool_runner._validate_server_item has cognitive complexity 127 (threshold 15). Drivers by points: if/else 25 (64 pts), boolean chains 47, loops 4 (14 pts), ternaries 1 (2 pts) (nesting depth added 50). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ResponsesWebSocketAccumulator.add_event (cognitive 124) src/openai/lib/responses_websocket/_accumulator.py:243— ResponsesWebSocketAccumulator.add_event has cognitive complexity 124 (threshold 15). Drivers by points: if/else 46 (85 pts), boolean chains 28, loops 2 (6 pts), error handling 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-dependency-security.published_reachability (cognitive 117) scripts/check-dependency-security.py:320— check-dependency-security.published_reachability has cognitive complexity 117 (threshold 15). Drivers by points: if/else 23 (85 pts), loops 8 (24 pts), boolean chains 8 (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_Run.__init__ (cognitive 111) src/openai/lib/responses_tool_runner.py:1031— _Run.__init__ has cognitive complexity 111 (threshold 15). Drivers by points: if/else 37 (64 pts), boolean chains 32, ternaries 6 (10 pts), loops 3 (5 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-dependency-security.preserves_requirement_source_markers (cognitive 100) scripts/check-dependency-security.py:1348— check-dependency-security.preserves_requirement_source_markers has cognitive complexity 100 (threshold 15). Drivers by points: if/else 26 (64 pts), loops 13 (21 pts), boolean chains 15 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-dependency-security.marker_options (cognitive 82) scripts/check-dependency-security.py:929— check-dependency-security.marker_options has cognitive complexity 82 (threshold 15). Drivers by points: if/else 29 (71 pts), boolean chains 8, ternaries 1 (2 pts), loops 1 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
browser._read_result (cognitive 71) src/openai/lib/browser.py:618— browser._read_result has cognitive complexity 71 (threshold 15). Drivers by points: if/else 22 (52 pts), boolean chains 11, loops 4 (7 pts), error handling 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_Run.validate (cognitive 67) src/openai/lib/responses_tool_runner.py:1528— _Run.validate has cognitive complexity 67 (threshold 15). Drivers by points: if/else 26 (39 pts), boolean chains 19, error handling 3 (5 pts), ternaries 2 (4 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatCompletionStreamState._accumulate_chunk (cognitive 65) src/openai/lib/streaming/chat/_completions.py:362— ChatCompletionStreamState._accumulate_chunk has cognitive complexity 65 (threshold 15). Drivers by points: if/else 17 (51 pts), boolean chains 7, loops 3 (5 pts), error handling 1 (2 pts) (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AssistantEventHandler._emit_sse_event (cognitive 63) src/openai/lib/streaming/_assistants.py:280— AssistantEventHandler._emit_sse_event has cognitive complexity 63 (threshold 15). Drivers by points: if/else 16 (49 pts), boolean chains 7, loops 3 (7 pts) (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (AsyncAssistantEventHandler._emit_sse_event) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncAssistantEventHandler._emit_sse_event (cognitive 63) src/openai/lib/streaming/_assistants.py:712— AsyncAssistantEventHandler._emit_sse_event has cognitive complexity 63 (threshold 15). Drivers by points: if/else 16 (49 pts), boolean chains 7, loops 3 (7 pts) (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (AssistantEventHandler._emit_sse_event) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
check-dependency-security.uncovered_marker_fragments (cognitive 61) scripts/check-dependency-security.py:1066— check-dependency-security.uncovered_marker_fragments has cognitive complexity 61 (threshold 15). Drivers by points: if/else 13 (43 pts), loops 4 (10 pts), boolean chains 8 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_models.construct_type (cognitive 61) src/openai/_models.py:608— _models.construct_type has cognitive complexity 61 (threshold 15). Drivers by points: if/else 20 (35 pts), error handling 4 (9 pts), boolean chains 8, ternaries 3 (7 pts), loops 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ResponsesWebSocketAccumulator.detailed_snapshot (cognitive 61) src/openai/lib/responses_websocket/_accumulator.py:152— ResponsesWebSocketAccumulator.detailed_snapshot has cognitive complexity 61 (threshold 15). Drivers by points: if/else 15 (38 pts), loops 5 (10 pts), ternaries 2 (8 pts), boolean chains 5 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
responses_tool_runner._supplied_result (cognitive 60) src/openai/lib/responses_tool_runner.py:960— responses_tool_runner._supplied_result has cognitive complexity 60 (threshold 15). Drivers by points: if/else 19 (44 pts), boolean chains 9, ternaries 1 (4 pts), loops 2 (3 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ResponsesWebSocketAccumulator._add_rich_event (cognitive 60) src/openai/lib/responses_websocket/_accumulator.py:490— ResponsesWebSocketAccumulator._add_rich_event has cognitive complexity 60 (threshold 15). Drivers by points: if/else 22 (36 pts), ternaries 7 (13 pts), loops 3 (6 pts), boolean chains 5 (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.
ResponseStreamState.accumulate_event (cognitive 59) src/openai/lib/streaming/responses/_responses.py:402— ResponseStreamState.accumulate_event has cognitive complexity 59 (threshold 15). Drivers by points: if/else 19 (40 pts), boolean chains 11, loops 4 (8 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_client_auth.synccopy (cognitive 57) src/openai/lib/_client_auth.py:413— _client_auth.synccopy has cognitive complexity 57 (threshold 15). Drivers by points: boolean chains 23, if/else 15 (19 pts), ternaries 13 (15 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (_client_auth.asynccopy) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_client_auth.asynccopy (cognitive 57) src/openai/lib/_client_auth.py:886— _client_auth.asynccopy has cognitive complexity 57 (threshold 15). Drivers by points: boolean chains 23, if/else 15 (19 pts), ternaries 13 (15 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (_client_auth.synccopy) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_models._build_discriminated_union_meta (cognitive 55) src/openai/_models.py:781— _models._build_discriminated_union_meta has cognitive complexity 55 (threshold 15). Drivers by points: if/else 13 (39 pts), loops 4 (12 pts), boolean chains 2, error handling 2 (nesting depth added 34). 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.
check-dependency-security.reviewed_additive_protected_contexts (cognitive 54) scripts/check-dependency-security.py:2015— check-dependency-security.reviewed_additive_protected_contexts has cognitive complexity 54 (threshold 15). Drivers by points: if/else 10 (39 pts), loops 4 (10 pts), boolean chains 5 (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.
check-dependency-security.preserves_published_security_bound (cognitive 53) scripts/check-dependency-security.py:1687— check-dependency-security.preserves_published_security_bound has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (33 pts), boolean chains 15, loops 3 (5 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_client_auth.sync__init__ (cognitive 53) src/openai/lib/_client_auth.py:99— _client_auth.sync__init__ has cognitive complexity 53 (threshold 15). Drivers by points: if/else 26 (37 pts), boolean chains 7, ternaries 5 (7 pts), loops 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_client_auth.async__init__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_client_auth.async__init__ (cognitive 53) src/openai/lib/_client_auth.py:565— _client_auth.async__init__ has cognitive complexity 53 (threshold 15). Drivers by points: if/else 26 (37 pts), boolean chains 7, ternaries 5 (7 pts), loops 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_client_auth.sync__init__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
browser._observed_state (cognitive 52) src/openai/lib/browser.py:761— browser._observed_state has cognitive complexity 52 (threshold 15). Drivers by points: if/else 18 (43 pts), boolean chains 8, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-dependency-security.reconcile_resolution_domains (cognitive 51) scripts/check-dependency-security.py:1155— check-dependency-security.reconcile_resolution_domains has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (43 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WebSocketConnectionBase._reconnect (cognitive 48) src/openai/_websocket_connection.py:291— WebSocketConnectionBase._reconnect has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (34 pts), error handling 3 (6 pts), ternaries 1 (4 pts), boolean chains 3, loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-dependency-security.preserves_supported_security_branches (cognitive 47) scripts/check-dependency-security.py:1535— check-dependency-security.preserves_supported_security_branches has cognitive complexity 47 (threshold 15). Drivers by points: if/else 10 (31 pts), boolean chains 8, loops 4 (8 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserToolset._dispatch (cognitive 47) src/openai/lib/browser.py:1461— BrowserToolset._dispatch has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (14 pts), error handling 9 (13 pts), ternaries 7 (12 pts), boolean chains 8 (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. This shape REPEATS in the file: one other method here (AsyncBrowserToolset._dispatch) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncBrowserToolset._dispatch (cognitive 47) src/openai/lib/browser.py:1718— AsyncBrowserToolset._dispatch has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (14 pts), error handling 9 (13 pts), ternaries 7 (12 pts), boolean chains 8 (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. This shape REPEATS in the file: one other method here (BrowserToolset._dispatch) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DecisionsToolRunner.run (cognitive 47) src/openai/lib/decisions_tool_runner.py:342— DecisionsToolRunner.run has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (27 pts), ternaries 4 (10 pts), error handling 6 (9 pts), loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-dependency-security.preserves_dependency_security_bounds (cognitive 46) scripts/check-dependency-security.py:1787— check-dependency-security.preserves_dependency_security_bounds has cognitive complexity 46 (threshold 15). Drivers by points: if/else 8 (29 pts), loops 4 (10 pts), ternaries 1 (5 pts), boolean chains 2 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ResponsesWebSocketAccumulator._add_item (cognitive 46) src/openai/lib/responses_websocket/_accumulator.py:596— ResponsesWebSocketAccumulator._add_item has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (36 pts), loops 2 (6 pts), boolean chains 3, ternaries 1 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
bedrock.bedrock (cognitive 46) src/openai/providers/bedrock.py:383— bedrock.bedrock has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 22, if/else 16 (18 pts), ternaries 5 (6 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ComputerToolset._dispatch (cognitive 45) src/openai/lib/computer.py:657— ComputerToolset._dispatch has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (24 pts), error handling 4 (8 pts), ternaries 3 (7 pts), boolean chains 5, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AsyncComputerToolset._dispatch) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncComputerToolset._dispatch (cognitive 45) src/openai/lib/computer.py:867— AsyncComputerToolset._dispatch has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (24 pts), error handling 4 (8 pts), ternaries 3 (7 pts), boolean chains 5, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ComputerToolset._dispatch) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_deltas.accumulate_delta (cognitive 45) src/openai/lib/streaming/_deltas.py:10— _deltas.accumulate_delta has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (25 pts), boolean chains 8, error handling 2 (8 pts), loops 2 (4 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AsyncDecisionsToolRunner.run (cognitive 42) src/openai/lib/decisions_tool_runner.py:461— AsyncDecisionsToolRunner.run has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 4 (10 pts), error handling 6 (9 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-dependency-security.minimums (cognitive 41) scripts/check-dependency-security.py:1227— check-dependency-security.minimums has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 4 (8 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseAPIResponse._parse (cognitive 40) src/openai/_response.py:129— BaseAPIResponse._parse has cognitive complexity 40 (threshold 15). Drivers by points: if/else 22 (30 pts), boolean chains 6, error handling 1 (3 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.
AsyncStream.__stream__ (cognitive 40) src/openai/_streaming.py:178— AsyncStream.__stream__ has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (30 pts), boolean chains 6, ternaries 1 (3 pts), loops 1 (nesting depth added 22). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
LegacyAPIResponse._parse (cognitive 39) src/openai/_legacy_response.py:198— LegacyAPIResponse._parse has cognitive complexity 39 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 6, error handling 1 (3 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.
_x509._retry_delay (cognitive 39) src/openai/auth/_x509.py:344— _x509._retry_delay has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (21 pts), error handling 3 (10 pts), boolean chains 4, ternaries 1 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-dependency-security.preserves_additive_supported_releases (cognitive 38) scripts/check-dependency-security.py:1984— check-dependency-security.preserves_additive_supported_releases has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (27 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Stream.__stream__ (cognitive 37) src/openai/_streaming.py:63— Stream.__stream__ has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (27 pts), boolean chains 6, ternaries 1 (3 pts), loops 1 (nesting depth added 20). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
AsyncWebSocketConnectionBase._attempt_reconnect (cognitive 37) src/openai/_websocket_connection.py:535— AsyncWebSocketConnectionBase._attempt_reconnect has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (25 pts), error handling 3 (6 pts), ternaries 1 (4 pts), boolean chains 1, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseClient._build_request (cognitive 36) src/openai/_base_client.py:599— BaseClient._build_request has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 6, ternaries 3 (5 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.
_BrowserBase.__init__ (cognitive 36) src/openai/lib/browser.py:1266— _BrowserBase.__init__ has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 15, loops 2, ternaries 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
computer._calls (cognitive 35) src/openai/lib/computer.py:341— computer._calls has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 7, error handling 1 (3 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_Router.dispatch (cognitive 35) src/openai/lib/responses_websocket/_session.py:235— _Router.dispatch has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 2 (9 pts), loops 2 (5 pts), boolean chains 4 (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.
SyncAPIClient.request (cognitive 34) src/openai/_base_client.py:1135— SyncAPIClient.request has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (17 pts), error handling 4 (8 pts), boolean chains 5, ternaries 1 (3 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
browser._state (cognitive 34) src/openai/lib/browser.py:957— browser._state has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 8, ternaries 3 (4 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
computer._valid_native_message (cognitive 33) src/openai/lib/computer.py:272— computer._valid_native_message has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 6, loops 2 (5 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
browser._arguments (cognitive 32) src/openai/lib/browser.py:1149— browser._arguments has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 26, if/else 3 (4 pts), error handling 1, 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.
check-dependency-security.secures_supported_published_branches (cognitive 31) scripts/check-dependency-security.py:1900— check-dependency-security.secures_supported_published_branches has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 3 (6 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.
_transform._transform_recursive (cognitive 31) src/openai/_utils/_transform.py:154— _transform._transform_recursive has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 8, ternaries 2 (4 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. This shape REPEATS in the file: one other method here (_transform._async_transform_recursive) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_transform._async_transform_recursive (cognitive 31) src/openai/_utils/_transform.py:322— _transform._async_transform_recursive has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 8, ternaries 2 (4 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. This shape REPEATS in the file: one other method here (_transform._transform_recursive) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
BedrockOpenAI.copy (cognitive 30) src/openai/lib/bedrock.py:535— BedrockOpenAI.copy has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 9 (10 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (AsyncBedrockOpenAI.copy) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncBedrockOpenAI.copy (cognitive 30) src/openai/lib/bedrock.py:773— AsyncBedrockOpenAI.copy has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 9 (10 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (BedrockOpenAI.copy) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
check-dependency-security.marker_version_bounds (cognitive 29) scripts/check-dependency-security.py:519— check-dependency-security.marker_version_bounds has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 12, if/else 10 (11 pts), ternaries 5 (6 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
check-dependency-security.replacement_contexts (cognitive 29) scripts/check-dependency-security.py:1290— check-dependency-security.replacement_contexts has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 7, loops 2, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-dependency-security.published_bounds (cognitive 29) scripts/check-dependency-security.py:1614— check-dependency-security.published_bounds has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 8, ternaries 1 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-dependency-security.excludes_affected_published_branch (cognitive 29) scripts/check-dependency-security.py:1848— check-dependency-security.excludes_affected_published_branch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 3 (5 pts), boolean chains 4 (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.
bedrock._copy_configuration (cognitive 29) src/openai/lib/bedrock.py:209— bedrock._copy_configuration has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 15, if/else 10 (11 pts), ternaries 3 (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.
AgentTurnResultCollector.accept (cognitive 29) src/openai/lib/beta/agents/_result.py:115— AgentTurnResultCollector.accept has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (8 pts), boolean chains 5, error handling 1 (3 pts), loops 1 (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.
_tools.function_tool (cognitive 29) src/openai/lib/beta/agents/_tools.py:240— _tools.function_tool has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 5 (7 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
computer._actions (cognitive 28) src/openai/lib/computer.py:404— computer._actions has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 8, 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.
ChatCompletionStreamState._build_events (cognitive 28) src/openai/lib/streaming/chat/_completions.py:495— ChatCompletionStreamState._build_events has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 6, loops 2 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_utils._extract_items (cognitive 27) src/openai/_utils/_utils.py:79— _utils._extract_items has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (6 pts), error handling 2 (3 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.
browser._browser_image (cognitive 26) src/openai/lib/browser.py:1030— browser._browser_image has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 9, ternaries 2 (5 pts), error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_response_resources._output_text_parser (cognitive 25) src/openai/lib/_response_resources.py:39— _response_resources._output_text_parser has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_uploads.async_upload_file_chunked (cognitive 25) src/openai/lib/_uploads.py:98— _uploads.async_upload_file_chunked has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 2 (4 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.
_files.directory_files (cognitive 25) src/openai/lib/beta/agents/_files.py:117— _files.directory_files has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_Run.context_snapshot (cognitive 25) src/openai/lib/responses_tool_runner.py:1233— _Run.context_snapshot has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-dependency-security.requested_extra_reachability (cognitive 24) scripts/check-dependency-security.py:423— check-dependency-security.requested_extra_reachability has cognitive complexity 24 (threshold 15). Drivers by points: loops 5 (12 pts), if/else 3 (8 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
Querystring._stringify_item (cognitive 23) src/openai/_qs.py:65— Querystring._stringify_item has cognitive complexity 23 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 6 (9 pts), ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_responses.get_input_tool_by_name (cognitive 23) src/openai/lib/_parsing/_responses.py:170— _responses.get_input_tool_by_name has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (7 pts), boolean chains 4 (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.
_response_resources.async_stream (cognitive 23) src/openai/lib/_response_resources.py:483— _response_resources.async_stream has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
responses_tool_runner._mcp_approval_policy (cognitive 23) src/openai/lib/responses_tool_runner.py:306— responses_tool_runner._mcp_approval_policy has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseModel.construct (cognitive 22) src/openai/_models.py:251— BaseModel.construct has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 2 (4 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_response_resources.stream (cognitive 22) src/openai/lib/_response_resources.py:315— _response_resources.stream has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_Run.context_input (cognitive 22) src/openai/lib/responses_tool_runner.py:1314— _Run.context_input has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 6, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-dependency-security.covers_transitive_security_release (cognitive 21) scripts/check-dependency-security.py:1943— check-dependency-security.covers_transitive_security_release has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 7, 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.
_multipart.encode_multipart (cognitive 21) src/openai/_multipart.py:11— _multipart.encode_multipart has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SendQueue.flush_sync (cognitive 21) src/openai/_send_queue.py:84— SendQueue.flush_sync has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 1 (2 pts), loops 2, 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. This shape REPEATS in the file: one other method here (SendQueue.flush_async) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SendQueue.flush_async (cognitive 21) src/openai/_send_queue.py:138— SendQueue.flush_async has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 1 (2 pts), loops 2, 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. This shape REPEATS in the file: one other method here (SendQueue.flush_sync) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_x509._is_replayable_request (cognitive 21) src/openai/auth/_x509.py:382— _x509._is_replayable_request has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 2 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_module_runtime.load_client (cognitive 21) src/openai/lib/_module_runtime.py:26— _module_runtime.load_client has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_pydantic._ensure_strict_json_schema (cognitive 21) src/openai/lib/_pydantic.py:27— _pydantic._ensure_strict_json_schema has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (15 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_files._deepcopy_with_paths (cognitive 20) src/openai/_files.py:146— _files._deepcopy_with_paths has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
browser._state_origin (cognitive 20) src/openai/lib/browser.py:859— browser._state_origin has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4, 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.
ResponseStreamState.handle_event (cognitive 20) src/openai/lib/streaming/responses/_responses.py:276— ResponseStreamState.handle_event has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (10 pts), boolean chains 5, if/else 4 (5 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-dependency-security.direct (cognitive 19) scripts/check-dependency-security.py:186— check-dependency-security.direct has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 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.
_client_auth.sync_send_with_auth_retry (cognitive 19) src/openai/lib/_client_auth.py:273— _client_auth.sync_send_with_auth_retry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 1 (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. This shape REPEATS in the file: one other method here (_client_auth.async_send_with_auth_retry) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_client_auth.async_send_with_auth_retry (cognitive 19) src/openai/lib/_client_auth.py:739— _client_auth.async_send_with_auth_retry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 1 (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. This shape REPEATS in the file: one other method here (_client_auth.sync_send_with_auth_retry) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_completions.parse_chat_completion (cognitive 19) src/openai/lib/_parsing/_completions.py:96— _completions.parse_chat_completion has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AzureOpenAI.__init__ (cognitive 19) src/openai/lib/azure.py:256— AzureOpenAI.__init__ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (16 pts), ternaries 2, boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (AsyncAzureOpenAI.__init__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncAzureOpenAI.__init__ (cognitive 19) src/openai/lib/azure.py:633— AsyncAzureOpenAI.__init__ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (16 pts), ternaries 2, boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (AzureOpenAI.__init__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_Run.select (cognitive 19) src/openai/lib/decisions_tool_runner.py:238— _Run.select has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ResponsesToolRunner._dispatch (cognitive 19) src/openai/lib/responses_tool_runner.py:2189— ResponsesToolRunner._dispatch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (18 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. This shape REPEATS in the file: one other method here (AsyncResponsesToolRunner._dispatch) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncResponsesToolRunner._dispatch (cognitive 19) src/openai/lib/responses_tool_runner.py:2666— AsyncResponsesToolRunner._dispatch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (18 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. This shape REPEATS in the file: one other method here (ResponsesToolRunner._dispatch) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncRealtimeConnectionManager._connect_ws (cognitive 19) src/openai/resources/realtime/realtime.py:662— AsyncRealtimeConnectionManager._connect_ws has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 2 (4 pts), error handling 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. This shape REPEATS in the file: one other method here (RealtimeConnectionManager._connect_ws) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
RealtimeConnectionManager._connect_ws (cognitive 19) src/openai/resources/realtime/realtime.py:1121— RealtimeConnectionManager._connect_ws has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 2 (4 pts), error handling 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. This shape REPEATS in the file: one other method here (AsyncRealtimeConnectionManager._connect_ws) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
check-dependency-security.allows_published_release (cognitive 18) scripts/check-dependency-security.py:1661— check-dependency-security.allows_published_release has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 3 (7 pts), loops 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
_uploads.upload_file_chunked (cognitive 18) src/openai/lib/_uploads.py:21— _uploads.upload_file_chunked has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 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.
bedrock._legacy_provider (cognitive 18) src/openai/lib/bedrock.py:127— bedrock._legacy_provider has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 6, ternaries 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
_tools._tool_output (cognitive 18) src/openai/lib/beta/agents/_tools.py:111— _tools._tool_output has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, 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.
vertex.vertex (cognitive 18) src/openai/providers/vertex.py:171— vertex.vertex has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (8 pts), ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WebSocketConnectionBase._iter_events (cognitive 17) src/openai/_websocket_connection.py:224— WebSocketConnectionBase._iter_events has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AsyncWebSocketConnectionBase._iter_events) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncWebSocketConnectionBase._iter_events (cognitive 17) src/openai/_websocket_connection.py:452— AsyncWebSocketConnectionBase._iter_events has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (WebSocketConnectionBase._iter_events) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
TranscriptState.push (cognitive 17) src/openai/lib/live/_transcript_state.py:47— TranscriptState.push has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
_Run.validate_mcp_selection (cognitive 17) src/openai/lib/responses_tool_runner.py:1502— _Run.validate_mcp_selection has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 7, ternaries 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.
_Accumulator.add (cognitive 17) src/openai/lib/responses_websocket/_session.py:105— _Accumulator.add has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6 (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.
AsyncForksConnection.__aiter__ (cognitive 17) src/openai/resources/live/forks.py:151— AsyncForksConnection.__aiter__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ForksConnection.__iter__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncForksConnection.dispatch_events (cognitive 17) src/openai/resources/live/forks.py:285— AsyncForksConnection.dispatch_events has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ForksConnection.__iter__ (cognitive 17) src/openai/resources/live/forks.py:581— ForksConnection.__iter__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AsyncForksConnection.__aiter__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncLiveConnection.__aiter__ (cognitive 17) src/openai/resources/live/live.py:371— AsyncLiveConnection.__aiter__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (LiveConnection.__iter__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncLiveConnection.dispatch_events (cognitive 17) src/openai/resources/live/live.py:505— AsyncLiveConnection.dispatch_events has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LiveConnection.__iter__ (cognitive 17) src/openai/resources/live/live.py:794— LiveConnection.__iter__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AsyncLiveConnection.__aiter__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncSidebandConnection.__aiter__ (cognitive 17) src/openai/resources/live/sideband.py:156— AsyncSidebandConnection.__aiter__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SidebandConnection.__iter__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncSidebandConnection.dispatch_events (cognitive 17) src/openai/resources/live/sideband.py:292— AsyncSidebandConnection.dispatch_events has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SidebandConnection.__iter__ (cognitive 17) src/openai/resources/live/sideband.py:595— SidebandConnection.__iter__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AsyncSidebandConnection.__aiter__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncRealtimeConnection.__aiter__ (cognitive 17) src/openai/resources/realtime/realtime.py:343— AsyncRealtimeConnection.__aiter__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (RealtimeConnection.__iter__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncRealtimeConnection.dispatch_events (cognitive 17) src/openai/resources/realtime/realtime.py:485— AsyncRealtimeConnection.dispatch_events has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RealtimeConnection.__iter__ (cognitive 17) src/openai/resources/realtime/realtime.py:808— RealtimeConnection.__iter__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AsyncRealtimeConnection.__aiter__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncTranslationsConnection.__aiter__ (cognitive 17) src/openai/resources/realtime/translations/translations.py:233— AsyncTranslationsConnection.__aiter__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (TranslationsConnection.__iter__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncTranslationsConnection.dispatch_events (cognitive 17) src/openai/resources/realtime/translations/translations.py:370— AsyncTranslationsConnection.dispatch_events has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TranslationsConnection.__iter__ (cognitive 17) src/openai/resources/realtime/translations/translations.py:661— TranslationsConnection.__iter__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AsyncTranslationsConnection.__aiter__) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_base_client.get_platform (cognitive 16) src/openai/_base_client.py:2253— _base_client.get_platform has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
AzureOpenAI._prepare_options (cognitive 16) src/openai/lib/azure.py:495— AzureOpenAI._prepare_options has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (4 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AsyncAzureOpenAI._prepare_options) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AsyncAzureOpenAI._prepare_options (cognitive 16) src/openai/lib/azure.py:874— AsyncAzureOpenAI._prepare_options has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (4 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AzureOpenAI._prepare_options) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ResponsesWebSocketSession._read (cognitive 16) src/openai/lib/responses_websocket/_session.py:479— ResponsesWebSocketSession._read has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 3 (5 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AsyncResponsesWebSocketSession._read (cognitive 16) src/openai/lib/responses_websocket/_session.py:625— AsyncResponsesWebSocketSession._read has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 4 (6 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.
D4 · Code Duplication· Near-duplicate member family (10 members, 21 shared lines) · ×1
Near-duplicate member family (10 members, 21 shared lines) src/openai/resources/live/forks.py:457— src/openai/resources/live/forks.py:457-511 | src/openai/resources/live/forks.py:883-937 | src/openai/resources/live/live.py:675-729 | src/openai/resources/live/live.py:1093-1147 | src/openai/resources/live/sideband.py:466-523 | src/openai/resources/live/sideband.py:901-958 | src/openai/resources/realtime/realtime.py:663-739 | src/openai/resources/realtime/realtime.py:1122-1196 | src/openai/resources/realtime/translations/translations.py:545-600 | src/openai/resources/realtime/translations/translations.py:969-1024 — These 10 members are variants of one another: a block of 21 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 10 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 10 times.
Near-duplicate member pair (145 shared lines) src/openai/lib/browser.py:1469— src/openai/lib/browser.py:1469-1628 | src/openai/lib/browser.py:1726-1893 — These two members are variants of one another: 145 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 (119 shared lines) src/openai/_legacy_response.py:199— src/openai/_legacy_response.py:199-337 | src/openai/_response.py:130-272 — These two members are variants of one another: 119 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 (114 shared lines) src/openai/lib/computer.py:666— src/openai/lib/computer.py:666-785 | src/openai/lib/computer.py:876-997 — These two members are variants of one another: 114 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 (110 shared lines) src/openai/lib/responses_tool_runner.py:1932— src/openai/lib/responses_tool_runner.py:1932-2187 | src/openai/lib/responses_tool_runner.py:2412-2664 — These two members are variants of one another: 110 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 (74 shared lines) src/openai/lib/decisions_tool_runner.py:351— src/openai/lib/decisions_tool_runner.py:351-442 | src/openai/lib/decisions_tool_runner.py:470-557 — These two members are variants of one another: 74 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 (48 shared lines) src/openai/lib/streaming/_assistants.py:281— src/openai/lib/streaming/_assistants.py:281-423 | src/openai/lib/streaming/_assistants.py:713-855 — These two members are variants of one another: 48 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· Members sharing a duplicated core (26 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (26 members, 50+ identical tokens) src/openai/_client.py:306— src/openai/_client.py:306-343 | src/openai/_client.py:601-628 | src/openai/_client.py:833-870 | src/openai/_client.py:1128-1155 | src/openai/lib/_chat_completion_resources.py:325-380 | src/openai/lib/_chat_completion_resources.py:429-483 | src/openai/lib/_response_resources.py:359-480 | src/openai/lib/_response_resources.py:527-647 | src/openai/resources/beta/threads/runs/runs.py:124-152 | src/openai/resources/beta/threads/runs/runs.py:240-265 | src/openai/resources/beta/threads/runs/runs.py:381-407 | src/openai/resources/beta/threads/runs/runs.py:1667-1695 | src/openai/resources/beta/threads/runs/runs.py:1783-1807 | src/openai/resources/beta/threads/runs/runs.py:1925-1951 | src/openai/resources/beta/threads/threads.py:124-149 | src/openai/resources/beta/threads/threads.py:231-254 | src/openai/resources/beta/threads/threads.py:1204-1229 | src/openai/resources/beta/threads/threads.py:1314-1337 | src/openai/resources/chat/completions/completions.py:135-218 | src/openai/resources/chat/completions/completions.py:264-327 | src/openai/resources/chat/completions/completions.py:1938-2021 | src/openai/resources/chat/completions/completions.py:2067-2130 | src/openai/resources/responses/responses.py:260-302 | src/openai/resources/responses/responses.py:404-445 | src/openai/resources/responses/responses.py:2178-2220 | src/openai/resources/responses/responses.py:2322-2363 — These 26 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 26 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 26 times.
D4 · Code Duplication· Members sharing a duplicated core (20 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (20 members, 50+ identical tokens) src/openai/resources/audio/transcriptions.py:596— src/openai/resources/audio/transcriptions.py:596-742 | src/openai/resources/audio/transcriptions.py:1286-1432 | src/openai/resources/audio/translations.py:152-227 | src/openai/resources/audio/translations.py:340-415 | src/openai/resources/audio/voice_consents.py:60-106 | src/openai/resources/audio/voice_consents.py:312-358 | src/openai/resources/audio/voices.py:165-194 | src/openai/resources/audio/voices.py:381-410 | src/openai/resources/files.py:76-155 | src/openai/resources/files.py:417-496 | src/openai/resources/images.py:68-137 | src/openai/resources/images.py:1244-1313 | src/openai/resources/videos.py:85-136 | src/openai/resources/videos.py:281-321 | src/openai/resources/videos.py:381-422 | src/openai/resources/videos.py:438-482 | src/openai/resources/videos.py:670-721 | src/openai/resources/videos.py:866-906 | src/openai/resources/videos.py:968-1009 | src/openai/resources/videos.py:1025-1069 — These 20 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 20 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 20 times.
D4 · Code Duplication· Members sharing a duplicated core (13 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (13 members, 50+ identical tokens) src/openai/resources/beta/agents/agents.py:583— src/openai/resources/beta/agents/agents.py:583-610 | src/openai/resources/beta/agents/environments/environments.py:314-341 | src/openai/resources/beta/agents/sessions/events.py:221-251 | src/openai/resources/beta/agents/sessions/sessions.py:714-741 | src/openai/resources/beta/agents/vaults/vaults.py:404-431 | src/openai/resources/beta/assistants.py:832-857 | src/openai/resources/beta/chatkit/threads.py:280-305 | src/openai/resources/beta/threads/threads.py:1414-1439 | src/openai/resources/files.py:645-670 | src/openai/resources/live/sessions.py:400-428 | src/openai/resources/skills/content.py:113-138 | src/openai/resources/vector_stores/vector_stores.py:533-558 | src/openai/resources/videos.py:921-953 — These 13 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 13 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 13 times.
D4 · Code Duplication· Members sharing a duplicated core (8 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (8 members, 50+ identical tokens) src/openai/_base_client.py:1460— src/openai/_base_client.py:1460-1474 | src/openai/_base_client.py:1486-1500 | src/openai/_base_client.py:1512-1526 | src/openai/_base_client.py:1537-1547 | src/openai/_base_client.py:2071-2085 | src/openai/_base_client.py:2097-2116 | src/openai/_base_client.py:2128-2142 | src/openai/_base_client.py:2153-2163 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
Duplicated block (121 lines × 2) src/openai/lib/_client_auth.py:122— src/openai/lib/_client_auth.py:122-242 | src/openai/lib/_client_auth.py:588-708 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `_sdk_client.OpenAI` in one and `_sdk_client.AsyncOpenAI` 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 (93 lines × 2) src/openai/lib/azure.py:281— src/openai/lib/azure.py:281-373 | src/openai/lib/azure.py:658-750 — both copies are in the same file, so extract the 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 (90 lines × 2) src/openai/lib/_client_auth.py:460— src/openai/lib/_client_auth.py:460-549 | src/openai/lib/_client_auth.py:933-1022 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (71 lines × 2) src/openai/lib/bedrock.py:565— src/openai/lib/bedrock.py:565-635 | src/openai/lib/bedrock.py:803-873 — both copies are in the same file, so extract the 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 (31–55 lines × 4) src/openai/resources/admin/organization/projects/api_keys.py:360— src/openai/resources/admin/organization/projects/api_keys.py:360-414 | src/openai/resources/admin/organization/projects/rate_limits.py:278-320 | src/openai/resources/admin/organization/projects/service_accounts/api_keys.py:143-180 | src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py:468-498 — before extracting anything, compare `src/openai/resources/admin/organization/projects/api_keys.py` and `src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 183 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/admin/organization/projects/api_keys.py:360` 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 (52 lines × 2) src/openai/lib/azure.py:404— src/openai/lib/azure.py:404-455 | src/openai/lib/azure.py:781-832 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (48 lines × 2) src/openai/_legacy_response.py:212— src/openai/_legacy_response.py:212-259 | src/openai/_response.py:143-190 — before extracting anything, compare `src/openai/_legacy_response.py` and `src/openai/_response.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 136 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/openai/_response.py:193` calls `cast` and `src/openai/_legacy_response.py:262` 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 (46–47 lines × 2) src/openai/lib/browser.py:1500— src/openai/lib/browser.py:1500-1545 | src/openai/lib/browser.py:1758-1804 — both copies are in the same file, so extract the 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/openai/lib/browser.py:1500` 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 (45 lines × 2) src/openai/_streaming.py:72— src/openai/_streaming.py:72-116 | src/openai/_streaming.py:192-236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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 (43–44 lines × 2) src/openai/lib/browser.py:1583— src/openai/lib/browser.py:1583-1625 | src/openai/lib/browser.py:1847-1890 — both copies are in the same file, so extract the 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/openai/lib/browser.py:1847` 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 (40–41 lines × 2) src/openai/lib/computer.py:700— src/openai/lib/computer.py:700-739 | src/openai/lib/computer.py:913-953 — both copies are in the same file, so extract the 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/openai/lib/computer.py:913` 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 (40 lines × 2) src/openai/lib/_assistants_runs.py:139— src/openai/lib/_assistants_runs.py:139-178 | src/openai/lib/_assistants_runs.py:263-302 — both copies are in the same file, so extract the 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/openai/lib/_assistants_runs.py:139` 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/openai/lib/_assistants_runs.py:303` calls `maybe_transform` and `src/openai/lib/_assistants_runs.py:179` 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 (38–39 lines × 2) src/openai/lib/_assistants_runs.py:506— src/openai/lib/_assistants_runs.py:506-543 | src/openai/lib/_assistants_runs.py:628-666 — both copies are in the same file, so extract the 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/openai/lib/_assistants_runs.py:506` 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/openai/lib/_assistants_runs.py:667` calls `maybe_transform` and `src/openai/lib/_assistants_runs.py:544` 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 (37–38 lines × 2) src/openai/lib/responses_tool_runner.py:2278— src/openai/lib/responses_tool_runner.py:2278-2315 | src/openai/lib/responses_tool_runner.py:2750-2786 — both copies are in the same file, so extract the 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/openai/lib/responses_tool_runner.py:2278` 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 (32 lines × 2) src/openai/_legacy_response.py:306— src/openai/_legacy_response.py:306-337 | src/openai/_response.py:241-272 — before extracting anything, compare `src/openai/_legacy_response.py` and `src/openai/_response.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 136 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 (21–30 lines × 6) src/openai/resources/beta/agents/sessions/subagents/turns/items.py:60— src/openai/resources/beta/agents/sessions/subagents/turns/items.py:60-89 | src/openai/resources/beta/agents/sessions/subagents/turns/items.py:153-182 | src/openai/resources/beta/agents/sessions/subagents/turns/turns.py:68-88 | src/openai/resources/beta/agents/sessions/subagents/turns/turns.py:212-232 | src/openai/resources/beta/threads/runs/steps.py:63-89 | src/openai/resources/beta/threads/runs/steps.py:228-254 — there are 6 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 6 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/openai/resources/beta/agents/sessions/subagents/turns/items.py:60` 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 (30 lines × 2) src/openai/resources/admin/organization/projects/roles.py:423— src/openai/resources/admin/organization/projects/roles.py:423-452 | src/openai/resources/admin/organization/projects/spend_alerts.py:452-486 — before extracting anything, compare `src/openai/resources/admin/organization/projects/roles.py` and `src/openai/resources/admin/organization/projects/spend_alerts.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 179 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/openai/resources/admin/organization/projects/roles.py:423` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (28 lines × 3) src/openai/resources/live/forks.py:286— src/openai/resources/live/forks.py:286-313 | src/openai/resources/live/live.py:506-533 | src/openai/resources/live/sideband.py:293-320 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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 × 2) src/openai/lib/browser.py:1469— src/openai/lib/browser.py:1469-1495 | src/openai/lib/browser.py:1726-1752 — both copies are in the same file, so extract the 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/openai/lib/browser.py:1469` 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 (23–24 lines × 2) src/openai/_base_client.py:1209— src/openai/_base_client.py:1209-1232 | src/openai/_base_client.py:1832-1854 — both copies are in the same file, so extract the 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/openai/_base_client.py:1832` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (22 lines × 3) src/openai/resources/live/forks.py:718— src/openai/resources/live/forks.py:718-739 | src/openai/resources/live/live.py:931-952 | src/openai/resources/live/sideband.py:734-755 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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 × 12) src/openai/resources/beta/agents/sessions/subagents/items.py:59— src/openai/resources/beta/agents/sessions/subagents/items.py:59-89 | src/openai/resources/beta/agents/sessions/subagents/items.py:148-178 | src/openai/resources/beta/agents/sessions/subagents/turns/turns.py:121-151 | src/openai/resources/beta/agents/sessions/subagents/turns/turns.py:265-295 | src/openai/resources/beta/agents/sessions/turns/items.py:59-89 | src/openai/resources/beta/agents/sessions/turns/items.py:147-177 | src/openai/resources/beta/threads/runs/steps.py:126-167 | src/openai/resources/beta/threads/runs/steps.py:291-332 | src/openai/resources/vector_stores/file_batches.py:248-285 | src/openai/resources/vector_stores/file_batches.py:579-616 | src/openai/resources/vector_stores/files.py:349-368 | src/openai/resources/vector_stores/files.py:777-796 — `src/openai/resources/beta/agents/sessions/subagents/items.py` and `src/openai/resources/beta/agents/sessions/turns/items.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 2 separate duplicated blocks between them, totalling at least 51 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/openai/resources/beta/agents/sessions/subagents/items.py:59` 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 (19 lines × 8) src/openai/resources/live/forks.py:485— src/openai/resources/live/forks.py:485-503 | src/openai/resources/live/forks.py:911-929 | src/openai/resources/live/live.py:703-721 | src/openai/resources/live/live.py:1121-1139 | src/openai/resources/live/sideband.py:497-515 | src/openai/resources/live/sideband.py:932-950 | src/openai/resources/realtime/translations/translations.py:574-592 | src/openai/resources/realtime/translations/translations.py:998-1016 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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/openai/resources/live/forks.py:485` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–19 lines × 2) src/openai/lib/streaming/_assistants.py:282— src/openai/lib/streaming/_assistants.py:282-300 | src/openai/lib/streaming/_assistants.py:716-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.
Duplicated block (17–18 lines × 4) src/openai/lib/_assistants_runs.py:81— src/openai/lib/_assistants_runs.py:81-98 | src/openai/lib/_assistants_runs.py:449-466 | src/openai/lib/_assistants_threads.py:67-83 | src/openai/lib/_assistants_threads.py:194-210 — before extracting anything, compare `src/openai/lib/_assistants_runs.py` and `src/openai/lib/_assistants_threads.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 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/openai/lib/_assistants_runs.py:100` calls `poll` and `src/openai/lib/_assistants_threads.py:84` 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 (2–18 lines × 3) src/openai/_base_client.py:581— src/openai/_base_client.py:581-582 | src/openai/_client.py:263-280 | src/openai/_client.py:790-807 — 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. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `url` to `URL` in one and `httpx2.URL` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (16–17 lines × 2) src/openai/_base_client.py:1192— src/openai/_base_client.py:1192-1208 | src/openai/_base_client.py:1815-1830 — both copies are in the same file, so extract the 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/openai/_base_client.py:1815` 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 (12–16 lines × 6) src/openai/_base_client.py:1460— src/openai/_base_client.py:1460-1471 | src/openai/_base_client.py:1486-1497 | src/openai/_base_client.py:1512-1523 | src/openai/_base_client.py:2071-2082 | src/openai/_base_client.py:2097-2112 | src/openai/_base_client.py:2128-2139 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/_base_client.py:1460` 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 (15–16 lines × 2) src/openai/_send_queue.py:121— src/openai/_send_queue.py:121-136 | src/openai/_send_queue.py:174-188 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–16 lines × 2) src/openai/_websocket_connection.py:373— src/openai/_websocket_connection.py:373-388 | src/openai/_websocket_connection.py:598-610 — both copies are in the same file, so extract the 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 lines × 26) src/openai/_client.py:329— src/openai/_client.py:329-343 | src/openai/_client.py:614-628 | src/openai/_client.py:856-870 | src/openai/_client.py:1141-1155 | src/openai/lib/_chat_completion_resources.py:361-375 | src/openai/lib/_chat_completion_resources.py:464-478 | src/openai/lib/_response_resources.py:440-454 | src/openai/lib/_response_resources.py:607-621 | src/openai/resources/beta/threads/runs/runs.py:138-152 | src/openai/resources/beta/threads/runs/runs.py:251-265 | src/openai/resources/beta/threads/runs/runs.py:393-407 | src/openai/resources/beta/threads/runs/runs.py:1681-1695 | src/openai/resources/beta/threads/runs/runs.py:1793-1807 | src/openai/resources/beta/threads/runs/runs.py:1937-1951 | src/openai/resources/beta/threads/threads.py:135-149 | src/openai/resources/beta/threads/threads.py:240-254 | src/openai/resources/beta/threads/threads.py:1215-1229 | src/openai/resources/beta/threads/threads.py:1323-1337 | src/openai/resources/chat/completions/completions.py:204-218 | src/openai/resources/chat/completions/completions.py:313-327 | src/openai/resources/chat/completions/completions.py:2007-2021 | src/openai/resources/chat/completions/completions.py:2116-2130 | src/openai/resources/responses/responses.py:288-302 | src/openai/resources/responses/responses.py:431-445 | src/openai/resources/responses/responses.py:2206-2220 | src/openai/resources/responses/responses.py:2349-2363 — before extracting anything, compare `src/openai/resources/beta/threads/threads.py` and `src/openai/resources/responses/responses.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/_client.py:329` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 2) src/openai/lib/streaming/_assistants.py:366— src/openai/lib/streaming/_assistants.py:366-380 | src/openai/lib/streaming/_assistants.py:799-812 — both copies are in the same file, so extract the 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/openai/lib/streaming/_assistants.py:799` 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 × 14) src/openai/resources/beta/responses/responses.py:4995— src/openai/resources/beta/responses/responses.py:4995-5007 | src/openai/resources/beta/responses/responses.py:5325-5337 | src/openai/resources/live/forks.py:271-283 | src/openai/resources/live/forks.py:703-715 | src/openai/resources/live/live.py:491-503 | src/openai/resources/live/live.py:916-928 | src/openai/resources/live/sideband.py:278-290 | src/openai/resources/live/sideband.py:719-731 | src/openai/resources/realtime/realtime.py:471-483 | src/openai/resources/realtime/realtime.py:936-948 | src/openai/resources/realtime/translations/translations.py:356-368 | src/openai/resources/realtime/translations/translations.py:786-798 | src/openai/resources/responses/responses.py:4184-4196 | src/openai/resources/responses/responses.py:4515-4527 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/live/forks.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 96 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 4) src/openai/resources/live/forks.py:516— src/openai/resources/live/forks.py:516-528 | src/openai/resources/live/forks.py:942-954 | src/openai/resources/live/sideband.py:528-540 | src/openai/resources/live/sideband.py:963-975 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/sideband.py` as WHOLE FILES: this scan already matched 35 separate duplicated blocks between them, totalling at least 510 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/openai/resources/live/forks.py:516` 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 (12–13 lines × 2) src/openai/lib/responses_tool_runner.py:2037— src/openai/lib/responses_tool_runner.py:2037-2049 | src/openai/lib/responses_tool_runner.py:2524-2535 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 14) src/openai/resources/beta/responses/responses.py:5152— src/openai/resources/beta/responses/responses.py:5152-5163 | src/openai/resources/beta/responses/responses.py:5476-5487 | src/openai/resources/live/forks.py:430-441 | src/openai/resources/live/forks.py:856-867 | src/openai/resources/live/live.py:648-659 | src/openai/resources/live/live.py:1066-1077 | src/openai/resources/live/sideband.py:439-450 | src/openai/resources/live/sideband.py:874-885 | src/openai/resources/realtime/realtime.py:636-647 | src/openai/resources/realtime/realtime.py:1095-1106 | src/openai/resources/realtime/translations/translations.py:518-529 | src/openai/resources/realtime/translations/translations.py:942-953 | src/openai/resources/responses/responses.py:4341-4352 | src/openai/resources/responses/responses.py:4666-4677 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/live/forks.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 96 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/responses/responses.py:5152` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 6) src/openai/resources/live/forks.py:133— src/openai/resources/live/forks.py:133-144 | src/openai/resources/live/forks.py:563-574 | src/openai/resources/live/live.py:353-364 | src/openai/resources/live/live.py:776-787 | src/openai/resources/live/sideband.py:137-148 | src/openai/resources/live/sideband.py:576-587 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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–12 lines × 3) src/openai/_base_client.py:584— src/openai/_base_client.py:584-593 | src/openai/_client.py:271-282 | src/openai/_client.py:798-809 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/_client.py:271` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 14) src/openai/resources/beta/responses/responses.py:5124— src/openai/resources/beta/responses/responses.py:5124-5133 | src/openai/resources/beta/responses/responses.py:5448-5457 | src/openai/resources/live/forks.py:402-411 | src/openai/resources/live/forks.py:828-837 | src/openai/resources/live/live.py:620-629 | src/openai/resources/live/live.py:1038-1047 | src/openai/resources/live/sideband.py:411-420 | src/openai/resources/live/sideband.py:846-855 | src/openai/resources/realtime/realtime.py:608-617 | src/openai/resources/realtime/realtime.py:1067-1076 | src/openai/resources/realtime/translations/translations.py:490-499 | src/openai/resources/realtime/translations/translations.py:914-923 | src/openai/resources/responses/responses.py:4313-4322 | src/openai/resources/responses/responses.py:4638-4647 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/live/forks.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 96 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9–10 lines × 6) src/openai/resources/live/forks.py:297— src/openai/resources/live/forks.py:297-305 | src/openai/resources/live/forks.py:726-735 | src/openai/resources/live/live.py:517-525 | src/openai/resources/live/live.py:939-948 | src/openai/resources/live/sideband.py:304-312 | src/openai/resources/live/sideband.py:742-751 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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 (9–10 lines × 4) src/openai/resources/realtime/realtime.py:497— src/openai/resources/realtime/realtime.py:497-505 | src/openai/resources/realtime/realtime.py:959-968 | src/openai/resources/realtime/translations/translations.py:382-390 | src/openai/resources/realtime/translations/translations.py:809-818 — before extracting anything, compare `src/openai/resources/realtime/realtime.py` and `src/openai/resources/realtime/translations/translations.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 398 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: `RealtimeErrorEvent` names `....types.realtime.realtime_error_event` in one and `...types.realtime.realtime_error_event` 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 (6–9 lines × 14) src/openai/resources/beta/agents/sessions/subagents/items.py:82— src/openai/resources/beta/agents/sessions/subagents/items.py:82-90 | src/openai/resources/beta/agents/sessions/subagents/items.py:171-179 | src/openai/resources/beta/agents/sessions/subagents/turns/items.py:85-93 | src/openai/resources/beta/agents/sessions/subagents/turns/items.py:178-186 | src/openai/resources/beta/agents/sessions/subagents/turns/turns.py:144-152 | src/openai/resources/beta/agents/sessions/subagents/turns/turns.py:288-296 | src/openai/resources/beta/agents/sessions/turns/items.py:83-90 | src/openai/resources/beta/agents/sessions/turns/items.py:171-178 | src/openai/resources/beta/threads/runs/steps.py:162-167 | src/openai/resources/beta/threads/runs/steps.py:327-332 | src/openai/resources/vector_stores/file_batches.py:278-286 | src/openai/resources/vector_stores/file_batches.py:609-617 | src/openai/resources/vector_stores/files.py:361-369 | src/openai/resources/vector_stores/files.py:789-797 — before extracting anything, compare `src/openai/resources/beta/agents/sessions/subagents/items.py` and `src/openai/resources/beta/agents/sessions/subagents/turns/items.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/agents/sessions/subagents/items.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. The matched lines also transfer control out of the body holding them, 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/openai/resources/beta/agents/sessions/subagents/turns/items.py:84` calls `ValueError` and `src/openai/resources/beta/agents/sessions/turns/items.py:81` 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 (9 lines × 8) src/openai/_base_client.py:1462— src/openai/_base_client.py:1462-1471 | src/openai/_base_client.py:1488-1497 | src/openai/_base_client.py:1514-1523 | src/openai/_base_client.py:1537-1545 | src/openai/_base_client.py:2073-2082 | src/openai/_base_client.py:2099-2112 | src/openai/_base_client.py:2130-2139 | src/openai/_base_client.py:2153-2161 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/_base_client.py:1462` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/openai/_base_client.py:1487` calls `TypeError` and `src/openai/_base_client.py:1536` 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 (9 lines × 3) src/openai/_legacy_response.py:138— src/openai/_legacy_response.py:138-146 | src/openai/_response.py:324-332 | src/openai/_response.py:431-439 — before extracting anything, compare `src/openai/_legacy_response.py` and `src/openai/_response.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 136 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/openai/_response.py:322` calls `read` and `src/openai/_legacy_response.py:136` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 10) src/openai/resources/beta/responses/responses.py:5187— src/openai/resources/beta/responses/responses.py:5187-5194 | src/openai/resources/beta/responses/responses.py:5511-5518 | src/openai/resources/live/live.py:734-741 | src/openai/resources/live/live.py:1152-1159 | src/openai/resources/realtime/realtime.py:744-751 | src/openai/resources/realtime/realtime.py:1201-1208 | src/openai/resources/realtime/translations/translations.py:605-612 | src/openai/resources/realtime/translations/translations.py:1029-1036 | src/openai/resources/responses/responses.py:4376-4383 | src/openai/resources/responses/responses.py:4701-4708 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 104 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/openai/resources/beta/responses/responses.py:5187` 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 (8 lines × 8) src/openai/resources/live/forks.py:514— src/openai/resources/live/forks.py:514-521 | src/openai/resources/live/forks.py:940-947 | src/openai/resources/live/live.py:732-739 | src/openai/resources/live/live.py:1150-1157 | src/openai/resources/live/sideband.py:526-533 | src/openai/resources/live/sideband.py:961-968 | src/openai/resources/realtime/translations/translations.py:603-610 | src/openai/resources/realtime/translations/translations.py:1027-1034 — before extracting anything, compare `src/openai/resources/live/forks.py` and `src/openai/resources/live/live.py` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 553 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–8 lines × 2) src/openai/lib/streaming/_assistants.py:351— src/openai/lib/streaming/_assistants.py:351-358 | src/openai/lib/streaming/_assistants.py:784-790 — both copies are in the same file, so extract the 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/openai/lib/streaming/_assistants.py:784` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) src/openai/_legacy_response.py:358— src/openai/_legacy_response.py:358-362 | src/openai/_legacy_response.py:376-380 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 14) src/openai/resources/beta/responses/responses.py:4962— src/openai/resources/beta/responses/responses.py:4962-4985 | src/openai/resources/beta/responses/responses.py:5292-5315 | src/openai/resources/live/forks.py:238-261 | src/openai/resources/live/forks.py:670-693 | src/openai/resources/live/live.py:458-481 | src/openai/resources/live/live.py:883-906 | src/openai/resources/live/sideband.py:245-268 | src/openai/resources/live/sideband.py:686-709 | src/openai/resources/realtime/realtime.py:438-461 | src/openai/resources/realtime/realtime.py:903-926 | src/openai/resources/realtime/translations/translations.py:323-346 | src/openai/resources/realtime/translations/translations.py:753-776 | src/openai/resources/responses/responses.py:4151-4174 | src/openai/resources/responses/responses.py:4482-4505 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/live/forks.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 96 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 14) src/openai/resources/beta/responses/responses.py:5101— src/openai/resources/beta/responses/responses.py:5101-5114 | src/openai/resources/beta/responses/responses.py:5425-5438 | src/openai/resources/live/forks.py:379-392 | src/openai/resources/live/forks.py:805-818 | src/openai/resources/live/live.py:597-610 | src/openai/resources/live/live.py:1015-1028 | src/openai/resources/live/sideband.py:388-401 | src/openai/resources/live/sideband.py:823-836 | src/openai/resources/realtime/realtime.py:585-598 | src/openai/resources/realtime/realtime.py:1044-1057 | src/openai/resources/realtime/translations/translations.py:467-480 | src/openai/resources/realtime/translations/translations.py:891-904 | src/openai/resources/responses/responses.py:4290-4303 | src/openai/resources/responses/responses.py:4615-4628 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/live/forks.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 96 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 12) src/openai/resources/beta/responses/responses.py:5086— src/openai/resources/beta/responses/responses.py:5086-5096 | src/openai/resources/beta/responses/responses.py:5410-5420 | src/openai/resources/live/forks.py:364-374 | src/openai/resources/live/forks.py:790-800 | src/openai/resources/live/live.py:582-592 | src/openai/resources/live/live.py:1000-1010 | src/openai/resources/live/sideband.py:373-383 | src/openai/resources/live/sideband.py:808-818 | src/openai/resources/realtime/translations/translations.py:452-462 | src/openai/resources/realtime/translations/translations.py:876-886 | src/openai/resources/responses/responses.py:4275-4285 | src/openai/resources/responses/responses.py:4600-4610 — before extracting anything, compare `src/openai/resources/beta/responses/responses.py` and `src/openai/resources/live/forks.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 96 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `event` to `BetaResponsesClientEvent | BetaResponsesClientEventParam` in one and `ForkClientEvent | ForkClientEventParam` 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.
No lint or typecheck script — test ✓ · lint ✗ · typecheck ✗ — read from this repository's package.json scripts and corroborated against its CI workflows. A script counts when its name or command matches the step: `test` for the suite, `lint` or `prettier` for linting, `typecheck`/`type-check`/`tsc` for type checking. ✗ therefore means no script or CI step under those names was found, NOT that the step is absent from your pipeline — a task invoked by a runner this check does not read, or named something else entirely, is not seen and is worth confirming before acting on a cross. A ✓ means the wiring is DECLARED — a script or CI step under those names exists. It is not a statement that the step passes, or that it runs at all: nothing here installs a dependency or executes a suite.
Dead file (~42 LoC) scripts/utils/node-tooling.cjs— no import path from any entry point (5 application, 1 tooling, 3 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
X1 · Async correctness· Task from `asyncio.get_running_loop().create_task` is not kept · ×1
Task from `asyncio.get_running_loop().create_task` is not kept src/openai/_base_client.py:1617— 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.
Orphaned file src/openai/resources/admin/organization/groups/users.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/resources/admin/organization/projects/certificates.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/resources/admin/organization/projects/rate_limits.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/resources/admin/organization/projects/spend_limit.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/resources/admin/organization/projects/model_permissions.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/resources/beta/realtime/transcription_sessions.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/resources/admin/organization/projects/hosted_tool_permissions.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/resources/admin/organization/spend_limit.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/resources/admin/organization/projects/data_retention.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/types/beta/assistant_stream_event.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/resources/admin/organization/data_retention.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/types/beta/threads/run.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/types/realtime/realtime_server_event.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/types/beta/realtime/__init__.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/types/beta/thread_create_params.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/types/moderation.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/types/fine_tuning/job_create_params.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/types/beta/realtime/transcription_session_update.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/types/beta/realtime/session_create_response.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/types/beta/realtime/transcription_session_update_param.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/resources/fine_tuning/fine_tuning.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/types/beta/realtime/transcription_session_create_params.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/types/fine_tuning/fine_tuning_job.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/lib/_pydantic.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/openai/types/beta/assistant.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.
Duplicated predicate src/openai/_legacy_response.py:291— `cast_to is not object and not origin is list and not origin is dict and not origin is Union and not issubclass(origin, BaseModel)` appears character-identically in 2 files — src/openai/_legacy_response.py, src/openai/_response.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/openai/lib/_client_auth.py:440— `default_headers is not None and set_default_headers is not None` appears character-identically in 2 files — src/openai/lib/_client_auth.py, src/openai/lib/bedrock.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/openai/lib/_client_auth.py:442— `default_query is not None and set_default_query is not None` appears character-identically in 2 files — src/openai/lib/_client_auth.py, src/openai/lib/bedrock.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/openai/lib/beta/agents/_result.py:125— `event.type == "agent.session.turn.completed" or event.type == "agent.session.turn.failed" or event.type == "agent.session.turn.cancelled"` appears character-identically in 2 files — src/openai/lib/beta/agents/_result.py, src/openai/lib/streaming/agents/_streams.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/openai/lib/_assistants_runs.py:185— `event_handler or AssistantEventHandler()` appears character-identically in 2 files — src/openai/lib/_assistants_runs.py, src/openai/lib/_assistants_threads.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/openai/lib/_assistants_runs.py:550— `event_handler or AsyncAssistantEventHandler()` appears character-identically in 2 files — src/openai/lib/_assistants_runs.py, src/openai/lib/_assistants_threads.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/openai/resources/beta/responses/responses.py:5025— `event_type == "error" and not specific and not generic` appears character-identically in 4 files — src/openai/resources/beta/responses/responses.py, src/openai/resources/realtime/realtime.py, src/openai/resources/realtime/translations/translations.py, src/openai/resources/responses/responses.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/openai/lib/browser.py:1051— `file_id is not None and (not isinstance(file_id, str) or not file_id.strip())` appears character-identically in 2 files — src/openai/lib/browser.py, src/openai/lib/computer.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/openai/lib/browser.py:1050— `image_url is not None and (not isinstance(image_url, str) or not image_url.strip())` appears character-identically in 2 files — src/openai/lib/browser.py, src/openai/lib/computer.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/openai/_legacy_response.py:277— `inspect.isclass(origin) and issubclass(origin, response_types)` appears character-identically in 2 files — src/openai/_legacy_response.py, src/openai/_response.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/openai/_legacy_response.py:287— `inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel)` appears character-identically in 2 files — src/openai/_legacy_response.py, src/openai/_response.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/openai/lib/bedrock.py:88— `isinstance(base_url, str) and not base_url.strip()` appears character-identically in 2 files — src/openai/lib/bedrock.py, src/openai/providers/bedrock.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/openai/_websocket_connection.py:136— `isinstance(event_type, str) and event_type and event_type != "error"` appears character-identically in 3 files — src/openai/_websocket_connection.py, src/openai/resources/realtime/realtime.py, src/openai/resources/realtime/translations/translations.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/openai/lib/computer.py:383— `item.type == "message" and item.status == "completed" and item.phase != "commentary"` appears character-identically in 2 files — src/openai/lib/computer.py, src/openai/lib/responses_tool_runner.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/openai/auth/_workload.py:232— `not self._token_unusable() and not self._needs_refresh()` appears character-identically in 2 files — src/openai/auth/_workload.py, src/openai/auth/_x509.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/openai/lib/_bedrock_auth.py:173— `os.environ.get("AWS_REGION") or os.environ.get("AWS_DEFAULT_REGION")` appears character-identically in 2 files — src/openai/lib/_bedrock_auth.py, src/openai/providers/bedrock.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/openai/lib/browser.py:1253— `returns_awaitable is not None and returns_awaitable != asynchronous` appears character-identically in 2 files — src/openai/lib/browser.py, src/openai/lib/computer.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/openai/lib/decisions_tool_runner.py:156— `self.cancelled is not None and self.cancelled()` appears character-identically in 2 files — src/openai/lib/decisions_tool_runner.py, src/openai/lib/responses_tool_runner.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/openai/_base_client.py:2257— `get_platform` swallows every exception into `return 'Unknown'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch src/openai/_base_client.py:2331— `get_python_runtime` swallows every exception into `return 'unknown'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch src/openai/_base_client.py:2338— `get_python_version` swallows every exception into `return 'unknown'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch src/openai/_base_client.py:2345— `get_architecture` swallows every exception into `return 'unknown'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch src/openai/_utils/_utils.py:410— `get_async_library` swallows every exception into `return 'false'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 8 significant file(s) lose their only recent owner: src/openai/lib/streaming/agents/_streams.py, src/openai/lib/beta/agents/_files.py, src/openai/lib/beta/agents/_tools.py, src/openai/lib/beta/agents/_artifacts.py, src/openai/lib/beta/agents/_stream.py, src/openai/lib/streaming/agents/_tools.py, src/openai/lib/_tools.py, src/openai/types/beta/beta_response_function_tool_call_output_item.py. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 4 significant file(s) lose their only recent owner: src/openai/resources/realtime/translations/translations.py, src/openai/lib/responses_websocket/_accumulator.py, src/openai/lib/responses_websocket/_session.py, src/openai/types/websocket_connection_options.py. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 3 significant file(s) lose their only recent owner: src/openai/auth/_x509.py, src/openai/resources/safety/cases.py, src/openai/types/beta/agent_session_event.py. Pair on, review, or document these before any departure.
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 (21 single-owned of 519 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; 519 of the 2063 production source files in this repository met that bar). They are anonymized user #4 (1 file(s)), anonymized user #5 (1 file(s)), anonymized user #6 (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: scripts/check-dependency-security.py, src/openai/_utils/_path.py, src/openai/lib/streaming/_deltas.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)` (200453 LoC, 5710 module-visible types across 117 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history)· Rotate the exposed credentials · ×1
D34 · Knowledge Freshness· Further orphaned files (smaller) · ×1
Further orphaned files (smaller) — 77 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: src/openai/resources/admin/organization/groups/users.py, src/openai/resources/admin/organization/projects/certificates.py, src/openai/resources/admin/organization/projects/rate_limits.py, src/openai/resources/admin/organization/projects/spend_limit.py, src/openai/resources/admin/organization/projects/model_permissions.py, src/openai/resources/beta/realtime/transcription_sessions.py, src/openai/resources/admin/organization/projects/hosted_tool_permissions.py, src/openai/resources/admin/organization/spend_limit.py (and 69 more) (87 orphaned of 519 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; 519 of the 2063 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P3 · Security & performance tooling· Dependabot does not watch pip · ×1
Dependabot does not watch pip .github/dependabot.yml:2— `.github/dependabot.yml` schedules updates, but no `package-ecosystem` entry covers `pip`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list.
Skipped (documented): devcontainer installs the pinned toolchain and bootstraps local tools tests/node-tooling.test.cjs:132— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
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.
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 01a1a2de-24f6-7962-bf73-78a07c004c60 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 237 · Warnings: 730 · Recommendations: 111 · Info: 1 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 03-11-2026 @ 19:23 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.