From 99daddd6d2786c9adda925cfd51a3fbee9d64aef Mon Sep 17 00:00:00 2001 From: Sohil Kshirsagar Date: Mon, 16 Mar 2026 08:52:36 -0700 Subject: [PATCH] fix: add actionable warning for background requests during replay --- src/instrumentation/core/utils/modeUtils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/instrumentation/core/utils/modeUtils.ts b/src/instrumentation/core/utils/modeUtils.ts index c2280e72..4bb467a9 100644 --- a/src/instrumentation/core/utils/modeUtils.ts +++ b/src/instrumentation/core/utils/modeUtils.ts @@ -73,7 +73,9 @@ export function handleReplayMode({ // Background request: App is ready + not within a trace (no parent span) + not a server request if (isAppReady && !currentSpanInfo && !isServerRequest) { - logger.debug(`[ModeUtils] Handling no-op request`); + logger.warn( + `[ModeUtils] Background request detected during replay (no active trace context). This typically means a background job, scheduled task, or middleware (e.g., rate limiters, message consumers) is running outside of a test trace. To avoid errors, disable these services when TUSK_DRIFT_MODE=REPLAY.`, + ); // This is a background request (app is ready and no parent span), call the backgroundRequestHandler return noOpRequestHandler(); }