fix(mcp): report real tier/ELO/G on idempotent arena_submit re-submit - #68
Open
colinisme wants to merge 1 commit into
Open
fix(mcp): report real tier/ELO/G on idempotent arena_submit re-submit#68colinisme wants to merge 1 commit into
colinisme wants to merge 1 commit into
Conversation
ArenaEngine.submit() is idempotent — re-submitting an already-pooled ghost is a no-op guarded by `if (!isSubmitted[agentId])` and emits no GhostSubmitted event. arena_submit parsed only that event, so a re-submit fell through to the 0/0/Bronze defaults and reported a misleading "Ghost submitted! Tier: Bronze, ELO 0, G 0" even though the ghost was correctly sitting in (e.g.) the Gold pool and matchmaking accordingly. Fall back to live on-chain reads (tierStates + getGhost) when no event is present, and lead the message with "Already in the pool" so the no-op case is honest. Verified live on mainnet: a pooled agent now reports its true Gold/ELO/G on re-submit instead of Bronze/0/0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
arena_submitreports a misleadingTier: Bronze, ELO 0, G at submit: 0when an agent that is already in the matchmaking pool re-submits — even though the ghost is correctly sitting in its real tier (e.g. Gold) and matchmaking pairs it there.Reproduced live on mainnet while running Arena battles for three agents: Colin111 (#32) was already pooled from a prior session, so its re-submit printed
Bronze / 0 / 0— yet it was matched in Gold and won. The on-chain submission was always correct; only the MCP's return message was wrong.Root cause
ArenaEngine.submit()is intentionally idempotent:A re-submit of an already-pooled ghost is a no-op that emits no
GhostSubmittedevent.arenaSubmit()parsed only that event, so when it was absent the function fell through to itstier = 0, elo = 0, gAtSubmit = 0defaults →Bronze / 0 / 0. (settleMatchclearsisSubmitted, which is why agents that had just fought re-submitted with correct values and never showed the bug.)Fix
When no
GhostSubmittedevent is found, fall back to live on-chain reads instead of the zero defaults:arena.tierStates([agentId])→ real tier + G balancearena.getGhost(agentId)→ real ELOThe tool message now leads with "Already in the pool" for the no-op case so it's honest about what happened, and adds an
alreadyPooledflag to the return shape.Verification (live, Gravity mainnet)
Ghost submitted! Tier: Gold, ELO 1017, G 2175Ghost submitted! Tier: Bronze, ELO 0, G 0❌Already in the pool Tier: Gold, ELO 1017, G 2175✅tier_infoconfirms ground truth =Gold / 2175.tsc --noEmitpasses; the trackedbin/gravity-town-mcp.mjsbundle was rebuilt from the patched source.🤖 Generated with Claude Code