Repository navigation
refactor: Fix chrome process and server fails, update webdriverio to v10.1.0 - #181
Conversation
….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>
[Medium impact] The latest changes appear safe to merge; both previous cleanup findings are addressed. SummaryThis PR updates WebdriverIO to 10.1.0, improves tool error messages, adjusts documentation search, and adds cleanup for local Chrome processes.
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
Reviews (2) · Last reviewed commit: "fix(session): Match driver processes by ..." · Reviewed by Greptile |
| 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); |
There was a problem hiding this comment.
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.
| export function killAllDriverTrees(): void { | ||
| for (const metadata of getState().sessionMetadata.values()) killPids(driverTree(metadata.driverPid)); |
There was a problem hiding this comment.
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>
Proposed changes
Types of changes
Checklist
Further comments
Reviewers: @webdriverio/project-committers