#3907·nanoclaw

[bug] Gateway detection fails when a nested pnpm prints a workspace warning to stdout

Author: glifocatCreated Sep 25, 2026Updated Sep 25, 2026
Labelskind/bugtriage/unresolved

Affected NanoClaw version or commit

c313d061 (v2.4.0)

Host platform

Linux

What happened?

/update-nanoclaw validate failed on an install where OneCLI was installed and healthy:

No installed gateway could be detected; run setup before restarting NanoClaw

setup/gateways/selection.ts:19-23 decides by comparing the whole stdout of a pnpm child to one word:

typescript
      execFileSync('pnpm', ['exec', 'tsx', script], {
        cwd: projectRoot,
        encoding: 'utf8',
        stdio: ['ignore', 'pipe', 'ignore'],
      }).trim() === 'installed'

The controller itself runs under pnpm exec tsx, so this pnpm is nested inside another pnpm. In that case pnpm prints workspace warnings to stdout, not stderr. Any package.json under the project with a pnpm field triggers one. On this install it was an agent-written file under groups/. The same thing from the minimal repro below (project path redacted):

groups/zz-repro                          |  WARN  The field "pnpm.onlyBuiltDependencies" was found in <project-root>/groups/zz-repro/package.json. This will not take effect. You should configure "pnpm.onlyBuiltDependencies" at the root of the workspace instead.
installed

The detector printed installed, but the check sees two lines and returns false. Agents can write package.json files into their own group folder, so an agent can block an operator's update without meaning to.

What did you expect?

A detector that says installed should be read as installed, whatever else pnpm prints.

How can we reproduce it?

From the root of a checkout with OneCLI installed (ONECLI_URL set in .env):

bash
mkdir -p groups/zz-repro
echo '{"name":"zz-repro","private":true,"pnpm":{"onlyBuiltDependencies":["esbuild"]}}' > groups/zz-repro/package.json

# Not nested: stdout is clean.
pnpm exec tsx .claude/skills/add-onecli/scripts/detect.ts 2>/dev/null
# -> installed

# Nested, the way the controller runs it: the warning lands on stdout.
pnpm exec sh -c 'pnpm exec tsx .claude/skills/add-onecli/scripts/detect.ts 2>/dev/null'
# -> the WARN line, then: installed

rm -rf groups/zz-repro

Tested with pnpm 10.34.5.

Suggested fix

Stop parsing pnpm's stdout. Any of these would work:

  • Have detect.ts answer with its exit code (0 installed, non-zero absent) and check the status.
  • Run the detector without pnpm in between, for example with the project's node_modules/.bin/tsx.
  • At minimum, compare only the last non-empty line.

The exit-code version is the most robust.

Related, but not blocking

  • runDetector came in with #3815.
  • The same nested-package.json warnings also pollute other stdout-parsing paths. On this install they have broken scripts/q.test.ts before. That is a separate report if it matters.

OS version and CPU architecture

Ubuntu 24.04.4 LTS, x86_64

Install or update path

Something else (/update-nanoclaw transactional update on a customized install)

Docker version

Docker 29.3.1

Channel or interface

Not channel-specific

Agent provider

Not provider-specific

Relevant redacted logs

(see above)

Last version that worked

Not a regression. Present since selection.ts landed in #3815.


Assisted by Claude; reviewed and verified by a human before submission.