Skip to content

fix(serviceoffer): scope ERC-8004 agentId to the offer's own chain - #764

Merged
bussyjd merged 1 commit into
integration/v0.14.0-rc0from
fix/erc8004-chain-scoped-agentid
Jul 16, 2026
Merged

fix(serviceoffer): scope ERC-8004 agentId to the offer's own chain#764
bussyjd merged 1 commit into
integration/v0.14.0-rc0from
fix/erc8004-chain-scoped-agentid

Conversation

@bussyjd

@bussyjd bussyjd commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Canary402 field report — issue 1 (🚨 ERC-8004 identity incorrectly reused across chains)

Switching an offer's spec.payment.network from 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.status is never chain-tagged and never reset when spec.chain changes. Four sites trusted it (or the equally chain-blind offer.status.agentId) as an AgentID source: reconcileRegistrationStatus, reconcileRegistrationActive (whose firstNonEmpty fallback also skipped the entire on-chain ownership-verification block whenever the stale id was non-empty), reconcileRegistrationTombstone, and applySharedRegistrationStatus (which also flipped Registered=True off 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

  • All four sites now derive AgentID solely from 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=True requires a chain-scoped AgentID; status.registrationTxHash is only mirrored when one exists (same chain-blind source).
  • Disabling registration clears status.agentId/registrationTxHash.
  • New RemoveAgentIdentityRegistration counterpart to Upsert… + obol sell identity forget <chain> escape hatch so already-poisoned identity records can be corrected (previously permanent).

Tests

  • Chain-switch regression test: recorded base-sepolia id + switch to base → nothing upserted for base, registration document unchanged (fails on pre-fix code with a spurious base entry).
  • Shared/borrowing offer on a mismatched chain does not adopt the owner's foreign-chain id nor flip Registered.
  • Disable-clears-status, RemoveAgentIdentityRegistration unit 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

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
@bussyjd
bussyjd merged commit 52263e4 into integration/v0.14.0-rc0 Jul 16, 2026
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