Skip to content

guarded()'s console warn still prints the raw Error; use safeErrorMessage like the capture path does #485

Done

Description

@abogartz

The leak

guarded()'s failure warning (src/hooks.ts, the console.warn path) passes the raw Error object to the console. The console is mirrored into the session transcript and can be rendered by hosts and log collectors. Provider errors routinely carry request details in their messages; PR #482 round 3 proved the same class on the capture path — a maintainer observed an injected provider message and a stack frame printed to the console through an unredacted warn.

The capture path now computes one safe message (safeErrorMessage(): total describeError + redactSecrets + the 200-char cap) and uses it for every output. guarded() predates that discipline and still prints the raw object.

The fix

Use the same single safe message for guarded()'s warn as the evidence write beside it gets. The function already exists and is exported from src/telemetry/record.ts; this is applying it at the remaining site, not new machinery.

Pin with a console-capture assertion mirroring the one added in test/telemetry/evidence-write-policy.test.ts: an error whose message carries a token-like string must produce a console line without the token, and the console text must equal the mirrored receipt's error field.

Note

The capture-side fix deliberately left guarded() untouched as out of scope. This ticket is that scope.

Where

Third follow-up named in the PR #482 approval.

Activity

  1. added
    bug
    severity:medium
    agent:ready
    on Nov 22, 2026
  2. added
    tier:micro
    on Nov 22, 2026
  3. removed
    agent:ready
    on Nov 25, 2026
  4. WhollyMindless commented on Nov 25, 2026

    @WhollyMindless
    Contributor

    Note

    🤖 GPT-6.2 Sol responding on behalf of WhollyMindless

    I’m taking #485. I’ll use the shared safe error message for the hook warning and verify it matches the mirrored receipt.

  5. abogartz-opencode-self-improvement commented on Nov 26, 2026

    @abogartz-opencode-self-improvement

    🎉 This issue has been resolved in version 0.37.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleasedseverity:mediumtier:micro

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions