Skip to content

feat(browser): keep logins across sessions with named profiles - #344

Merged
ElbertePlinio merged 4 commits into
mainfrom
feat/339-browser-profiles
Oct 28, 2026
Merged

ElbertePlinio merged 4 commits into
mainfrom
feat/339-browser-profiles

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

A browser session deletes its Chrome profile at teardown. So an agent that needs a logged-in site makes the user log in again in every session.

Browser sessions can now take a named profile with --profile <name> or the MCP session_create profile field. Pickforge keeps it at ~/.pickforge/lab/profiles/<name> with mode 0700. One session holds a profile at a time. Teardown, crash recovery and the reaper keep it. For a named profile, teardown asks Chrome to close through CDP Browser.close first, because Chrome writes recent cookies to disk only on a clean close. The verified process-group stop still runs afterwards. pickforge-lab profile list and profile delete manage profiles. MCP gets a read-only profile_list and no delete. Sessions without --profile keep the ephemeral profile.

Closes #339

Requirement Verified by Scenario Result Evidence
CLI and MCP accept a profile name, and Chrome uses profiles/<name> Tests, manual CLI QA Create with --profile, reuse the profile in a second session, MCP session_create with profile, --profile on a desktop session Profile dir used and reused; non-browser sessions refuse the flag browser-session.test.ts, browser.test.ts (MCP), session.test.ts, QA log
Safe profile names Tests, manual CLI QA ../x, Upper, -lead, 33 characters Refused with a clear error browser-session.test.ts, QA log
0700, no symlink, no foreign owner, no readable profile Tests, manual CLI QA Symlink at the profile and at the root, modes 750/701/720/704, a writable root or parent, a foreign uid from fstat Refused, nothing followed or changed; the error names the profile profiles.test.ts, QA log
Teardown, crash recovery and the reaper keep named profiles Tests, real Chrome, manual CLI QA Destroy, failed startup, kill -9 of the session group, reaper run Profile kept every time session.test.ts, integration.test.ts, QA log
A login survives teardown Real Chrome test, manual CLI QA A persistent cookie set 2 s before destroy; Node 20.19.0 without a global WebSocket; a CDP failure; an unrelated server on a reused CDP port; a slow handshake; abort in each phase Cookie sent in the next session; fallback group stop always runs; no other browser contacted integration.test.ts, session.test.ts, QA log
One live session per profile, recoverable after a crash Tests, manual CLI QA Concurrent claims, a dead creator, a crash mid-release, reused browser or Xvfb PIDs, an unrecorded live browser One claim wins and refusals name the holder; stale holds recover; live ones stay profiles.test.ts, QA log
Chrome singleton files do not block the next session Tests, real Chrome Stale Singleton* links after kill -9, a reused PID, a PID hidden by /proc permissions, other Chromium builds and a linked PICKFORGE_HOME Stale links cleared without following them; a live owner of the same profile is kept profiles.test.ts, integration.test.ts
profile list and profile delete Tests, manual CLI QA Size, last use and holder; one unsafe entry among healthy ones; a vanished cache dir; delete while held, without --yes, of a missing profile Healthy entries still listed with per-entry errors; delete refused while held or unconfirmed profiles.test.ts, browser-session.test.ts, browser.test.ts, QA log
Docs Read the diff README, SECURITY.md, docs/releases/UNRELEASED.md Explain what a profile stores, the basic cookie store without a keyring, and which accounts to keep out Diff
Repo checks typecheck, lint, coverage, build, PickCheck Full suite with the real browser required Pass: 3,184 tests, lines 89.6%; PickCheck 0 violations in 183 functions Local run at 248e523

QA pass: I drove the built CLI against real Chrome on the lab's private Xvfb, with an isolated PICKFORGE_HOME and a small local cookie server. The pass found the lost-cookie bug, a misleading symlink message, and a list that failed on one bad entry. All three are fixed above and were rerun.

Declined as not needed for this change: claiming the hold before session creation, a sleep between lock retries, sweeping orphan lock files, and clearing singleton files during delete.

Rollback: revert this PR. Profiles stay on disk under ~/.pickforge/lab/profiles and can be removed by hand.

Council review, 3 rounds:

Delegate Round 1 Round 2 Round 3
GPT-6 Astra 6/10 7/10 9/10
Fable 5.1 8/10 8/10 not run
Kimi K3.1 Pro 8/10 9/10 not run

@ElbertePlinio
ElbertePlinio merged commit 373fa32 into main Oct 28, 2026
10 checks passed
@ElbertePlinio
ElbertePlinio deleted the feat/339-browser-profiles branch October 28, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

browser: persistent named login profiles

1 participant