Skip to content

Desktop: a window the relay refused goes back through its entry, never left on the refusal - #2883

Draft
davidmckayv wants to merge 1 commit into
mainfrom
fix/desktop-relay-refusal
Draft

davidmckayv wants to merge 1 commit into
mainfrom
fix/desktop-relay-refusal

Conversation

@davidmckayv

@davidmckayv davidmckayv commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Desktop connected to OpenBot Cloud through the relay could leave its window on the relay's own refusal, a white page that says only "This relay is for the OpenBot window.", with no way back short of quitting the app. Reported in dogfooding on 1.2.0-rc.5: closing the window and opening it again from the Dock didn't help; quitting did.

What happened

From the two troubleshooting logs:

  • One run of the app from 2026-12-01 21:46:47Z to 2026-12-03 17:38:59Z, one relay the whole time ([relay] listening on 127.0.0.1:59128, then [relay] stopped only at the quit). No second instance, no second relay, and the window loaded well after the relay was up and worked for a day.
  • The page's last word was at 2026-12-02 23:05:52Z, and it still named front end v1.2.7 the next morning: nothing of the app's own loaded after that. The refusal page has no script, and the relay logged no refusals, so the logs go quiet.
  • The relay answers that sentence in two places. The entry (ENTER_PATH) can't have refused: the window only goes there with the live relay's own secret. So it was the check every other request meets: no foreign Origin (a page load sends none), so either no cookie or Sec-Fetch-Site saying another site. The window's page load came without the cookie.
  • Opening the window again (Dock, tray, a second launch) runs show_window, which takes any address on the relay's origin to be "already showing OpenBot", the refusal included, and leaves the window there. A quit stops the relay, and the next launch starts a new one and sends the window through its entry, which hands it a fresh cookie. That is why only the quit helped.

Nothing in 1.2.9 changed this; the relay's checks and the window's way back are the same on main as in rc.5. A Desktop that signed in through the relay before 1.2.8 still shows OpenBot through it until the person next signs in, so this still matters on current releases.

What changed

  • The relay keeps the path of a page load it refused (a navigation, Sec-Fetch-Dest: document, or a GET for HTML from a webview that sends no Sec-Fetch-Dest) until the window enters again or a page load passes, and writes every refusal to the log with why (another site's origin, another site, no cookie). Method and path only, never a header or the secret. Refused requests that aren't page loads are written at most every 30 seconds.
  • When a page load on the relay's origin ends on that refusal, the window goes back through the entry at the same page, and the entry hands it the cookie again. At most once in 5 seconds and three times a minute, so a cookie that never sticks doesn't send the window round in circles.
  • Opening the window again from the Dock, the tray or a second launch does the same when it is on the refusal, every time.
  • A request of the page's own that comes without the cookie (Sec-Fetch-Site: same-origin, which no other site's page can send) tells the shell, which sends the window back through the entry at the page it shows.
  • Nothing else changes about what the relay accepts: another site's page and another program still get the refusal and never reach OpenBot.

Tests

  • Regression, red before and green after: a_window_the_relay_refused_goes_back_through_the_entry_when_it_is_opened_again (the shell, with a real relay in front of an OpenBot stand-in). The window is signed in through the relay, enters, loses the cookie, and its page load is refused with that exact sentence; then Show Window. Before the fix:

    assertion `left == right` failed: left on the relay's refusal at http://127.0.0.1:55362/
      left: "/"
     right: "/.openbot-relay/enter"
    

    After: the window goes to the entry, gets the same run's cookie, and its page loads.

  • a_page_load_the_relay_refused_enters_the_relay_again_by_itself: the refused load ends and the window goes back through the entry at that page with nobody opening it, once; a refusal straight after is left to the person, and opening the window then still enters.

  • the_windows_page_asking_without_the_cookie_enters_the_relay_again: the page's own request without the cookie sends the window back through the entry.

  • The relaunch path, a_quit_and_the_next_launch_give_the_window_a_new_relay_it_enters: quit stops the relay, the next launch starts one with a secret of its own and sends the window through its entry, its page loads, and the last run's cookie opens nothing.

  • In the relay, a_page_load_refused_for_want_of_the_cookie_is_kept_until_the_window_enters_again, with the WebKit window stand-in now sending a page load's Accept and Sec-Fetch-* headers: the refused page is kept, a fetch is never taken for a page load, only the page's own same-origin request tells the shell, and the entry at that page lets the window back in.

  • cargo test --lib connected::, the shell's connected tests, cargo fmt --check and cargo clippy --all-targets -D warnings pass locally.

No screen changed: the refusal itself is the same page, and the window now leaves it. No Desktop screenshots, because getting a real WKWebView to drop the relay's session cookie on demand isn't something I could reproduce locally; the report's screenshot is the before. No install or upgrade path is touched.

Changelog

OpenBot Desktop.

  • Connected to an OpenBot elsewhere, the window is no longer left on a white page that says "This relay is for the OpenBot window." It goes back to OpenBot by itself, and opening the window again from the Dock, the tray or a second launch always gets back to it.

…r left on the refusal

Connected through the relay, the window's page load could come without the run's cookie, and the
relay answered its refusal, a white page with no script that says only "This relay is for the
OpenBot window." Show Window (the Dock, the tray, a second launch) took any address on the relay's
origin to be showing OpenBot already, the refusal included, so opening the window again left it
there; only a quit, which starts a new relay and enters it, got the person back. Reported on
1.2.0-rc.5 connected to OpenBot Cloud.

The relay now keeps the path of a page load it refused until the window enters again or a page load
passes, and writes every refusal to the log with why (method and path only, never the secret). A
page load in the window that ends on that refusal goes back through the entry at the same page by
itself (at most once in 5 seconds and three times a minute), and opening the window again does the
same every time. A request of the page's own that comes without the cookie (Sec-Fetch-Site:
same-origin) tells the shell, which sends the window through the entry at the page it shows.

Nothing else changes about what the relay accepts: another site's page and another program are
still refused and never reach OpenBot.

This branch has not been deployed

No deployments
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