Claude CLI backend defaults preserved on registry absence
Bug fixes ensure the Claude CLI backend falls back to sensible defaults and properly applies environment variable overrides when the plugin registry is unavailable.
The Claude CLI backend was failing to bootstrap when the plugin registry was absent. Specifically, the configuration resolution logic would return null instead of falling back to default settings, breaking workspace bootstrap file injection (AGENTS.md, SOUL.md, IDENTITY.md, USER.md) on first turns. Additionally, environment variable overrides specified in backend configs weren't being applied correctly to spawned processes—sanitization was using the wrong base environment.
These fixes ensure the backend operates correctly in minimal environments where plugin registries aren't available. For operators running isolated or air-gapped setups, bootstrap files will now be injected as expected, and environment variable configurations will take effect properly.
The changes span the CLI backend configuration resolution, the process spawning logic, and gateway server lifecycle management. A live probe test was added to deterministically verify bootstrap injection works in real subprocess scenarios.
View Original GitHub Description
Summary
- preserve Claude CLI fallback defaults and env overrides when the plugin registry is absent
- add deterministic spawn coverage for injected workspace bootstrap files
- add a live subprocess probe for first-turn AGENTS/SOUL/IDENTITY/USER injection and stop task-registry maintenance on gateway shutdown
Verification
- pnpm test src/gateway/server-close.test.ts src/agents/cli-backends.test.ts src/agents/cli-runner.spawn.test.ts
- OPENCLAW_LIVE_TEST=1 OPENCLAW_LIVE_CLI_BACKEND=1 OPENCLAW_LIVE_CLI_BACKEND_PRESERVE_ENV='["ANTHROPIC_API_KEY","ANTHROPIC_API_KEY_OLD"]' pnpm exec vitest run --config vitest.live.config.ts src/gateway/gateway-cli-backend.live.test.ts -t 'injects AGENTS, SOUL, IDENTITY, and USER files into the first Claude CLI turn'\n- pnpm build\n\n## Notes\n- the repo-wide pre-commit
pnpm checkpath still trips an unrelatedtsgofailure in src/gateway/server.config-apply.test.ts, so commits used FAST_COMMIT after the scoped gates above passed