Repository navigation
fix: ship the codemode sandbox in pie-pi-process - #442
Conversation
|
Web runtime evidence at c66cb33: codemode→MCP call, tool_search→deferred tool call, and a direct MCP call through the Pie daemon (screenshots + recording-002). recording-002.webm |
commit: |
c66cb33 to
adc149f
Compare
adc149f to
83b0f9a
Compare
|
React Doctor skipped this pull request — it changed no React files. Reviewed by React Doctor for commit |
83b0f9a to
b4065d3
Compare
|
Rebased onto #436 (aff3ff7) on top of main db2acfa. New head: b4065d3. The runtime-setup hunk is reapplied to the regenerated Pi patch, and the lockfile still changes only the patch hash.
|
b4065d3 to
c906fae
Compare
c906fae to
8a8a578
Compare
8a8a578 to
499d016
Compare
Independent review: ready
1. CIEvery required check finished successfully on 2. Review
3. Independent verificationRun in a clean reviewer worktree at
Gaps (not blocking)
Re-review needed ifThe head or base changes, the Pi version or patch changes, or |
|
Merged the independently reviewed and verified head 499d016 (record: #442 (comment)) onto base e8ad3fa by squash. Merge commit: 91247ad. |


Requirement
Every
codemodecall in Pie fails, so MCP servers with the default (codemode) exposure are unusable. Found while checking whether MCP, codemode and tool_search load in Pie. This already happens onmain(Pi 0.99.1 bundle), so it is not a regression from #433. Stacked on #436 because it extends the same Pi 1.0.2 patch.The bundle shows two separate failures:
.wasmfile import yields./quickjs-<hash>.wasm, relative to the bundle. Pi'sbun/runtime-setup.jspasses that string through as is, so it is read relative to the Session's cwd:Failed to load QuickJS: ENOENT … './quickjs-r1pq2107.wasm'.codemode-worker.jsbeside the bundle (PI_BUNDLED_NODE), butbuild-pi-process.tsnever built it:Cannot find module …/codemode-worker.js.Expected behavior
codemodescripts run in the sandbox whatever the Session cwd is.$bunfspaths) are unaffected.Changes and risks
patches/@earendil-works__pi-coding-agent@1.0.2.patch: indist/bun/runtime-setup.js, a relative wasm path is resolved againstimport.meta.url. It usesfileURLToPath, so install paths with spaces (macOS Application Support) work.build-pi-process.ts: builds Pi'sdist/extensions/codemode/worker.jsintodist/pi-process/codemode-worker.js, the same way asimage-resize-worker.js.pnpm-lock.yaml: only the patch hash changes.Verification
Tested revision:
c66cb336.rpc-bundle.test.tscase:runtime/and runs it with a different cwd;codemode, and the provider calls it withreturn 6 * 7;isError:falseand output42.codemode-worker.jsmakes it fail withCannot find module. Restoring the old wasm line makes it fail withENOENT './quickjs-…wasm'. With the fix it passes.pnpm build,pnpm checkand the node tests pass: 1342 passed, 1 skipped.pie-verify web, isolatedPIE_HOMEandPI_CODING_AGENT_DIR, fake e2e provider, three stdio MCP fixtures with direct, codemode and deferred exposure):codemodeandtool_search, plus the direct MCP tools.codemodecallingtools.mcp__code_tools__say_helloreturnshello from code-tools.tool_searchloads 2 deferred tools, andmcp__deferred_tools__weather_lookupthen returnssunny per deferred-tools.mcp__dev_tools__say_helloreturnshello from dev-tools.tools.bash({command:"pwd"})and returns the Session cwd.electron-builderfor this change).