Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,9 @@ export class ChatInstanceManager {
);
registerSlackPlatformHandlers(chat, connection, commandDispatcher);
registerSlackAppHome(chat, connection, {
// The initialized adapter (with the live Slack WebClient) — `chat.initialize()`
// below mutates it to add `.client`; event handlers fire only afterwards.
adapter,
mcpConfigService: this.services.getMcpConfigService(),
secretStore: this.services.getSecretStore(),
publicGatewayUrl: this.publicGatewayUrl,
Expand Down
13 changes: 10 additions & 3 deletions packages/server/src/gateway/connections/slack-platform-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ type SlackActionEvent = {

/** Dependencies the App Home tab needs to render status and run OAuth. */
export interface SlackAppHomeDeps {
/**
* The initialized Slack adapter — the one with the live `@slack/web-api`
* client. The adapter handed to event handlers via `event.adapter` is the
* webhook-dispatch instance and has no `client`, so `publishHomeView` must
* go through this one.
*/
adapter?: SlackHomeAdapter;
mcpConfigService?: McpConfigService;
secretStore?: WritableSecretStore;
/** Public origin of the gateway — used to build the OAuth redirect URI. */
Expand Down Expand Up @@ -481,7 +488,7 @@ export function registerSlackAppHome(
}

chat.onAppHomeOpened(async (event: SlackAppHomeEvent) => {
await publishHome(event.adapter, {
await publishHome(deps.adapter ?? event.adapter, {
connection,
deps,
userId: event.userId,
Expand Down Expand Up @@ -516,7 +523,7 @@ export function registerSlackAppHome(
);
}
}
await publishHome(event.adapter, { connection, deps, userId });
await publishHome(deps.adapter ?? event.adapter, { connection, deps, userId });
return;
}

Expand All @@ -537,7 +544,7 @@ export function registerSlackAppHome(
"Failed to start MCP OAuth flow from Slack home tab"
);
}
await publishHome(event.adapter, {
await publishHome(deps.adapter ?? event.adapter, {
connection,
deps,
userId,
Expand Down
Loading