mirror of https://github.com/garrytan/gstack.git
The Bun.spawn polyfill omitted `proc.exited`, so eight call sites in
browse/src/ that `await proc.exited` (DPAPI decryption, isBrowserRunning,
browser-skill-commands, cli, terminal-agent) silently no-op on Windows —
the await resolves to `undefined` immediately, the caller reads stdout
before the child has produced anything, and the operation looks like a
silent failure. Most visible symptom: cookie picker's DPAPI helper
reports `DPAPI decryption failed:` with empty stderr.
Adding `proc.exited` exposes the second-order issue: every consumer that
awaits exited *before* reading stdout hits `Response body disturbed or
locked`, because Node's auto-flowing Readable has already drained by the
time the consumer wraps it. `Readable.toWeb()` (Node 18+) hands the
consumer a buffered Web ReadableStream that behaves like Bun's native
API regardless of read order. Falls back to the raw Node Readable on
Node < 18 so the polyfill stays backward-compatible.
The test file's existing `require('${polyfillPath}')` interpolation
escaped its backslashes on Windows, so the tests had been silently
unrunnable there; a `.replace(/\/g, '/')` on the resolved path fixes
the interpolation and lets the new regressions run on the
windows-free-tests matrix.
Test plan
- bun test browse/test/bun-polyfill.test.ts — 7 pass (3 new + 4 existing)
- bun test browse/test/cookie-import-browser.test.ts — 22 pass
- bun test (full suite) — passes; the unrelated batch.test.ts
beforeEach-timeout flake is the only fail and is present on main.
Related: #764 (Windows cookie import), PR #392 (open WIP for full DPAPI
+ v20 fallback support — this PR is strictly scoped to the polyfill so
it can land independently of that broader effort).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| bin | ||
| scripts | ||
| src | ||
| test | ||
| PLAN-snapshot-dropdown-interactive.md | ||
| SKILL.md | ||
| SKILL.md.tmpl | ||