Summary
Currently, apply_stream_output_guardrails in src/proxy/handlers/format_handler.rs only supports a single hard-rejection path that returns a GatewayError::Validation error. Error handling should be extended to support two configurable modes:
- Strict mode – return a
400 Bad Request status code when the guardrail blocks streaming output.
- Lenient mode – instead of an error, return a simulated "Let's change the subject" (topic-deflection) response, giving a softer guardrail experience.
Background
Raised during review of PR #108 (comment: #108 (comment)) as a follow-up to the streaming output guardrail implementation.
Requested by
@bzp2010
Summary
Currently,
apply_stream_output_guardrailsinsrc/proxy/handlers/format_handler.rsonly supports a single hard-rejection path that returns aGatewayError::Validationerror. Error handling should be extended to support two configurable modes:400 Bad Requeststatus code when the guardrail blocks streaming output.Background
Raised during review of PR #108 (comment: #108 (comment)) as a follow-up to the streaming output guardrail implementation.
Requested by
@bzp2010