Skip to content

sync: harness 32d8d51#36

Merged
Alezander9 merged 1 commit intomainfrom
sync/harness-32d8d51
May 6, 2026
Merged

sync: harness 32d8d51#36
Alezander9 merged 1 commit intomainfrom
sync/harness-32d8d51

Conversation

@Alezander9
Copy link
Copy Markdown
Member

Summary

Brings browser-use/browser-harness up to 32d8d515e. 52 upstream commits since 59a166f.

Files updated (verbatim from upstream)

  • src/browser_harness/_ipc.pyBH_RUNTIME_DIR split from BH_TMP_DIR (PR #318, backward-compatible fallback); umask 0077 around AF_UNIX bind to remove chmod TOCTOU (PR #309); ping/identify hardening against non-dict / non-positive-pid responses (PR #294).
  • src/browser_harness/admin.py — PID-reuse safety in restart_daemon via _process_start_time fingerprint (Linux /proc, macOS ps -o lstart, Windows GetProcessTimes) + new identify() helper (PR #294).
  • src/browser_harness/daemon.py — Chrome Canary profile discovery on macOS + Windows (PR #263); Brave on Windows (PR #284); /json/version 404 → ws://127.0.0.1:<port><ws_path> fallback for Chrome 147+ default user-data-dir, IPv6 host bracketing (PR #292); set_session enables Page/DOM/Runtime/Network for parity with initial attach (PR #296).
  • src/browser_harness/helpers.pycurrent_tab resolves target_id server-side via daemon meta (PR #305); wait_for_network_idle filters events by session_id so background tabs don'''t poison idle (PR #296).
  • src/browser_harness/run.py — explicit BU_CDP_URL / BU_CDP_WS blocks cloud auto-bootstrap; previously the explicit endpoint was silently overridden (PR #300).
  • tests/unit/{test_admin,test_helpers,test_run}.py — updated for the changes above. New: tests/unit/test_daemon.py, tests/unit/test_ipc.py.
  • README.md — banner asset URL switched to ink-bleed SVG (PR #285).
  • .github/VOUCHED.td — two bot/fabricated-profile exclusions (PRs #308, #310).

Excluded paths (skipped per UPSTREAM.md §3)

  • 8 new domain-skills additions upstream (agentlist, browser-use-cloud, freewheel-mrm, tasksquad-ai, vercel, x — PRs #281, #282, #283, #288, #301, #302) plus shopify-admin reorg/cleanup. Skipped.

Divergences

  • (no change) — only .gitignore (.venv/) remains, untouched in this window.

BrowserCode integration impact

  • None required for this sync. browser-execute.ts continues to set BH_TMP_DIR=ctx.bhTmpDir; BH_RUNTIME_DIR falls back to BH_TMP_DIR so behavior is unchanged.
  • Future improvement (logged in UPSTREAM.md sync row): pass BH_RUNTIME_DIR separately from BH_TMP_DIR to lift the AF_UNIX 104-byte budget off the persistent path. Out of scope for this sync.

Verification

  • script/check-harness-diff.sh: only known .gitignore divergence remains.
  • uv run python -c "from browser_harness import run, helpers, daemon, admin, _ipc; print('''imports ok''')"imports ok.
  • uv run browser-harness --version0.1.0.
  • uv run --with pytest pytest tests/unit/ -q → 76 passed.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 13 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/bcode-browser/harness/tests/unit/test_admin.py">

<violation number="1" location="packages/bcode-browser/harness/tests/unit/test_admin.py:401">
P2: Make this PID-reuse test deterministic by stubbing `_process_start_time`; otherwise it depends on whether PID 4242 exists on the runner and can flake instead of testing the reuse path.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

# Second identify() call (right before SIGTERM) returns None — simulating
# the daemon having exited and its PID having been reused by an unrelated
# process. The function must NOT escalate to SIGTERM in that state.
identify_responses = iter([live_pid, None])
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Make this PID-reuse test deterministic by stubbing _process_start_time; otherwise it depends on whether PID 4242 exists on the runner and can flake instead of testing the reuse path.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/bcode-browser/harness/tests/unit/test_admin.py, line 401:

<comment>Make this PID-reuse test deterministic by stubbing `_process_start_time`; otherwise it depends on whether PID 4242 exists on the runner and can flake instead of testing the reuse path.</comment>

<file context>
@@ -252,3 +252,278 @@ def fake_browser_use(path, method, body=None):
+    # Second identify() call (right before SIGTERM) returns None — simulating
+    # the daemon having exited and its PID having been reused by an unrelated
+    # process. The function must NOT escalate to SIGTERM in that state.
+    identify_responses = iter([live_pid, None])
+    monkeypatch.setattr(admin.os, "kill", fake_kill)
+    monkeypatch.setattr(admin.ipc, "identify", lambda name, timeout=5.0: next(identify_responses))
</file context>
Fix with Cubic

@Alezander9 Alezander9 merged commit 3d7f38f into main May 6, 2026
3 checks passed
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.

1 participant