Skip to content

Stale workspace registration causes unrecoverable cli.codebase_auto_registration_failed with misleading secondary error #1146

@CyberClash

Description

@CyberClash

What happened

After uninstalling a prior tool (Aperant / Auto-Claude, which shares the ~/.archon/workspaces/ directory layout), my first archon workflow run in a fresh git repo failed with:

{"err":{"type":"Error","message":"Source symlink at C:\Users\<user>\.archon\workspaces\<org>\<repo>\source already points to C:\Users\<user>\.archon\workspaces\<repo>, expected C:/dev/<repo>"}...}
Error: Cannot create worktree: not in a git repository.
Run from within a git repo, or use --no-worktree to skip isolation.

The repo is a valid git repository. The real cause was a stale <org>/<repo>/source symlink pointing to a leftover workspace snapshot (~/.archon/workspaces/<repo>/, ~34MB of files from the prior tool).

Problems

  1. The secondary "Cannot create worktree: not in a git repository" error is misleading — it implies a git-detection failure when the root cause is registration bailing before git even gets consulted.
  2. No self-heal path. Nothing in the error suggests recovery. A user has to read the stack trace, locate createProjectSourceSymlink (packages/paths/src/archon-paths.ts), and manually rm -rf ~/.archon/workspaces/<org>/<repo>/ (and usually the stale target too) to unblock.
  3. Discoverability is poor. archon isolation list doesn't show the broken entry as broken — it appears fine until a workflow is actually run.

Reproduction

  1. Have a stale workspace dir from any prior tool sharing the ~/.archon/workspaces/ layout (or any leftover symlink at <org>/<repo>/source pointing to an unexpected target).
  2. Run archon workflow run <any-workflow> --branch <name> "<msg>" from a valid git repo whose derived name collides.
  3. Observe the error above.

Suggested fixes (any one helps)

  • Detect stale-target symlink and auto-repoint when the old target no longer exists (or matches the current repo root).
  • Add archon isolation repair <name> or a --repair flag that deletes the broken registration and re-creates it.
  • Suppress the secondary "not in a git repository" line when the true cause was a registration failure earlier in the chain.
  • Include the rm -rf ~/.archon/workspaces/<org>/<repo>/ recovery hint directly in the error message body.

Environment

  • Archon CLI v0.3.6 (source build)
  • Windows 11 Pro, build 10.0.26200
  • bun runtime, MINGW64 (Git Bash)
  • Prior tool that created the collision: Aperant / Auto-Claude (uninstalled before filing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priority - Backlog, when time permitsarea: cliCLI commands and interfacearea: isolationWorktree isolation providerbugSomething is brokeneffort/mediumFew files, one domain or module, some coordination neededuxUser experience improvements

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions