← Back to Pull requests

fix(bot-desktop): floor the browser selection on the profile's Chromium version #135947

Open
unknown opened this pull request with 601 lines diff across 7 files
View on GitHub
unknown unknown commented on Oct 10, 2026 03:14 UTC
Author

What does this PR do?

hermes update provisions the PM tool environment, which exports AGENT_BROWSER_EXECUTABLE_PATH pinned to the PM Chromium (currently 145). tools/bot_desktop/browser.py::executable() honors that variable first, so after an update the Bot Desktop launches an older Chromium than the one that last wrote its persistent user-data-dir — and Chromium SIGTRAPs (rc -5) opening a jar written by a newer build, right after opening the DevTools endpoint, which the browser tool reports as CDP response channel closed on every profile.

This PR floors the selection on the profile: executable() accepts the profile's user-data-dir, and when the chosen binary's major version is lower than the version Chromium recorded in <user-data-dir>/Last Version, the bundled/system finders are consulted for a build that can still open it (the pre-update selection path: the newest Playwright Chromium in ~/.cache/ms-playwright). The floor applies to the explicit pin and to every fallback candidate alike:

  • explicit pin opens the profile → kept, exactly as before (zero behavior change);

  • explicit pin is older and a newer bundle/system build exists → that build is selected, so the dock icon, the agent's browser and the status pane all agree on the browser that will really start;

  • nothing newer exists → the explicit pin stands (every candidate crashes the same way, and the user chose that pin);

  • no Last Version yet (first run) or an unprobeable binary → never blocks a launch, and no version probe runs at all without profile knowledge.
  • The binary version probe runs <exe> --version (argument list, no shell) once per path via lru_cache.

    Related Issue

    Fixes #135932

    Type of Change

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

  • tools/bot_desktop/browser.py: executable() takes an optional keyword-only profile and applies the version floor; new helpers _chromium_major (cached --version probe), _profile_chromium_major (Last Version parser), _opens_profile (fail-open comparison).

  • tools/bot_desktop/browser.py: dock_launch() and env_for_agent() pass the profile's user-data-dir so the dock and the agent get the same floored selection.

  • tools/bot_desktop/runtime.py: the status probe's browser field reports the floored selection too.

  • tests/tools/test_bot_desktop_browser.py: adapt two executable mocks to the new keyword-only parameter.

  • tests/tools/test_bot_desktop_browser_executable_guard.py: new — the fallback contract, the keep/stand cases, first-run profiles, the Last Version parser and the real --version line parse.
  • How to Test

    1. python -m pytest tests/tools/test_bot_desktop_browser_executable_guard.py tests/tools/test_bot_desktop_browser.py tests/tools/test_bot_desktop_runtime.py tests/tools/test_local_env_bot_desktop.py -q → Observed result: 42 passed, 7 skipped, 0 failed (the 7 skips are pre-existing host-dependent skips).
    2. The guard tests fail on upstream/main (the keyword and helpers do not exist there) and pass with this change.
    3. python scripts/check --base upstream/main → Observed result: scripts/check: 11 checks, ok.

    Checklist

    Code

  • I've read the Contributing Guide

  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)

  • I searched for existing PRs to make sure this isn't a duplicate

  • My PR contains only changes related to this fix/feature (no unrelated commits)

  • I've run pytest tests/ -q and all tests pass

  • python scripts/check passes (the blocking lint and code-health checks CI runs)

  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)

  • I've tested on my platform: macOS 15 (arm64); the guarded path is exercised by the new unit tests, the Linux dock path is unchanged when no profile version is known
  • Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — docstrings on executable() and the new helpers document the floor

  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A

  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A

  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — Last Version reads use utf-8-sig, the --version probe pins encoding="utf-8", errors="replace"

  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A
  • Diff: 601 lines (+450 / -151) across 7 files Reviewer: PRATHAMESH75 Review duration: 79042m
    All Vouch review confidence checks passed
    Residual risk 0.34 = Change Risk (0.57) × (1 − Review Confidence (0.41)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.57 · 601 lines diff across 7 files
    0.57
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    40%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.383
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #135947"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 40.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 57.1% (MEDIUM) · Higher = larger blast radius
    57.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 40.9% · Lower = rushed or shallow review
    40.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 33.7% · Safe to merge
    33.7%