Skip to content

UI/mobile v25 + admin control surfaces; ABI, state, and approval flow refactor#1452

Open
MontrealAI wants to merge 2 commits into
mainfrom
codex/upgrade-agijobmanager-ui-to-v25-tdowgh
Open

UI/mobile v25 + admin control surfaces; ABI, state, and approval flow refactor#1452
MontrealAI wants to merge 2 commits into
mainfrom
codex/upgrade-agijobmanager-ui-to-v25-tdowgh

Conversation

@MontrealAI
Copy link
Copy Markdown
Owner

Motivation

  • Upgrade the mobile UI enhancements to a new v25 namespace and harmonize mobile docking/sheet behavior for improved mobile UX.
  • Expose and centralize administrative controls in the UI so operators can inspect and invoke admin methods for both AGIJobManager and ENSJobPages without littering the primary layout.
  • Improve runtime state handling, protocol parameter access, and safer action reviews/approval flows to reduce accidental irreversible calls and better reflect on-chain BondMath logic client-side.

Description

  • Renamed mobile enhancement identifiers and CSS/JS symbols from v23 to v25 (IDs, classes, script id, and related functions) and updated the mobile shell wiring accordingly.
  • Added an Admin Control Surfaces card with generated routine/danger control lists and UI helpers (postureBadge, adminControlButton) and an executeAdminControl flow to prompt, confirm, and submit admin methods to agiJobManager or ensJobPages.
  • Expanded the ABIs and introduced ensureAbiMethods to add many administrative/read functions to AGIJobManagerABI and ENSJobPagesABI (owner/moderators, pause/unpause variants, blacklist/delist/rescue/resolution methods, ENS setters, etc.).
  • Centralized runtime state in APP_STATE and replaced scattered appState usage, added resetRuntimeState, jobsReadDegraded tracking, and improved event-read fallbacks around getActiveJobIdsFromEvents with clearer degraded-mode behavior and toasts.
  • Reworked the action confirmation flow: replaced older requestSimpleReview with requestActionConfirmation/openActionReview that use a promise-resolver pattern (pendingActionConfirmResolver) and tightened review UI/confirm behavior for approvals and admin calls.
  • Standardized protocol numeric access via getProtocolBigInt, introduced ensLabelPreviewForJobId, and renamed/refactored bond computation functions to computeAgentBondExactForJob and related callers to better use on-window protocolState values.
  • Minor UX/content tweaks: metadata createdVia bumped to v25.0, copy adjustments in calculators and helper text, and some localStorage key handling consolidated for TX activity.

Testing

  • Performed automated static checks and build verification (linter and JS syntax/build checks) on the modified bundle and they completed successfully.
  • No new unit tests were added as part of this change; the changes were validated by running the SPA build pipeline and loading the generated page in a test browser for basic runtime smoke checks (scripts executed without syntax/runtime initialization errors).

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: ab81adb7e8

ℹ️ 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 +5588 to +5592
if(!requireConnected() || !mustBeReadyToWrite()) return;
const contract = target === 'ens' ? ensJobPages : agiJobManager;
const argInput = prompt(`Optional comma-separated args for ${method}`);
const args = String(argInput || '').trim() ? String(argInput).split(',').map(x=>x.trim()) : [];
const ok = await requestActionConfirmation({
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Enforce admin role checks before sending admin txs

This handler only gates on connectivity/write readiness and then proceeds to execute any selected admin method, so non-owner/non-moderator wallets can still submit owner-only calls from the new admin surface; those calls will revert on-chain after submission and users will still pay gas. Because the previous flow had explicit role checks, this is a regression that can cause avoidable fund loss for any connected mainnet user exploring these controls.

Useful? React with 👍 / 👎.

Comment on lines +2356 to +2363
function resetRuntimeState(reason='context reset'){
activeJobIndexCache.ids = null;
activeJobIndexCache.ts = 0;
jobCache.clear();
latestJobs = [];
APP_STATE.jobsReadDegraded = false;
APP_STATE.admin = {managerOwner:null, ensOwner:null, isModerator:false};
if(reason) console.info('[resetRuntimeState]', reason);
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 visible runtime UI state on context reset

The reset path now clears only caches/state objects and no longer clears rendered job/admin fields, so when account or network context changes (including wallet disconnect flows that return immediately after reset), the page can keep showing stale data from the previous session. This is misleading for operators because ownership/posture/job information appears current even though the runtime context has been invalidated.

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: eb94ce5b78

ℹ️ 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 +5607 to +5610
const isOwner = managerOwner && account === managerOwner;
if(isOwner) return {ok:true, role:'manager-owner'};
const moderatorMethods = new Set(['resolveDisputeWithCode','resolveStaleDispute']);
if(APP_STATE.admin?.isModerator && moderatorMethods.has(method)) return {ok:true, role:'moderator'};
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 Match admin role checks to on-chain modifiers

isAuthorizedForAdminMethod currently authorizes the connected owner for every manager admin call and also treats resolveStaleDispute as a moderator method, but on-chain permissions are split the other way for these dispute functions (resolveDisputeWithCode is onlyModerator, while resolveStaleDispute is onlyOwner in contracts/AGIJobManager.sol). In practice, an owner who is not a moderator (or a moderator who is not owner) will be told they are authorized, sign the tx, and then hit a revert on-chain after paying gas.

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