Skip to content

v29: Harden ENSJobPages preview & FreeTrialSubdomainRegistrarIdentity (contract-faithful identity flow)#1480

Open
MontrealAI wants to merge 4 commits into
mainfrom
codex/upgrade-agijobmanager-html-to-v29-873iqt
Open

v29: Harden ENSJobPages preview & FreeTrialSubdomainRegistrarIdentity (contract-faithful identity flow)#1480
MontrealAI wants to merge 4 commits into
mainfrom
codex/upgrade-agijobmanager-html-to-v29-873iqt

Conversation

@MontrealAI
Copy link
Copy Markdown
Owner

Motivation

  • Finish a correctness-first v29 pass that makes ENS Job Page Preview and the alpha-agent identity flow contract-faithful, robust, and mobile-friendly while preserving the single-file UI surface.
  • Remove stale assumptions (old ENSJobPages address, job-<id> label guesses, simplified identity ABI) and drive identity UX from the registrar preview(label) + rootHealth() canonical reads.

Description

  • Resolve ENSJobPages from AGIJobManager.ensJobPages() first and then use the verified fallback 0x06188e77c1c38d392b16d9d9fb24673363ce1da0 with explicit ensPagesAddressSource tracking, and hydrate the preview with live getters including owner, ens, nameWrapper, publicResolver, jobLabelPrefix, jobLabelSnapshot(nextJobId), jobEns* and nextJobId.
  • Replace and extend the ENSJobPagesABI and FreeTrialSubdomainRegistrarIdentityABI shapes to match the authoritative contract tuples for rootHealth, preview, and labelData, and parse their full return tuples.
  • Rebuild the identity state machine so preview(label) is the primary truth driving status labels, CTA enablement, token card fields, and post-success refresh; map status codes to named states and enable register, claimIdentity, and syncIdentityByLabel according to the contract semantics.
  • Make the identity route the recommended UX (FreeTrialSubdomainRegistrarIdentity.register(label)), preserve the ENS-only expert registerSimple(parentNode,label,newOwner) path as secondary (recipient override only on ENS-only path), and do not expose any transfer/approval controls for the soulbound identity NFT.
  • Improve mission-control and command-palette precedence so claimable and desynced/expired repair states win ahead of generic mint prompts; prefer live reads for wrapper/resolver via AGIJobManager.nameWrapper()/ens() and show explicit degraded messaging when those reads fail.
  • Decode tokenURI JSON (base64 data:) client-side to populate NFT name/description/image and display the identity token card fields using preview(label), ownerOf(tokenId), and labelData(tokenId) in contract-faithful ways; add root-health cross-checks (namehash vs ROOT_NODE) and mismatch warnings for wrapper/registry differences.
  • Keep all major v28 surfaces intact, update visible versioning/storage keys to v29, add defensive stale-state clearing on account/chain changes, and harden mobile/responsive previews.

Testing

  • Extracted inline script and ran node --check /tmp/v29.js to validate script syntax after the changes, which succeeded.
  • Searched the artifact for forbidden stale patterns and native dialogs using grep (looked for 0xc19A84, job-<id>, job-${, and alert|confirm|prompt) and found none of the banned items present; these checks passed.
  • Performed programmatic smoke checks of the updated code paths (ABI names, parseIdentityPreviewResult, ENSJobPages resolution) via local JS inspection and small runtime checks in the file; these validated the updated parsing and runtime-read ordering.
  • Attempted a Playwright file:// screenshot run to visually verify layout, which failed in the current container environment due to file:/// resolution constraints (environmental limitation), not a code error; no browser artifact produced.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 79e070c225

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const wrapperAddr = wrapperCheckDegraded ? NAME_WRAPPER : managerWrapperAddr;
if(!wrapperAddr || isZeroAddress(wrapperAddr)) throw new Error('No usable NameWrapper address available for verification.');
const nw = new web3.eth.Contract(NameWrapperABI, wrapperAddr);
const runtimeNameWrapper = await agiJobManager?.methods?.nameWrapper().call().catch(()=> '') || NAME_WRAPPER;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reapply zero-address fallback for NameWrapper lookup

This lookup now falls back only on empty/failed reads, not on the all-zero address, so when AGIJobManager.nameWrapper() returns 0x000...000 the code still instantiates NameWrapperABI at the zero address and ownerOf/approval checks fail. In that degraded-but-supported configuration, ENS role verification regresses from "works with fallback" to hard error for agent/club validation.

Useful? React with 👍 / 👎.

if(preview?.tokenId && !!preview?.identityExists){
const [ownerOf, labelData, tokenURI, lockedState] = await Promise.all([
freeTrialRegistrarIdentity.methods.ownerOf(preview.tokenId).call().catch(()=> preview?.tokenOwner || ''),
if(preview?.identityExists && preview?.tokenId){
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear token card state when identity preview is absent

The token-card rendering now only updates inside if (preview?.identityExists && preview?.tokenId) and no longer has the previous reset branch, so switching from a label with an identity token to one without a token leaves stale owner/minted/metadata/image values on screen. The same stale state occurs when tokenURI is not base64 JSON, because that path also no longer clears metadata fields.

Useful? React with 👍 / 👎.

Comment on lines +3119 to +3121
}else if(connected && isMainnet && hasAcceptedTerms && !verified.agentAlpha){
title = 'Mint your alpha-agent ENS access key';
body = 'You can mint a free-trial *.alpha.agent.agi.eth identity now (gas only), then auto-verify it for agent readiness.';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Evaluate preview claim/sync states before mint prompt

Mission-control now branches on !verified.agentAlpha before any preview-driven claim/sync logic, while the p.claimable/desynced checks were moved into the later System ready block. That means wallets with claimable/desynced identity state but no local ENS verification flag are steered to "mint free alpha-agent ENS" instead of the correct claim/sync repair action.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac746fc3b0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +3138 to +3140
}else if(connected && isMainnet && hasAcceptedTerms && !verified.agentAlpha){
title = 'Mint your alpha-agent ENS access key';
body = 'You can mint a free-trial *.alpha.agent.agi.eth identity now (gas only), then auto-verify it for agent readiness.';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Prioritize active job actions over alpha-mint fallback

The new !verified.agentAlpha branch now runs before both the validator (jobStats.completion > 0 && verified.club) and agent (jobStats.open > 0 && verified.agent) branches, so connected mainnet users who have actionable jobs but lack the alpha badge are redirected to mint guidance instead of the task they can perform right now. This regresses mission-control prioritization and can hide urgent review/apply workflows behind an unrelated identity prompt.

Useful? React with 👍 / 👎.

Comment on lines +4061 to +4064
const lockedReason = identityWriteLockedReason(preview);
const registerEnabled = !lockedReason && preview?.registrable;
const claimEnabled = !lockedReason && preview?.claimable;
const syncEnabled = !lockedReason && preview?.identityExists && (preview.status===3 || preview.status===4);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Block identity actions on ROOT_NODE mismatch

This flow still detects a ROOT_NODE mismatch, but lockedReason no longer incorporates that condition, so register/claim/sync can remain enabled even when namehash(ALPHA_AGENT_PARENT) disagrees with the contract root. In that misconfigured state users are prompted to submit identity writes that are expected to fail or target inconsistent state, whereas the previous logic explicitly locked writes on mismatch.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82a0255f1c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


const rootMismatch = (rootNode || h?.rootNode) && computed.toLowerCase() !== String(h?.rootNode || rootNode).toLowerCase();
let mismatchWarnings = [];
const rootNodeMismatch = !!rootNode && computed.toLowerCase() !== String(rootNode).toLowerCase();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore rootHealth fallback in ROOT_NODE mismatch check

rootNodeMismatch now compares only ROOT_NODE() output, but that getter is read with .catch(()=> '') and can fail independently from rootHealth(). In that degraded-read scenario, rootNodeMismatch becomes false even when rootHealth.rootNode disagrees with namehash(ALPHA_AGENT_PARENT), so lockedReason no longer blocks register/claim/sync and users can be prompted into writes against an inconsistent root. The previous logic used the health tuple as a fallback and avoided this safety regression.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant