Skip to content

console.warn in anonymizer.js spams TUI stdout in OpenCode plugin #47

Closed

Description

@RaviTharuma

Bug

src/core/anonymizer.ts (compiled to dist/core/anonymizer.js:315) contains a raw console.warn("Validation warnings:", safeErrors) call that dumps PII leak validation warnings directly to stdout.

In TUI-based editors like OpenCode, console.warn from plugins bypasses the log-level system and renders directly in the terminal UI, making the interface unusable when the anonymizer fires frequent validation warnings (e.g. POTENTIAL_PII_LEAK).

Screenshot

The output looks like this, repeated for every tool call:

Validation warnings: [
  {
    code: "POTENTIAL_PII_LEAK",
    message: "Leak scan found 2 potential PII leak(s)",
  }
]

Expected behavior

Validation warnings should either:

  1. Be suppressed entirely (they're informational, not actionable by the user)
  2. Be routed through the plugin's structured logging (client.app.log) instead of raw console.warn
  3. Use an optional onValidationWarning callback in the config

Context

The OpenCode plugin (dist/opencode-plugin/plugin.js) already correctly uses client.app.log() for all its own logging. The issue is that the core anonymizer still uses a raw console.warn that leaks through.

Affected version

[email protected]

Suggested fix

Remove or gate the console.warn in the anonymizer's anonymize() method. The validation result is already available in the return value's stats.leakScanPassed field, so callers can handle it if needed.

Activity

  1. self-assigned this
    on Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions