Skip to content

feat(mcp): add playwright preset to hermes mcp add - #68488

Open
ygd58 wants to merge 3 commits into
NousResearch:mainfrom
ygd58:fix/mcp-playwright-preset-v2
Open

feat(mcp): add playwright preset to hermes mcp add#68488
ygd58 wants to merge 3 commits into
NousResearch:mainfrom
ygd58:fix/mcp-playwright-preset-v2

Conversation

@ygd58

@ygd58 ygd58 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Context

Ports #63771 forward onto current main per @teknium1's review.

Fix

Adds @playwright/mcp to the built-in MCP preset registry alongside the existing codex preset. Browser detection now reuses hermes_cli.browser_connect.get_chrome_debug_candidates() -- the same platform-aware resolver CDP-attach uses -- instead of a bespoke shutil.which() name list, so macOS .app bundles and Windows install directories (including the WSL /mnt/c mirror) are correctly detected rather than misclassified as absent.

  • codex preset preserved alongside playwright
  • --no-sandbox added only on Linux when euid==0 (root/VPS/Docker)
  • --browser=chromium fallback added only when no system browser is found
  • Dropped the incorrect Fixes #19760 reference (unrelated, closed Nix build issue)

Verification

9/9 new tests pass in TestPlaywrightMcpPreset; 67/67 in the full tests/hermes_cli/test_mcp_config.py file.

Ports NousResearch#63771 forward onto current main per teknium1's review.

Adds @playwright/mcp to the built-in MCP preset registry alongside the
existing codex preset. Per review: browser detection now reuses
hermes_cli.browser_connect.get_chrome_debug_candidates() -- the same
platform-aware resolver CDP-attach uses -- instead of a bespoke
shutil.which() name list, so macOS .app bundles and Windows install
directories (including the WSL /mnt/c mirror) are correctly detected
as a present system browser rather than misclassified as absent.

- codex preset preserved alongside playwright
- --no-sandbox added only on Linux when euid==0 (root/VPS/Docker)
- --browser=chromium fallback added only when get_chrome_debug_candidates()
  finds no system browser
- Dropped the incorrect 'Fixes NousResearch#19760' reference (that issue is the
  unrelated, closed Nix npmDepsHash build failure)

9/9 new tests pass in TestPlaywrightMcpPreset; 67/67 in the full
tests/hermes_cli/test_mcp_config.py file.
@alt-glitch alt-glitch added type/feature New feature or request comp/cli CLI entry point, hermes_cli/, setup wizard tool/mcp MCP client and OAuth tool/browser Browser automation (CDP, Playwright) P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows labels Jul 21, 2026
…eset

Per teknium1's review of NousResearch#63771 ('add macOS/Windows non-PATH tests'),
only the macOS .app-bundle case was added. Add the matching Windows
standard-install-directory case, confirming the platform-aware
get_chrome_debug_candidates() resolver -- not a bare shutil.which()
name list -- is what determines browser availability on Windows too.

68/68 tests pass in tests/hermes_cli/test_mcp_config.py.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for carrying the Playwright preset forward and reusing the existing platform-aware browser resolver.

Problems

  • Blocking: hermes_cli/mcp_config.py:59 adds a bare os.geteuid() call. The PR's required Windows footguns CI job failed on this exact line because os.geteuid does not exist on native Windows, and the repository checker requires an explicit hasattr/getattr guard even when the expression is short-circuited by sys.platform == "linux".

Suggested changes

  • Make the root check explicitly Windows-safe with getattr or hasattr, preserving the current Linux-root behavior, then rerun python scripts/check-windows-footguns.py --all.

This is an automated hermes-sweeper review.

Comment thread hermes_cli/mcp_config.py Outdated
extra: list[str] = []

# Root/AppArmor safety flag (Linux-only).
if sys.platform == "linux" and os.geteuid() == 0:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Blocking: the required Windows-footguns CI job rejects this bare os.geteuid() reference because that attribute is absent on native Windows. Please use an explicit getattr/hasattr guard while retaining the Linux-root condition.

@teknium1 teknium1 added the sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform label Jul 30, 2026
Follow-up per review of NousResearch#68488.

sys.platform == "linux" short-circuits the bare os.geteuid() call at
runtime, but the required windows-footguns CI checker (scripts/check-
windows-footguns.py) rejects any bare os.geteuid/getuid/getgid
reference statically, regardless of the surrounding guard -- it can't
prove the short-circuit at the AST level, only recognizes an explicit
hasattr/getattr guard.

Fixed to hasattr(os, "geteuid") and os.geteuid() == 0, matching the
established pattern already used for the identical Linux-root check
elsewhere in the codebase (hermes_cli/main.py:5736).

Verified: python scripts/check-windows-footguns.py --all now passes
clean (0 footguns, 788 files scanned). 68/68 tests pass in the full
tests/hermes_cli/test_mcp_config.py file (no regression).
@ygd58

ygd58 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Fixed -- changed to hasattr(os, "geteuid") and os.geteuid() == 0, matching the identical Linux-root check pattern already used at hermes_cli/main.py:5736. Ran python scripts/check-windows-footguns.py --all directly: 0 footguns, 788 files scanned. 68/68 tests pass.

@GottZ

GottZ commented Aug 3, 2026

Copy link
Copy Markdown

This was generated by AI during triage.

Summary

Fifteen PRs address or reference this complex: twelve Nix changes range from one-line TUI/web/desktop hash refreshes through hash-check automation to the merged importNpmLock removal of the drifting-hash class. The other three are successive Playwright MCP preset implementations: #19768 used incomplete browser detection, #63771 added tests/docs but still missed non-PATH macOS/Windows installs, and #68488 reuses the repository's platform-aware resolver and includes the requested Windows-safe root guard.

Related pull requests

Duplicates

#17133 is the hash-only subset of #17174; #19764 and #19766 contain the same TUI hash change; #48213 and #48883 contain substantially the same importNpmLock solution, with #48883 as the merged current-main salvage. #19768, #63771, and #68488 are successive Playwright-preset implementations, with #68488 carrying forward and correcting the reviewed deficiencies rather than being an identical diff.

Suggested consolidation

Keep #68488 open with a salvage path: retain its platform-aware resolver reuse, preserved codex preset, tests, and documentation, then obtain contributor re-review of the amended head. This does not bypass the visible keep-open/blocking review: the shown diff now contains the requested hasattr(os, "geteuid") guard, while #19768 and #63771 are already-closed superseded iterations and the Nix PRs are resolved historical implementations or duplicates.

Complex graph

flowchart LR
    classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
    classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
    classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
    classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
    classDef best stroke-width:3px,stroke:#b45309
    classDef target stroke-width:3px,stroke:#4338ca
    subgraph Dup19768 ["PRs duplicating each other"]
        P19768["PR #19768 (closed)"]
        P63771["PR #63771 (closed)"]
        P68488["PR #68488 (open)"]
    end
    class P19768 closed
    class P63771 closed
    class P68488 open
    class P68488 target
    click P19768 "https://github.com/NousResearch/hermes-agent/pull/19768"
    click P63771 "https://github.com/NousResearch/hermes-agent/pull/63771"
    click P68488 "https://github.com/NousResearch/hermes-agent/pull/68488"
Loading

Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label).

Cross-PR triage: Reviewed 15 pull requests and 5 issues in this complex. Each diff was read against this issue; Assessment working set: 79 kB of PR diffs, 45 kB of issue/PR text, 24 kB of discussion (47 comments), 47 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

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 sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows tool/browser Browser automation (CDP, Playwright) tool/mcp MCP client and OAuth type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants