Skip to content

fix(edge): Chrome tear-down never fails a job, and never leaves an orphan - #84

Merged
mayoalexander merged 1 commit into
mainfrom
fix/cdp-teardown
Sep 18, 2026
Merged

mayoalexander merged 1 commit into
mainfrom
fix/cdp-teardown

Conversation

@mayoalexander

Copy link
Copy Markdown

close() raced Chrome's helpers and threw ENOTEMPTY out of a finally (a successful export could exit non-zero); a launch timeout orphaned a headless Chrome. Now: wait for exit, retry the delete, swallow a leftover temp dir; process-group kill. 6/6 clean cycles, 3 forced timeouts, zero strays. src/cli/cmd 1537/0.

🤖 Generated with Claude Code

…phan

Two ways the browser used by export/verify could hurt a run that had
succeeded:

1. close() deleted Chrome's temp profile 120ms after SIGTERM, while Chrome's
   helpers were still writing into it. rmSync threw ENOTEMPTY out of a
   `finally`, turning a successful export into a failed one. Now it waits for
   the process to exit, retries the delete, and a leftover temp folder is
   swallowed — it is never worth failing a job over.

2. Killing only the spawned pid left a headless Chrome orphaned for 21 minutes
   after a launch that timed out. Chrome now starts in its own process group
   and tear-down kills the group, in both the timeout path and close().

Verified: 6/6 launch→inspect→close cycles clean; 3 forced launch timeouts;
zero stray Chromes and zero leftover profiles after both. Full src/cli/cmd
suite 1537/0; reference suite 28/28.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K9LZmfMCptv6tUqxryDrTx
@mayoalexander
mayoalexander merged commit 7b7df19 into main Sep 18, 2026
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