Skip to content

App: signing out lands on the sign-in screen, not an error - #2003

Closed
davidmckayv wants to merge 3 commits into
mainfrom
sign-out-lands-on-sign-in
Closed

davidmckayv wants to merge 3 commits into
mainfrom
sign-out-lands-on-sign-in

Conversation

@davidmckayv

@davidmckayv davidmckayv commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Signing out (from the account menu, or from any other Sign out) landed on "Something went wrong! Couldn't find that organization." instead of the sign-in screen, until a reload. Found on OpenBot Cloud, where people work in an organization of their own rather than default.

Why

After sign-out the app still knew the organization the person had worked in. The sign-in screen reads the deployment (readDeployment in lib/deployment/queries.ts), which asks in the known organization. Asked as somebody no longer signed in, the server answers 404 for that organization, and the sign-in route's beforeLoad failed. A reload knows no organization, so it asks at default as nobody and works.

The fix

  • The sign-in screen reads as nobody. readDeployment takes asNobody, and the sign-in options use it. They ask at default as nobody whatever organization the app last knew, as on a fresh load.
  • The organization is forgotten on the sign-in screen, not at Sign out. Once the sign-in screen is showing, it calls forgetOrganization() (query-client.ts). That forgets the organization, everything the app held for it, and the person's list of organizations. The next person to sign in on the same browser sees nothing the last one was shown. Sign out itself changes nothing about the organization: forgetting it there, while the app's pages were still on screen, redrew them in no organization, and they failed with "The organization is not known yet."
  • The sign-in options are keyed as the deployment's (["deployment", "sign-in"]), the same in every organization, so forgetting doesn't load them again under the screen.

Test

app/tests/sign-out-lands-on-sign-in.test.tsx runs the real sign-in gate, sign-in screen and Sign out hook against a real HTTP server on this computer that answers as OpenBot does. It serves the person's organizations and their own person only while they are signed in, and the deployment in their organization only to members. Answers are checked against the generated schemas.

  • Signing out lands on the sign-in screen: on main it fails with ClientError: Couldn't find that organization. With the fix it passes.
  • Signing out from the account menu: home sits inside the app's own organization boundary, with a screen that reads the organization. The test signs out with the account menu's hook and checks that the app's pages are gone before the organization is forgotten. When the organization was forgotten at Sign out, it failed with The organization is not known yet. It passes now.
  • Connect your AI's step test (connect-your-ai.test.tsx) has a fake server that now signs out as the real one does.

The sign-in, sign-out, organization, query-client and Desktop-connected tests pass, as do typecheck, lint and format.

Signing out from an organization other than `default` landed on "Something
went wrong! Couldn't find that organization." until a reload. The app
still knew the organization the person had worked in, so the sign-in
screen asked for the deployment there as somebody no longer signed in, and
the server answered not found.

A sign-out now forgets the organization and everything the app held for
it. The sign-in screen asks at `default` as nobody, as it does on a fresh
load, and the next person to sign in on the same browser sees nothing the
last one was shown.

The new test runs the real sign-in gate, sign-in screen and Sign out
against a real HTTP server that answers as OpenBot does. It fails on main
with that exact error and passes with the fix.
@davidmckayv
davidmckayv force-pushed the sign-out-lands-on-sign-in branch from b624807 to fb34ba1 Compare November 22, 2026 01:25
Forgetting the organization in Sign out itself happened while the app's
pages were still on screen. Signing out from the account menu on the home
page then drew those pages again in no organization, and they failed with
"The organization is not known yet." until a reload.

Sign out changes nothing about the organization now. The sign-in screen
reads what it offers as nobody, whatever organization the app last knew, so
it never asks for an organization somebody signed out isn't in. Once it is
on screen, with nothing of the app left to draw, it forgets the
organization and what the app held for it. What the sign-in screen offers
is keyed as the deployment's, the same in every organization, so
forgetting doesn't load it again under the screen.

The new test signs out from the account menu's hook on a home page inside
the app's own organization boundary. It fails on the previous commit with
that exact error and passes now. The test that signs out to the sign-in
screen still passes.
@davidmckayv

Copy link
Copy Markdown
Contributor Author

Superseded by #2004, which landed first and fixes the same sign-out error by reading the deployment at default as nobody when the known organization answers not found.

Checked before closing: this PR's own sign-out-to-sign-in test passes on main with #2004 and without this change. The only thing this PR added beyond that, forgetting the organization after sign-out, is not visible to anybody: every web sign-in leaves for the identity provider and loads the page fresh. Sign out from the account menu and from the Connect your AI step were both checked on a real OpenBot Cloud install.

@davidmckayv
davidmckayv deleted the sign-out-lands-on-sign-in branch November 22, 2026 02:18
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