Skip to content

fix(browser): snapshot live macOS profile databases - #111670

Closed
KoNit-K wants to merge 1 commit into
NousResearch:mainfrom
KoNit-K:fix/macos-live-profile-snapshot
Closed

KoNit-K wants to merge 1 commit into
NousResearch:mainfrom
KoNit-K:fix/macos-live-profile-snapshot

Conversation

@KoNit-K

@KoNit-K KoNit-K commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

This fixes real-profile snapshots on macOS when Google Chrome is still running. SQLite authentication databases are now opened as immutable read-only sources and backed up into a new sibling file, rather than writing into a previously used snapshot database. The completed backup atomically replaces the old file after its stale SQLite sidecars are removed, so an abandoned destination lock or WAL cannot make the browser profile appear unavailable.

Related Issue

Fixes #111647

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Changes Made

  • hermes_cli/browser_connect.py — opens Chrome auth databases through an immutable read-only SQLite URI, backs each one up to a fresh temporary sibling, removes obsolete destination SQLite sidecars, and atomically replaces the old snapshot file.
  • tests/tools/test_browser_real_profile.py — covers a live WAL source with a stale locked destination, verifies the immutable URI, and updates lock/WAL expectations for atomic snapshot replacement.

How to Test

  • scripts/run_tests.sh tests/tools/test_browser_real_profile.py -q — 82 passed.
  • .venv/bin/ruff check hermes_cli/browser_connect.py tests/tools/test_browser_real_profile.py — all checks passed.
  • CONTROL: the focused suite still verifies fresh snapshots, profile selection, owner-only permissions, and lock guidance alongside the new replacement path.

Evidence

  • BEFORE RED: writing a SQLite backup directly to a stale destination could return unavailable databases while the destination was locked; the new focused regression requires _copy_auth_file(...) is True with that lock present.
  • AFTER GREEN: scripts/run_tests.sh tests/tools/test_browser_real_profile.py -q completed with 82 passed, including the live-WAL and stale-destination-lock regression.
  • CONTROL: the same run retained the existing snapshot integrity and source-WAL sidecar coverage; ruff reported no diagnostics in either changed Python file.

Review follow-up

This is scoped to the macOS snapshot path. The regression models Chrome's live WAL and a prior Hermes destination lock locally; Windows sharing semantics and Docker publishing remain covered by their platform-specific CI paths rather than claimed as locally verified here.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've run relevant tests locally (see How to Test)
  • I've added tests for my changes
  • I've tested on my platform: macOS

Documentation & Housekeeping

  • Documentation update: N/A; the existing real-profile documentation already permits copying while Chrome is running
  • cli-config.yaml.example: N/A
  • CONTRIBUTING.md or AGENTS.md: N/A
  • Cross-platform impact considered
  • Tool descriptions/schemas: N/A

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have tool/browser Browser automation (CDP, Playwright) comp/cli CLI entry point, hermes_cli/, setup wizard labels Sep 15, 2026
KoNit-K pushed a commit to KoNit-K/hermes-agent that referenced this pull request Sep 17, 2026
@KoNit-K
KoNit-K force-pushed the fix/macos-live-profile-snapshot branch from b06c786 to 009e126 Compare September 17, 2026 13:54
KoNit-K added a commit to KoNit-K/hermes-agent that referenced this pull request Sep 17, 2026
@KoNit-K

KoNit-K commented Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer update: reconciled against current main in local commit 29e9408. The new immutable-profile snapshot regressions pass (2/2); Ruff and git diff --check are clean. The complete containing test file is not green on current main: test_relaunch_path_does_snapshot also fails unchanged on upstream main, while test_snapshot_failure_fails_closed reaches a live agent-browser session probe and times out in this environment. Neither failure is caused by this two-file PR. There are no reviews or unresolved threads. This is local-only pending separate authorization to rewrite/push the PR branch.

@KoNit-K
KoNit-K force-pushed the fix/macos-live-profile-snapshot branch from 009e126 to 29e9408 Compare September 20, 2026 09:29
@KoNit-K

KoNit-K commented Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

Published: the verified current-main reconciliation is now the PR head at 29e94081a2. The focused immutable-profile snapshot regressions remain green; no unresolved review threads remain.

KoNit-K commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Closing this PR because upstream has now resolved #111647 through merged #113080 with a different design decision. #113080 keeps locked auth-database handling fail-closed, improves the per-database error reporting, and updates the documentation so macOS/Linux no longer promise live profile copying while Chrome is running. This PR instead restores live snapshots via immutable SQLite reads, so its core premise no longer matches the direction that was accepted upstream. The current head was still valid and tested, but keeping this alternate policy carrier open would now mean arguing to reverse the WAL/consistency stance rather than completing the accepted fix.

@KoNit-K KoNit-K closed this Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have tool/browser Browser automation (CDP, Playwright) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS: real-profile snapshot fails with 3 databases unavailable while Chrome is running, contrary to docs

2 participants