Make background freezes and silent losses visible in room diagnostics#112
Closed
ankitsejwal wants to merge 1 commit into
Closed
Make background freezes and silent losses visible in room diagnostics#112ankitsejwal wants to merge 1 commit into
ankitsejwal wants to merge 1 commit into
Conversation
The room diagnostics dump was blind to the events behind #107/#108 — an iOS background freeze had to be inferred from a silent hole in the keepalive log. Surface them explicitly: `background`/`foreground` AppState transitions, a `suspend` event when a keepalive fires long-late (frozen timers), a `stale-send` when a send is rerouted off a socket that only looked open, and a `longestInboundGapMs` past-stall marker in the summary and panel.
This was referenced Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #109.
Why
While debugging #107 (silent resume memory-wipe) and #108 (orphaned send after unlock), the room diagnostics dump was blind to exactly the events that mattered — we had to infer the iOS background freeze from a ~2-minute hole in the keepalive log. This makes those events explicit.
What's added
background/foregrounddiag events, so a gap in the log reads asbackground … foregroundinstead of an unexplained hole (noteBackground()on the client; the hook's AppState listener now reports both edges).KEEPALIVE_MSafter the previous one, emitsuspend · resumed after Ns suspended. That's the smoking gun for a frozen event loop, turning a guess into a logged fact; it also catches timer throttling when AppState doesn't cleanly cycle.stale-sendevent when a send is routed to the outbox because the socket only looked open (the exact orphaned-send scenario from A message sent right after unlocking the phone can silently get no reply #108), so a would-be-lost message is visible instead of silent.longestInboundGapMssnapshot field surfaced in the summary line (maxInboundGap=Ns) and as a panel row, flagging a past stall even after the socket recovered.suspendamber,stale-sendred,foregroundgreen,backgroundgray).Deferred to a follow-up
The "flag an unexpected session swap" bullet — surfacing when the daemon fell back to a fresh, memoryless session (the #107 signal) — needs a daemon → phone wire change to mark the fallback. That touches the same daemon files as the in-flight #107 fix (#110), so I left it out here to avoid conflicting with that PR; it's best landed on top of #110. I'll open it as a follow-up.
Verification
tsc --noEmitclean. Additive / diagnostic-only — no change to connection behavior. (Mobile has no unit-test harness in this repo.)Stacked on #108 (base branch
fix/room-stale-open-on-resume, since both touchroomClient.ts+useLucidAsk.tsx) — merge after #108.