Skip to content

fix: add auto-repair for state inconsistencies in init and workspace add#322

Merged
dlorenc merged 1 commit intodlorenc:mainfrom
aronchick:work/jolly-badger
Jan 28, 2026
Merged

fix: add auto-repair for state inconsistencies in init and workspace add#322
dlorenc merged 1 commit intodlorenc:mainfrom
aronchick:work/jolly-badger

Conversation

@aronchick
Copy link
Copy Markdown
Contributor

Summary

Fixes state inconsistency issues when init or workspace add commands fail partway through execution. Previously, if these commands failed after creating tmux sessions/windows but before updating state, re-running would fail with cryptic tmux errors like "duplicate session" or "window already exists".

Changes

initRepo command:

  • Check for existing repository in state before cloning
  • Check for existing tmux session before creation
  • Auto-repair by killing stale tmux sessions with clear user feedback
  • Return clear error message if repo already tracked

addWorkspace command:

  • Check for existing worktree path before creation
  • Check for existing tmux window before creation
  • Auto-repair by removing stale worktrees
  • Auto-repair by killing stale tmux windows

Impact

This improves the P0 "Clear error messages" goal from ROADMAP.md by:

  1. Preventing confusing error states from partial command failures
  2. Making the system self-healing - users can simply re-run the command
  3. Providing clear feedback when auto-repair happens

Test Plan

  • All unit tests pass
  • Build succeeds
  • Manual testing of error scenarios

Alignment with Roadmap

This addresses the P0 goal: "Clear error messages: Every failure should tell the user what went wrong and how to fix it"

The auto-repair mechanism means users don't need to manually clean up stale resources - the system fixes itself and continues, making multiclaude more reliable and user-friendly.

🤖 Generated with Claude Code

@dlorenc dlorenc added the multiclaude PRs created by multiclaude workers label Jan 28, 2026
Fixes state inconsistency issues when init or workspace add commands fail
partway through execution. Previously, if these commands failed after creating
tmux sessions/windows but before updating state, re-running would fail with
cryptic tmux errors.

Changes:
- initRepo: Check for existing tmux session and state entry before creation
  - Auto-repair by killing stale tmux sessions
  - Clear error if repo already tracked in state
- addWorkspace: Check for existing tmux window and worktree before creation
  - Auto-repair by killing stale tmux windows
  - Auto-repair by removing stale worktrees

This improves P0 "Clear error messages" goal by preventing confusing error
states and making the system self-healing.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@dlorenc dlorenc merged commit 35a6dea into dlorenc:main Jan 28, 2026
6 checks passed
aronchick added a commit to aronchick/multiclaude that referenced this pull request Jan 29, 2026
…add (dlorenc#322)

Fixes state inconsistency issues when init or workspace add commands fail
partway through execution. Previously, if these commands failed after creating
tmux sessions/windows but before updating state, re-running would fail with
cryptic tmux errors.

Changes:
- initRepo: Check for existing tmux session and state entry before creation
  - Auto-repair by killing stale tmux sessions
  - Clear error if repo already tracked in state
- addWorkspace: Check for existing tmux window and worktree before creation
  - Auto-repair by killing stale tmux windows
  - Auto-repair by removing stale worktrees

This improves P0 "Clear error messages" goal by preventing confusing error
states and making the system self-healing.

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

multiclaude PRs created by multiclaude workers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants