Summary
When you run pi-web from a project directory, Gondolin mounts pi-web's own installation folder as the VM workspace. You get a Next.js project tree inside /workspace instead of your actual project files.
Prerequisites
pi-web installed and available on PATH
- Gondolin extension enabled (built-in example from pi)
- A project directory outside the pi-web install path (e.g.
~/my-project)
Steps to reproduce
cd ~/my-project
pi-web
- Pi loads the Gondolin extension, which creates a VM
- Inside the VM,
/workspace shows pi-web's source tree, not ~/my-project
Expected behavior
The VM's /workspace should contain the directory the user was in when they ran pi-web. That is ~/my-project, not the pi-web install path.
Root cause
Pi-web spawns a pi subprocess that inherits pi-web's own working directory (something like ~/.local/share/fnm/.../node_modules/@agegr/pi-web/). Gondolin reads process.cwd() to pick the workspace mount, which gives it the wrong path.
Proposed fix
This is pi-web's side to fix, not Gondolin's. Pi-web controls the pi process and its environment. Options:
Option A: pass PI_PROJECT_ROOT as an env var
pi-web can grab the caller's original directory (from INIT_CWD, process.env.PWD, or process.argv[1]) and forward it to the pi subprocess:
PI_PROJECT_ROOT=/Users/xxx/my-project pi --port 30141
Gondolin can check for PI_PROJECT_ROOT before falling back to process.cwd().
Option B: chdir back after init
pi-web's server could chdir() to the original working directory after startup, so child processes naturally inherit the right cwd.
Option C: IPC handshake
pi-web sends the project root to the pi process over IPC. Pi stores it in session config. Gondolin reads it from there.
Environment
pi-web version: 0.8.4
pi-coding-agent version: 0.83.0
- Gondolin extension version: built-in example from pi
- OS: macOS (ARM64)
Summary
When you run
pi-webfrom a project directory, Gondolin mounts pi-web's own installation folder as the VM workspace. You get a Next.js project tree inside/workspaceinstead of your actual project files.Prerequisites
pi-webinstalled and available on PATH~/my-project)Steps to reproduce
cd ~/my-projectpi-web/workspaceshows pi-web's source tree, not~/my-projectExpected behavior
The VM's
/workspaceshould contain the directory the user was in when they ranpi-web. That is~/my-project, not the pi-web install path.Root cause
Pi-web spawns a pi subprocess that inherits pi-web's own working directory (something like
~/.local/share/fnm/.../node_modules/@agegr/pi-web/). Gondolin readsprocess.cwd()to pick the workspace mount, which gives it the wrong path.Proposed fix
This is pi-web's side to fix, not Gondolin's. Pi-web controls the pi process and its environment. Options:
Option A: pass
PI_PROJECT_ROOTas an env varpi-web can grab the caller's original directory (from
INIT_CWD,process.env.PWD, orprocess.argv[1]) and forward it to the pi subprocess:Gondolin can check for
PI_PROJECT_ROOTbefore falling back toprocess.cwd().Option B: chdir back after init
pi-web's server could
chdir()to the original working directory after startup, so child processes naturally inherit the right cwd.Option C: IPC handshake
pi-web sends the project root to the pi process over IPC. Pi stores it in session config. Gondolin reads it from there.
Environment
pi-webversion: 0.8.4pi-coding-agentversion: 0.83.0