Skip to content

Bound every synchronous git/ssh call on the main process - #116

Merged
currentbits merged 1 commit into
mainfrom
coder/synchronous-git-on-the-main-process-even-d0e336
Aug 16, 2026
Merged

currentbits merged 1 commit into
mainfrom
coder/synchronous-git-on-the-main-process-even-d0e336

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Closes #88.

execFileSync blocks the Electron main-process event loop — agent streaming and every window with it. Only push opted into a timeout, so diff, listFiles, sync info, repo info, merge and the ssh variants of all of them ran unbounded: one hung filesystem or unreachable remote froze the whole app. Same failure class as the prStatus freeze already in docs/ISSUES.md, which was fixed at one call site and never generalized. (ssh ConnectTimeout=10 bounds the connect, not the command.)

What changed

  • electron/ssh.js — execCommand defaults timeout to a new SYNC_TIMEOUT_MS (15s) when the caller did not set one. One choke point instead of a guard per call site.
  • electron/worktrees.js — gitOut/gitTry route through execCommand instead of calling execFileSync directly, so they inherit that default. Local and remote git are now bounded by the same line.
  • electron/services.js — gitFetch/gitPull pass an explicit 60s; network git is legitimately slower than local, and the 15s default would have broken them.
  • Caller-supplied timeouts still win — push keeps its explicit 30s, and gitTry.timedOut already keys on ETIMEDOUT, which is what execFileSync throws on a timeout kill (verified).

Verification

  • New tests in electron/test/ssh.test.js: default applied locally, default applied over ssh, caller override wins, and gitTry inherits it. Mutation-checked — deleting the default line fails 3 of them.
  • Electron suite: 749 pass / 9 fail; the 9 (orch-server) fail identically on this branch and without the change.

Not done

Moving the hot IPC paths (diff, listFiles) to async spawn. 15s is a bounded freeze, not no freeze — that is a larger change than a bound, and is called out as a remainder in the docs/ISSUES.md entry.

🤖 Generated with Claude Code

  • PR created by the Claude Code agent

execFileSync blocks the Electron event loop, agent streaming included.
Only push opted into a timeout; diff, listFiles, sync info, repo info,
merge and the ssh variants of those had none, so a hung filesystem or an
unreachable remote froze the whole app — the prStatus failure class,
never generalized.

ssh.js execCommand is now the single choke point: it defaults timeout to
SYNC_TIMEOUT_MS (15s), and worktrees gitOut/gitTry route through it
instead of execFileSync. Caller-supplied timeouts still win (push keeps
30s); services gitFetch/gitPull pass 60s since network git is honestly
slower.

Co-Authored-By: Claude Opus 5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@currentbits
currentbits merged commit d69d6ac into main Aug 16, 2026
1 check passed
@currentbits
currentbits deleted the coder/synchronous-git-on-the-main-process-even-d0e336 branch October 3, 2026 16:07
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.

Synchronous git on the main-process event loop with no default timeout

1 participant