Skip to content

sync: harness 04f7716#20

Merged
Alezander9 merged 1 commit intomainfrom
sync/harness-04f7716
Apr 29, 2026
Merged

sync: harness 04f7716#20
Alezander9 merged 1 commit intomainfrom
sync/harness-04f7716

Conversation

@Alezander9
Copy link
Copy Markdown
Member

Summary

Brings browser-use/browser-harness up to 04f7716. 7 upstream commits since fefca43.

Three groups of changes:

  • Windows fixes (PR #240, browser-harness)ensure_daemon warm probe now goes through ipc.connect instead of raw socket.AF_UNIX (which doesn't exist on Windows Python), so Windows users don't churn the daemon on every warm call. New BH_TMP_DIR env override so callers (e.g. browsercode per-session scratch) can redirect sock/port/pid/log + screenshots to a single dir. Drop DETACHED_PROCESS from Windows daemon spawn flags to suppress an empty python.exe console window.
  • chrome://inspect tab flooding (PR #232, browser-harness) — new _open_inspect=False flag on ensure_daemon; run_setup passes it to avoid spawning new tabs in a recovery loop.
  • Skill rename (PR #242, browser-harness)SKILL.md frontmatter name: browser-harnessbrowser; same for install.md. Pure end-user surface change (slash command /browser); no integration code on our side references it.

Files updated

  • packages/bcode-browser/harness/src/browser_harness/_ipc.pyBH_TMP_DIR override, spawn-flag fix
  • packages/bcode-browser/harness/src/browser_harness/admin.pyipc.connect warm probe, _open_inspect flag, drop unused _paths() helper
  • packages/bcode-browser/harness/src/browser_harness/helpers.pycapture_screenshot and debug-click overlay route through ipc._TMP
  • packages/bcode-browser/harness/SKILL.md, packages/bcode-browser/harness/install.md — skill name rename

All changes are in the protected src/browser_harness/*.py zone — taken upstream verbatim per harness-sync.md policy.

Divergences

No change. Still just .gitignore adding .venv/.

Verification

  • Smoke test: uv run python -c "from browser_harness import run, helpers, daemon, admin, _ipc"imports ok
  • uv run browser-harness --version0.1.0
  • PR #240 was independently end-to-end tested on Linux against headless Chrome before this sync (in the originating Slack thread) — ensure_real_tab, page_info, js, capture_screenshot (lands in BH_TMP_DIR), click_at_xy, scroll, plus PID-stable warm-probe verification.
  • User also confirmed end-to-end tested PR #240 on Mac.

Sync log

UPSTREAM.md row appended.

7 upstream commits since fefca43. Windows fixes (#232, #240) +
skill rename (#242). All in the protected src/browser_harness/
zone — taken verbatim. No divergences touched.

Files:
- src/browser_harness/_ipc.py: BH_TMP_DIR override; drop DETACHED_PROCESS
- src/browser_harness/admin.py: ensure_daemon warm probe via ipc.connect
- src/browser_harness/helpers.py: screenshot + debug-click via ipc._TMP
- SKILL.md: name: browser-harness -> browser
- install.md: name: browser-harness-install -> browser-install
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 6 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/src/browser_harness/helpers.py">

<violation number="1" location="packages/bcode-browser/harness/src/browser_harness/helpers.py:235">
P2: Ensure the screenshot parent directory exists before writing, otherwise `BH_TMP_DIR` values that don't already exist will cause `capture_screenshot()` to fail with `FileNotFoundError`.</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.

"""Save a PNG of the current viewport. Set max_dim=1800 on a 2× display to
keep the file under the 2000px-per-side limit some image-aware LLMs enforce."""
path = path or str(Path(tempfile.gettempdir()) / "shot.png")
path = path or str(ipc._TMP / "shot.png")
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Apr 28, 2026

Choose a reason for hiding this comment

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

P2: Ensure the screenshot parent directory exists before writing, otherwise BH_TMP_DIR values that don't already exist will cause capture_screenshot() to fail with FileNotFoundError.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/bcode-browser/harness/src/browser_harness/helpers.py, line 235:

<comment>Ensure the screenshot parent directory exists before writing, otherwise `BH_TMP_DIR` values that don't already exist will cause `capture_screenshot()` to fail with `FileNotFoundError`.</comment>

<file context>
@@ -232,7 +232,7 @@ def scroll(x, y, dy=-300, dx=0):
     """Save a PNG of the current viewport. Set max_dim=1800 on a 2× display to
     keep the file under the 2000px-per-side limit some image-aware LLMs enforce."""
-    path = path or str(Path(tempfile.gettempdir()) / "shot.png")
+    path = path or str(ipc._TMP / "shot.png")
     r = cdp("Page.captureScreenshot", format="png", captureBeyondViewport=full)
     open(path, "wb").write(base64.b64decode(r["data"]))
</file context>
Suggested change
path = path or str(ipc._TMP / "shot.png")
path = Path(path) if path else ipc._TMP / "shot.png"
path.parent.mkdir(parents=True, exist_ok=True)
path = str(path)
Fix with Cubic

@Alezander9 Alezander9 merged commit eaf358e into main Apr 29, 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