You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add threading locks to all 6 shared mutable state locations with
threading.RLock for reentrant-safe cache access.
SSRF hardening: reject ftp/ftps in is_url(), validate Mistral browser
URLs, validate initial URL in web safeFetch().
Fix resolve_direct() dispatch for LLMS_TXT, SERPER, DOCLING, OCR.
Fix Profile.max_hops() returning None for unknown profiles.
Fix web/package.json non-existent version specifiers.
Update conftest to use lock-safe clear methods.
Update tests for new is_url() ftp rejection.
All quality gate checks verified: 162 Python tests, 52 Rust tests,
ruff, black, cargo fmt, clippy, web lint pass.
Capture self.open_until once at function entry to avoid a
TOCTOU (time-of-check-time-of-use) race between the None
guard on line 17 and the attribute read on line 20.
We reviewed changes in b4dd390...378fbe9 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
The reason will be displayed to describe this comment to others. Learn more.
Access to a protected member _query_resolve of a client class
Accessing a protected member (a member prefixed with _) of a class from outside that class is not recommended, since the creator of that class did not intend this member to be exposed. If accesing this attribute outside of the class is absolutely needed, refactor it such that it becomes part of the public interface of the class.
The reason will be displayed to describe this comment to others. Learn more.
Access to a protected member _circuit_breakers of a client class
Accessing a protected member (a member prefixed with _) of a class from outside that class is not recommended, since the creator of that class did not intend this member to be exposed. If accesing this attribute outside of the class is absolutely needed, refactor it such that it becomes part of the public interface of the class.
The reason will be displayed to describe this comment to others. Learn more.
Access to a protected member _url_resolve of a client class
Accessing a protected member (a member prefixed with _) of a class from outside that class is not recommended, since the creator of that class did not intend this member to be exposed. If accesing this attribute outside of the class is absolutely needed, refactor it such that it becomes part of the public interface of the class.
The reason will be displayed to describe this comment to others. Learn more.
Method doesn't use the class instance and could be converted into a static method
The method doesn't use its bound instance. Decorate this method with @staticmethod decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.
The reason will be displayed to describe this comment to others. Learn more.
Using the global statement
It is recommended not to use global statement unless it is really necessary. Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. This also make code difficult to read, because they force you to search through multiple functions or even modules just to understand all the different locations where the global variable is used and modified. Read more about why it should be avoided here.
The reason will be displayed to describe this comment to others. Learn more.
Access to a protected member _circuit_breakers of a client class
Accessing a protected member (a member prefixed with _) of a class from outside that class is not recommended, since the creator of that class did not intend this member to be exposed. If accesing this attribute outside of the class is absolutely needed, refactor it such that it becomes part of the public interface of the class.
The reason will be displayed to describe this comment to others. Learn more.
Access to a protected member _routing_memory of a client class
Accessing a protected member (a member prefixed with _) of a class from outside that class is not recommended, since the creator of that class did not intend this member to be exposed. If accesing this attribute outside of the class is absolutely needed, refactor it such that it becomes part of the public interface of the class.
The reason will be displayed to describe this comment to others. Learn more.
Attribute '_conn' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Using the global statement
It is recommended not to use global statement unless it is really necessary. Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. This also make code difficult to read, because they force you to search through multiple functions or even modules just to understand all the different locations where the global variable is used and modified. Read more about why it should be avoided here.
The reason will be displayed to describe this comment to others. Learn more.
Using the global statement
It is recommended not to use global statement unless it is really necessary. Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. This also make code difficult to read, because they force you to search through multiple functions or even modules just to understand all the different locations where the global variable is used and modified. Read more about why it should be avoided here.
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR establishes the GOAP Wave 2-7 implementation roadmap and addresses Wave 1 safety/correctness fixes. While the documentation updates are comprehensive, the implementation of thread-safety in scripts/circuit_breaker.py and scripts/utils.py contains critical gaps where locks are released prematurely, potentially leading to race conditions under high concurrency.
Codacy results indicate the project is 'Up to Standards', but substantial code duplication exists between core scripts and agent-specific directories that must be managed to prevent logic drift. Furthermore, while the plan claims to wire missing providers (LLMS_TXT, SERPER, etc.), the orchestration logic for these appears incomplete or untested in the current diff. High-risk files like circuit_breaker.py have identified logic issues combined with missing coverage, making them primary candidates for regression testing before merging.
About this PR
The documentation mentions wiring LLMS_TXT, SERPER, DOCLING, and OCR providers into resolve_direct, but this orchestration logic appears unaddressed in the current code changes. Ensure these are integrated and tested.
Finding N12 (raw requests.post) is flagged as a P1 security risk but deferred to Wave 4. Given that Wave 1 is intended as a safety and correctness push, consider moving the migration to the shared session and is_safe_url validation into this PR or the immediate next phase.
Test suggestions
Verify is_url rejects ftp and ftps schemes.
Verify safeFetch performs initial URL validation before the first fetch attempt to prevent SSRF.
Verify CircuitBreakerState.is_open captures temporal state once to prevent TOCTOU races.
Verify resolve_direct correctly handles LLMS_TXT, SERPER, DOCLING, and OCR providers.
Verify RoutingMemory ranking remains stable and thread-safe under concurrent access via RLock.
Increase unit test coverage for scripts/semantic_cache.py and scripts/routing_memory.py to address high-complexity uncovered paths.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify resolve_direct correctly handles LLMS_TXT, SERPER, DOCLING, and OCR providers.
2. Increase unit test coverage for `scripts/semantic_cache.py` and `scripts/routing_memory.py` to address high-complexity uncovered paths.
The reason will be displayed to describe this comment to others. Learn more.
🟡 MEDIUM RISK
There is significant code duplication between the core scripts and the .agents/skills directory. This logic drift risk should be addressed by moving shared logic into a common internal package or using symbolic links.
The reason will be displayed to describe this comment to others. Learn more.
🟡 MEDIUM RISK
The _cache_lock (RLock) should be held for the full duration of the read-and-retrieve sequence. Releasing it before accessing the cache instance allows for other threads to modify or clear the cache proxy in the gap.
The reason will be displayed to describe this comment to others. Learn more.
🟡 MEDIUM RISK
The breaker status check should be wrapped within the registry lock to ensure atomicity between retrieval and state inspection. This fulfills the requirement identified in finding N5.
The reason will be displayed to describe this comment to others. Learn more.
⚪ LOW RISK
Nitpick: Use lazy log formatting (e.g., logger.warning('msg %s', arg)) to remain consistent with other providers and avoid unnecessary string interpolation costs when the log level is not active.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
plans/16-GOAP-WAVE2-6.md— 7-wave GOAP plan with 54 tasks covering CI config, constants extraction, quality/safety fixes, Rust file splits (semantic_cache.rs 1056, config.rs 712, query.rs 527), test coverage, and cross-platform parityplans/AUDIT.md— M7 resolved (Playwright runs 3 projects), P3 resolved (Rust --profile wired), Q4/Q5 added, 12 new findings (N1-N12)plans/README.md— Wave 7 added, plan 16 active / 15 supersededKey Findings From Audit
Waves Defined