Skip to content

fix: createAgent fallback when event parsing fails on Gravity#17

Merged
keanji-x merged 2 commits intomainfrom
feat/upgrade-script-and-docs
Apr 17, 2026
Merged

fix: createAgent fallback when event parsing fails on Gravity#17
keanji-x merged 2 commits intomainfrom
feat/upgrade-script-and-docs

Conversation

@keanji-x
Copy link
Copy Markdown
Collaborator

Summary

  • Add fallback in chain.createAgent(): when AgentCreated event parsing fails (common on Gravity testnet), query findAgentByName to resolve the agentId from the confirmed transaction
  • Previously 19/25 agents failed to start with "Agent creation succeeded but no agentId returned"

Test plan

  • All 25 agents connect successfully on Gravity testnet after fix
  • Verified findAgentByName correctly returns agent IDs on Gravity

🤖 Generated with Claude Code

keanji-x and others added 2 commits April 17, 2026 14:54
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>
@keanji-x keanji-x merged commit 67421ba into main Apr 17, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant