The browser skill's browser closes within seconds of its session's end

The test timed out because the skill itself was slow, not because the test waited too briefly. A session's browser stayed behind just as long for a real user.

Cause

  1. When the session's process ends, the skill's holder process notices within a second and asks Chrome to shut down in an orderly way.
  2. On a busy machine, that orderly shutdown takes 6 to over 10 seconds. The holder waited up to 10 s for it before exiting.
  3. One run of the full suite under load, logged from inside the holder: the session's end was noticed after 0.4 s. Chrome hadn't finished closing 10 s later, so the 10 s fallback ran out. The test's 10 s wait was over before that.

Fix

The holder now gives Chrome 2 s to close on its own, then exits. When it exits, Playwright kills Chrome's process tree and removes its temporary profile. A graceful shutdown keeps nothing worth having: the profile is thrown away either way.

Time from the session's end until the browser is gone

Chrome frozen on purpose (SIGSTOP) to stand in for a shutdown that drags on. The new test does the same.

Before
10.8 s
After
2.8 s

Both times Chrome ended up killed and its profile removed; the difference is how long it stayed behind. Without the freeze, on an idle machine, the browser goes in about 1 s, as before.

Full test suite under load

bun test --parallel with 6 extra busy processes (yes > /dev/null) on this Mac.

RunResultDuration
1browser skill: all pass · 1811 pass, 0 fail86 s
2browser skill: all pass · 1810 pass, 1 fail (another test)95 s
3browser skill: all pass · 1810 pass, 2 fail (other tests)142 s
4browser skill: all pass · 1810 pass, 2 fail (other tests)111 s

The other failures, in five other test files, are other tests timing out on the loaded machine; they have nothing to do with closing the browser. The new test fails on the old code (the browser still isn't gone after 6 s) and passes on the new one.