You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each GoalLoopService.test.ts case finishes its own async work (fire-and-forget persist() / maybeContinue()) before afterEach removes its temp directory.
Actual
The tests leave async persistence running after they end. afterEach deletes the temp dir, and the late GoalLoopStore.write() then logs [goal-loop] persisting loop state failed: ENOENT … rename …goal-loop.json.<uuid>.tmp. Main CI run 36156560842 has 13 such warnings against 13 distinct temp dirs (12 rename, 1 open), all in the GoalLoopService worker.
Impact
Test hygiene, not user state: the errors are caught, and all the paths are test temp dirs. But the leftover work adds noise and can perturb fake-timer/I/O ordering in later cases in the same worker, which is the class of race behind #1314.
Where
src/main/goalLoop/GoalLoopService.test.ts (afterEach at the top) against GoalLoopService.tsvoid this.persist() / void this.maybeContinue().
Fix direction
Give the service a test-only drain (await in-flight continuations and persists), or stop the service before cleanup; do not swallow the log.
Also covers #1296 items 3 and 7 (moved here from PR #1353):
goalLoopTurnHooks.system.test.ts settles 20 ms before rm (ENOTEMPTY under load);
fixed 10–300 ms sleeps followed by 'not called' in GoalLoopService.test.ts (:64, :74, :205), goalLoop.system.test.ts:59 and goalLoopTurnHooks.system.test.ts (:101-106, :123) pass vacuously under load.
All three share this root cause: persistence and continuation work outliving the test. A drain on the service (await in-flight continuations and persists) makes 'nothing happened' provable and cleanup safe, replacing the sleeps. Blocked on #1337, which is changing GoalLoopService.test.ts.
Activity
Juliusolsson05 commentedon Sep 27, 2026
Also covers #1296 items 3 and 7 (moved here from PR #1353):
rm(ENOTEMPTY under load);All three share this root cause: persistence and continuation work outliving the test. A drain on the service (await in-flight continuations and persists) makes 'nothing happened' provable and cleanup safe, replacing the sleeps. Blocked on #1337, which is changing GoalLoopService.test.ts.
fix(goal-loop): a drain for in-flight work; tests dispose before clea…