fix: wire PII redaction + token empty warnings for plugin platforms

PII redaction: build_session_context_prompt() now checks the plugin
registry's pii_safe flag in addition to the hardcoded _PII_SAFE_PLATFORMS
frozenset. Plugin platforms that set pii_safe=True (e.g. phone-based
messaging bridges) get their user IDs redacted before LLM context.

Token empty warnings: the empty-token diagnostic at config load now
checks the plugin registry's required_env when a platform isn't in the
hardcoded _token_env_names dict. Catches 'enabled but empty' for
plugin platforms too.
This commit is contained in:
Teknium 2026-04-11 15:34:59 -07:00 committed by Teknium
parent 2e20f6ae2d
commit 457128d4e8
2 changed files with 32 additions and 13 deletions

View file

@ -891,6 +891,15 @@ def _validate_gateway_config(config: "GatewayConfig") -> None:
if not pconfig.enabled:
continue
env_name = _token_env_names.get(platform)
if not env_name:
# Check plugin registry for required_env
try:
from gateway.platform_registry import platform_registry
entry = platform_registry.get(platform.value)
if entry and entry.required_env:
env_name = entry.required_env[0] # primary env var
except Exception:
pass
if env_name and pconfig.token is not None and not pconfig.token.strip():
logger.warning(
"%s is enabled but %s is empty. "