feat(browser): close-with-approval flow for Windows real-profile (toggle arms, agent asks, blocked if still locked) [proof do-not-merge]

Refines the Windows path per three requirements:
1. Only when the toggle is set — closing is offered only if
   browser.real_profile_autoclose is on.
2. Blocked when locked — snapshot_real_profile NEVER kills; a locked profile
   always returns the [profile-locked] signal and the copy is refused. A later
   attempt that is still locked blocks again (no loop, no auto-kill).
3. Ask approval to close — closing is an explicit, user-approved step:
    (new CLI subcommand) runs
   close_browser_holding_profile only when the agent has the user's OK. The
   locked error tells the agent to ask first, then run it, then retry.

- browser_connect: snapshot blocks with _PROFILE_LOCKED_PREFIX (autoclose-armed
  message offers the close; off message says fully-quit); no in-snapshot kill.
- main.py:  subcommand (identity+binding-verified
  tree kill via close_browser_holding_profile); added to _BUILTIN_SUBCOMMANDS.
- browser_tool: surfaces the locked signal + the exact approved-close command.
- Docs/config: toggle arms + agent asks + blocked-if-still-locked.

Tests: snapshot blocks-not-kills with autoclose on AND off; process matcher
identity/binding. 73 real-profile tests pass. Windows live E2E (proof): locked
blocks fast without killing → approved close terminates Chrome → snapshot then
copies a valid DB; autoclose-off blocks with quit guidance.
This commit is contained in:
Teknium
2026-08-26 19:10:21 -07:00
parent 00d5632249
commit e4451ec6e5
8 changed files with 339 additions and 60 deletions
@@ -0,0 +1,62 @@
name: Windows real-profile live E2E
# ON-DEMAND PROOF (real-profile browsing, PR #95620 — Windows close-with-approval).
#
# Proves on a REAL windows-latest runner that a running Chrome holding the
# profile makes snapshot BLOCK (never kill/hang), the explicit approved close
# then terminates Chrome and releases the lock, and snapshot then succeeds.
#
# PROOF workflow — reverted before merge; must not land on main. Per-sha
# concurrency + no cancel-in-progress so runs complete.
on:
push:
branches:
- "feat/real-profile-cdp"
permissions:
contents: read
concurrency:
group: windows-realprofile-e2e-${{ github.sha }}
cancel-in-progress: false
jobs:
real-profile-e2e:
name: real-profile close-with-approval live E2E (windows-latest)
runs-on: windows-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Google Chrome
shell: pwsh
run: choco install googlechrome --no-progress -y --ignore-checksums
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # 8.2.0
with:
version: "0.9.28"
enable-cache: true
cache-dependency-glob: |
pyproject.toml
uv.lock
- name: Set up Python 3.11
uses: ./.github/actions/retry
with:
command: uv python install 3.11
- name: Install dependencies
uses: ./.github/actions/retry
with:
command: uv sync --locked --python 3.11 --extra dev
- name: Run real-profile close-with-approval live E2E
shell: bash
run: |
set -uo pipefail
uv run --no-sync python -m pytest \
tests/hermes_cli/test_real_profile_windows_live.py \
-o addopts= -v -s -p no:cacheprovider