fix(discovery): tune RPC timeout and failure threshold from production data#239
Open
uibeka wants to merge 1 commit intoConway-Research:mainfrom
Open
fix(discovery): tune RPC timeout and failure threshold from production data#239uibeka wants to merge 1 commit intoConway-Research:mainfrom
uibeka wants to merge 1 commit intoConway-Research:mainfrom
Conversation
…n data PER_CHUNK_TIMEOUT_MS (3s → 8s) and MAX_CONSECUTIVE_FAILURES (2 → 5) in getRegisteredAgentsByEvents were set pre-production in PR Conway-Research#228. Production operation on Base revealed both are too tight: eth_getLogs on recent block ranges regularly exceeds 3s, and two consecutive timeouts on the newest chunks (scanned first) aborts the entire scan before reaching older blocks where agent mint events live. Updated to production-validated values tested across 10+ successful discovery calls on two agents. 8s accommodates observed Base RPC latency with margin. 5 consecutive failures tolerates transient slow chunks without abandoning the scan. Also bumped timeout on the discover_agents loop test (180s) since it makes real RPC calls and the increased per-chunk timeout extends worst-case execution time. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
4 tasks
Contributor
Author
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.
Problem
PER_CHUNK_TIMEOUT_MS(3s) andMAX_CONSECUTIVE_FAILURES(2) ingetRegisteredAgentsByEvents()were set pre-production in PR #228. Production operation on Base's public RPC revealed both values are too aggressive for real-world latency:eth_getLogson recent block ranges regularly exceeds 3 seconds (3-6s observed). These are not failures — the RPC is responding, just slower on recent blocks that aren't fully indexed yet. The 3-secondPromise.racetimeout treats them as failures.Two consecutive timeouts on the newest chunks aborts the entire scan. The scanner processes newest blocks first. If the first two chunks are slow (common for recent blocks), the scanner gives up before ever reaching the older blocks where agent mint events actually live. Result:
discover_agentsreports 0 agents even though 20+ exist on-chain.Production Evidence
Observed across two agents running on Base mainnet (Feb 26):
discover_agentsreturns 0 agentsFix
Two constant value changes in
getRegisteredAgentsByEvents():PER_CHUNK_TIMEOUT_MS3_000(3s)8_000(8s)MAX_CONSECUTIVE_FAILURES25Scope
src/registry/erc8004.ts) — 2 constant values updatedsrc/__tests__/loop.test.ts) — timeout bump from 30s default to 180s to accommodate corrected scanning duration. Thediscover_agentsloop test makes real RPC calls to Base mainnet; with correct timeout values, worst-case scan path is ~40s (5×8s), exceeding the default 30s test timeout. The test was only fast before because the scanner was aborting prematurely — the exact bug being fixed.Testing
pnpm build— zero errorspnpm test— all existing tests passRelated