fix(slack): log silently-swallowed thread starter/history fetch errors#2807
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
resolveSlackThreadStarter()andresolveSlackThreadHistory()(extensions/slack/src/monitor/media.ts) wrapped theirconversations.replies()calls incatch { return null }/catch { return [] }— no log, no warning, no metric. When the Slack API fails (missingim:history/channels:historyscope, 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-effortnull/[]fallback.logVerbosematches the established convention for best-effort Slack operations in the same directory (context.ts:295logsslack 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 existingresolveSlackThreadHistory"throws" test and added aresolveSlackThreadStartererror-path test — both assert the fallback value AND thatlogVerbosefired with the failure context plus the error detail.media.test.ts+monitor.media.test.tspass (33 tests);tsgoclean.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