Skip to content

fix(sync): Prevent indefinite hang on credential prompts and slow fetches#544

Draft
tony wants to merge 1 commit intomasterfrom
fix-sync-hang-on-credential-prompts
Draft

fix(sync): Prevent indefinite hang on credential prompts and slow fetches#544
tony wants to merge 1 commit intomasterfrom
fix-sync-hang-on-credential-prompts

Conversation

@tony
Copy link
Copy Markdown
Member

@tony tony commented Apr 7, 2026

Summary

  • Set GIT_TERMINAL_PROMPT=0 at sync() entry so git fails fast instead of blocking on stdin when credentials are needed
  • Add 120s timeout to _maybe_fetch() subprocess call to prevent indefinite blocking on slow/large repo fetches
  • Handle subprocess.TimeoutExpired with a descriptive error message

Fixes #543

Context

vcspull sync --workspace <path> --all hangs indefinitely when any repo in the batch triggers a git credential prompt (SSH passphrase, HTTPS password) or when fetching a very large repo (e.g. 15GB rust-lang/rust). The sync loop is sequential, so one stuck git fetch blocks all remaining repos with no timeout or recovery.

Test plan

  • New parametrized test for TimeoutExpired handling in _maybe_fetch
  • Spy test verifying GIT_TERMINAL_PROMPT=0 is passed in subprocess env
  • Spy test verifying timeout kwarg is passed to subprocess
  • Test verifying sync() sets GIT_TERMINAL_PROMPT=0 via os.environ.setdefault
  • All 961 existing + new tests pass
  • ruff, mypy clean

… slow fetches

why: vcspull sync hangs indefinitely when a repo needs credentials (git
waits on stdin) or when fetching very large repos (e.g. 15GB rust-lang/rust).
Sequential processing means one stuck repo blocks the entire batch.

what:
- Set GIT_TERMINAL_PROMPT=0 at sync() entry to make git fail fast on auth
- Add 120s timeout to _maybe_fetch subprocess.run() call
- Handle subprocess.TimeoutExpired with descriptive error message
- Pass no-prompt env to _maybe_fetch subprocess calls
- Add tests for timeout handling, env propagation, and prompt suppression

Refs: #543
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.36%. Comparing base (e498d50) to head (9fe9c4f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #544      +/-   ##
==========================================
+ Coverage   84.27%   84.36%   +0.08%     
==========================================
  Files          29       29              
  Lines        3809     3818       +9     
  Branches      758      759       +1     
==========================================
+ Hits         3210     3221      +11     
+ Misses        377      376       -1     
+ Partials      222      221       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

sync hangs indefinitely on credential prompts and slow fetches

1 participant