Skip to content

fix: pr-bug-scan validated finding from #4462#4733

Open
buf0-bot[bot] wants to merge 1 commit into
mainfrom
bot/pr-bug-scan-4462-1780717953
Open

fix: pr-bug-scan validated finding from #4462#4733
buf0-bot[bot] wants to merge 1 commit into
mainfrom
bot/pr-bug-scan-4462-1780717953

Conversation

@buf0-bot
Copy link
Copy Markdown
Contributor

@buf0-bot buf0-bot Bot commented Jun 6, 2026

Automated fix-PR from pr-bug-scan for parent #4462.

Fixer status: FIXED_WITH_CODE_PROOF
Summary: Race git fetch in refreshBranchCleanupTargetRefs against a 5s timeout so worktree.rm cannot stall on unreachable remotes.
Blocked proof link: src/shared/git-branch-cleanup.ts:61
Typecheck: skipped

Proof (from validator)

  • C1 — proof_type: code_analysis
    • trigger: User invokes worktree.rm (mobile or desktop) on a worktree whose branch was squash-merged upstream, while the saved remote is unreachable.
    • observable: removeWorktree promise does not resolve until git fetch errors or completes; on slow/unreachable remotes this stalls the worktree.rm RPC and blocks the calling UI flow.
    • path:
      • src/main/git/worktree.ts:592 removeWorktree calls git branch -d
      • src/main/git/worktree.ts:610 -d fails with 'not fully merged' (squash-merge shape)
      • src/main/git/worktree.ts:613 catch invokes deleteAlreadyMergedBranchAfterSafeDeleteFailure
      • src/main/git/worktree.ts:626 refreshBranchCleanupTargetRefs(runGit, targetRefs) is awaited synchronously
      • src/shared/git-branch-cleanup.ts:61 await readOptionalGitStdout(runGit, ['fetch', '--prune', remote])
      • src/shared/git-branch-cleanup.ts:3 readOptionalGitStdout has no timeout, just try/catch

Generated by pr-bug-scan (proof-machine architecture). Human approval required before merge.

Race git fetch in refreshBranchCleanupTargetRefs against a 5s timeout so worktree.rm cannot stall on unreachable remotes.
Copy link
Copy Markdown
Contributor

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — races git fetch --prune in refreshBranchCleanupTargetRefs against a 5s timeout so an unreachable remote cannot stall worktree.rm.

  • Add Promise.race timeout to refreshBranchCleanupTargetRefs — the git fetch --prune for refreshing remotes before branch-cleanup now times out at 5s via Promise.race, with the timer cleaned up in a finally block.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

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.

0 participants