From d22564df4d72496a29e5f936caf34250016c4ff8 Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Sun, 31 May 2026 00:47:47 -0300 Subject: [PATCH] fix(session-pool): round-robin fingerprints in SessionFactory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit createSession() used rotator.random() despite its docstring saying 'next available fingerprint'. Random draws collide in a small profile pool, producing duplicate fingerprints (and duplicate sess-- ids) across a warm pool — flaky tests and look-alike sessions. Switch to rotator.next() so each pooled session gets a distinct fingerprint, as documented. --- open-sse/services/sessionPool/sessionFactory.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/open-sse/services/sessionPool/sessionFactory.ts b/open-sse/services/sessionPool/sessionFactory.ts index ab23e17bab..39c1c2e596 100644 --- a/open-sse/services/sessionPool/sessionFactory.ts +++ b/open-sse/services/sessionPool/sessionFactory.ts @@ -25,7 +25,10 @@ export class SessionFactory { * would involve Playwright browser automation. */ createSession(): Session { - const fingerprint = this.rotator.random(); + // Round-robin so each session in a warm pool gets a distinct fingerprint + // (a pool of look-alike sessions defeats the purpose). The rotator still + // exposes random() for callers that want unpredictability over time. + const fingerprint = this.rotator.next(); return new Session( fingerprint, this.config.cooldownBase,