Skip to content

feat: enhance repair command to recreate core agents and default workspace#333

Open
aronchick wants to merge 1 commit intodlorenc:mainfrom
aronchick:resolve-pr-327
Open

feat: enhance repair command to recreate core agents and default workspace#333
aronchick wants to merge 1 commit intodlorenc:mainfrom
aronchick:resolve-pr-327

Conversation

@aronchick
Copy link
Copy Markdown
Contributor

Summary

Rebased PR #327 onto main to resolve merge conflicts. This PR enhances the repair command with the ability to recreate core agents and default workspace.

Changes:

Conflict Resolution:
The original PR used the old socket.Response{} pattern, but main now uses socket.SuccessResponse() helper from #331. Resolved by using the new helper while preserving all the new data fields (agents_created, workspaces_created).

Supersedes #327 (from spiculedata fork) - that PR had merge conflicts that couldn't be resolved by pushing to the original branch.

Test plan

  • go build ./cmd/multiclaude - builds successfully
  • go test ./... - all tests pass
  • golangci-lint run ./... - 0 issues
  • Test repair command manually with missing agents

🤖 Generated with Claude Code

Co-Authored-By: David Aronchick aronchick@expanso.io

…space

Improve the repair command to be more comprehensive by ensuring core
agents and a default workspace exist after cleanup. This enhancement
aligns with ROADMAP.md P1 "Agent restart" by making repair more robust
and reducing the need for manual intervention.

Changes:
- CLI: Add ensureCoreAgents() and ensureDefaultWorkspace() helpers
- CLI: Update localRepair() to recreate missing core agents
- CLI: Create default workspace "my-default-2" if none exist
- Daemon: Add ensureCoreAgents() and ensureDefaultWorkspace() methods
- Daemon: Update handleRepairState() to recreate missing agents
- Both: Improve output to show what was removed and what was created
- Tests: Add comprehensive tests for all scenarios

Key Features:
1. Recreates missing supervisor agent if absent
2. Recreates missing merge-queue (non-fork) or pr-shepherd (fork)
3. Creates default workspace if no workspaces exist
4. Does not duplicate existing agents/workspaces
5. Provides detailed output showing:
   - Removed: dead agents
   - Cleaned: orphaned resources
   - Created: core agents and workspaces

Test Coverage:
- TestRepairEnsuringCoreAgents: Verifies core agents are created
- TestRepairEnsuringPRShepherdInForkMode: Fork mode verification
- TestRepairDoesNotDuplicateAgents: Prevents duplicates

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@buggtb
Copy link
Copy Markdown

buggtb commented Jan 29, 2026

Merge Queue Review

CI Status: ✅ All checks passing (6/6)
Merge Status: MERGEABLE/CLEAN

Scope Check:

Roadmap Alignment: ✅ Aligns with P1 'Agent restart' - makes repair more robust

Note: This is a fork PR. Human action required to merge.

Related PRs (likely superseded):

🤖 Merge-queue agent

@aronchick
Copy link
Copy Markdown
Contributor Author

Merge Queue: READY TO MERGE

  • CI: All 6 checks passing
  • Merge status: MERGEABLE/CLEAN
  • Reviews: None blocking

This PR is ready for maintainer merge.

whitmo added a commit to whitmo/multiclaude that referenced this pull request Mar 1, 2026
whitmo added a commit to whitmo/multiclaude that referenced this pull request Mar 1, 2026
Add 14 tests covering daemon handleRepairState, ensureCoreAgents, and
ensureDefaultWorkspace. Tests verify response fields, graceful no-ops
when tmux session is missing, idempotency, fork mode handling, and
error cases for nonexistent repos.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
whitmo added a commit to whitmo/multiclaude that referenced this pull request Mar 1, 2026
…c#333 on pr-triage-b2

Tests from multiclaude workers (silly-otter, lively-otter, clever-bear):
- PR dlorenc#338: Token-aware status display, hibernate help, rich list_repos response
- PR dlorenc#339: Context-aware refresh, worktree path detection, --all flag parsing
- PR dlorenc#337: Categorized help (worker report captured, tests via CLI assertions)
- PR dlorenc#333: Enhanced repair (worker report captured, daemon handler tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
whitmo added a commit to whitmo/multiclaude that referenced this pull request Mar 1, 2026
…faultWorkspace, spawnCoreAgent

These functions (from PR dlorenc#333) had zero test coverage. Adds 8 tests covering:
- ensureCoreAgents with empty state, missing tmux session, existing agents, fork mode
- ensureDefaultWorkspace with empty state, existing workspace, missing tmux session
- spawnCoreAgent error message includes resp.Error details

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants