Skip to content

Recover by itself after a long outage, and never read one as terms to agree to - #2152

Merged
davidmckayv merged 1 commit into
mainfrom
fix/outage-recovery
Nov 24, 2026
Merged

davidmckayv merged 1 commit into
mainfrom
fix/outage-recovery

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

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 in failureReason and only reaches error after 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:

  • Terms: fixed, as above.
  • AI connection (onboarding's Connect your AI): the same mistake the other way round. A hold read as "no AI needed", which could take somebody out of onboarding. Fixed the same way.
  • Sign-in state (who is signed in, and their organization): already passes failures on to "Back in a moment". Not affected.
  • Onboarding: decided from the signed-in person, so a hold already shows "Back in a moment". Not affected.
  • Setup, admin, and the personal-only pages: these read the deployment's facts, which a hold doesn't refuse, and their fallback is the edition every sharded OpenBot runs. Not affected.

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:
    • An open page (Routines) shows the hold, then fills in by itself once OpenBot answers. While the hold lasts, the read is asked about once per Retry-After.
    • With the terms no longer kept, moving to Teams shows "Back in a moment" (never "Agree to the terms"), then opens Teams by itself.
  • 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.
  • The organization browser tests now run the app's real signed-in gate and terms screen, not a stand-in.

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.

… 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
davidmckayv merged commit d8a5d7b into main Nov 24, 2026
35 checks passed
@davidmckayv
davidmckayv deleted the fix/outage-recovery branch November 24, 2026 21:28
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.

1 participant