angristan / angristan/fast-resume

FR: Recreate missing Git worktree when resuming a session

Aberta
#87 1 comentário 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Rust
Estrelas
157
Forks
17
Merge médio
16min
PRs com merge (30d)
4

Descrição

## Problem

A session can reference a Git worktree that no longer exists. Selecting that session fails before agent starts:

```text
Error: failed to change directory to /path/to/repo/.worktrees/example

Caused by:
No such file or directory (os error 2)
```

This commonly happens after local worktree cleanup while session history remains available.

## Reproduction

Tested with `fr 2.10.0` and Pi:

1. Create Git repository and branch.
2. Create worktree for branch.
3. Start Pi inside worktree and create session.
4. Exit Pi.
5. Remove worktree while keeping branch.
6. Run `fr`.
7. Select session.

`fr` exits with status 1 and does not recreate worktree.

I reproduced this twice in an isolated temporary repository. As a control, I recreated worktree and selected same session. `fr` then resumed Pi from correct directory with correct session ID.

## Requested behavior

When saved directory is missing and appears to be Git worktree, offer to recreate it before resuming session.

For example:

```text
Session worktree is missing:
/path/to/repo/.worktrees/example

Recreate it from branch `example`? [y/N]
```

Then run equivalent of:

```text
git worktree add /path/to/repo/.worktrees/example example
```

Automatic recovery could be limited to unambiguous cases:

- Parent Git repository can be found.
- Matching local branch exists.
- Target path does not exist.
- Branch is not checked out in another worktree.

If recovery is ambiguous, current failure can remain with more actionable context.

## Current implementation

Resume handoff calls `set_current_dir()` before agent execution. Missing directories fail immediately. There is no Git worktree recovery path.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.