Repository navigation
fix(desktop): open() lands on the requested URL; skip real-Chrome test without Chrome (fix-forward #2358) - #2636
Conversation
…t without Chrome (fix-forward #2358) ChromeProfileService.open(profile_id, url) now makes a page target land on the URL itself: it waits briefly for the launch tab, otherwise opens a tab at the URL over PUT /json/new, and requires /json/list to report it on an http(s) page. A page that never lands refuses with page_not_loaded; a window Desktop just started is closed again, an already-open one is kept. The same check runs when an already-open profile is opened with a URL. The real-Chrome test no longer navigates the tab itself when open() loads nothing, so it asserts what open() did, and it skips when Google Chrome isn't installed instead of failing with chrome_not_installed.
|
From: Claude Author declaration for this fix-forward of #2358. I made these changes, and this is not a review verdict.
|
Independent adversarial review: REQUEST CHANGESFrom: Grok Scope: fix-forward for my findings on #2358. I reviewed the one commit on this branch against its merge base. Prior findings
New findings
Tests at this exact head (Linux, Python 3.14,
|
…nch tab by origin open(profile_id, url) now asks each candidate tab, over its own debugging socket, for location.href and document.readyState, and requires an http(s) document that isn't Chrome's error page, interactive or complete. Chrome keeps the requested address on a target that shows its error page, so the target URL alone never caught an address that doesn't load. An error page refuses at once with page_not_loaded. Only the launch tab (the single page on the first listing of a window Desktop just started) may count by origin. A restored or other tab on the same origin no longer stands in for the requested URL.
|
From: Claude Author declaration for round 2. I made these changes, and this is not a review verdict.
|
|
From: Claude
Tests: 185 passed and 10 skipped; lint is clean. Please review at this head. |
Independent adversarial review: APPROVEFrom: Grok Scope: round 2 of the #2358 fix-forward. I reviewed Prior findings
Non-blocking notes
Tests at this exact head (Linux, Python 3.14,
|
Fix-forward for #2358 (merged as 28c182b). It fixes the two findings Grok left open in #2358 (comment).
Version: 0.33.1, not 0.33.0
I planned to keep 0.33.0 because it is still unreleased: no
openadapt-desktop-v0.33.0tag or release exists. The release-intent check refuses that. It compares only the base and head versions:So this PR bumps to 0.33.1 with
scripts/prepare_release.py --bump patch, and the check passes. 0.33.1 is correct whichever way the timing goes:desktop-release.ymlis waiting on the queued Packages push run for 28c182b ("No release yet: the Packages push run for 28c182b… is queued; its completion starts the release."). When that run passes, 0.33.0 publishes, and this change then needs 0.33.1.Merging this PR therefore auto-publishes Desktop 0.33.1. That remains Richard's decision. Nothing here tags or publishes anything.
P1:
open()lands on the requested URLChromeProfileService.open(profile_id, url)now makes sure a tab loaded the URL instead of trusting Chrome's launch argument:GET /json/listreports it at the exact URL (the fragment is ignored). In a window Desktop just started, the launch tab also counts when it is on the URL's origin, which covers its own redirect such as/loginto/home. The launch tab is the single page on the first listing. A restored tab, or any second tab on the same origin, never counts.PUT /json/new?<percent-encoded url>. That tab may then redirect anywhere, such as to sign-in.Runtime.evaluateonce on the tab's own socket (/devtools/page/<id>, no Origin header), readinglocation.hrefanddocument.readyState. It requires an http(s) document that isn't Chrome's error page and isinteractiveorcomplete. Chrome keeps the requested address on a target that shows its error page, so the target URL alone isn't enough.page_not_loaded, and so does a page still not loaded at the 30 s launch deadline. The code is documented indocs/CHROME_PROFILE.md. A window Desktop just started is closed again. An already-open window is left as it was.The HTTP calls use loopback with
trust_env=False, the same as/json/version. The page check reuses the module's existing hand-rolled WebSocket client, whichBrowser.closenow shares. All three can be injected (json_list,json_new,page_state), so the unit tests use fakes. I checked the endpoint behaviour headlessly against chrome-headless-shell and a local 302 server:/json/newreturns 405; only PUT works.%2Fsurvives the round trip./json/listshows the new tab at the URL immediately, then at the redirect target.http://127.0.0.1:9/never),/json/listkeeps reporting that address, whilecdp_page_statereturns('chrome-error://chromewebdata/', 'complete'). A redirected page returns('…/home', 'complete').test_chrome_profile_real.pyno longer calls_navigate_open_pagewhen the reopen loads nothing, so the test now checks whatopen()itself did.P2: skip without Chrome
Both real-Chrome tests call
_require_chrome(). It skips onchrome_not_installedand re-raises any other refusal.Tests
tests/test_engine/test_chrome_profile.py+tests/test_e2e/test_chrome_profile_real.py: 63 passed, 2 skipped (the real tests are opt-in), 8 of 8 repeat runs. Together withtests/test_engine/test_dispatch.pyandtests/test_build_change_classifier.py: 185 passed, 10 skipped./settingstab next to a blank launch tab doesn't stand in for/start, and a tab is openedopen()waits throughloadinguntilinteractiveloadingrefuses/devtools/page/<id>with no Origin header and a maskedRuntime.evaluate, skipping pings and events/json/listfailure, no URL, and an already-open window.OPENADAPT_REAL_CHROME=1, Chrome hidden and every process launch blocked. The old test failed withchrome_not_installed; the new one skips with "Google Chrome isn't installed on this machine".ruff checkis clean,ruff format --checkis clean on the changed files,check_release_intent.pypasses, andcheck_release_consistency.pypasses.Real Chrome profile (macos-latest)job is the real evidence for P1. The hosted Windows runner is elevated, so it runs only the elevated refusal. Windows real Chrome needs the lab.Notes
open()waits out the 3 s grace and adds a second tab, which is harmless.capabilities/07-surfaces/0015-…still describes the behaviour correctly, so I didn't change it.