Skip to content

handleslack: don't make archived channels read-only before the archive notice - #202

Draft
indent[bot] wants to merge 2 commits into
mainfrom
indent/slackgo-archive-notice
Draft

indent[bot] wants to merge 2 commits into
mainfrom
indent/slackgo-archive-notice

Conversation

@indent

@indent indent Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Logs

Failed to send message part to Matrix with subtype=channel_archive and M_FORBIDDEN: user has insufficient power level (events_default=100, required_power_level=100). This happened 14 times in the last 24h (6 accounts) and 5 times the day before (5 accounts). From Nov 27 to Nov 30 it hit 27 times: 17 accounts, 24 channels, 6 clusters. The first failure came right after archived channels started being made read-only. Loki window checked: 2026-11-30 05:45-06:00 UTC, plus 5 more accounts around their archive events.

Cause

Slack sends channel_updated before the channel_archive message. The ChannelUpdateEvent resync fetches the channel info, sees is_archived and sets events_default to 100. The "archived the channel" notice is then rejected and dropped. The archive message's own PostHandleFunc was supposed to apply read-only after the notice is bridged.

Change

Resyncs triggered by channel_updated no longer make a room read-only: when the fetched channel is archived, events_default and the topic power level are left unchanged, and read-only is applied after the archive notice by its PostHandleFunc. Unarchiving still lifts read-only through the channel_updated resync, and the unarchive notice's PreHandleFunc also lifts it before the notice is bridged. The startup full sync still applies the archived state; catch-up resyncs don't update chat info.

Before / after

Note: not tested against a live account.

Case Base Head
Archive: channel update, then archive notice Room goes read-only first; notice dropped Notice shown, then room read-only
Unarchive with notice, then a message Notice and message shown; room writable Notice and message shown; room writable
Unarchive without notice, from read-only room Room writable; next message shown Room writable; next message shown

Caveats: on head the topic level also stays unchanged until the archive notice, so a lost notice leaves the room writable until the next restart. Channels already archived at startup are read-only on both.

View in Indent
Tag @indent to continue the conversation here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant