Strip profile session restore when configure batch carries a start_url - #339
Open
yummybomb wants to merge 2 commits into
Open
Strip profile session restore when configure batch carries a start_url#339yummybomb wants to merge 2 commits into
yummybomb wants to merge 2 commits into
Conversation
yummybomb
marked this pull request as ready for review
August 17, 2026 21:51
hiroTamada
approved these changes
Aug 18, 2026
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.
Summary
When
/chromium/configurereceives both a profile archive and astart_url, the documented behavior is thatstart_urlwins: the browser should come up on that page with the profile's saved tabs discarded. Today that override is racy. The profile archive keepsDefault/Sessions(intentionally, so tab restore works when nostart_urlis given), and Chrome restores those tabs asynchronously after DevTools comes up.DispatchStartURLenumerates page targets right after DevTools readiness, closes the extras it sees, and navigates the first — so any restored tab that materializes after that enumeration survives and can leave the browser sitting on a profile tab instead of the requested page.Fix: when the configure batch carries a
start_url, deleteDefault/Sessionsfrom the extracted profile before installing it. With no session-restore data on disk, Chrome never reopens the old tabs and there is nothing to race. This mirrors what the legacy-profile migration path in the API already does for the same reason.Scope notes:
start_urlis present,Default/Sessionsis kept and tab restore behaves exactly as before.Testing
go test ./cmd/api/api/ -count=1passes (includes newTestStripProfileSessionRestore).go vet ./cmd/api/api/clean./chromium/configurepowerset e2e covers the profile+start_url combination path.Note
Low Risk
Narrow change on the profile install path, gated on
start_url; behavior withoutstart_urlis unchanged.Overview
When
/chromium/configureinstalls a profile archive and astart_url, the handler now removesDefault/Sessionsfrom the extracted profile before install so Chrome cannot asynchronously restore saved tabs and raceDispatchStartURL.Profile-only configures are unchanged: session data stays on disk and tab restore still works. Only the live VM copy is modified; the uploaded archive is untouched.
Adds
stripProfileSessionRestoreandTestStripProfileSessionRestore(removes Sessions, leaves other profile files, no error if Sessions is missing).Reviewed by Cursor Bugbot for commit aa17d7b. Bugbot is set up for automated code reviews on this repo. Configure here.