fix(serviceoffer): scope ERC-8004 agentId to the offer's own chain - #764
Merged
bussyjd merged 1 commit intoJul 16, 2026
Merged
Conversation
Every site that fed ServiceOfferStatus.AgentID trusted RegistrationRequest.Status.AgentID (or the equally chain-blind status.AgentID/offer.Status.AgentID fallbacks) even though that subresource is never chain-tagged and is never reset when spec.payment.network changes. Switching an offer from Base Sepolia to Base retained the Sepolia numeric id, skipped the on-chain ownership check (erc8004 FindRegistrationByOwnerAndURI/TxHash), and durably wrote it into the shared AgentIdentity CR under "base" — even though that Base token may belong to a different wallet. Disabling registration left the stale id in status/CLI output. Fixes all four sites to derive AgentID solely via AgentIdentityAgentIDForChain(identity.Status, <this offer's own chain>): reconcileRegistrationStatus, reconcileRegistrationActive (now correctly forces on-chain verification after a chain switch), reconcileRegistrationTombstone, and applySharedRegistrationStatus (also drops the stale bare-Phase Registered=True path for the same reason). Disable now clears status.AgentID/RegistrationTxHash. Adds RemoveAgentIdentityRegistration plus `obol sell identity forget <chain>` as the operator remediation path for already-poisoned records. Addresses a Canary402 field report. Claude-Session: https://claude.ai/code/session_014YjPMViNrZ7zBVgUQzwEKk
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.
Canary402 field report — issue 1 (🚨 ERC-8004 identity incorrectly reused across chains)
Switching an offer's
spec.payment.networkfrom Base Sepolia to Base retained the Sepolia numeric Agent ID and published it as a Base registration — a token that on Base may belong to a different wallet — and disabling registration left the wrong entry in status output.Root cause
RegistrationRequest.statusis never chain-tagged and never reset whenspec.chainchanges. Four sites trusted it (or the equally chain-blindoffer.status.agentId) as an AgentID source:reconcileRegistrationStatus,reconcileRegistrationActive(whosefirstNonEmptyfallback also skipped the entire on-chain ownership-verification block whenever the stale id was non-empty),reconcileRegistrationTombstone, andapplySharedRegistrationStatus(which also flippedRegistered=Trueoff a bare non-chain-scoped phase/id — widened by 84dcbf8). The unverified id was then durably upserted into the shared AgentIdentity CR and rendered into/.well-known/agent-registration.json, with no removal path anywhere in the codebase.Fix
AgentIdentityAgentIDForChain(identity.Status, <the offer's own chain>); a chain switch therefore forces the existing on-chain ownership check (FindRegistrationByOwnerAndURI/ByTxHash) before anything is recorded.Registered=Truerequires a chain-scoped AgentID;status.registrationTxHashis only mirrored when one exists (same chain-blind source).status.agentId/registrationTxHash.RemoveAgentIdentityRegistrationcounterpart toUpsert…+obol sell identity forget <chain>escape hatch so already-poisoned identity records can be corrected (previously permanent).Tests
go test ./...green; implementer verified both new regression tests fail when the two core lines are reverted.Part of the Canary402 field-report sweep (6 PRs). Commit unsigned — batch re-sign before merge if required.
https://claude.ai/code/session_014YjPMViNrZ7zBVgUQzwEKk