Skip to content

Bug: Gondolin VM mounts pi-web install dir as workspace instead of the user's project directory #314

Description

@EricKY26

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

  1. cd ~/my-project
  2. pi-web
  3. Pi loads the Gondolin extension, which creates a VM
  4. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions