Skip to content

Child substrate creation races on the shared npm prefix under concurrent sessions (transient 'backend create failed') #105

Description

@rz1989s

Observed (2026-09-03, ~11:5x)

A subagent foreground dispatch failed at backend creation:

backend create failed: npm install @getpipher/pi-statusline@0.4.5 --prefix /Users/rector/.pi/agent/npm --legacy-peer-deps failed with code 1

A manual re-run of the identical command minutes later: up to date in 862ms (success). Version 0.4.5 exists on npm and is the settings pin — not a missing-package problem.

Suspected cause

Two pi sessions (RECTOR runs several in parallel) each spawning child sessions → concurrent npm install --prefix <shared ~/.pi/agent/npm> racing on the same node_modules. npm has no cross-process install lock by default; a transient code-1 (EEXIST/ENOENT during tree mutation) is the expected failure shape. The failing dispatch died at creation; the retry succeeded once the other session's install settled.

Impact

  • Dispatch creation fails spuriously under parallel-session load — looks like a fleet bug to the controller, is an environment race.
  • No retry happens at this layer today (backend creation failure = dispatch fails).

Ask

  1. Reproduce: two sessions dispatching simultaneously with a cold/invalidated ~/.pi/agent/npm prefix.
  2. Consider a serialized install guard (lockfile around the substrate install) or one bounded retry with backoff on backend create failed before surfacing the error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions