Skip to content

refactor: Fix chrome process and server fails, update webdriverio to v10.1.0 - #181

Merged
Winify merged 13 commits into
mainfrom
chore/wdio-10.1.0
Oct 30, 2026
Merged

Winify merged 13 commits into
mainfrom
chore/wdio-10.1.0

Conversation

@Winify

@Winify Winify commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Proposed changes

Types of changes

  • Polish (an improvement for an existing feature)
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (improvements to the project's docs)
  • Specification changes (updates to WebDriver command specifications)
  • Internal updates (everything related to internal scripts, governance documentation and CI files)

Checklist

  • I have squashed commits that belong together
  • I have tested with Claude Desktop (or another MCP-compatible client)
  • I have read the CONTRIBUTING doc
  • I have added the necessary documentation for new/changed tools (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Further comments

Reviewers: @webdriverio/project-committers

Winify and others added 12 commits October 29, 2026 20:14
….1.0

@wdio/protocols stays at 10.0.2; no 10.1.0 was published.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
webdriver 10.1.0 rejects commands after the browser or driver closed the
connection with errors named "session ended", which @wdio/session's dead
session patterns do not match. errorResult now keeps the original message
and hint and adds a note that the session has ended, also for SESSION_DIED.
The note stays neutral because the same error follows an intentional
close_session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every tool catch built its own `Error X: ${e}` text, which doubled the
prefix for Error objects ("Error navigating: Error: boom") and skipped the
ended-session note. Tools now return errorResult(e, prefix): the prefix is
kept, a distinctive error name (e.g. "stale element reference") is kept,
and SessionError hints and the ended-session note are appended.

- mock.tool.ts drops its local helper.
- emulate_device's unknown-device result is now flagged isError.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a hung page deleteSession fails and webdriver SIGKILLs only the
chromedriver pid, orphaning ~11 Chrome processes per session.

- Local Chrome (not on Windows) spawns chromedriver detached, so it leads
  its own process group; start_session stores its pid on the session.
- When deleteSession fails, in close_session or when a session is replaced,
  the whole group is SIGKILLed.
- Shutdown kills remaining local driver groups after 3.5s, before MCP
  clients escalate to SIGKILL (~4s), and again on process exit; the 5s
  shutdown timeout for cloud teardown is unchanged.

Verified live on a hung page: 0 leftover Chrome/chromedriver processes for
close_session, client shutdown, normal close, and replaced sessions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ueries

- A chunk's trail now names the sections it starts in, and each hit's trail
  is resolved at the excerpt's first line instead of the chunk's last heading.
- Adjacent query words are also scored joined (`test runner` -> `testrunner`)
  against titles only, so compounds the corpus spells as one token match.
- The name boost now applies to path terms only; title words already score
  in the title field, so boosting them too counted them twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- User spawnOpts can no longer set detached: false and silently disable
  the chromedriver process-group kill.
- A session's driverPid is cleared once deleteSession succeeds, so a
  shutdown group kill that runs while its tunnel is still stopping
  cannot SIGKILL a reused pid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No package in the tree depends on fast-xml-parser, so the override
had no effect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- puppeteer-core ^25 is inside webdriverio 10.1.0's peer range and
  dedupes with the copy @wdio/electron-service already pulls, leaving one
  puppeteer-core in the tree.
- @types/node ^22 matches the lowest supported Node in engines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vite reached the tree only as a peer of vitest and @vitest/mocker, so the
locked vite@7.3.1 was kept even though the override asks for ^7.3.2.
Re-resolving moves it to 7.3.7 and drops the esbuild 0.27.7 copy it pulled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- docs-index: one headingLines() generator holds the fence state machine
  for both chunkCorpus and trailAt; search() scores through a scoreToken()
  helper; each hit's text is split once. query_docs output is unchanged.
- spawnsDetachedDriver() in the local browser provider is the single rule
  for detaching chromedriver and recording its pid, so Windows sessions no
  longer store a pid the group kill would ignore.
- emulate_device rethrows to its outer catch, mock tools share one error
  context constant, and errorMessage() narrows its own input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d group

Spawning chromedriver detached let a failed teardown kill its Chrome
children, but it also moved them out of the server's process group, so a
SIGKILL of that group left chromedriver and ~12 Chrome processes running.

- chromedriver is spawned normally again; user chromedriver options pass
  through untouched and no longer appear in generated session code.
- Before deleteSession, the driver's process tree is listed with ps;
  webdriver SIGKILLs only the driver pid on failure, after which its
  children are reparented and cannot be found. A failed delete kills the
  captured pids.
- Shutdown and exit kill each live session's tree; ps runs only when a
  driver pid is known.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- start_session: os/osVersion are provider-native values passed as-is;
  Digital.ai app refs are cloud:<name>.
- get_accessibility covers web contexts (browser, Electron), not native
  mobile; get_elements filters by viewport, containers and pagination.
- CLAUDE.md: type-check note names the global TypeScript 7 failure;
  Digital.ai app refs use cloud:<name>.
- Drop the unregistered browserstack.tool.ts and the TestingBot
  `testingbotLocal` alias that no schema exposes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Winify Winify changed the title Chore/wdio 10.1.0 refactor: Fix Oct 29, 2026
@Winify Winify changed the title refactor: Fix refactor: Fix chrome process and server fails, update webdriverio to v10.1.0 Oct 29, 2026
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The latest changes appear safe to merge; both previous cleanup findings are addressed.

Summary

This PR updates WebdriverIO to 10.1.0, improves tool error messages, adjusts documentation search, and adds cleanup for local Chrome processes.

  • Local Chrome sessions clean up lingering browser processes when they close.
  • Browser tools give callers clearer errors when an action fails.
  • Documentation search finds joined terms and points to the excerpt’s section.
  • The standalone BrowserStack app tool is removed.
  • The project updates WebdriverIO and its working guidance.
  • TestingBot reads its tunnel setting from the tunnel option.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Start local Chrome session] --> B[Save driver and Chrome identities]
  B --> C[Close session]
  C --> D[Save current process tree]
  D --> E[Call deleteSession]
  E -->|Fails or times out| F[Kill processes with matching identities]
  D --> G[Shutdown fallback]
  G --> F
  E -->|Succeeds| H[Clear saved tree]
  F --> H
Loading

Reviews (2) · Last reviewed commit: "fix(session): Match driver processes by ..." · Reviewed by Greptile

Comment thread src/session/driver-tree.ts Outdated
Comment on lines +24 to +28
const entries = processes ?? listProcesses();
const tree = [pid];
for (let i = 0; i < tree.length; i++) {
for (const { pid: childPid, ppid } of entries) {
if (ppid === tree[i] && !tree.includes(childPid)) tree.push(childPid);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Cleanup can kill another application

If ChromeDriver dies and the OS gives its saved PID to another process before cleanup runs, driverTree collects that unrelated process and its children. Closing the session or stopping MCP then sends them SIGKILL. Save and check the original process identity, such as its start time, before killing a stored PID.

Comment thread src/session/lifecycle.ts Outdated
Comment on lines +221 to +222
export function killAllDriverTrees(): void {
for (const metadata of getState().sessionMetadata.values()) killPids(driverTree(metadata.driverPid));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Chrome can survive server shutdown

killAllDriverTrees rebuilds each tree instead of using the tree captured before deleteSession. If ChromeDriver exits while deletion is still waiting, surviving Chrome children are no longer under that PID. The shutdown fallback misses them, and MCP exits after five seconds, before the 90-second deletion timeout can kill the saved tree. Keep the pre-deletion tree available to the shutdown fallback, with process-identity checks.

Capture chromedriver and its Chrome children with their process start
time at session start, and re-check pid + start time before every
SIGKILL, so a recycled PID is never signalled. Chrome reparented after a
chromedriver crash is now still found and killed on close.

The shutdown fallback reuses the tree captured before deleteSession and
drops it once the delete settles. Lifecycle tests no longer send real
signals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Winify
Winify merged commit 3ab11dc into main Oct 30, 2026
6 checks passed
@Winify
Winify deleted the chore/wdio-10.1.0 branch October 30, 2026 10:31
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