Browse Source

fix(multiplexer): add test assertion and race window comment

Michael Henke 1 month ago
parent
commit
a69304ccfe

+ 2 - 0
src/multiplexer/session-manager.ts

@@ -623,6 +623,8 @@ export class MultiplexerSessionManager {
   async closeSessionFromCoordinator(sessionId: string): Promise<void> {
     if (!this.enabled) return;
     // Coordinator already vetted lifecycle policy; skip re-check
+    // ponytail: theoretical race if new job starts between coordinator's
+    // retryDeferredClose() and this call, but session IDs are unique per launch
     await this.closeSession(sessionId, 'idle', true);
   }
 

+ 1 - 0
src/utils/background-job-coordinator.test.ts

@@ -117,5 +117,6 @@ describe('BackgroundJobCoordinator', () => {
     });
 
     expect(listener).toHaveBeenCalledWith('full-chain-test');
+    expect(listener).toHaveBeenCalledTimes(1);
   });
 });