fix(calls): a finished call no longer rings again after a reload (#312) #365

Merged
jared merged 1 commits from fix/phantom-ring-after-reload into lotus 2026-10-16 22:24:05 -04:00
Owner

Fixes #312.

After a reload or restart within a ring's lifetime, the catch-up sync replays the ring together with the caller's hang-up and your own decline. The MatrixRTC session can also keep the stale join. The client rang again for up to 90 s, and showed "1 Live" (the call screen instead of the chat) for minutes.

Change

  • Before ringing, check the room's state (utils/callRing.ts, unit-tested).
    • Don't ring if we already declined that ring or are already in the call.
    • If the caller has no active membership yet, re-check after 4 s, since a real call's membership can land just after its ring. Ring only if they joined.
  • The "caller gone" dismissal also consults room state, not only the possibly stale session.
  • When sync becomes live (startup or reconnect), recompute every active RTC session from the current state. That clears a stale "Live".

Verified headless, with Bob's call membership and ring in an invite-only room:

step before after
live ring rings rings
caller hangs up stops stops
reload within the ring window rings again + "1 Live" no ring, no "Live"
ring arrives just before the caller's membership rings rings

tsc clean · unit tests pass · ESLint/Prettier clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5

Fixes #312. After a reload or restart within a ring's lifetime, the catch-up sync replays the ring together with the caller's hang-up and your own decline. The MatrixRTC session can also keep the stale join. The client rang again for up to 90 s, and showed **"1 Live"** (the call screen instead of the chat) for minutes. **Change** - **Before ringing**, check the room's *state* (`utils/callRing.ts`, unit-tested). - Don't ring if we already declined that ring or are already in the call. - If the caller has no active membership yet, re-check after 4 s, since a real call's membership can land just after its ring. Ring only if they joined. - **The "caller gone" dismissal** also consults room state, not only the possibly stale session. - **When sync becomes live** (startup or reconnect), recompute every active RTC session from the current state. That clears a stale "Live". **Verified** headless, with Bob's call membership and ring in an invite-only room: | step | before | after | |---|---|---| | live ring | rings | rings | | caller hangs up | stops | stops | | reload within the ring window | **rings again + "1 Live"** | no ring, no "Live" | | ring arrives just before the caller's membership | rings | rings | `tsc` clean · unit tests pass · ESLint/Prettier clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
jared added 1 commit 2026-10-16 21:28:38 -04:00
fix(calls): a finished call no longer rings again after a reload (#312)
CI / Build & Quality Checks (pull_request) Successful in 1m39s
CI / Trigger Desktop Build (pull_request) Skipped
CI / Docker image build & smoke test (pull_request) Skipped
CI / Secret scan (gitleaks) (pull_request) Successful in 7s
CI / Playwright smoke (e2e) (pull_request) Successful in 10m58s
05d7e87d26
After a reload/restart within a ring's lifetime, the catch-up sync replays
the ring together with the caller's hang-up and our own decline, and the
MatrixRTC session can keep the stale join. The client rang again for up to
90 s and showed "1 Live" (call screen instead of chat) for minutes.

- Before ringing, check the room STATE (utils/callRing.ts, unit-tested):
  no ring if we already declined that ring or are in the call; if the
  caller has no active membership yet, re-check after 4 s (a real call's
  membership can land just after its ring) and ring only if they joined.
- The "caller gone" dismissal also consults room state, not only the
  possibly stale session.
- When sync becomes live (startup or reconnect), recompute every active
  RTC session from the current state, clearing a stale "Live".

Verified headless (Bob's membership + ring in an invite-only room):
live ring rings; hang-up stops it; reload within the window: before
rang again + "1 Live", now no ring and no "Live"; a ring that arrives
just before the membership still rings.

Fixes #312

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
jared merged commit 2d31312a73 into lotus 2026-10-16 22:24:05 -04:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#365