test: fix failing agent-config-setup tests (#1187)

* test: fix failing agent-config-setup tests by handling $HOME path substitution

Fixed 15 failing tests in agent-config-setup.test.ts by adding proper $HOME
path substitution in mock_run callbacks. The config setup functions use
$HOME instead of ~ in the mv commands, but the test mocks only were
replacing ~/ paths. Now all mock_run callbacks properly replace both:
- ~/ paths (for mkdir commands)
- $HOME paths (for mv commands in upload_config_file)

All 8061 CLI tests now pass. All 80 shell tests remain passing.

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

* fix: clarify monitoring loop requirements to prevent early session termination (#1194)

All four run modes (team_building, triage, review_all, scan) now have
explicit "Monitor Loop (CRITICAL)" sections with step-by-step instructions:

1. Call TaskList to check task status
2. Process completed tasks/messages
3. Call Bash("sleep 15") to wait
4. REPEAT until done or timeout

This fixes the issue where team leads would spawn teammates, then fail
to enter the monitoring loop, causing the session to end prematurely
(since "session ENDS when you produce a response with NO tool calls").

The previous vague instruction "Loop: TaskList → process → sleep 5"
was insufficient. The new format makes it crystal clear that:
- The loop must be INFINITE (keep repeating)
- EVERY iteration must include BOTH TaskList AND Bash sleep calls
- The session will end if you stop calling tools

This addresses the bug where review_all sessions ended after ~115s
instead of running the full 30min cycle.

Co-authored-by: Security Reviewer <security-reviewer@spawn.dev>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: document Sprite vs normal VM paths in SKILL.md, never invent directories (#1196)

- Add environment table: Sprite VMs use /home/sprite/, normal VMs use /root/
- Replace all hardcoded /root/spawn paths with <REPO_ROOT> placeholders
- Instruct agents to ask the user for the repo path, never guess
- Explicitly ban inventing directories like /home/claude-runner/

Co-authored-by: Security Reviewer <security-reviewer@spawn.dev>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: fix agent-config-setup.test.ts - shell mocking for HOME variable substitution (#1195)

All 40 tests in agent-config-setup.test.ts now pass by properly handling
$HOME variable substitution in mock_run callbacks. Added createMockSetup()
helper function to DRY up repeated mock configuration across openclaw and
continue tests (16 tests total).

Changes:
- Fix mock_run() to replace $HOME before evaluating commands
- Add createMockSetup(tempDir, configDir) helper to reduce code duplication
- Update all setup_openclaw_config and setup_continue_config tests to use helper
- Ensures /tmp/spawn_config_* temp files are redirected to temp test directory

Agent: test-engineer

Co-authored-by: spawn-refactor-bot <refactor@openrouter.ai>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>

* refactor: reduce complexity in cmdConnect and setup_claude_code_config (#1191)

Extract helper functions to reduce nesting and duplication:

1. cmdConnect (54 → 28 lines): Extract runInteractiveCommand() helper to
   eliminate duplicate spawn/Promise handling for Sprite and SSH connections

2. interactiveListPicker (48 → 21 lines): Extract handleRecordAction() helper
   to reduce nesting in reconnect/rerun logic

3. setup_claude_code_config (46 → 40 lines): Extract _generate_claude_code_settings()
   and _generate_claude_code_state() helpers to clarify JSON generation and
   make the main function focus on orchestration

All changes preserve existing behavior and pass existing tests.

Agent: complexity-hunter

Co-authored-by: spawn-refactor-bot <refactor@openrouter.ai>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: spawn-refactor-bot <refactor@openrouter.ai>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Security Reviewer <security-reviewer@spawn.dev>
Co-authored-by: pr-maintainer <pr-maintainer@spawn>
This commit is contained in:
A 2026-02-15 16:03:43 -08:00 committed by GitHub
parent 8564e6d984
commit 6c8ab77bd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

Diff content is not available