Skip to content

collectAuthoritativeAutoDashboardData never passes projectCwd to subprocess #2

@igouss

Description

@igouss

Bug

Even if the auto-dashboard subprocess logic is fixed to read from disk (see #1), it has no way to know which project to read. The subprocess environment contains no project path.

Root Cause

bridge-service.ts calls:

// src/web/bridge-service.ts ~line 652
return await collectAuthoritativeAutoDashboardData(config.packageRoot, {
  execPath: deps.execPath ?? process.execPath,
  env,
  existsSync: deps.existsSync ?? existsSync,
});

collectAuthoritativeAutoDashboardData only accepts packageRoot — no projectCwd parameter. The subprocess env passed is {...process.env, GSD_AUTO_DASHBOARD_MODULE: autoModulePath} with no project path injected.

The subprocess runs with cwd: packageRoot (the GSD package root), not the user's project directory. Any disk reads using process.cwd() inside the subprocess would resolve against the package root, not the project.

Fix

Thread projectCwd through the call chain:

  1. collectAuthoritativeAutoDashboardData(packageRoot, projectCwd, options) — add parameter
  2. Pass GSD_PROJECT_CWD: projectCwd in the subprocess env
  3. The disk-state reader in the subprocess reads process.env.GSD_PROJECT_CWD as basePath

The bridge call site already has config.projectCwd available — it just needs to be forwarded.

Affected Files

  • src/web/auto-dashboard-service.tscollectAuthoritativeAutoDashboardData signature + subprocess env
  • src/web/bridge-service.ts — call site at ~line 652

Relationship

Companion to #1. Both must be fixed together for auto-mode status to work correctly in the web dashboard.

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