fix(mcp-scan): use itertools.count for thread-safe request IDs#2
Merged
Conversation
|
Welcome to the Agent Governance Toolkit! Thanks for your first pull request. |
🤖 AI Agent: code-reviewer — View detailsTL;DR: 0 blockers, 0 warnings. Clean and secure fix.
No action items or warnings. Clean change. |
🤖 AI Agent: breaking-change-detector — API CompatibilityAPI Compatibility
|
🤖 AI Agent: test-generator — `agent-governance-python/agent-os/src/agent_os/cli/mcp_scan.py`
|
🤖 AI Agent: docs-sync-checker — Docs SyncDocs Sync
|
🤖 AI Agent: security-scanner — View detailsNo security issues found. |
PR Review Summary
Verdict: ✅ Ready for human review |
Replace mutable function-attribute counter with itertools.count(1). Fixes thread-safety issue and prevents state leakage across test runs. Signed-off-by: ashik.kuppili <kvashik5@gmail.com>
702d4ae to
ec2bf2b
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Addresses blocker #1 and warnings 3-5 from code review on PR microsoft#2438:
_next_request_idfunction-attribute counter withitertools.count(1)— atomic under GIL, no cross-test state leakageautousepytest fixture to reset mutable class-level lists between tests--no-verify-tlsCLI flag withssl.SSLContextfor self-signed/internal MCP endpoints2024-11-05,2025-03-26,2025-06-18) with a warning instead of hard-rejectingAll 133 MCP tests pass.
Type of Change
Package(s) Affected
Checklist
Attribution & Prior Art
Prior art / related projects (if any):
N/A — uses standard library
itertools.countandsslmodule.AI Assistance
If AI tools materially shaped this change, briefly note what was used:
GitHub Copilot CLI for implementation assistance — all output reviewed and tested locally (133/133 tests pass).
IP, Patents, and Licensing
Related Issues
Addresses review feedback from microsoft#2438 (review)
Fixes blocker #1 and warnings 3-5 raised by @imran-siddique