Skip to content

fix(slack): log silently-swallowed thread starter/history fetch errors#2807

Merged
alexey-pelykh merged 1 commit into
mainfrom
fix/2104-slack-thread-fetch-logging
Jul 4, 2026
Merged

fix(slack): log silently-swallowed thread starter/history fetch errors#2807
alexey-pelykh merged 1 commit into
mainfrom
fix/2104-slack-thread-fetch-logging

Conversation

@alexey-pelykh

Copy link
Copy Markdown

Problem

resolveSlackThreadStarter() and resolveSlackThreadHistory() (extensions/slack/src/monitor/media.ts) wrapped their conversations.replies() calls in catch { return null } / catch { return [] } — no log, no warning, no metric. When the Slack API fails (missing im:history / channels:history scope, rate limit, token expiry, network error), thread context silently disappears and the agent starts a blank-context session. Nothing in the logs explains why, which the issue notes "makes debugging impossible."

Fix

Bind the error and logVerbose(...) it — with the channel ID, thread ts, and error string — before the best-effort null / [] fallback. logVerbose matches the established convention for best-effort Slack operations in the same directory (context.ts:295 logs slack status update failed for channel … the same way), and the issue explicitly sanctions it ("Add logWarn or logVerbose"). Return behavior is unchanged; the failure is just no longer invisible.

Tests

media.test.ts: extended the existing resolveSlackThreadHistory "throws" test and added a resolveSlackThreadStarter error-path test — both assert the fallback value AND that logVerbose fired with the failure context plus the error detail. media.test.ts + monitor.media.test.ts pass (33 tests); tsgo clean.

Note: upstream OpenClaw has the same silent-catch pattern in extensions/slack/src/monitor/media.ts — this fix is RemoteClaw-local; any upstream contribution is out of scope here.

Fixes #2104

🤖 Generated with Claude Code

resolveSlackThreadStarter and resolveSlackThreadHistory caught every error from
conversations.replies() and returned null/[] with no logging. When the Slack
call fails (missing scope, rate limit, token expiry, network), thread context
silently vanishes and the agent starts a blank-context session — with nothing
in the logs to explain why.

Log the failure at verbose level (matching the sibling context.ts convention
for best-effort Slack operations) with the channel ID, thread ts, and error,
before falling back to null/[]. Best-effort behavior is preserved; the failure
is just no longer invisible.

Fixes #2104

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alexey-pelykh
alexey-pelykh merged commit 6d99ddf into main Jul 4, 2026
20 checks passed
@alexey-pelykh
alexey-pelykh deleted the fix/2104-slack-thread-fetch-logging branch July 4, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant