feat(slack): expose webClientOptions to configure the underlying WebClient#602
feat(slack): expose webClientOptions to configure the underlying WebClient#602aqt-dev wants to merge 1 commit into
Conversation
…lient The adapter constructs its `@slack/web-api` WebClient(s) with no retry/timeout configuration, so they inherit the SDK default `tenRetriesInAboutThirtyMinutes` retry policy. Under sustained rate limiting a single `chat.update`/ `chat.postMessage` can block for ~30 minutes, which stalls callers that stream frequent edits (a hung delivery can hold up a whole turn) and there is currently no way to tune it from outside the adapter. Add an optional `webClientOptions: WebClientOptions` field to `SlackAdapterConfig`, forwarded into both the default client and the per-token clients used for multi-workspace requests. Callers can now pass `retryConfig`, `timeout`, etc. `apiUrl` continues to take precedence over `webClientOptions.slackApiUrl`.
|
@aqt-dev is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @dancer (cc @gr2m) — thanks for all the recent work on the Slack adapter, it's been great to build on. I ran into a case where the adapter's This PR just adds an optional No rush at all, but would love your eyes on it whenever you have a moment. Happy to adjust the approach if you'd prefer it shaped differently. |
Problem
The Slack adapter constructs its
@slack/web-apiWebClient(s) with onlyslackApiUrl— no retry or timeout configuration:So both the default client and the per-token clients (
getClientForToken, used for multi-workspace requests) inherit@slack/web-api's default retry policy,retryPolicies.tenRetriesInAboutThirtyMinutes. Under sustained rate limiting, a singlechat.update/chat.postMessageblocks for ~30 minutes while the WebClient sleeps onRetry-Afterand retries.For bots that stream responses (a placeholder message edited repeatedly via
chat.update), a burst of activity in one channel exhausts the per-channel rate limit and a single hung delivery can stall an entire turn — and there is currently no way to tune this from outside the adapter, sincecreateSlackAdapterdoesn't surface any WebClient options beyondapiUrl.Change
Add an optional
webClientOptions?: WebClientOptionstoSlackAdapterConfig, forwarded into both WebClient constructions (default + per-token). Callers can now passretryConfig,timeout,rejectRateLimited, etc.:webClientOptionsis omitted.apiUrlcontinues to take precedence overwebClientOptions.slackApiUrl(the dedicated field wins).Tests
Added two tests under
direct WebClient access via adapter.client:webClientOptionsto the bound WebClientapiUrltakes precedence overwebClientOptions.slackApiUrlpnpm --filter @chat-adapter/slack test→ 478 passed.typecheck,biome check, andkonsistentall clean. Changeset included (minor).