GR
Guided Review
πŸ”—
GUIDED MODE
Review Progress0/5 completed
WHY#20#5#1#8END
πŸ“‹
Phase 1 β€” Understand the Intent
Before looking at any code, understand what problem is being solved and why.
Read each item in the reading list, confirm you've read it, then pass the AI context check to unlock the code review.
Files changed
17
Additions
+330
Deletions
βˆ’50
Chunks to review
4
Est. review time
~22 min
Reading list

fix(guardrail): pass request_data to output response handlers

firestaerter3β€’fix/guardrail-request-data-v2 β†’ main
Problem: unified_guardrail.py calls process_output_response() but does not forward request_data β€” the full input-phase context dict. Any guardrail that needs to correlate input state with output state (e.g. PII tokens stored during masking) has no way to access it during output processing.
Part of #22821. Supersedes #22879.
Changes:
- base_translation.py: Add request_data: Optional[dict] = None to both abstract signatures
- unified_guardrail.py: Forward data as request_data at all three output call sites
- All 13 concrete handlers: Accept request_data parameter; handlers that build a local dict now merge with the incoming parameter via `{(request_data or {}), "response": response}`
- Existing tests updated: Mock handler signatures in unified guardrail tests
Test plan: New test file with 6 tests covering signature conformance and behavioral forwarding. All 6 new + 8 existing unified guardrail tests pass.