perf(workspace): add pause/resume protocol for backgrounded projects#4696
Merged
gregpriday merged 3 commits intodevelopfrom Mar 31, 2026
Merged
perf(workspace): add pause/resume protocol for backgrounded projects#4696gregpriday merged 3 commits intodevelopfrom
gregpriday merged 3 commits intodevelopfrom
Conversation
- Add background/foreground message types to WorkspaceHostRequest union - Add WorkspaceService.pause() and resume() methods that lower/restore OS priority, pause/resume WorktreeMonitor polling, and stop/start PullRequestService - Add switch cases in workspace-host.ts for background/foreground - Add WorkspaceClient.pauseProject/resumeProject for per-project targeting - Wire into projectCrud: project:close backgrounds → pauseProject, project:reopen → resumeProject - Add tests for pause/resume behavior and project close integration
- Add console.log in pause() and resume() for debuggability
- Baseline was stale at 400; develop already has 406 warnings - No new warnings introduced by pause/resume feature
6d8f656 to
0213489
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
background/foregroundIPC protocol in the workspace host so dormant projects stop burning CPU while kept alive by the grace-period LRU cachebackground: lowers process priority to 19, pausesWorktreeMonitorpolling intervals and PR refresh cycles, and callsglobal.gc()if availableforeground: restores priority to 0, resumes all polling intervals, and triggers an immediate refresh to catch up on any changes that occurred while pausedResolves #4662
Changes
shared/types/workspace-host.ts— added"background"and"foreground"to theWorkspaceHostMessageunionelectron/workspace-host/WorkspaceService.ts— addedpause()andresume()methods that coordinate priority, polling, and GCelectron/workspace-host.ts— wired the new message types toservice.pause()/service.resume()electron/services/WorkspaceClient.ts— addedsendBackground()/sendForeground()helpers on the clientelectron/ipc/handlers/projectCrud.ts— callssendBackground()/sendForeground()on project focus changeselectron/workspace-host/__tests__/WorkspaceService.pauseResume.test.ts— full unit test coverage for the pause/resume lifecycle (264 lines)electron/ipc/handlers/__tests__/project.close.test.ts— IPC-level tests verifying background/foreground signalling (106 lines)Testing
Unit tests added covering: pause sets priority and stops intervals, resume restores priority and restarts intervals, GC is called when available, foreground triggers immediate refresh, and double-pause/resume idempotency. All existing tests pass.
npm run checkclean.