Implement Gateway session kernel and checkpoint state machine #5

Open
opened 2026-08-03 07:47:21 +00:00 by lost-rob0t · 0 comments
lost-rob0t commented 2026-08-03 07:47:21 +00:00 (Migrated from github.com)

Depends on

Goal

Implement the Discord Gateway protocol kernel behind the transport abstraction with transcript-first verification.

Scope

  • WebSocket open and payload assembly
  • zlib-stream decompression across arbitrary fragment boundaries
  • HELLO, IDENTIFY, RESUME, READY, and RESUMED
  • sequence tracking and checkpoint creation
  • heartbeat scheduling and acknowledgement tracking
  • generation-tagged timers that discard stale work after reconnect
  • reconnect, invalid-session, resumable-close, and terminal-close classification
  • bounded backoff and quarantine state
  • immutable client-context digest checks for resume

Constraints

  • client contexts are pinned and changed only by explicit configuration revision
  • checkpoints contain no token, cookie, authorization header, or proxy password
  • terminal close codes must not enter restart loops
  • the Gateway kernel emits typed events; it does not apply StarIntel scope or publication policy

Exit gate

  • all Gateway state-machine transcripts pass in accelerated and virtual time
  • stale heartbeat generations cannot terminate a newer connection
  • resume only accepts matching account, client-context, profile, and schema digests
  • compressed and fragmented dispatches reconstruct exact raw payloads
  • invalid-session handling clears only fields required for re-identification
## Depends on - #3 - #4 ## Goal Implement the Discord Gateway protocol kernel behind the transport abstraction with transcript-first verification. ## Scope - WebSocket open and payload assembly - zlib-stream decompression across arbitrary fragment boundaries - `HELLO`, `IDENTIFY`, `RESUME`, `READY`, and `RESUMED` - sequence tracking and checkpoint creation - heartbeat scheduling and acknowledgement tracking - generation-tagged timers that discard stale work after reconnect - reconnect, invalid-session, resumable-close, and terminal-close classification - bounded backoff and quarantine state - immutable client-context digest checks for resume ## Constraints - client contexts are pinned and changed only by explicit configuration revision - checkpoints contain no token, cookie, authorization header, or proxy password - terminal close codes must not enter restart loops - the Gateway kernel emits typed events; it does not apply StarIntel scope or publication policy ## Exit gate - all Gateway state-machine transcripts pass in accelerated and virtual time - stale heartbeat generations cannot terminate a newer connection - resume only accepts matching account, client-context, profile, and schema digests - compressed and fragmented dispatches reconstruct exact raw payloads - invalid-session handling clears only fields required for re-identification
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nsaspy/cl-discord-self#5
No description provided.