Managed Slack enrollment: conversations.list returns the app's channel view while history calls act as the user
Summary
For a credential-group managed Slack enrollment (type managed_oauth, user token verified at enrollment with token_type === 'user' and the full SLACK_MANAGED_USER_SCOPES list including groups:read), tool calls diverge in identity within a single workflow run:
slack_v2get_channel_historyon a human-to-human DM of the enrollee succeeds — only the enrollee's user token can read that conversation.slack_v2list_channelsin the same run, bound to the sameoauthCredential, returns the app's channel view: only channels the Sim integration is present in, and omits private channels the enrollee is verifiably a member of.
Reproduction (staging workspace 6056c597-cd15-40a5-b6ba-831347b80473)
Run ingest-slack (5a4c8be6-d148-4bd3-8596-dff2d464bd9e), deployed, async, input:
{"subject":"[email protected]","credentialId":"ed101c5f-11c8-4580-9704-f2c2c00b4383","kbId":"…","dmChannelIds":"D0BAYR0HS3X"}
Observed in run 518060e5-d667-46f0-9c34-6b9be5627fde (2026-09-05):
listChannelsoutput: 17 conversations, all where the Sim app is present;C0AMLFYRZU4(#rvtech-internal, private) absent even thoughconversations.membersconfirms the enrolleeU0BB278QRRQis a member.fetchHistoryonD0BAYR0HS3X(a DM between two humans, U0BB278QRRQ and U090GFBMY21): succeeds, 289+ messages written.
Reproduced for a second enrollee ([email protected], credential 6c86b682…, run 0c9ca129…): 20 conversations listed, #rvtech-internal absent despite membership. So it is systematic, not one credential.
Why it matters
Any per-user Slack ingest driven by conversations.list silently sees only app-invited channels, so per-person corpora are built from the app's membership rather than the person's. Downstream this looks like missing data with no error anywhere.
Notes for the fix
- The enrollment flow stores the
authed_user.access_token(user token) —apps/sim/lib/credential-groups/slack-managed-users.tsenforcestoken_type === 'user'. apps/sim/tools/slack/list_channels.tsbuilds auth asBearer ${params.accessToken || params.botToken}; both spans in the repro bindoauthCredential, so the substitution happens in server-side token resolution for the listing path, not in the block config.- The custom bot service-account resolver (
SLACK_CUSTOM_BOT_PROVIDER_IDinapps/sim/lib/oauth/credential-service.ts) returns the bot token; something appears to routeconversations.list(and possibly other non-history reads) through it for managed enrollments.
🤖 Generated with Claude Code
https://claude.ai/code/session_015G1LmfSHrFrrZRsR8dG37Z
Closing per repo-owner preference: findings tracked internally. The reproduction and analysis live in the enterprise-search POC's ticket records.