feat: add Slack threading support (threadTs, autoThread, returnTs, dryRun, maxReports)#80
Open
smeiring wants to merge 4 commits into
Open
feat: add Slack threading support (threadTs, autoThread, returnTs, dryRun, maxReports)#80smeiring wants to merge 4 commits into
smeiring wants to merge 4 commits into
Conversation
Adds message threading to all reporter commands, a SlackClient class
with retry logic, and several quality-of-life options. All new options
are optional and backwards-compatible.
New options:
- threadTs / --thread-ts: reply to an existing Slack thread
- returnTs / --return-ts: output {"ts":"..."} for step chaining in CI
- replyBroadcast / --reply-broadcast: broadcast threaded reply to channel
- autoThread / --auto-thread: auto-thread failure details under a summary
(default false — existing behaviour unchanged)
- maxReports / --max-reports: cap individual failure messages (default 10)
- dryRun / --dry-run: print payload to stdout instead of sending
SlackClient (src/client/slack-client.ts):
- Unifies webhook and OAuth token paths behind a single sendMessage() API
- Retries on ratelimited and transient errors (configurable maxRetries)
- Friendly error messages for channel_not_found, invalid_auth, not_in_channel
Also runs npm audit fix to resolve 3 transitive vulnerabilities:
- glob <10.5.0 (high) — CLI command injection, dev-only dependency
- ajv <6.14.0 (moderate) — ReDoS via $data option (not used)
- brace-expansion 5.0.2-5.0.5 (moderate) — DoS via large numeric ranges
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced May 23, 2026
When a webhook call returns a 4xx/5xx, @slack/webhook throws an error with statusCode and body properties. Previously formatError fell back to error.message which only contained "An HTTP protocol error occurred: statusCode = 400", discarding the actual Slack error detail (e.g. "invalid_blocks", "text_too_long"). Now formatError checks for statusCode + body and produces: "Slack webhook error (400): invalid_blocks" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…docs - Fix auto-thread default: it is opt-in (false by default), not the default - Remove the incorrect "Auto-Threading (Default)" section - Add Dry Run and Limit Failure Reports sections - Restructure env vars into a dedicated section; remove SLACK_TITLE, SLACK_FAILED_EMOJI, SLACK_PASSED_EMOJI (not on this branch) - Remove --update-ts and --react options from Options list (separate PRs) - Fix --auto-thread default description in Options list (true → false) - Add --max-retries to Options list - Add Threading Support and Dry Run to Features list Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Adds message threading to all reporter commands, a
SlackClientclass with retry logic, and several quality-of-life options. All new options are optional and fully backwards-compatible — existing behaviour is unchanged.Also fixes #47 — webhook 400 errors now include the Slack response body in the error message, making it much easier to diagnose issues like oversized payloads.
New options
threadTs--thread-ts/-ttSLACK_THREAD_TSreturnTs--return-ts/-rt{"ts":"..."}to stdout for step chaining in CIreplyBroadcast--reply-broadcast/-rbautoThread--auto-thread/-atSLACK_AUTO_THREADfalse)maxReports--max-reports/-mr10)dryRun--dry-run/-drSLACK_DRY_RUNThreading in CI pipelines
SlackClient refactor (
src/client/slack-client.ts)Replaces the ad-hoc helper functions with a unified
SlackClientclass that:sendMessage()APIratelimitedand transient errors (configurable viamaxRetries/SLACK_MAX_RETRIES)channel_not_found,invalid_auth,not_in_channel)Slack webhook error (400): invalid_blocksSecurity
Also includes
npm audit fixresolving 3 transitive vulnerabilities (glob high, ajv moderate, brace-expansion moderate).What's NOT in this PR
react,failedEmoji,passedEmoji) — can follow separatelyupdateTs) — can follow separatelyTest plan
npm run build:check— type-check passesnpm test— 47 tests pass (30 new tests for SlackClient and threading)npm run lint:check && npm run format:check— CI checks passnpx slack-ctrf results ctrf-report.json --dry-run— prints full Block Kit payload, does not sendnpx slack-ctrf failed ctrf-report.json --thread-ts 1234567890.123456 --dry-run— payload contains"thread_ts": "1234567890.12346"npx slack-ctrf results ctrf-report.json --return-ts --dry-run— prints{"ts":"dry-run-ts"}on stdout🤖 Generated with Claude Code