Repository navigation
Commit 4b59db6
fix(slack): prompt reconnect when a DM grant predates im:read
The `dms` optional scope group originally requested only im:history/im:write
and their mpim counterparts. im:read/mpim:read were added later, because
enumerating DM conversations (conversations.list with types=im,mpim) needs the
read scopes rather than the history ones.
OAuth scopes are fixed when the grant is made, so a connection authorized
before that change keeps the older scope set and cannot enumerate DMs. The
resulting failure is silent and permanent:
- registerDMWebhook only needs im:history, so the DM webhook registers and
the connection looks healthy.
- listDMChannels guards on im:read and returns early, so `dm_channels` is
never populated.
- isKnownDMChannel therefore rejects every incoming DM event, and no DM ever
syncs — with no error surfaced and no reconnect prompt.
That early return exists so a user who declined DM sync isn't force-flagged for
reconnection by a missing_scope error. But it could not tell "declined DM sync"
apart from "opted in on an older grant", so it silently stranded the latter.
Both scopes come from the same group, so im:history without im:read can only
mean an older grant, never a decline. Use that to disambiguate: flag re-auth so
the user is prompted to reconnect and re-consent. A connection that declined DM
sync has neither scope and is left alone, preserving the original guard.
Reconnecting is required to recover — a scope the grant never had cannot be
obtained without re-consent.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent b95d6ec commit 4b59db6
2 files changed
Lines changed: 65 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
497 | 541 | | |
498 | 542 | | |
499 | 543 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1683 | 1683 | | |
1684 | 1684 | | |
1685 | 1685 | | |
1686 | | - | |
1687 | | - | |
| 1686 | + | |
1688 | 1687 | | |
1689 | 1688 | | |
1690 | 1689 | | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
1691 | 1696 | | |
1692 | 1697 | | |
1693 | 1698 | | |
| |||
1700 | 1705 | | |
1701 | 1706 | | |
1702 | 1707 | | |
1703 | | - | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
1704 | 1722 | | |
1705 | 1723 | | |
1706 | 1724 | | |
| |||
0 commit comments