Skip to content

fix(slack): silent error swallowing in thread starter/history fetch #2104

Description

@alexey-pelykh

Summary

resolveSlackThreadStarter() and resolveSlackThreadHistory() in src/slack/monitor/media.ts catch all errors and return null / [] without any logging. When the Slack API call fails (permissions, rate limits, token expiry, network errors), thread context silently disappears — the agent receives no thread history and starts a blank session.

Steps to Reproduce

  1. Configure a cron job that delivers to a Slack DM channel
  2. Simulate a Slack API failure on conversations.replies() (e.g., revoke im:history scope temporarily, or trigger rate limiting)
  3. Reply in a thread to the delivered message
  4. Observe: no error logged, agent responds with zero thread context

Expected Behavior

Errors from conversations.replies() should be logged at warn level so operators can diagnose missing thread context. The current silent catch {} pattern makes debugging impossible.

Actual Behavior

Errors are silently swallowed:

// src/slack/monitor/media.ts:396-398 (thread starter)
} catch {
  return null;
}

// src/slack/monitor/media.ts (thread history, equivalent pattern)
} catch {
  return [];
}

No log, no warning, no metric. The system proceeds as if thread history simply doesn't exist.

Affected Code

  • resolveSlackThreadStarter()src/slack/monitor/media.ts
  • resolveSlackThreadHistory()src/slack/monitor/media.ts

Suggested Fix

Add logWarn or logVerbose in the catch blocks with the error message, channel ID, and thread timestamp. This preserves the best-effort behavior (return null/empty) while making failures visible.

Also present in upstream OpenClaw at extensions/slack/src/monitor/media.ts:425-427 and 517-519.

Metadata

Metadata

Assignees

No one assigned

    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