Files
harness-tools/docs/fast-browser-named-profiles.md
T
jb fd63b0ccec
fast-browser scenarios / Offline scenario contract tests (push) Failing after 44s
fast-browser scenarios / Local Chromium headless scenarios (push) Failing after 23s
fast-browser-with-jev
2026-09-20 12:24:08 -04:00

4.8 KiB
Raw Blame History

Fast Browser named profiles

User decisions

  • Support both manual setup/sign-in and automated launches from /fast-browser.
  • Use an exclusive profile lock. Parallel agents must choose different names; copying/cloning profiles is not part of this change.
  • Keep profile data on close. There is no automatic logout, profile reset, or deletion action.

Configuration and storage

Add optional browser.profile, a 1–64 character managed name starting with a letter/digit and containing letters, digits, dots, underscores or hyphens. It is not an arbitrary filesystem path and is valid only for launch mode. Without it, the existing disposable profile behavior stays unchanged.

Resolve profiles below $XDG_DATA_HOME/fast-browser/profiles/<name>, or $HOME/.local/share/fast-browser/profiles/<name> when XDG_DATA_HOME is unset. This matches the manual evebot profile command already given to the user. Adopt existing manually prepared profiles without deleting their contents, provided they are not in use. Keep directories private and reject symlink/path traversal.

The browser object continues to replace lower-precedence browser settings as a unit. An explicit per-call browser object without profile therefore requests a disposable profile, not an inherited persistent one.

Session lifecycle

Manual setup: launch the named browser visibly with its dedicated user-data directory, but without CDP/remote-debugging flags. This mode is for the user to sign in. It does not create an automation connection, expose a page to JEV, or claim that a particular external service will accept subsequent automation. An explicit setup-session ID identifies only the owned process lifetime; observe/run cannot automate it.

Automated launch: open the same named profile with CDP enabled and return the normal automation session ID. The manual browser must be fully closed first. Browser profile locks and process ownership are distinct from CDP endpoint leases, and both must be respected.

Acquire a cross-process lock before either launch. Reject active unmanaged Chromium profile use as well, rather than forwarding a new command into an existing unowned browser. Do not blindly remove stale SingletonLock files. Ignore/remove stale DevToolsActivePort metadata only after obtaining exclusive profile access, so a previous session's port cannot be mistaken for the newly launched browser.

Closing a session terminates its owned process and releases locks only after exit is confirmed. Disposable profiles are cleaned up; named profiles survive both normal close and startup failures. Preserve retryable ownership bookkeeping if termination or cleanup fails. Shutdown handles manual and automated sessions.

Launch baseline from live testing

The initial visible /usr/bin/chromium launch with extra disable/password/keychain flags and a reduced desktop environment crashed twice with SIGSEGV. User-confirmed normal launch worked. A diagnostic launch also worked with only:

  • --user-data-dir=<private directory>
  • --remote-debugging-address=127.0.0.1 and --remote-debugging-port=0 for automation
  • --no-first-run and --no-default-browser-check
  • the requested URL

That diagnostic retained XDG_SESSION_TYPE and other non-secret desktop context. Adopt this minimal baseline for the managed launcher, omitting the two debugging flags for manual setup. Do not force a different password-store/keychain mode between setup and automation. This establishes a working combination, not which individual old flag or omitted variable caused the crash.

UI

Add a profile row to the native subdued-value settings view. An unset name means disposable; inherited names must remain visibly inherited. Add explicit manual-setup and automated-launch menu actions. Use current saved settings and report the returned session ID/profile. Following user feedback, every valid scope-local settings edit saves automatically; Escape returns without discarding earlier edits. Cancelling a field edit or failing validation/write preserves its previous value. Launch remains an explicit separate action. Existing close-all acts only on this Pi instance's sessions and never deletes a named profile.

Verification

Final integration checks passed: bun run test:fast-browser (111 TypeScript tests and 21 Python tests), bun run typecheck, bun run test:packages, bun run test, and git diff --check.

Offline coverage includes name validation, config roundtrips, cross-manager contention, adoption, persistent sentinel-file retention, forced-visible setup without CDP, stale-port handling, failure cleanup, menu callbacks, conversation session metadata and unchanged disposable behavior. Real cookies were not used. No external login attempt or resumption of the cancelled Evebot test occurred during development; a live named-profile setup remains a user-driven check after reload.