Skip to content

Fix CONFIG opcode timeouts on startup (op=22) - #6

Draft
erop39 wants to merge 1 commit into
mainfrom
cursor/fix-config-timeout-5256
Draft

Fix CONFIG opcode timeouts on startup (op=22)#6
erop39 wants to merge 1 commit into
mainfrom
cursor/fix-config-timeout-5256

Conversation

@erop39

@erop39 erop39 commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Problem

After login, the service logged repeated warnings:

cmd timeout: op=22 seq=2
cmd timeout: op=22 seq=3

This blocked startup for ~16–32 seconds before participant resolution, even though mute state was already loaded from the snapshot (7 muted chats).

Root cause

Opcode 22 (CONFIG) in the Max WebSocket protocol is write-only — it is used to set mute/unmute (dontDisturbUntil), not to fetch settings. The previous fetch_settings() implementation sent CONFIG RPC requests and waited for responses that never arrive.

Fix

  • Remove the broken CONFIG fetch on startup and on NOTIF_CONFIG
  • Load mute state from AUTH_SNAPSHOT (chats[] + settings.chats + config)
  • Request a fuller snapshot at login (chatsCount: 40, sync params)
  • Apply live mute updates from NOTIF_CHAT / NOTIF_CONFIG push payloads
  • Show muted chat count in the Telegram startup notification when SKIP_MUTED=true

Testing

  • pytest -q — 230 tests pass
Open in Web Open in Cursor 

Opcode 22 (CONFIG) is write-only in the Max protocol — it sets mute
settings but does not return them. The previous fetch_settings() RPC
blocked startup with 8s timeouts per attempt.

Load mute state from AUTH_SNAPSHOT (chats + settings.chats) instead,
request a fuller snapshot (chatsCount 40 + sync params), and apply live
updates from NOTIF_CHAT / NOTIF_CONFIG payloads.

Co-authored-by: eGoR <erop39@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants