Skip to content

fix(happy-app): debounce encryption-race message recovery (companion to #701)#1

Open
cjb0001 wants to merge 1 commit intofix/sync-wedgefrom
fix/ios-message-sync-wedge
Open

fix(happy-app): debounce encryption-race message recovery (companion to #701)#1
cjb0001 wants to merge 1 commit intofix/sync-wedgefrom
fix/ios-message-sync-wedge

Conversation

@cjb0001
Copy link
Owner

@cjb0001 cjb0001 commented Feb 27, 2026

Summary

Companion follow-up to slopus#701: add debounced recovery scheduling for session-encryption race paths so message sync does not repeatedly thrash retries when encryption is temporarily unavailable.

Why this follow-up

slopus#701 already addresses wedge behavior broadly (bounded retries, timeouts, cursor monotonicity, reverse pagination). One remaining edge case is transient session-encryption unavailability during fetch/update handling, which can still trigger repeated immediate invalidations.

This PR adds a tiny, focused recovery debounce to smooth that path.

Changes (on top of slopus#701)

  • Add per-session messageRecoveryTimers map.
  • Add scheduleMessageRecovery(sessionId, delayMs=500) helper.
  • In fetchMessages, when session encryption is missing:
    • schedule a delayed recovery instead of throwing/retrying immediately.
  • In new-message path, when encryption is still missing after session refresh:
    • schedule delayed recovery instead of immediate reinvalidate.
  • Clear recovery timer on delete-session cleanup.

File changed

  • packages/happy-app/sources/sync/sync.ts

Validation

  • corepack yarn --cwd packages/happy-app typecheck

Base

@cjb0001 cjb0001 changed the title fix(happy-app): prevent iOS message sync wedge on encryption race fix(happy-app): debounce encryption-race message recovery (companion to #701) Feb 27, 2026
@cjb0001 cjb0001 changed the base branch from main to fix/sync-wedge February 27, 2026 14:23
@cjb0001 cjb0001 force-pushed the fix/ios-message-sync-wedge branch from a1bd2b2 to f069e15 Compare February 27, 2026 14:23
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.

1 participant