fix: createAgent fallback when event parsing fails on Gravity#17
Merged
fix: createAgent fallback when event parsing fails on Gravity#17
Conversation
On Gravity testnet, the AgentCreated event from GameEngine receipt logs sometimes fails to parse (ethers v5 parseLog throws on logs from other contracts in the same tx). This left agentId as null, causing ensureAgent to throw "Agent creation succeeded but no agentId returned". Add fallback: if event parsing returns no agentId, query the chain via findAgentByName to resolve the ID from the already-confirmed transaction. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Orchestrator.startAll now resolves all agents on-chain BEFORE starting any cycles. Previously, early agents' cycles fired concurrent RPC calls (harvest, build, etc.) that interfered with later agents' create_agent transactions on Gravity testnet, causing 19/25 agents to fail. Also adds findAgentByName fallback in chain.createAgent when event parsing fails. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
chain.createAgent(): whenAgentCreatedevent parsing fails (common on Gravity testnet), queryfindAgentByNameto resolve the agentId from the confirmed transactionTest plan
findAgentByNamecorrectly returns agent IDs on Gravity🤖 Generated with Claude Code