Skip to content

fix(logout): report connection loss after a refused logout - #515

Merged
santi1584 merged 1 commit into
mainfrom
fix/refused-logout-493
Nov 29, 2026
Merged

santi1584 merged 1 commit into
mainfrom
fix/refused-logout-493

Conversation

@santi1584

Copy link
Copy Markdown
Collaborator

Closes #493.

Before this change, requestedLogout stayed set until the session ended. If Jamera refused a logout (no-logout tile, fight, or an onLogout script, which may refuse silently), a later unrelated connection loss looked deliberate, and the TV did not show its connection-lost notice.

How it works

  • A new logoutIntent (src/lib/jamera/logoutIntent.ts) replaces the boolean. The intent ends on the first inbound frame that arrives at least 5 s after the request.
  • Protocol76::logout closes the connection in the same task when it succeeds, so the server sends nothing after a successful logout.
  • When it refuses, the server keeps sending, and Jamera's ping every 5 s guarantees a frame arrives even after a silent script refusal. The intent therefore ends within about 10 s, without matching the server's message text.
  • PacketDispatcher.nextFrame now accepts several one-shot listeners, so the logout watch and the TV resume probe don't evict each other. Behaviour is unchanged for the single existing caller, which always cancels.

Known edges

  • A drop within about 5–10 s after a refusal is still treated as deliberate.
  • A browser stall of more than 5 s right after Log out could make a successful logout show the notice.

Tests: five unit tests in src/__tests__/logoutIntent.test.ts. Lint, build, proxy typecheck and 1,050 unit tests pass locally. CI runs the browser and Chromium 79 checks.

From the #505 quick-win queue.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LSWCoMs13M8tAk61rMV9q3

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
otclient-web 56e98c4 Commit Preview URL

Branch Preview URL
Nov 29 2026, 10:07 AM

The logout flag was only cleared on session teardown, so if the server
refused the logout (no-logout tile, fight, or an onLogout script) a later
unrelated socket loss was treated as deliberate and the TV's
connection-loss notice was suppressed.

Scope the intent to the logout exchange: Jamera's Protocol76::logout
either closes the connection in the same dispatcher task or refuses and
keeps the session alive (script refusals may send nothing). Any inbound
frame received more than one round trip after the request was therefore
sent after a refusal, so the intent lapses on the first frame after a 5 s
grace window (Jamera pings idle players every 5 s). PacketDispatcher's
nextFrame now supports several concurrent waiters so this does not
displace the TV resume probe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LSWCoMs13M8tAk61rMV9q3
@santi1584
santi1584 force-pushed the fix/refused-logout-493 branch from 65d617b to 56e98c4 Compare November 29, 2026 10:06
@santi1584
santi1584 merged commit aa4f1e2 into main Nov 29, 2026
11 checks passed
@santi1584
santi1584 deleted the fix/refused-logout-493 branch November 29, 2026 10:11
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.

A rejected logout can hide the next unexpected connection loss

1 participant