mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-04-07 11:38:16 +00:00
When the non-ephemeral batch endpoint returns 401 or 403 (expired token, revoked credentials, JWKS rotation), _initialize_backend_batch now switches is_current_batch_ephemeral to True and retries via the ephemeral endpoint. This preserves traces that would otherwise be lost due to the timing gap between client-side token validation and server-side JWT decode. The fallback only triggers on the non-ephemeral path to prevent infinite recursion. If the ephemeral attempt also fails, trace_batch_id is cleared normally. Addresses the 2M+ failed push attempts in which valid client-side tokens were rejected on the server.