feat: companion drives your real Chrome profile by default#43
Merged
Conversation
The companion launched Chrome with a clean, throwaway profile, so the agent never inherited the user's logins/cookies — defeating the point of running the browser on the user's own machine. Switch the default launch to launchPersistentContext against the real Chrome user-data dir (OS-standard location), so the agent gets the user's existing sessions. Chrome locks a profile while open, so a profile-lock failure is turned into a clear, actionable error. Add --fresh to opt back into a clean profile, plus --user-data-dir / --profile overrides. stop() now only closes contexts we launched, leaving an attached --cdp browser and its tabs untouched.
This was referenced Jun 4, 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.
Why
The companion (
zero browser connect) launched Chrome with a clean, throwaway profile, so the agent never inherited the user's logins/cookies — defeating the point of running the browser on the user's own machine.What
launchPersistentContextagainst the real Chrome user-data dir (OS-standard location), so the agent gets the user's existing sessions.--fresh/--cdp).--fresh(clean throwaway profile, lets Chrome stay open),--user-data-dir <path>,--profile <name>.stop()now only closes contexts we launched, leaving an attached--cdpbrowser and its tabs untouched.Testing
tsc --noEmitclean;bun build.tssucceeds.🤖 Generated with Claude Code