Repository navigation
fix(browser): a start tab already on its URL's page is reloaded there, so a load of cookies alone reaches it - #685
Open
earakely-scale wants to merge 5 commits into
Conversation
…, so a load of cookies alone reaches it A load of cookies or local storage without tabs loads the start tabs again so their pages read it. A tab already on its start URL's document, as a hash-routed page's is, only moved within it: the navigation named no loader, loaded nothing, and timed out. Such a tab now moves to the URL within its document if it's elsewhere there, then reloads, and the load takes the reload's first commit as its document. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ent, and the log keeps that reload's cause Comparing the start URL with the tab's left out URLs the browser spells otherwise (https://shop.test#/orders is https://shop.test/#/orders in the tab). The start tab now navigates as before and reloads when the browser's answer names no loader, which is the browser saying it stayed in the document. A move within a document no longer uses up a reload asked for after it, so the log takes the reload's navigation for agentenv's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the load at once A reload's loader is now its main frame's first document request as well as its first commit, so a reload the browser aborts before committing fails the start tab instead of waiting out its time. The test browser answers a reload before it commits, as Chrome does, and the Chromium test also loads cookies with the tab on another route of its start page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…as landed Chrome answers a navigation that stays in the document before the move lands, so a reload sent at once loaded the route the tab was on: a cookie load with the tab on another route of its start page reloaded that route. The start tab now waits for its main frame's move within the document, up to MOVE_WITHIN_S, before it reloads, and the test browser answers such a move before it lands, as Chrome does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he test browser names its delays A start tab's wait can cancel its reload before the browser answers it; its pending cause in the log is now cleared, so a later navigation of the page isn't taken for agentenv's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
A website browser loads its start tabs again after a load of cookies or local storage without tabs, so their pages
read what was just set. A start tab already on its start URL's document, as every hash-routed page's is
(
https://<site>.test/#/<page>), wasn't loaded again.Page.navigateto a URL that differs from where the tab is only in its fragment, or not at all, moveswithin the document. It answers with no
loaderIdand loads nothing._StartLoadnever settled, so the tab wastimed_outafter its wait, and the page never readthe cookies.
_refuse_failedthen refuses the load.timed_out, so its readiness goes false.How
BrowserControl._start_navigation: a start tab navigates as before. When the browser's answer names no loader,the browser has stayed in the document, so the tab then sends
Page.reloadand the page loads again and reads whatthe load set. The browser decides what counts as the same document, so URLs it spells otherwise are covered too, for
example
https://shop.test#/ordersfor a tab athttps://shop.test/#/orders.sent at once reloads the route the tab was on (seen on real Chromium). So the tab waits for its main frame's
Page.navigatedWithinDocument, up toMOVE_WITHIN_S(5 s), before it reloads._StartLoad: a reload's answer names no loader either, so areloadingload takes its main frame's firstdocument request or commit after the reload as its document. A reload that fails before it commits (for example
net::ERR_ABORTED) therefore fails the tab at once, instead of waiting out its time.agentenv's (
Causes.navigates_next), and forgotten if the reload fails or is cut short.Causes.navigated_within: it now uses up a pending reload or history move only when it returns that one. Areload asked for once the move's answer arrived was otherwise used up by the move's own log entry, so the reload was
logged as the page's own.
Proof
packages/agentenv-protocol/tests/test_website_browser.py). TheNavigatingstub now answers asame-document navigation as Chrome does, with no loader and
Page.navigatedWithinDocument, and loads onPage.reload.test_a_start_tab_already_on_its_pages_document_is_reloaded_there_and_loads_againcovers a tab at its URL, atanother route of its page, and at its URL spelled otherwise. It fails on
main,timed_out, and passeshere.
test_a_reload_asked_for_once_a_move_within_a_document_answered_is_left_for_the_navigation_it_makes(intest_browser_log.py) fails onmainand passes here.test_a_start_tab_whose_reload_fails_before_it_commits_fails_at_once_naming_whychecks the failed reload.test_a_start_tab_whose_reload_never_answers_times_out_and_leaves_no_cause_for_a_later_navigationchecks that areload cut short by the tab's wait leaves no cause in the log.
tests fail if the reload doesn't wait for the move.
test_a_start_tab_on_another_page_of_its_site_navigates_and_isnt_reloadedchecks the usual path is unchanged.tst/integration/computer/chromium_app_test.py, on an amd64 host):test_a_load_of_cookies_alone_reloads_a_start_tab_on_a_hash_route_so_its_page_reads_them. Chromium sits onhttp://127.0.0.1:8783/app#/trips, a loopback page whose title shows itssidcookie. Aload_artifactofcookies alone must bring the page back signed in, without waiting out the live timeout. A second load, with the
tab moved to
app#/home, must bring the page back atapp#/tripswith the new cookie.check_browser_data) covers the same load on a start URL without a fragment.wait for the move, the second load reloaded
app#/home; that's how the race was found.the installed distribution): the new test failed. The page stayed
app signed out, which is this bug on realChromium.
tst/unit, one test fails, a Windows disk recipe test thatfails the same way on
mainon macOS. CI runs the full unit suite on Linux.Notes
the start URL plus
?launching. That workaround can stay; this fixes the path it didn't cover.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge.Summary
Reloads start tabs after same-document navigation so pages read newly loaded cookies and local storage.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Load start URL] --> B{Navigation names a loader?} B -->|Yes| C[Track document load] B -->|No| D[Wait for move within document] D --> E[Reload page] E -->|Request succeeds| C E -->|Request fails or is cancelled| F[Clear pending log cause]Reviews (5) · Last reviewed commit: "fix(browser): a start tab's reload cut s..." · Reviewed by Greptile