Commit graph

1950 commits

Author SHA1 Message Date
A
dc3e4650bb
refactor: update test README with missing test file entries (#2458)
Add 6 undocumented test files to the test index README:
- do-payment-warning.test.ts (Cloud-specific)
- sprite-keep-alive.test.ts (Cloud-specific)
- history-corruption.test.ts (Infrastructure)
- paths.test.ts (Infrastructure)
- fs-sandbox.test.ts (Infrastructure)
- picker.test.ts (Parsing and type utilities)

Also remove duplicate manifest-cache-lifecycle.test.ts entry
that appeared in both Core manifest and Infrastructure sections.

Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 16:47:50 -04:00
A
b4e0f575d3
fix: show correct hint when spawn delete filter matches nothing (#2456)
The 'create a spawn first' message was shown even when active servers
existed but none matched the filter. Now shows 'Run spawn delete without
filters to see all servers.' for the unmatched-filter case and reserves
the create hint for when no servers exist at all.

Fixes #2454

Agent: code-health

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-10 13:01:01 -07:00
A
3978ff6d4d
fix: apply validateLaunchCmd to manifest fallback path in connect.ts (#2455)
Security: the manifest-derived fallback path in connect.ts bypassed the
validateLaunchCmd() allowlist that guards history-derived commands. A
malicious or modified manifest.json cache could inject arbitrary commands
executed on the remote VM via SSH.

Fixes #2453

Agent: security-auditor

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-10 15:28:00 -04:00
A
5db9cc2a80
fix: show history table directly when no active servers found in spawn list (#2451)
Instead of telling users to pipe through `spawn list | cat` to view their
spawn history, render the history table inline when no active connections
exist. The | cat workaround was needed because non-interactive mode skips
the picker; now interactive mode falls through to renderListTable directly,
consistent with what `spawn list | cat` was already doing.

Agent: ux-engineer

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-10 15:21:00 -04:00
Ahmed Abushagur
c77ca106d2
feat: ssh tunnel + browser auto-open for OpenClaw web dashboard (#2452)
OpenClaw runs a web dashboard on port 18791 of the remote VM. This
change SSH-tunnels that port to localhost and auto-opens the browser,
giving users a web UI with zero CLI knowledge needed.

- Add TunnelConfig to AgentConfig interface (agents.ts)
- Add startSshTunnel function with port-finding logic (ssh.ts)
- Capture gateway token in closure so the same token is used for both
  the remote config and the browser URL (agent-setup.ts)
- Wire tunnel into orchestration pipeline between preLaunch and
  interactiveSession (orchestrate.ts)
- Add getConnectionInfo to CloudOrchestrator interface and implement
  in all SSH-based clouds (DO, Hetzner, AWS, GCP)
- Local: opens browser directly at localhost:18791
- Sprite: gracefully skipped (no standard SSH)
- Add USER.md bootstrap to guide OpenClaw users to web dashboard

Closes #2449
Supersedes #2418

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
2026-03-10 14:25:43 -04:00
A
a46a92a8a4
fix: add missing PATH entries in Hetzner and DigitalOcean runServer/interactiveSession (#2450)
AWS and GCP both include $HOME/.npm-global/bin and $HOME/.claude/local/bin in the
PATH exported before running remote commands. Hetzner and DO were missing these two
entries, causing "command not found" errors for Claude Code and npm-global packages
on those clouds.

Agent: code-health

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-10 14:24:16 -04:00
A
1bddd713ea
fix: base64-encode commands in SSH exec to prevent injection (#2448)
All four SSH-based cloud drivers (aws, digitalocean, gcp, hetzner)
passed the command string directly as an SSH argument, which gets
interpreted by the remote shell. While current callers pass trusted
E2E test code, this creates a security footgun for future changes.

Fix: base64-encode the command locally and decode it on the remote
side before piping to bash. The encoded string contains only safe
characters [A-Za-z0-9+/=], eliminating any injection vector. Stdin
is preserved for callers that pipe data into cloud_exec.

Closes #2432, closes #2433, closes #2434, closes #2435

Agent: complexity-hunter

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
2026-03-10 13:22:33 -04:00
A
47b26deafa
fix: harden Sprite exec against injection via org flags and grep patterns (#2446)
- Replace word-split _sprite_org_flags() call sites with _sprite_cmd()
  helper that uses a proper bash array for the -o flag, eliminating
  injection risk from org names with spaces or shell metacharacters
- Validate _SPRITE_ORG against [A-Za-z0-9_-]+ in _sprite_validate_env
- Use grep -qF (fixed-string) instead of grep -q for app name matching
  to prevent regex metacharacters in names from causing false matches
- Use mktemp for _stderr_tmp in _sprite_exec instead of predictable
  PID-based path (/tmp/sprite-exec-err.$$) to prevent symlink attacks

Closes #2436

Agent: complexity-hunter

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
2026-03-10 10:08:17 -07:00
A
9bf3c216e8
fix: harden provision.sh against command injection in env_b64 and app_name (#2444)
- Validate app_name at function entry (alphanumeric, dots, hyphens, underscores
  only) before it's used in file paths or passed to cloud_exec
- Add trap-based cleanup for the temp file used during .spawnrc fallback creation
- Add security comments documenting the three-layer defense model: printf %q
  quoting, base64 encoding, and stdin piping (no interpolation into command
  strings)

The core vulnerability (env_b64 interpolated into the cloud_exec command string)
was already fixed in a prior commit that switched to stdin piping. This change
adds defense-in-depth and documentation.

Fixes #2437, #2441

Agent: code-health

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 10:07:23 -07:00
A
a22fe9010c
fix: safe printf format strings and document e2e source usage (#2445)
install.sh: Replace color variable interpolation in printf format strings
with %b arguments to prevent format string injection (fixes #2443).

common.sh: Use %b for color escapes in logging functions. Document that
BASH_SOURCE and source usage in load_cloud_driver is intentional since
e2e scripts are filesystem-only, not curl|bash (fixes #2438).

Agent: ux-engineer

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 12:28:45 -04:00
A
3724bb8ba4
fix: address SSH command injection risks in e2e cloud drivers (#2447)
Add defense-in-depth validation across all e2e cloud driver scripts:

- Validate IP addresses match IPv4 format before use in SSH commands
  (aws, digitalocean, gcp, hetzner)
- Validate SSH username contains only safe characters (gcp)
- Validate resource IDs are numeric before interpolating into API URLs
  (digitalocean droplet IDs, hetzner server IDs)
- URL-encode app name in Hetzner API query parameter to prevent
  query parameter injection
- Validate numeric env vars (INPUT_TEST_TIMEOUT, PROVISION_TIMEOUT,
  INSTALL_WAIT) that get interpolated into remote command strings

Fixes #2432, #2433, #2434, #2435, #2442

Agent: security-auditor

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 12:27:47 -04:00
A
0380ad33f9
refactor: remove dead exports only used within their own files (#2431)
- withSpinner in commands/shared.ts
- ENTITY_DEFS in commands/shared.ts
- isValidManifest in manifest.ts
- waitForInstance in aws/aws.ts
- SignalEntry, ExitCodeEntry in guidance-data.ts

Bump version: 0.15.37 -> 0.15.38

Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
2026-03-10 08:51:15 -04:00
A
15e4715555
fix: validate server ID in status.ts before API calls (#2430)
status.ts passed server_id from history directly into Hetzner/DO API
URLs without calling validateServerIdentifier(). Both delete.ts and
connect.ts validate first; status.ts was the only gap. A tampered
~/.spawn/history.json could craft a server_id with path traversal
characters (e.g. "../v2/account") causing the Bearer token to be
sent to an unintended API endpoint (SSRF via URL path manipulation).

Fix: call validateServerIdentifier() after extracting serverId,
returning "unknown" gracefully on failure.

Agent: code-health

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-10 07:17:07 -04:00
A
00aa4b2dbf
fix: always reject set -u in shell script validation hook (#2427)
The validate-file.ts hook previously only blocked `set -u` when
`set -eo pipefail` was absent from the file. This allowed scripts
with both `set -eo pipefail` and `set -u` to pass validation,
contradicting the shell rules that unconditionally ban nounset.

Fix the regex to always reject `set -u` variants on actual set
invocation lines (not comments or strings), and update the error
message to recommend `${VAR:-}` instead.

Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
2026-03-10 02:37:33 -07:00
A
73ab90fb53
test: remove duplicate getSpawnDir/getHistoryPath tests from history.test.ts (#2426)
These path-utility tests were duplicated between history.test.ts and
paths.test.ts. Consolidate into paths.test.ts (the canonical location)
and move 4 unique test cases (dot-relative path, .. resolution, outside
home rejection, home-as-SPAWN_HOME) that only existed in history.test.ts.

Removes 64 lines of duplicate test code with zero coverage loss.

Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
2026-03-10 02:35:13 -07:00
A
01263193be
fix: add killWithTimeout to waitForCloudInit SSH processes across all clouds (#2425)
Without per-process timeouts, if the user's network drops during
cloud-init polling, the CLI hangs forever while billing continues.
Adds 30s kill timers to each polling SSH command (matching the
waitForSsh pattern in shared/ssh.ts) and 330s to DO's streaming SSH.

Agent: code-health

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 02:33:01 -07:00
A
72ccb098ab
feat: integrate Sprite keep-alive tasks for all Sprite agents (#2428)
Adds sprite-keep-running support so sprites stay alive during long
agent sessions instead of shutting down due to inactivity.

- Add installSpriteKeepAlive() to sprite/sprite.ts: downloads and
  installs the sprite-keep-running script (~/.local/bin) on the sprite
  during setup. Non-fatal: logs a warning if download fails so
  deployment still proceeds.

- Modify interactiveSession() to wrap the session command in a temp
  script (base64-encoded to handle multi-line restart loops) and exec
  it via sprite-keep-running if available, with plain bash fallback.

- Call installSpriteKeepAlive() in sprite/main.ts createServer() step
  after setupShellEnvironment(), applying to all Sprite agents.

- Add sprite-keep-alive.test.ts: 11 unit tests covering download URL,
  install path, error resilience, session script structure, and
  keep-alive wrapper inclusion.

Fixes #2424

Agent: issue-fixer

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-10 02:24:18 -07:00
A
e396a61b30
test: add unit tests for parsePickerInput in picker.ts (#2421)
Agent: test-engineer

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 01:31:59 -07:00
A
9a35227a90
fix: prevent tests from writing to real ~/.spawn/history.json (#2423)
* fix: set SPAWN_HOME in preload and add fs-sandbox guardrail test

The test preload now sets SPAWN_HOME to the sandbox directory by default,
so tests that call cmdRun/saveSpawnRecord without explicitly setting
SPAWN_HOME no longer write to the real ~/.spawn/history.json.

Add fs-sandbox.test.ts that verifies the sandbox is correctly configured
(HOME, SPAWN_HOME, XDG vars all point to temp). Update testing.md with
mandatory filesystem isolation rules.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: add root bunfig.toml and fix biome formatting

Add root-level bunfig.toml with test preload so `bun test` works from
the repo root. Fix biome formatting in orchestrate.test.ts afterEach.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: lab <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude <claude@anthropic.com>
2026-03-10 00:54:17 -07:00
A
de76599b39
refactor: centralize path resolution into shared/paths.ts (#2422)
Move all filesystem path helpers (getUserHome, getSpawnDir, getHistoryPath,
getSpawnCloudConfigPath, getCacheDir, getCacheFile, getUpdateFailedPath,
getSshDir, getTmpDir) into a single shared/paths.ts module. This eliminates
scattered homedir()/process.env.HOME patterns across 8+ files and provides
a single import source for all path resolution.

- Create packages/cli/src/shared/paths.ts with 9 exported functions
- Update 17 source files to import from paths.ts
- Add re-exports in ui.ts and history.ts for backward compatibility
- Remove direct homedir() imports from gcp, sprite, local, ssh-keys, etc.
- Add comprehensive unit tests in paths.test.ts
- Bump CLI version to 0.15.34

Co-authored-by: lab <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-10 00:48:03 -07:00
Ahmed Abushagur
769aa69b31
fix: set OpenClaw default model to kimi-k2.5 to match manifest (#2419)
The manifest was updated to moonshotai/kimi-k2.5 but the code still
hardcoded openrouter/auto in both modelDefault and the configure
fallback.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
2026-03-10 03:29:08 -04:00
A
486aba49f6
fix: use process.env.HOME instead of os.homedir() for test sandboxing (#2417)
Bun's os.homedir() reads from getpwuid() and ignores runtime changes to
process.env.HOME. Named imports capture the native function binding, so
patching os.homedir on the default export doesn't propagate. This caused
all test files using homedir() to write .spawn-test-* dirs to the real
home directory instead of the preload sandbox.

Add getUserHome() helper to shared/ui.ts that prefers process.env.HOME,
replace all direct homedir() calls in production and test code.

Co-authored-by: lab <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-10 00:20:19 -07:00
A
b1afa4615f
ci: add commitlint and Husky for conventional commit validation (#2416)
- Add @commitlint/cli and @commitlint/config-conventional at repo root
- Configure commitlint with project-specific types (security, etc.)
- Set up Husky v9 with commit-msg hook running commitlint
- Add pre-commit hook running biome check on CLI source

Fixes #2406

Agent: code-health

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 23:46:18 -07:00
A
d60d0626e9
test: remove duplicate corruption recovery test from history.test.ts (#2414)
The "recovers from corrupted existing history file and creates backup"
test was a subset of the more thorough coverage in
history-corruption.test.ts. Removed the duplicate and its unused
readdirSync import.

Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
2026-03-09 22:50:29 -07:00
A
f272294902
refactor: Deduplicate getServerName and promptSpawnName across cloud modules (#2415)
Consolidates duplicate server naming logic from 5 cloud modules into shared utilities in src/shared/ui.ts. No behavioral changes - purely structural refactor.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-10 05:26:25 +00:00
A
a9cd3b700c
security: escape pkill regex metacharacters in app_name (#2412)
* security: escape pkill regex metacharacters in app_name

Fixes #2409 - escape regex metacharacters (., [, \, *, ^, $) in
app_name before using in pkill -f pattern to prevent unintended
process termination. Even though app_name is validated against a
safe character whitelist, . and - are regex metacharacters that
could match broader patterns than intended.

Note: #2410 (unquoted regex in bash conditional) was already fixed
by a prior commit that refactored the code to use sed instead of
[[ =~ BASH_REMATCH ]].

Agent: security-auditor
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: remove dead exec_long functions reintroduced from pre-#2407 code

Remove cloud_exec_long dispatcher and all _*_exec_long() functions
from common.sh and cloud driver files (aws, digitalocean, gcp,
hetzner, sprite). These were explicitly removed as dead code in
PR #2407 (commit c4ae1684) and must not be reintroduced.

Issue #2410 (unquoted regex in bash conditional) is already resolved:
the [[ =~ ]] pattern was previously replaced with case/sed parsing.

Fixes #2409
Fixes #2410

Agent: pr-maintainer
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-09 21:23:33 -07:00
A
d584cc4d4e
fix: allow nested worktree paths in pre-merge hook regex (#2401) (#2411)
The worktree path regex in pre-merge-check.ts used [^\s/]+ which only
matched a single path segment after /tmp/spawn-worktrees/. This blocked
PR merges from nested worktrees like refactor/fix/issue-N used by the
automated refactoring service.

Fix both the TypeScript regex ([^\s/]+ -> [^\s]+) and the inline bash
grep pattern in settings.json ([a-zA-Z0-9._-]+ -> [a-zA-Z0-9._/-]+).

Closes #2401

Agent: code-health

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-09 23:02:30 -04:00
A
c4ae16849d
refactor: remove dead cloud_exec_long and _*_exec_long functions (#2407)
The cloud_exec_long dispatcher in common.sh and all five cloud-specific
_exec_long implementations (aws, digitalocean, gcp, hetzner, sprite)
were defined but never called by any code in the e2e test suite.

Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 19:39:53 -07:00
A
7801c263bb
security: verify symlink targets before overwrite in install.sh (#2404)
Before creating symlinks in /usr/local/bin, verify that any existing
symlink points to a safe location ($HOME/.local/*, $HOME/.bun/*,
/usr/local/*, $HOME/.npm-global/*). If a symlink points to an
unexpected location, warn the user and skip to prevent malicious
symlink persistence through reinstalls.

Uses portable `readlink` (without -f) for macOS bash 3.2 compatibility.

Fixes #2402

Agent: security-auditor

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-09 18:37:58 -07:00
L
b2c74f9296
fix: precise try/catch error handling with logDebug diagnostics (#2397)
Add logDebug() function gated on SPAWN_DEBUG=1 for surfacing error
details without cluttering normal output. Refactor 6 silent/overly-broad
catch blocks:

- agent-tarball.ts: split 70-line try into fetch+parse and remote exec
- update-check.ts: remove outer try, wrap only performAutoUpdate
- history.ts: add warnings to swallowed tryCatch results
- oauth.ts: warn when API key save fails
- orchestrate.ts: warn on checkAccountReady and preProvision failures

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-09 17:58:12 -07:00
L
2da9e6cd46
refactor: restore @openrouter/spawn-shared workspace package (#2405)
* refactor: restore @openrouter/spawn-shared workspace package

Restore packages/shared/ as canonical location for parse.ts, result.ts,
and type-guards.ts. CLI shared files become thin re-exports, preserving
all existing import paths. SPA imports switch from fragile relative paths
to the workspace package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: sort exports in shared package barrel to satisfy biome

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: sort SPA imports to satisfy biome organizeImports

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-09 17:14:26 -07:00
A
fa323c8b58
fix(digitalocean): warn first-time users about required payment method (#2403)
Show a proactive warning before the OAuth/token entry flow when the user
has no saved DigitalOcean config and no DO_API_TOKEN env var. This prevents
new users from completing the full setup flow only to fail at provisioning
because their account has no payment method on file.

Warning is shown only once per first-time setup — returning users (who have
a saved token, even if expired or invalid) skip the reminder.

Closes #2395

Agent: issue-fixer

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 16:54:11 -07:00
Ahmed Abushagur
6380d35a11
chore: change OpenClaw default model to Kimi K2.5 (#2393)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
Co-authored-by: A <258483684+la14-1@users.noreply.github.com>
2026-03-09 16:27:43 -07:00
A
705687de17
fix: persist npm-global PATH to .profile/.bash_profile/.bashrc for SSH reconnect (#2399)
After SSH reconnect, agent commands (openclaw, codex, kilocode, junie) were
not found because PATH was only written to ~/.bashrc, which is not sourced
by login shells. Login shells (used by SSH) source ~/.profile or
~/.bash_profile instead.

Changes:
- Write .spawnrc sourcing to ~/.profile and ~/.bash_profile in addition
  to ~/.bashrc and ~/.zshrc (orchestrate.ts)
- Write npm-global PATH export to ~/.profile and ~/.bash_profile for all
  npm-installed agents: OpenClaw, Codex, Kilo Code, Junie (agent-setup.ts)
- Write Claude Code PATH to ~/.profile and ~/.bash_profile (agent-setup.ts)
- Write OpenCode PATH to ~/.profile and ~/.bash_profile (agent-setup.ts)
- Extract NPM_GLOBAL_PATH_PERSIST constant to DRY up repeated shell snippets
- Fix e2e provision.sh to also write .spawnrc sourcing to login shell configs
- Bump CLI version to 0.15.32

Fixes #2394

Agent: code-health

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-09 16:26:49 -07:00
A
5b47ad8da9
fix(ux): clarify auth ordering and remote machine context in setup messages (#2400)
- Reword preflight OpenRouter credential message to not imply it happens
  immediately (cloud auth runs first in the orchestration pipeline)
- Clarify GitHub CLI setup messages to specify "remote server" instead of
  leaving ambiguous "this machine" context for cloud users

Fixes #2396

Agent: ux-engineer

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-09 18:46:53 -04:00
Ahmed Abushagur
06796ec95c
fix: isolate orchestrate tests from user's ~/.spawn history (#2398)
The orchestrate test suite called runOrchestration (which internally
calls saveSpawnRecord) without setting SPAWN_HOME to a temp directory.
Every test run wrote ~20 fake records into the user's real history,
eventually filling it with 100 connectionless "testagent" entries
and wiping all real spawn history.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 18:46:19 -04:00
L
e182806eee
fix: graceful recovery from corrupted history.json (#2391)
* fix: graceful recovery from corrupted history.json

- Atomic writes (write to .tmp, rename into place) to prevent corruption
- Backup corrupted files with .corrupt suffix before discarding
- Per-record salvaging: if some v1 records are malformed, keep the valid ones
- Archive recovery: when history.json is corrupted, try loading from archives
- Stderr warnings when corruption is detected or records are recovered

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: replace try/catch with Result tryCatch wrapper in history.ts

Add tryCatch() to shared/result.ts and use it throughout history.ts to
eliminate all 7 try/catch blocks. Errors are now handled via Result
pattern matching instead of exception control flow.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: A <258483684+la14-1@users.noreply.github.com>
2026-03-09 14:50:29 -07:00
A
d73027eed4
fix(status): guard against empty serverId to avoid list-all-servers API calls (#2392)
When both server_id and server_name are missing from a connection record,
serverId falls back to "". Passing "" to fetchHetznerStatus/fetchDoStatus
constructs URLs like /v1/servers/ (list all), wasting rate-limit quota and
sending auth tokens to the wrong endpoint. Early-return "unknown" instead.

Agent: code-health

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 17:46:29 -04:00
Ahmed Abushagur
05f744e052
fix: atomic single-save for history records (createServer returns VMConnection) (#2388)
The two-phase save architecture was fundamentally broken: saveVmConnection()
was called inside createServer() BEFORE saveSpawnRecord() created the record,
so the merge-by-spawnId silently failed every time — resulting in records
with no connection data and `spawn ls` showing nothing.

Replace with atomic single-save: createServer() now returns VMConnection,
and the orchestrator calls saveSpawnRecord() once with connection data
included. Removes saveVmConnection(), getConnectionPath(),
mergeLastConnection(), and last-connection.json entirely.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: A <258483684+la14-1@users.noreply.github.com>
2026-03-09 14:32:45 -07:00
L
d9a25a4720
fix: ESC/Ctrl-C in picker falls back to numbered list instead of cancelling (#2390)
The TTY key loop treated explicit user cancellation (ESC/Ctrl-C) the same
as a TTY failure — both called fallback() which renders a numbered-list
picker. Now the key loop distinguishes between the two: cancel() exits
cleanly, fallback() is only used when /dev/tty is unavailable.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-09 14:28:02 -07:00
A
b8ca943592
test: consolidate repetitive check-entity tests into data-driven loops (#2389)
Replace 30+ individual it() blocks that each tested a single typo input
with data-driven loops using arrays of test cases. Same coverage, less
boilerplate. Reduces check-entity.test.ts from 401 to 330 lines.

Consolidated sections:
- non-existent entities: 5 tests -> 1 loop over 6 cases
- fuzzy match typos: 11 tests -> 2 loops over 6 cases each
- empty/boundary inputs: 8 tests -> 1 loop over 8 cases
- cross-kind fuzzy match: 6 tests -> 1 loop over 6 cases
- empty manifest: 2 near-identical tests -> 1 combined test

Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 16:53:08 -04:00
Ahmed Abushagur
e38f4483d6
fix: align cloud defaults with manifest (DO size, Hetzner location) (#2387)
DO default was s-2vcpu-4gb which isn't available in nyc3, causing 422
errors. Changed to s-2vcpu-2gb to match manifest.json. Also aligned
Hetzner default location from nbg1 to fsn1 to match manifest.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 18:23:22 +00:00
A
26d95e54bc
security: validate SPAWN_INSTALL_DIR against path traversal (Fixes #2385) (#2386)
Agent: security-auditor

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 10:55:00 -07:00
A
9af9d5669b
docs: add spawn status commands to README commands table (#2381)
Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
2026-03-09 10:38:23 -07:00
A
fb6d13d5d2
test: consolidate duplicate security validation tests (#2382)
Merge security-edge-cases.test.ts and security-encoding.test.ts into
security.test.ts. Move stripDangerousKeys tests to manifest.test.ts
(where the function is defined). All 1447 tests pass, zero regressions.

-- qa/dedup-scanner

Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
2026-03-09 10:37:01 -07:00
A
b87361bd27
refactor: remove dead code and unnecessary exports (#2376)
- Remove unused multiPickToTTY function, MultiPickOption interface, and
  MultiPickConfig interface from picker.ts (never called anywhere)
- Remove export keyword from 7 internal-only functions in commands/shared.ts
  that are used within the file but never imported externally:
  getEntityCollection, getEntityKeys, formatAuthVarLine,
  hasCloudConfigCredentials, getCredentialGuidance,
  checkAllCredentialsReady, printAuthVariableStatus

Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
2026-03-09 13:25:50 -04:00
L
5a86c4fc28
feat: migrate ori-basic rendering improvements into SPA bot (#2383)
Port all core architectural and rendering upgrades from ori-basic into
the setup-spa skill, bringing it to full parity.

## helpers.ts
- Replace JSON state (loadState/saveState/slack-issues.json) with SQLite
  (openDb/findThread/upsertThread/updateThread) using WAL mode and
  busy_timeout; add migrateFromJson() for legacy data
- Add full rich_text rendering pipeline: parseInlineMarkdown(),
  parseMarkdownBlock(), markdownToRichTextBlocks() — renders bold, italic,
  code, links, strikethrough, bullet/ordered lists, blockquotes, headers,
  fenced code blocks without Slack "See more" collapse
- Add extractMarkdownTables() + markdownTableToSlackBlock() for native
  Slack table blocks
- Add plainTextFallback() for push notification text
- Add PR_URL_REGEX constant
- Add flattenToolResultContent() for web_search_tool_result array content
- Update extractToolHint to handle query and url fields
- Update formatToolHistory to use emoji format:  *Name* `hint`
- Add tableBlocks field to SlackSegment interface

## main.ts
- Remove SLACK_CHANNEL_ID restriction — bot now responds in any channel + DMs
- Replace JSON state with SQLite throughout
- Add pendingQueues Map for FIFO concurrent message handling (no more dropped messages)
- Add buildPlanBlock() — structured task display with in_progress/complete
  status for all tools, interleaved with text via commitSegment()
- Replace mrkdwn section blocks with rich_text blocks via markdownToRichTextBlocks()
- Add overflow posting: when >47 blocks, extra content posts as follow-up messages
- Add firePrButtonIfNew() + buildPrButtonBlock() for immediate PR buttons during streaming
- Add cancel button (ActionsBlock) + cancel_run action handler + SIGTERM on process
- Add DM event handler (message.im channel_type)
- Track userId for thread state; pass SLACK_USER_ID to Claude subprocess env
- End-of-run: await prButtonPromise, delete mid-stream button, repost push-to-latest

## spa.test.ts
- Add SQLite tests (openDb, upsertThread, findThread, idempotency)
- Add parseInlineMarkdown tests (bold, code, link, italic, strikethrough, mixed)
- Add parseMarkdownBlock tests (paragraph, bullet list, ordered list, blockquote, header)
- Add markdownToRichTextBlocks tests (empty, plain, code fences, multiple fences)
- Add plainTextFallback tests
- Add extractMarkdownTables + markdownTableToSlackBlock tests
- Add web_search_tool_result handling test
- Update formatToolHistory + extractToolHint tests for new format
- Total: 94 tests, 0 fail

## package.json
- Add @slack/types and @slack/web-api dependencies (needed for Block types)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 10:24:31 -07:00
Ahmed Abushagur
7bab1c3289
fix: set browser.defaultProfile to openclaw for managed browser mode (#2384)
On headless VMs there's no Chrome extension to attach to. Setting
defaultProfile to "openclaw" tells OpenClaw to launch and manage
the browser itself via CDP instead of waiting for an extension relay.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:23:23 -04:00
A
f81ef1da4c
fix(status): add -a/--agent and -c/--cloud filter flags to spawn status (#2379)
`spawn status` silently ignored -a and -c flags, showing all servers
regardless. This is inconsistent with `spawn list` and `spawn delete`
which both support these filters.

- Update `cmdStatus` to accept `agentFilter`/`cloudFilter` options and
  pass them to `filterHistory()`
- Update `dispatchStatusCommand` to parse filter flags using the shared
  `parseListFilters` helper (same as list/delete)
- Document filter flags in help text for `spawn status`
- Bump version to 0.15.27

Fixes #2377

Agent: issue-fixer

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-09 07:10:05 -07:00
A
2074211d13
fix: wire maxAttempts parameter in waitForCloudInit for hetzner and digitalocean (#2380)
The `_maxAttempts` parameter in both Hetzner and DigitalOcean's
`waitForCloudInit()` was silently ignored — loop bounds and early-exit
checks were hardcoded. Rename to `maxAttempts` and use it consistently,
matching the AWS/GCP implementations.

Fixes #2378

Agent: issue-fixer

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-09 09:35:43 -04:00