Problem
grove up relies on nexus init (external CLI binary) to generate nexus.yaml. This breaks when:
nexus CLI isn't on PATH or is broken — e.g., /opt/anaconda3/bin/nexus shadows the real one, nexus --version fails
- Multiple worktrees share the same Nexus —
nexus init hardcodes data_dir to ~/.grove/nexus-data and default port 2026, so all worktrees connect to the same instance, leaking sessions across unrelated workspaces
Equivalent issue on koi: windoliver/koi#1129
Current state (partial fix in PR #185)
PR #185 moved the health-check fast path before the CLI check in ensureNexusRunning(), so existing running Nexus instances are discovered even when the CLI binary is broken. But this only works when Nexus is already running — cold start still fails.
Proposed fix
-
Generate nexus.yaml directly in startServices() when it's missing, instead of shelling out to nexus init. The file is simple YAML with known fields.
-
Derive port from workspace path (e.g., hash of cwd mapped to ephemeral range 10000-60000) so each worktree gets a stable unique port without collisions.
-
Set data_dir to worktree-local path so each worktree has isolated Nexus data — no cross-worktree session leaking.
-
discoverRunningNexus should verify data_dir matches before reusing a running Nexus instance. Currently it only checks if the port responds healthy, which can match another worktree's Nexus.
Files to change
src/cli/nexus-lifecycle.ts — generate YAML directly, derive port, per-worktree data_dir
src/shared/service-lifecycle.ts — fallback YAML generation when CLI unavailable
Problem
grove uprelies onnexus init(external CLI binary) to generatenexus.yaml. This breaks when:nexusCLI isn't on PATH or is broken — e.g.,/opt/anaconda3/bin/nexusshadows the real one,nexus --versionfailsnexus inithardcodesdata_dirto~/.grove/nexus-dataand default port 2026, so all worktrees connect to the same instance, leaking sessions across unrelated workspacesEquivalent issue on koi: windoliver/koi#1129
Current state (partial fix in PR #185)
PR #185 moved the health-check fast path before the CLI check in
ensureNexusRunning(), so existing running Nexus instances are discovered even when the CLI binary is broken. But this only works when Nexus is already running — cold start still fails.Proposed fix
Generate
nexus.yamldirectly instartServices()when it's missing, instead of shelling out tonexus init. The file is simple YAML with known fields.Derive port from workspace path (e.g., hash of cwd mapped to ephemeral range 10000-60000) so each worktree gets a stable unique port without collisions.
Set
data_dirto worktree-local path so each worktree has isolated Nexus data — no cross-worktree session leaking.discoverRunningNexusshould verifydata_dirmatches before reusing a running Nexus instance. Currently it only checks if the port responds healthy, which can match another worktree's Nexus.Files to change
src/cli/nexus-lifecycle.ts— generate YAML directly, derive port, per-worktree data_dirsrc/shared/service-lifecycle.ts— fallback YAML generation when CLI unavailable