Skip to content

fix(clone): stall-based git clone timeout + live progress in New Project / Clone dialog#161

Merged
Zeus-Deus merged 1 commit into
mainfrom
fix/timeout-gitclone
Jul 10, 2026
Merged

fix(clone): stall-based git clone timeout + live progress in New Project / Clone dialog#161
Zeus-Deus merged 1 commit into
mainfrom
fix/timeout-gitclone

Conversation

@Zeus-Deus

Copy link
Copy Markdown
Owner

Problem

Cloning a repo from the New Project → Clone screen failed with git clone timed out after 120 seconds on slow connections. git_clone_repo wrapped the clone in a hard absolute 120s timeout, so any healthy-but-slow clone (big repo, weak wifi) was killed mid-transfer. Meanwhile the UI showed only a bare "Cloning..." spinner — no signal that anything was happening.

Fix

Backend (src-tauri/src/commands/git.rs)

  • Run git clone --progress with piped stderr and stream it (split on both \r and \n — git delimits in-place progress with carriage returns)
  • Stall detection instead of an absolute cap: fail only when no output at all arrives for 120 consecutive seconds. A slow clone that keeps reporting progress never times out
  • Emit git-clone-progress Tauri events { targetDir, phase, percent, detail }, throttled to phase/percent changes; pure parse_clone_progress parser with unit tests
  • GIT_TERMINAL_PROMPT=0 so auth-required URLs fail fast instead of hanging on a hidden prompt; kill_on_drop; on stall-kill, remove the partial clone dir only if it didn't pre-exist
  • Real git failures still surface git's own stderr tail

Frontend

  • useCloneProgress hook (tilde-aware targetDir matching — the backend expands ~ before echoing it back — with unit tests) + CloneProgressRow component: phase label, percent, determinate progress bar (pulse while indeterminate), throughput detail line — design tokens only
  • Wired into both the New Project screen and the Clone dialog, with "Cloning — this can take a while on slow connections…" reassurance copy
  • Dev mock streams realistic progress so the flow works in npm run dev

Screenshot

Mid-clone in the New Project screen (dev mock):

clone progress

Verification

  • cargo test --manifest-path src-tauri/Cargo.toml --lib commands::git — 14 passed (9 new parser tests)
  • npm run check — clean
  • npm run test — 171 files / 2482 tests passed (5 new matchesCloneTarget tests)
  • Visual: drove New Project → Clone end-to-end in the dev mock with a ~/projects/ location; progress bar, phases, and MiB/s detail render live (screenshot above)

…ion + live progress

git_clone_repo killed healthy slow clones at a hard 120s cap — on a slow
connection a big repo reliably failed with 'git clone timed out after 120
seconds'. The clone now runs `git clone --progress`, streams stderr, and
only fails when NO output arrives for 120 consecutive seconds (a genuinely
wedged transfer). A slow-but-progressing clone can run as long as it needs.

- backend: stall-based timeout, kill_on_drop, GIT_TERMINAL_PROMPT=0
  (fail fast instead of hanging on hidden auth prompts), partial-clone
  cleanup on stall-kill (only if the target dir didn't pre-exist),
  git-clone-progress Tauri events (phase/percent/detail, throttled),
  pure parse_clone_progress parser + unit tests
- frontend: useCloneProgress hook (tilde-aware targetDir matching +
  tests) and CloneProgressRow (phase, percent, determinate bar,
  throughput detail) wired into the New Project screen and Clone dialog,
  with reassurance copy while cloning
- dev mock: git_clone_repo handler streams realistic progress events so
  the flow is demoable in npm run dev
- docs: workspace-creation.md clone-flow behavior notes
@Zeus-Deus Zeus-Deus merged commit c26929e into main Jul 10, 2026
4 checks passed
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.

1 participant