|
78 | 78 | - bundlePolyfill() returns an IIFE — _loadFile must NOT re-wrap (double-wrapping discards inner result) |
79 | 79 | - CJS-to-ESM wrapper must use `let exports` not `const` — CJS modules (ajv) reassign exports |
80 | 80 | - Non-TTY stdin must emit "end" on resume when empty — without it, apps hang at readPipedStdin() |
| 81 | +- process.kill(self, signal) must dispatch signal handlers for non-fatal signals (SIGWINCH/SIGCHLD/SIGURG/SIGCONT) instead of exiting — Pi TUI sends SIGWINCH on startup |
| 82 | +- Any async bridge handler that waits for external data (like _stdinRead) MUST be in ASYNC_BRIDGE_FNS in session.rs — dispatch via _loadPolyfill.applySyncPromise blocks the V8 thread |
| 83 | +- Pi cli.js imports undici which fails in-VM — use PI_MAIN (dist/main.js) directly and call main() instead |
81 | 84 | - SSRF check in createDefaultNetworkAdapter blocks 127.0.0.1 — test network adapters need directFetch bypass for mock servers |
82 | 85 | - crypto polyfill (node-stdlib-browser) lacks randomUUID — augment with bridge _cryptoRandomUUID |
83 | 86 | - process.stdout.write(data, callback) callback must be invoked — Pi's flush Promise depends on it |
@@ -966,3 +969,19 @@ Started: Sat Mar 21 02:49:43 AM PDT 2026 |
966 | 969 | - Async generator `yield` across V8-loaded ESM modules needs extra microtask checkpoints after event loop |
967 | 970 | - process.exit() inside TLA doesn't cleanly terminate the V8 session — test needs output-settle detection |
968 | 971 | --- |
| 972 | + |
| 973 | +## 2026-03-22 - US-028 (in progress) |
| 974 | +- Fixed process.kill(self, signal) to dispatch signal handlers for non-fatal signals (SIGWINCH, SIGCHLD, etc.) instead of always exiting |
| 975 | +- Added _stdinRead to ASYNC_BRIDGE_FNS in native/v8-runtime/src/session.rs — prevents V8 event loop deadlock when process.stdin.resume() starts the readLoop via _loadPolyfill.applySyncPromise dispatch |
| 976 | +- Rewrote pi-interactive.test.ts: removed probes, sandboxSkip, inline fetch patching; uses networkAdapter + ESM mode + PI_MAIN |
| 977 | +- Tests still fail: V8 sidecar crashes (IPC connection closed, exit code 1) during Pi TUI framework initialization — needs further sandbox fixes |
| 978 | +- Files changed: native/v8-runtime/src/session.rs, packages/nodejs/src/bridge/process.ts, packages/secure-exec/tests/cli-tools/pi-interactive.test.ts |
| 979 | +- **Learnings for future iterations:** |
| 980 | + - process.kill(self, SIGWINCH) was exiting instead of dispatching — Pi TUI (pi-tui package) sends SIGWINCH on startup to refresh terminal dimensions |
| 981 | + - _stdinRead dispatch through _loadPolyfill.applySyncPromise blocks the V8 thread — any async bridge handler that waits for external data MUST be in ASYNC_BRIDGE_FNS |
| 982 | + - Pi cli.js imports undici which fails in-VM — use PI_MAIN (main.js) directly and call main() instead |
| 983 | + - V8 execute_script() CJS mode doesn't await promises — use ESM (export {}) for interactive processes that need TLA |
| 984 | + - Pi's ProcessTerminal constructor calls process.kill(process.pid, "SIGWINCH") which is line 38 of pi-tui/dist/terminal.js |
| 985 | + - The V8 sidecar crash during Pi TUI init is NOT a JS-level error (process.exit interceptor doesn't fire) — it's a native Rust sidecar crash |
| 986 | + - After fixing _stdinRead async, cargo build --release takes ~3s (incremental), then must copy binary to node_modules/.pnpm/@secure-exec+v8-linux-x64-gnu@0.1.1-rc.3/node_modules/@secure-exec/v8-linux-x64-gnu/secure-exec-v8 |
| 987 | +--- |
0 commit comments