fix: Resolve worker teardown timeout by properly handling recursive scheduler promises #89
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
Fixed a critical issue where Playwright E2E tests would complete successfully but the worker would timeout during teardown after 60 seconds. This was caused by floating promises in the scheduler's recursive chain.
Problem
The latest commit on main (
7b1e53b6) broke the CI build with a worker teardown timeout:09:00:3509:01:35(exactly 60 seconds later)Worker teardown timeout of 60000ms exceededRoot Cause
In
ClaudeTerminal.tsx, thescheduleNext()function had two issues:scheduleNext()recursively without returning the promisescheduleNext()without any promise handlingThis created untracked promise chains that continued running even after tests completed, preventing the Playwright worker from cleaning up properly.
Solution
Promise<void>return type toscheduleNextfunction for clarityreturn scheduleNext()to properly chain the recursive promisevoidoperator on line 221 to explicitly mark the initial call as fire-and-forget while maintaining the promise chain internallyThis ensures that when
stopScheduler()is called (either explicitly or during test cleanup), the entire promise chain can resolve properly, allowing the Playwright worker to teardown without timing out.Changes
apps/desktop/src/renderer/components/ClaudeTerminal.tsx: Fixed promise handling in schedulerTest Plan
Evidence
CI logs from failed build (19359320911):
🤖 Generated with Claude Code