You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: US-027 - Pi headless tests running in-VM (native ESM)
Four bridge compatibility fixes enable Pi to boot and produce LLM-backed
output running inside the sandbox VM via kernel.spawn():
1. TextDecoder subarray fix (execution-driver.ts): V8_POLYFILLS TextDecoder
ignored byteOffset/byteLength of Uint8Array views, causing the Anthropic
SDK's LineDecoder to return corrupted SSE event lines.
2. Fetch Headers serialization (bridge/network.ts): The SDK passes Headers
instances (not plain objects) to fetch. JSON.stringify(Headers) produces
{} — normalize to plain Record before serialization.
3. Response body async iterator (bridge/network.ts): Add Symbol.asyncIterator
and Promise.resolve-based reader (not async function) to minimize microtask
overhead for the SDK's ReadableStreamToAsyncIterable.
4. V8 event loop microtask drain (session.rs): After the main event loop
exits (all bridge promises resolved), run additional microtask checkpoints
in a loop, re-entering the event loop if new bridge calls are created.
This handles deeply nested async generator yield chains across loaded ESM
modules (e.g., SDK SSE parser).
Test results: 5/6 pass (bash tool test skipped without WASM binaries).
0 commit comments