Repository navigation
Conversation
… not before OpenBot's page at /desktop/signed-in now tells Desktop when it traded the window's code for its session (window_signed_in), the same way it tells it when the trade fails (window_sign_in_failed). Desktop still saves the connection before the trade, for the page and for Sign in again, but ends setup and counts openbot_connect completed only once the page says the trade worked. A failed trade, a quit while the trade runs, or a quit at Sign in again after a first setup's failed trade is now setup_abandoned, not a connection. A page from an older OpenBot never sends window_signed_in. It goes on to the sign-in's next page only after a good trade, so while a trade waits the window loading that path is taken as the trade done, with the same events as before. No timeout and no API change.
…ot goes on to as a good trade Review follow-ups to the success signal: - A trade OpenBot's page says failed is now counted openbot_connect failed by the desktop, from the press, so the window's started always has an ending: the window that pressed Connect has gone to OpenBot's page. - A page from an older OpenBot leaves the trade's page only once the trade worked, so a load of any page on the window's origin but that one ends the trade, wherever the page went or a redirect took it, not only the exact path Desktop sent. It is counted on a thread of its own, off the webview's page-load handler. - window_signed_in is refused from any page but /desktop/signed-in. - Tests for a crash while the trade runs (closed by the next launch, as before), a late word after the window went on (counted once), and the window shown anew. The real-app test checks the page's word reached the desktop. Stale comments that said setup ends before the trade are fixed.
… page has loaded Something in front of an OpenBot (a proxy, a challenge) can send the window elsewhere before the trade's page ever runs: that is not a trade. The window going on now counts only after /desktop/signed-in finished loading or answered. The real-app test gains an older OpenBot's page, which says nothing when the code traded, and checks the app took the window going on as the trade done. TELEMETRY.md says completed's duration now includes the trade.
This branch has not been deployed
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
Since 1.2.8 (#2768), Desktop counts a connection through the window's own sign-in before that sign-in has worked. Once the browser sign-in comes back, Connect saves the connection, ends setup and counts
openbot_connectcompleted. All of that happens before OpenBot's page at/desktop/signed-intrades the code for the window's session. A first setup whose trade then fails shows Sign in again, and a quit there counts as a setup that connected. This is the follow-up from #2791's review (desktop_connected.rs:1309).Why. The page told Desktop when the trade failed (
window_sign_in_failed) and never when it worked, so Desktop had nothing to wait for.The fix. The page now tells Desktop when the trade works, the same way: a new page command,
window_signed_in, besidewindow_sign_in_failed. Desktop ends setup and countscompletedthen.One difference from "keep today's behaviour" for an older server, for your yes or no. An older page never sends
window_signed_in, and Desktop still counts its good trades (below). Its failed trades are now counted as failed, like a new page's:failed, andsetup_abandonedon quit, instead of today'scompleted. That's because every page already reports a failure. A quit during an older page's trade is alsosetup_abandonednow, and itscompletedcomes after the trade. Keeping today's count exactly would mean keeping the miscount your review flagged. If you'd rather keep it, see Decisions.In the page (
app/):finishWindowSignInsendswindow_signed_inafter a good trade and before the window goes on tonext. A refused or missing code sendswindow_sign_in_failedas before, and neverwindow_signed_in.SIGNED_IN_TELL_WAIT_MS), so a Desktop that doesn't answer never holds the window there. Outside Desktop it sends nothing. A Desktop from before the command refuses it, and the window goes on.In Desktop (
desktop/src-tauri/):connection.jsonbefore the window goes to the page, because the window's own commands, the failure path and Sign in again read it (save_choice). It no longer ends setup there. Instead it holds a pending trade: the window's origin and, for Connect from the first screen, the screen, the window's wait and when Connect was asked.window_signed_in, from/desktop/signed-inon the window's origin only (the ACL grants that origin, and the command checks the page), takes the trade. It ends setup and countscompletedfrom the press. Said again, it changes nothing.window_sign_in_failedtakes the trade and countsfailedfrom the press, since the window that pressed Connect has left for OpenBot's page and only Desktop can end itsstarted. Letting go of the window's sign-in (forget_window_sign_in) no longer ends setup.setup_abandoned.An older OpenBot. Desktop has to tell "an older page" from "the trade is still running". It does so from what the webview already reports, with no timeout and no server change:
/desktop/signed-inonly after a good trade (location.replace(next)). After a bad one it says so and stays.older_page_traded). Setup ends andcompletedis counted. The count runs on its own thread, off the page-load handler.A timeout is wrong both ways: a slow trade gets counted before it works, or a quick quit after a good trade gets counted as abandoned. A flag in the server's metadata is Decision 2.
Decisions for you
window_sign_in_failed, with today's count when it's absent.window_signed_inwould let Desktop keep exactly today's behaviour when the field is absent. The metadata is the server's, though, and during a rolling upgrade it need not match the release serving the page. I left it out.setup_abandoned. The next launch finds the saved connection and closes the session, as before. Counting it needs a second "kept" marker on disk, or not saving the connection until the trade, which changes what Sign in again shows. TELEMETRY.md says so, and a test pins it.Where it runs
connection.jsonis written when it was before.Boundary and audit
window_signed_infrom anywhere but the trade's page is refused by the ACL or the command, and is a page-to-Desktop message.API and database
api/changes: no request, server route, database orrelease-policy.jsonchange.window_signed_inis a Tauri command under Desktop's ACL (build.rs,desktop_page::PERMISSIONS, the generated capability schemas).Changelog
OpenBot Desktop.
Proof
Local, at
82a5c4ed8onmainab684e590, on Bun 1.4.3 as CI runs it, and Rust stable 1.100. Since thenmaingained #2929, #2930 and #2931 (checked 12:00 UTC, 4 Dec). None touches this change's files, and the routes above are unchanged.Tests across each boundary
plugin:openbot-desktop|window_signed_inandwindow_sign_in_failedby name from the window's address, through the plugin's handler under its ACL (window_shell). The setup window, another host or port, another page on the origin, and a window with no OpenBot at its origin are all refused. The name matches acrossbuild.rs,PERMISSIONS, the schemas, the workbench'sPAGE_COMMANDS(pageRegistry.test.tschecks it against the Rust source and the app) and the app's call.app/tests/desktop-window-sign-in.test.tsx), against Tauri's IPC as the page sees it. Told once, after the trade and before the app's first request. Never told on a refused or missing code. A Desktop without the command. A Desktop that doesn't answer, where the page waits on its trade page, then goes on.window_e2e, Desktop CI's macOS and Windows jobs). Against the stand-in's current page, the log shows the page's word reached the app (: its page said so). Against an older OpenBot's page, which says nothing, the app took the window going on as the trade done (: its page went on without saying so).Routes
From every caller of
connect_window_now,connect_to_openbot,sign_in_with_browser,show_window_at,window_sign_in_failedandSIGNED_IN_PATHacrossapp/,desktop/andshared/. Tests are inwindow_ipc_tests.rsunless named.completedfrom the press with its screen, or nothing with nonea_window_sign_in_ends_setup_once_the_page_says_it_traded_the_code(3 cases)failedfrom the press; quit =setup_abandoned; next launch adds nonea_window_sign_in_whose_trade_failed_is_abandoned_on_quitcompletedfor that go; no abandonsign_in_again_after_a_failed_trade_ends_setup_once_the_page_says_it_tradedsetup_abandoneda_quit_before_the_page_says_it_traded_is_abandoneda_crash_before_the_page_says_it_traded_is_closed_by_the_next_launchcompletedoncean_older_page_that_goes_on_without_saying_ends_setup_as_before;window_e2e_an_older_openbots_page_that_says_nothing_still_ends_the_tradesetup_abandoned. That window can't come back signed in by that trade: only the page trades the code, and it says so firstthe_window_shown_anew_drops_a_waiting_tradewindow_signed_infrom anywhere but the trade's pageonly_the_windows_own_page_says_it_tradedsign_in_with_browser)sign_in_with_browsertestsconnected_ipctests, passinga Desktop from before window_signed_in …,a Desktop that doesn't answer …;tellDesktopSignedInRed/green
Each change below was made, the touched tests were run, and the change was put back.
Desktop (
connected_ipc::, 51 tests; every change below turned some red):completedcounted before the trade, as onmain: 8 red. The first one:named true: nothing counted before the trade, left[Started, Completed { duration_ms: Some(522) }], right[Started].keepin place ofsave_choice): 3 red. Quit gave noSetupAbandoned { step: ConnectOpenbot }.not before its page loaded).another page).failed: 2 red.Page (the
/desktop/signed-incases, Chromium only):Local runs
cargo fmt --check.cargo test --bins: 552 pass, 0 fail, 1 ignored.cargo test --lib connected::: 104 pass, 0 fail, 4 ignored (thewindow_e2etests, which need a debug build).cargo clippy --all-targets -- -D warnings: clean on this diff (see below).biome lint --error-on-warnings .andbiome format .: clean.tsc --noEmitinapp/anddesktop/: clean.bun test desktop: 1,452 pass, 0 fail.app/tests/desktop-window-sign-in*.test.*: 16 pass without a browser; 46 pass, 0 fail in Chromium and WebKit.Unrelated, seen locally:
doc_lazy_continuationatlocal_eval_ipc_tests.rs:691, a file this doesn't touch; Desktop CI passed onmain.install::tests::osascript_saying_user_canceled_is_a_closed_promptfails on a Mac set to British English ("cancelled").Still to do before merge. A real macOS build beside an installed Desktop, with its own bundle id, HOME and
OPENBOT_DESKTOP_PROJECTand Cloud on. Run two first setups:started,completed, and nosetup_abandonedon quit;started,failed, thensetup_abandonedon quit.Both are read in PostHog for that build's installation only: