Repair Async Context Leakage

    1

    Repair lost or stale async context, cross-request/tenant contamination, ThreadLocal leaks, detached task inheritance, and over-broad context propagation.

    Secure checkout via Stripe

    0 installsSecurity scanned

    Works with the AI tools you already use

    CClaude CodeCCursorCCodex CLIGGitHub CopilotGGemini CLI+17 more

    See it in action

    You say

    Our Node/TypeScript SaaS uses AsyncLocalStorage for requestId, tenantId, userId, and traceId. A webhook handler schedules work with setImmediate, one helper caches the current context object in module scope, and a background email task is started with void sendEmail(). Under concurrency we occasionally see a log line with the correct requestId but the wrong tenantId. One detached task also keeps userId after the HTTP response is finished. Repair the repository with synthetic tenants and deterministic concurrency tests. Do not access production logs/data, change auth policy, or copy tokens into context.

    Your agent does

    Async context leakage found. A module-level cached context can outlive its request, detached work inherits request identity, and logging can combine mismatched ownership paths. The repair removes global context reuse, makes durable metadata explicit, restores/clears context at owned boundaries, and adds deterministic cross-tenant concurrency tests. Production isolation remains unverified.

    What you get

    Prevent cross-tenant data contamination in concurrent requests.Fix broken log correlation IDs across async and callback boundaries.Ensure background workers correctly inherit or detach from request context.Audit ThreadLocal and MDC usage for stale data leakage in worker pools.

    About this skill

    Async context bugs are difficult because the code often looks correct in one request and fails only under concurrency. A cached AsyncLocalStorage object can cross tenant boundaries, a reused worker thread can retain ThreadLocal state, or a detached task can inherit request identity long after the request ends.

    Repair Async Context Leakage gives an AI coding agent a repository workflow for mapping context sources and lifetimes, repairing propagation and cleanup, separating tracing from authorization, minimizing durable job metadata, and proving isolation with deterministic concurrent tests.

    It does not inspect production logs/data, change authorization policy, or copy secrets into diagnostic context.

    How to install

    Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean today

    Listedtoday

    Frequently Asked Questions