fix(agent): make buildHttpClient failures actionable (#823) - #919
Open
Sagethepeak wants to merge 1 commit into
Open
fix(agent): make buildHttpClient failures actionable (#823)#919Sagethepeak wants to merge 1 commit into
Sagethepeak wants to merge 1 commit into
Conversation
…em#823) - Classify errors as transient vs permanent (HttpClientError + classifyHttpClientError) - Wrap each sub-operation (loadSecret/createSigner/createScheme/createClient) so logs name the failing operation and safe inputs (rpcUrl, network, secretSource) without leaking secret - Log with event http_client_init_failed at warn (transient) / error (permanent) with operation, kind, code, safeInputs and cause - Exit with distinct codes 75 (EX_TEMPFAIL, retryable) vs 78 (EX_CONFIG, fix config) so supervisor can decide to restart; main() now defers construction via getHttpClient() and handles top-level crash in entry guard - Lazy singleton preserves backwards compat; eager fallback proxied to avoid import-time crash in tests
|
@Sagethepeak Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #823
Problem
buildHttpClientatagent/agent.js:248failed without distinguishing transient (retryable network) vs permanent (config) causes, leaving operator unable to tell whether to retry or fix config in unattended runs.Solution
HttpClientError(kind: transient|permanent) +classifyHttpClientError()(AbortError/timeout/ETIMEDOUT/ECONNREFUSED/ENOTFOUND/EAI_AGAIN/fetch failed/5xx/429 → transient; default permanent to avoid retry storms)loadSecret→createSigner→createScheme→createClient) so error carriesoperation(buildHttpClient.loadSecretetc.) andsafeInputs(rpcUrl,network,secretSource/filePath— never secret)http_client_init_failedatwarn(transient) vserror(permanent) withoperation,kind,code(HTTP_CLIENT_TRANSIENT|PERMANENT),safeInputs,cause75 EX_TEMPFAIL(transient, supervisor should restart) vs78 EX_CONFIG(permanent, fix config) — distinct from generic1crash; wired inmain()via lazygetHttpClient()and in entry guardmain().catchmain()Acceptance
agent:test50/50Verification
cd agent && npm test→ 50 passedManual:
classifyHttpClientError(new DOMException(..., 'AbortError')) === 'transient', permanent default for config errorsWhere
agent/agent.js— newEXIT_CODE,HttpClientError,classifyHttpClientError,logHttpClientFailure, refactoredbuildHttpClient,getHttpClientlazy init,main()handling