fix(scope): retry transient remote-fetch failures; fix unhandled rejection in findFirstEnv - #10603
Conversation
…e pLocate rejection in findFirstEnv A single HTTP 500 from a remote scope killed a 57-minute 'bit ci pr' build (observed on a lane snapping hundreds of components; the fetch to one scope returned 500 once). Two independent hardenings: - objects-fetcher: fetch is read-only and idempotent, so UnexpectedNetworkError (the transient class: server 5xx / isError payloads) now retries up to 3 attempts with 3s/12s backoff before failing the command. Auth and scope-not-found errors still throw immediately. - envs findFirstEnv: pLocate runs its async predicates concurrently, so a predicate rejecting after pLocate settles crashes the process as an unhandled rejection - which is exactly how the 500 surfaced. The predicate is a discovery heuristic; a component that cannot be loaded cannot be identified as an env, so log and return false instead of racing an uncatchable rejection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PR Summary by QodoRetry transient remote scope fetch failures and harden findFirstEnv against late rejections
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1. Retry blocks fetch concurrency
|
|
Code review by qodo was updated up to the latest commit 59d94cb |
Why
While load-testing
bit ci pron a full-cascade lane (#10602), a single transient HTTP 500 from one scope fetch (teambit.dependencies) killed a 57-minute build — twice over:objects-fetcherhas no retry: one 500 on an idempotent read fails the whole command.findFirstEnv'spLocate— concurrent predicates that reject afterpLocatesettles have no handler and crash the process.Changes
UnexpectedNetworkError(server 5xx / isError payloads) retries up to 3 attempts with 3s/12s backoff, with a warning log per retry. Auth/scope-not-found errors throw immediately as before. Fetch is read-only and idempotent, so retrying is safe.findFirstEnvpredicate hardened: load failures inside the discovery heuristic log a warning and return false ("cannot be identified as an env") instead of racing an uncatchable rejection.Verification
npm run lintgreen (oxlint + tsc),bit compileon both components.🤖 Generated with Claude Code