fix(inspection): bound AGT scanner calls with timeout; add scanner attribution (INJECT-002, INJECT-003) - #229
Merged
Conversation
…tribution to result
INJECT-002: wraps scan_response() and PromptInjectionDetector.detect() in
ThreadPoolExecutor with a configurable timeout (default 5s). A timeout is
treated as deny (fail-safe) so a slow/unresponsive AGT service cannot
exhaust worker slots indefinitely.
INJECT-003: adds injection_scanner and injection_score fields to
InspectionResult and StageResult. Callers writing audit chain entries now
have the specific scanner that triggered the deny ("agt_mcp", "agt_detector",
"regex", "timeout", "utf8_guard") and confidence score if available.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
imran-siddique
added a commit
that referenced
this pull request
Jun 7, 2026
…tribution to result (#229) INJECT-002: wraps scan_response() and PromptInjectionDetector.detect() in ThreadPoolExecutor with a configurable timeout (default 5s). A timeout is treated as deny (fail-safe) so a slow/unresponsive AGT service cannot exhaust worker slots indefinitely. INJECT-003: adds injection_scanner and injection_score fields to InspectionResult and StageResult. Callers writing audit chain entries now have the specific scanner that triggered the deny ("agt_mcp", "agt_detector", "regex", "timeout", "utf8_guard") and confidence score if available. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
scan_response()andPromptInjectionDetector.detect()inThreadPoolExecutor.submit(...).result(timeout=N). Default timeout is 5.0 seconds, configurable viaInspectionPipeline(scanner_timeout_seconds=...). A timeout is treated as deny (fail-safe) — a slow or unresponsive AGT service cannot exhaust worker slots indefinitelyinjection_scanner: str | Noneandinjection_score: float | Noneto bothStageResultandInspectionResult. Values:"agt_mcp","agt_detector","regex","timeout","utf8_guard". Callers writing audit chain entries now have the specific scanner that triggered a deny plus the confidence score if the AGT detector provided oneTest plan
pytest tests/unit/test_inspection.py -v— 31 passed (8 new tests)pytest tests/unit/ -q— 401 passedCloses #169
Closes #170
🤖 Generated with Claude Code