Add headless CI smoke test for pi /web bridge command
Session from pi-web on Hugging Face by woxQAQ · MIT · condensed by Coders Talk
Click a segment to jump to that moment
38msession
0interventions
GOAL
Verify that installing the pi-web extension via CI actually works by launching pi and starting the /web command, not just checking install succeeded.
- +0Prompt · +0Installing pi in CI isn't enough to verify our extension is correct — is there a way to open pi on the CI machine and actually start /web?
- +0mAgent did · +0mInvestigated pi's modes (interactive, print/JSON, RPC, SDK), read AGENTS.md, bin/index.ts, bridge lifecycle and tests to understand how /web currently works and why RPC mode can't drive it (custom() degrades to undefined).
- +2mAgent did · +2mExplained that /web is interactive (uses ctx.ui.custom()) so RPC/SDK smoke testing won't work as-is; proposed two options: drive real interactive pi via a PTY, or add a headless mode to /web itself.
- +3mPrompt · +3mok
- +6mAgent did · +6mImplemented headless mode for /web (packages/bin/index.ts), added a smoke test script (scripts/smoke-pi-web.mjs) that spawns pi, waits for a ready file, checks HTTP and WebSocket connectivity, wired it into pi-install.yml, added unit tests, ran pnpm test (270 passed) and verified the smoke script passes end-to-end against a temp HOME.
- +12mPrompt · +12mcommit
- +12mAgent did · +12mCommitted the headless /web changes, smoke script, workflow update and tests as d0b2bd5 ("test: add headless pi web smoke check"), 5 files changed, working tree clean.
- +36mFail · +36mCI on Windows failed with 'spawn pi ENOENT' — the smoke script couldn't find the pi executable on the Windows runner's PATH.
- +37mAgent did · +37mDiagnosed that spawn("pi") relied on a global PATH shim missing on Windows runners; rewrote scripts/smoke-pi-web.mjs to resolve and call the locally installed CLI (node .../pi-coding-agent/dist/cli.js) directly, falling back to pi/pi.cmd if absent, then re-ran the smoke test locally with a temp HOME.
- +38mOutcome · +38mWindows ENOENT root-caused and fixed by resolving the local pi CLI path instead of relying on PATH; smoke test verified passing locally against a fresh HOME after pi install, fix not yet committed.
VERDICT
Next time I'd start by asking directly for a headless mode in /web instead of first exploring RPC/SDK paths that turned out to be dead ends — that exploration cost a lot of turns before we landed on the right approach. The fix that actually mattered was catching that Windows CI couldn't find 'pi' on PATH and switching the smoke script to call the local CLI path directly rather than relying on a global shim.