#31071 [Bug]: Custom code guardrail modify(images=...) is silently dropped on the request path
### Check for existing issues
- [x] I have searched the existing issues and checked that my issue is not a duplicate.
### What happened?
A bug happened! The custom_code guardrail exposes modify(texts=..., images=..., tool_calls=...) as the way a guardrail rewrites a request. On the request path (input_type="request"), the returned texts and tool_calls are written back to the outgoing messages, but the returned images are never applied. There is no error and no warning; the modification is just lost. A guardrail that returns modify(images=[]) to strip images, or modify(images=[...]) to rewrite them, has no effect, and the original image content is forwarded to the upstream model unchanged.
This is easy to miss because the guardrail itself runs successfully and any accompanying texts change does take effect, so the only way to discover it is by capturing the actual upstream request.
Repro
Configure a custom_code guardrail as a pre-call hook whose body is roughly:
def apply_guardrail(inputs, request_data, input_type): if input_type != "request": return allow() if not (inputs.get("images") or []): return allow() return modify(ima…