diff --git a/gateway/run.py b/gateway/run.py index 37c4718d80b9..54baeae9b20d 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -11603,6 +11603,11 @@ class GatewayRunner(GatewayAuthorizationMixin, GatewayKanbanWatchersMixin, Gatew _comp = getattr(_hyg_agent, "context_compressor", None) if _comp is not None and getattr(_comp, "_last_compress_aborted", False): _err = getattr(_comp, "_last_summary_error", None) or "unknown error" + # Force-redact: provider exception text + # may contain credentials; this message + # reaches gateway users directly. + from agent.redact import redact_sensitive_text + _err = redact_sensitive_text(_err, force=True) _warn_msg = ( "⚠️ Context compression aborted " f"({_err}). No messages were dropped — " diff --git a/gateway/slash_commands.py b/gateway/slash_commands.py index ad61284f6a73..682d1431028c 100644 --- a/gateway/slash_commands.py +++ b/gateway/slash_commands.py @@ -3345,6 +3345,7 @@ class GatewaySlashCommandsMixin: compressed, approx_tokens, new_tokens, + compression_state=compressor, ) # Detect summary-generation failure so we can surface a # visible warning to the user even on the manual /compress @@ -3355,6 +3356,11 @@ class GatewaySlashCommandsMixin: # passed above so any active cooldown is bypassed. _summary_aborted = bool(getattr(compressor, "_last_compress_aborted", False)) _summary_err = getattr(compressor, "_last_summary_error", None) + # Force-redact provider exception text at this UI boundary + # even when global redaction is disabled. + if _summary_err: + from agent.redact import redact_sensitive_text + _summary_err = redact_sensitive_text(_summary_err, force=True) # Separately: did the user's CONFIGURED aux model fail # and we recovered via main? Surface that as an info # note so they can fix their config.