Repository navigation
Recover by itself after a long outage, and never read one as terms to agree to - #2152
Merged
Merged
Conversation
davidmckayv
requested review from
MikeRyanDev,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
November 24, 2026 20:37
… agree to While OpenBot moves an organization, or its database is out of reach, every read about it is answered 503 with a sentence and Retry-After. Two things went wrong when that lasted longer than one Retry-After, found by the end-to-end test of database sharding: - A page that was open (Memory) still said "This organization is unavailable right now" two minutes after the database came back. A refused read was asked again once, after its Retry-After, and never again when that one was refused too. It is now asked again after each refusal, one wait per read, at the pace Retry-After sets (no sooner than a second, no later than a minute), so the page fills in within one Retry-After of OpenBot answering. Other failures are retried as before. - Back to app, or opening Teams again, sometimes landed on "Agree to the terms". The signed-in gate had to read the terms again and took the refused read as "not agreed". The terms gate, and the AI connection gate (which read it as "no AI needed" and could take somebody out of onboarding), now throw the hold on, so the page says it calmly on "Back in a moment" and goes on by itself. Any other failure reads as before: the terms as still to agree to, the AI connection as not required. Tests: a browser test (Chromium and WebKit, wide and narrow, light and dark) with a hold of several Retry-Afters, for an open page and for the terms gate, now running the app's real signed-in gate and terms screen; and a fast test of both gates against the server's real 503s.
davidmckayv
force-pushed
the
fix/outage-recovery
branch
from
November 24, 2026 21:01
c57804e to
31fb156
Compare
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.
While OpenBot moves an organization between databases, or the organization's database is briefly out of reach, every read about it is answered 503 with a sentence for people ("OpenBot is moving this organization. Try again in a moment." or "This organization is unavailable right now. Try again in a moment.") and a Retry-After. The end-to-end test of database sharding found two things that went wrong when that lasted longer than one Retry-After.
A page that was open didn't come back
Memory, open when the database went down, still showed the unavailable sentence two minutes after it came back. A refused read was asked again once, after its Retry-After, and never again if that one was refused too, so any outage longer than the first wait left the page stuck until a reload.
Now a refused read is asked again after each refusal, for as long as the hold lasts, at the pace Retry-After sets (never sooner than a second, never later than a minute). The page fills in within one Retry-After of OpenBot answering again. Each read has one wait at a time, so the server is asked about it once per Retry-After at most, however many screens show it. A read nobody shows any more isn't asked. Other failures are retried as before.
This isn't done through TanStack Query's
retry/retryDelay: while a read is being retried, its failure stays infailureReasonand only reacheserrorafter the last try, so the page would say nothing about the hold while it waits.The terms screen during an outage
Back to app, or opening Teams a second time, sometimes landed on "Agree to the terms" for somebody who agreed long ago. The signed-in gate had to read the terms again (the app drops an answer nothing has shown for five minutes), the read was refused for the hold, and the gate took the refusal as "not agreed".
Now the terms gate passes a hold on instead of answering it, so the page shows the calm "Back in a moment" with the server's sentence and goes on by itself once OpenBot answers. I checked every gate for the same mistake:
Any failure that isn't a hold reads as before: the terms as still to agree to, so nobody gets in without the answer, and the AI connection as not required.
Tests
app/tests/organization-held-recovery.test.tsx, in Chromium and WebKit, at 1440 and 390 wide, light and dark, for both sentences, with a hold that lasts several Retry-Afters:app/tests/gates-read-holds.test.ts: the terms and AI connection gates against the server's real 503s, plus the other failures that still read as before.Red before the fix, green after. The open page stayed on the sentence, and the gate landed on /terms showing "Agree to the terms". The fast test had 4 of 6 failing, with every hold read as an answer. All six organization browser files (108 tests) and the terms browser tests pass in both engines.