Skip to content

fix: persist WorkspaceRepoPath in metadata to avoid projectRepoResolver on cleanup (#2608)#2679

Open
Pulkit7070 wants to merge 1 commit into
mainfrom
fix/issue-2608
Open

fix: persist WorkspaceRepoPath in metadata to avoid projectRepoResolver on cleanup (#2608)#2679
Pulkit7070 wants to merge 1 commit into
mainfrom
fix/issue-2608

Conversation

@Pulkit7070

@Pulkit7070 Pulkit7070 commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

What this does

Persists the workspace repo path (WorkspaceRepoPath) in a session's stored metadata so project/session teardown can locate and reclaim the session's worktree without having to re-resolve the project.

Problem

Cleanup relied on projectRepoResolver to find a session's worktree at teardown time. For archived (or otherwise stale) projects that lookup could fail, so cleanup couldn't reclaim the worktree — leaving orphaned worktrees on disk. Closes #2608.

Changes

  • backend/internal/domain/session.go — add WorkspaceRepoPath to session metadata.
  • backend/internal/session_manager/manager.go — populate it on spawn and use it during cleanup instead of depending on the resolver.
  • backend/internal/cli/session.go — plumb/surface the field where needed.

Testing

  • Build + targeted package tests green.
  • Remote CI green.

🤖 Generated with Claude Code

…er on cleanup (#2608)

- Add WorkspaceRepoPath field to SessionMetadata so the repo path is
  stored at spawn/restore time and survives project archival.
- Populate WorkspaceRepoPath in both spawn and restore metadata literals.
- Return RepoPath from workspaceInfo() so the gitworktree adapter takes
  the fast path (info.RepoPath != "") and bypasses projectRepoResolver
  for archived projects during cleanup.
- Expand cleanupSkipReason() with an ErrProjectNotResolvable case that
  surfaces a clear user-facing message instead of the generic fallback.
- Add --dry-run flag to `ao session cleanup` to preview which sessions
  would be removed without actually removing anything.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Pulkit7070 Pulkit7070 marked this pull request as ready for review July 13, 2026 23:31
@Pulkit7070

Copy link
Copy Markdown
Collaborator Author

@iamasx — this one's ready for review when you get a chance 🙏

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.

cleanup cannot reclaim archived-project worktrees and hides actionable teardown failures

1 participant