Skip to content

feat(network): add fetch timeouts to GitHub API and Git operations#3747

Merged
gregpriday merged 4 commits intodevelopfrom
feature/issue-3697-add-fetch-timeouts-github-api
Mar 19, 2026
Merged

feat(network): add fetch timeouts to GitHub API and Git operations#3747
gregpriday merged 4 commits intodevelopfrom
feature/issue-3697-add-fetch-timeouts-github-api

Conversation

@gregpriday
Copy link
Copy Markdown
Collaborator

Summary

  • Adds explicit timeouts to all GitHub GraphQL/REST calls and simple-git operations so the app no longer hangs during API outages or slow networks
  • GitHub GraphQL gets a 15s per-request timeout via AbortController signal, REST fetch calls get the same treatment
  • simple-git operations get a 30s timeout for local commands and 30s for network commands via the timeout constructor option
  • Timeout errors flow through the existing parseGitHubError handler and cache fallback, so timed-out requests serve stale data instead of freezing the UI

Resolves #3697

Changes

  • electron/services/github/GitHubAuth.tscreateClient() now accepts an optional AbortSignal and wires it into the Octokit request options
  • electron/services/GitHubService.ts — All GraphQL calls create an AbortController with 15s timeout; REST fetch uses AbortSignal.timeout()
  • electron/services/GitService.tssimpleGit() constructor receives timeout config
  • electron/utils/git.tscreateGit() utility updated with timeout parameter
  • electron/workspace-host/WorkspaceService.ts and WorktreeMonitor.ts — git instances created with timeouts
  • Various IPC handlers and services updated to pass timeout config through createGit()

Testing

  • Added unit tests for GitHubAuth timeout error handling
  • Updated existing git utility tests for the new timeout parameter
  • Updated workspace service test mocks for createGit signature change
  • npm run check passes clean (typecheck + lint + format)

@gregpriday
Copy link
Copy Markdown
Collaborator Author

Review status: Rebased and ready

- Add createGit() factory with 30s rolling block timeout for all simpleGit calls
- Add per-call AbortSignal.timeout(15s) to all @octokit/graphql calls
- Add AbortSignal.timeout to raw fetch() calls in GitHubAuth, GitHubService, githubCreateIssue
- Update parseGitHubError and GitHubAuth.validate to detect TimeoutError
- Replace all 29 simpleGit() call sites across 10 files with createGit()
- Export GITHUB_API_TIMEOUT_MS and GITHUB_AUTH_TIMEOUT_MS from github module
- Add createGit to vi.mock for utils/git.js in WorkspaceService and WorktreeMonitor tests
- Add test for TimeoutError mapping to network error message
- Add test verifying AbortSignal is passed to fetch during validation
- Merge createGit (timeout) and createHardenedGit (security config) into single function
- Add GIT_BLOCK_TIMEOUT_MS (30s) to createHardenedGit options
- Update all imports from createGit to createHardenedGit across services
- Update test mocks to reference hardenedGit.js instead of simple-git
@gregpriday gregpriday force-pushed the feature/issue-3697-add-fetch-timeouts-github-api branch from 84a5f17 to 45d7bef Compare March 19, 2026 03:26
@gregpriday gregpriday merged commit f5b901e into develop Mar 19, 2026
3 checks passed
@gregpriday gregpriday deleted the feature/issue-3697-add-fetch-timeouts-github-api branch March 19, 2026 03:26
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.

Add fetch timeouts to GitHub API and Git operations

1 participant