Summary
pnpm dkg openclaw setup fails on a fresh / nuked ~/.dkg directory because the daemon-start step inside setup is wrapped in a hard 30-second spawnSync timeout, but the first dkg start against an uninitialized ~/.dkg triggers a one-time blue-green slot migration that runs pnpm install in two slots — that takes minutes, not seconds.
The setup command then exits with ETIMEDOUT mid-migration, leaving ~/.dkg in a half-initialized state. dkg init alone does not surface this because it doesn't call dkg start and so doesn't trigger the slot migration.
Reproduction
rm -rf ~/.dkg
pnpm dkg openclaw setup
Output:
DKG OpenClaw Adapter Setup
========================================
[setup] OpenClaw workspace: /home/.../workspace
[setup] Agent name: Sentinel
[setup] Wrote ~/.dkg/config.json (DKG V10 Testnet, edge, port 9200)
[setup] Starting DKG daemon...
Migrating to blue-green release slots...
[setup] ERROR: Failed to start DKG daemon: spawnSync ...node ETIMEDOUT
Root cause
packages/adapter-openclaw/src/setup.ts:516-519 calls dkg start via spawnSync(node, [cliPath, 'start'], { stdio: 'inherit', timeout: 30_000 }).
packages/cli/src/migration.ts:19-110 (migrateToBlueGreen) runs when ~/.dkg/releases/current doesn't exist. It clones the repo into slots a and b and runs pnpm install --frozen-lockfile in each (the migration's own internal timeout is 10 minutes per INSTALL_TIMEOUT_MS).
- The setup-side 30s timeout fires long before the migration completes.
Suggested fix
Two reasonable options, either alone is enough:
- Skip or extend the daemon-start timeout in
setup.ts when first-run migration is detected. Detect by checking for the absence of ~/.dkg/releases/current and either drop the timeout to 0 (no timeout, inherit migration's own bounds) or raise it to a value that covers a realistic pnpm install (~10 minutes).
- Run the migration explicitly before the daemon-start step in setup. Call
migrateToBlueGreen directly from runSetup so the slot bootstrap completes without going through the timeout-bounded dkg start spawn.
Workaround for users hitting this today
pnpm dkg start # foreground, completes the slot migration unbounded
pnpm dkg stop # once the daemon is up, stop it
pnpm dkg openclaw setup --no-start
pnpm dkg start
After the first slot migration completes, all subsequent dkg start calls finish in seconds and dkg openclaw setup works as designed.
Affected
packages/adapter-openclaw/src/setup.ts
- (cross-reference)
packages/cli/src/migration.ts
Summary
pnpm dkg openclaw setupfails on a fresh / nuked~/.dkgdirectory because the daemon-start step inside setup is wrapped in a hard 30-secondspawnSynctimeout, but the firstdkg startagainst an uninitialized~/.dkgtriggers a one-time blue-green slot migration that runspnpm installin two slots — that takes minutes, not seconds.The setup command then exits with
ETIMEDOUTmid-migration, leaving~/.dkgin a half-initialized state.dkg initalone does not surface this because it doesn't calldkg startand so doesn't trigger the slot migration.Reproduction
rm -rf ~/.dkg pnpm dkg openclaw setupOutput:
Root cause
packages/adapter-openclaw/src/setup.ts:516-519callsdkg startviaspawnSync(node, [cliPath, 'start'], { stdio: 'inherit', timeout: 30_000 }).packages/cli/src/migration.ts:19-110(migrateToBlueGreen) runs when~/.dkg/releases/currentdoesn't exist. It clones the repo into slotsaandband runspnpm install --frozen-lockfilein each (the migration's own internal timeout is 10 minutes perINSTALL_TIMEOUT_MS).Suggested fix
Two reasonable options, either alone is enough:
setup.tswhen first-run migration is detected. Detect by checking for the absence of~/.dkg/releases/currentand either drop the timeout to0(no timeout, inherit migration's own bounds) or raise it to a value that covers a realisticpnpm install(~10 minutes).migrateToBlueGreendirectly fromrunSetupso the slot bootstrap completes without going through the timeout-boundeddkg startspawn.Workaround for users hitting this today
After the first slot migration completes, all subsequent
dkg startcalls finish in seconds anddkg openclaw setupworks as designed.Affected
packages/adapter-openclaw/src/setup.tspackages/cli/src/migration.ts