Files
kandev/apps/backend/internal/agent/runtime
João Salavisa 0f277457e9 fix(executor): re-clone provider repos when local path is missing or not a git repo (#1876)
* fix(executor): re-clone provider repos when local path is missing or not a git repo

Previously the re-clone guard only fired when local_path was empty, so a
set-but-invalid path (e.g. deleted checkout, or relocated by the provider
clone-path/identity change) was fed straight to the worktree preparer,
which hard-failed with "repository is not a git repository" instead of
recovering.

Two-part fix:
- resolveTaskRepoInfo now also re-clones when local_path exists but isn't
  a valid git checkout (new isLocalGitRepo helper), self-healing on next
  launch.
- validateWorktreeRequest now fails the "Validate repository" step with an
  honest error naming the offending path when it truly isn't a git repo,
  instead of passing and cascading into a misleading "sync interrupted"
  failure downstream.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(executor): gate stale-path reclone to provider repos and cover resume + multi-repo

Restrict the stale-local-path re-clone to genuinely provider-backed repos
(SourceType != "local") so a local checkout that's temporarily missing is
never silently overwritten. Centralize the re-clone guard into a shared
ensureRepoLocalPath helper and call it from the single-repo resume path
(applyResumeRepoConfig) so resume self-heals like a fresh launch. Apply the
same non-git-path validation used by the single-repo prepare path to the
multi-repo prepareOneRepo path so a stale secondary repo fails fast with a
clear message instead of surfacing worktree.Manager's ErrRepoNotGit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Kandev Agent <agent@kandev.dev>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 13:13:09 +01:00
..