Skip to content

fix: add security.display_redaction_only to keep secrets usable in tools#16849

Open
HiddenPuppy wants to merge 2 commits into
NousResearch:mainfrom
HiddenPuppy:fix/display-redaction-only
Open

fix: add security.display_redaction_only to keep secrets usable in tools#16849
HiddenPuppy wants to merge 2 commits into
NousResearch:mainfrom
HiddenPuppy:fix/display-redaction-only

Conversation

@HiddenPuppy

Copy link
Copy Markdown
Contributor

Summary

security.redact_secrets was redacting credential values in **both** tool results (file reads, terminal output) and display/logging paths. When the LLM received partially-masked values (sk-a***c12) from tool results, it could not use them in subsequent commands — breaking:

Changes

New config: security.display_redaction_only

Setting Effect
false (default) Current behavior — redact everywhere (backward compatible)
true Redact only in chat display + logs; real values pass through to tools
security:
  redact_secrets: true
  display_redaction_only: true

How it works

  • redact_sensitive_text() — used by tool results (file reads, terminal output, code execution). Respects the new flag: skips patterns when display_redaction_only=true so the LLM gets real values.
  • redact_for_display() — new function that **always** redacts, used by chat output (send_message), logs (RedactingFormatter), and context summaries. Never skips even when the flag is active.
  • All entry points — CLI, gateway, and hermes_cli all bridge the new config to the env var.

Testing

  • tests/agent/test_redact.py: 75 tests, all passing ✅

Closes #16843
Closes #16700

Root cause: redact_sensitive_text() was applied uniformly to both tool
results (file reads, terminal output) and display/logging paths. When
the LLM received partially-masked values (sk-a***c12) from tool results,
it could not use them in subsequent commands — breaking Bitwarden CLI
workflows (NousResearch#16700) and terminal credential usage (NousResearch#16843).

Fix:
- Add security.display_redaction_only config flag
- redact_sensitive_text() skips patterns when flag is active (tool results)
- New redact_for_display() always redacts (chat output, logs)
- RedactingFormatter uses redact_for_display (always redact logs)
- All gateway/platform/cli entry points bridge the new flag

When display_redaction_only=true:
  ✓ LLM sees real values in tool results
  ✓ User sees redacted values in chat
  ✓ Logs are always redacted

Closes NousResearch#16843
Closes NousResearch#16700
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery comp/cron Cron scheduler and job management area/config Config system, migrations, profiles labels Apr 28, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #16700 and #16843 — same root cause (redact_secrets breaks tool execution). Note: #16794 (flip default to off) already merged as interim fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/agent Core agent loop, run_agent.py, prompt builder comp/cli CLI entry point, hermes_cli/, setup wizard comp/cron Cron scheduler and job management comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

2 participants