Repository navigation
A tab signed out elsewhere stops asking, and goes to sign-in - #2816
Merged
Merged
Conversation
davidmckayv
requested review from
MikeRyanDev,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
December 2, 2026 21:06
A browser hides the 401 that refuses a WebSocket upgrade, so the conversation events socket only saw it close and reconnected for ever, backing off to 30 seconds. The read of a computer's wheel took OpenBot's 401 for a missed read and asked again every second or two. One person's tab, signed out since the afternoon, did both for hours and never told them (Cloud alert: conversation-events 401 at 25%). - A socket refused before it opens asks once who is signed in (getPerson, the gate's own question), then no more than every 30 seconds. Nobody: it stops, and opens again only once somebody is signed in. - The wheel's read stops on OpenBot's own 401, as it does for a Bot that is gone. A proxy's 401 is still only a missed read. - Either way the app is told (SignedOutWatch), and the signed-in gate runs again: the sign-in screen, or Desktop's and the embed's own renewal. - The socket names the app in an optional `client` query parameter, so a refused socket is logged with the app that asked.
davidmckayv
force-pushed
the
fix/signed-out-tab-stops
branch
from
December 2, 2026 21:18
67e17d1 to
be18d99
Compare
9 tasks done
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.
What this changes
A Cloud alert today (
GET /api/v2/organizations/:organizationId/conversation-eventsrefused 401 at 25%) traced to one person's tab, signed out since 14:40Z and still on web/1.2.5. For hours it kept asking OpenBot, and it never told the person they were signed out. Two things did the asking:SSO_REQUIRED_CLOSEstopped it.BOT_GONEstopped it.Now:
getPerson, the same question the_authedgate asks, and doesn't ask again more often than every 30 seconds. If nobody is signed in, the socket stops, and it opens again only once somebody is signed in. Any other answer (the network, a 5xx, a proxy's page) keeps today's backoff. This runs after the embed renewal that already happened on a refused-before-open close, so it follows that existing pattern.BOT_GONE. Coming back to the tab asks once more, also as forBOT_GONE. A 401 that isn't OpenBot's JSON (a proxy) still counts only as a missed read (refusedAsSignedOut).lib/auth/session-check.tsandcomponents/auth/signed-out-watch.tsx, mounted in_authed), and the signed-in gate runs again. In a browser that means the existing sign-in screen, which brings the person back to the page they were on. Inside OpenBot Desktop it means Desktop'ssign_in_refused, and embedded it means the host's renewal. Nothing is drawn that wasn't drawn before.clientquery parameter (web/1.2.8), because a browser can't setOpenBot-Clienton a WebSocket. The server writes it into its log when it refuses the socket (the backend half, in its own PR).Why the client re-checks instead of the server accepting the upgrade and closing with a "signed out" code: a server change would only help apps released from now on, together with servers upgraded from now on. The re-check works against every server in the support window, Cloud included. It also reuses the gate's own flow, so every way of signing in (browser, Desktop, embedded) is handled the way it already is on a load. And it works for any Bot, because nothing about it depends on the Bot.
Where it runs
Boundary and audit
clientquery parameter is only logged.API and database
api/asyncapi.yaml: one new optional query parameter onconversationEvents,client. It is additive: a socket opened without it is answered the same, and nothing is refused for it. It is listed inapi/accepted-live-breaking-changes.md, ascapabilitieswas on 2026-11-26.bun run api:live:diffpasses, andbun run api:generatechanges nothing. There is no OpenAPI change and no database change. I read docs/api-and-migrations.md.Changelog
Signing in.
Proof
Red on main's hooks, green on this branch. I put back main's
use-channel-events.ts,use-control.tsandcontrol.ts, kept the tests, ran them, then restored the branch:app/tests/stay-signed-in-browser.test.tsx, "signed out elsewhere while open": Playwright, Chromium and WebKit. It runs the real gate, frame, sidebar and wheel against a real HTTP and WebSocket server, which then refuses everything with OpenBot's 401 and closes the socket. The test checks that the tab lands on sign-in, and that across 2 minutes of the page's clock (Playwrightpage.clock.runFor, four times the 30-second backoff ceiling) there are no new upgrades, wheel reads orpeople/mereads.app/tests/signed-out-tab-stops.test.tsx, through the real hooks: a socket refused with nobody signed in stops and says so; one refused while signed in keeps reconnecting and asks only once; a stopped socket opens again after a sign-in; the wheel stops on OpenBot's 401; a proxy's 401 is still a missed readI also ran the existing socket, wheel, gate and error-reporting suites (58 tests across 9 files),
tsc --noEmitfor the app, and biome on the changed files.Screenshots: the sign-in screen the tab lands on, in Chromium and WebKit. It is the existing screen, unchanged.