Skip to content

fix: Consolidate Agentic CLI connection loading into host adapter#31123

Merged
adonesky1 merged 1 commit into
mainfrom
cw/connection-loading
Jun 10, 2026
Merged

fix: Consolidate Agentic CLI connection loading into host adapter#31123
adonesky1 merged 1 commit into
mainfrom
cw/connection-loading

Conversation

@ieow

@ieow ieow commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Description

Agentic CLI connection loading duplicated the same notification logic already implemented in the SDK Connect V2 host application adapter (agenticCliLoading.ts dispatched showSimpleNotification / hideNotificationById directly).

This PR removes that duplicate module and routes Agentic CLI loading through deps.hostapp.showConnectionLoading / hideConnectionLoading, keeping a single code path for connection-loading UI.

showConnectionLoading now accepts optional ShowConnectionLoadingOptions with autodismissMs. The default remains 10s for standard SDK Connect flows; Agentic CLI passes 15s via AGENTIC_CLI_CONNECTION_LOADING_AUTODISMISS_MS to accommodate the longer MWP → OTP → dashboard connect sequence.

Changelog

CHANGELOG entry: null

Related issues

Fixes: #30911 (comment)

Manual testing steps

Feature: Agentic CLI connection loading

  Scenario: user connects via Agentic CLI deeplink
    Given the app is unlocked and Agentic CLI connect is available
    When user opens an Agentic CLI connect deeplink
    Then a connection-loading notification appears with the dApp name
    And the notification auto-dismisses after ~15s if the flow stalls
    And the notification is hidden when the connect flow completes or fails

  Scenario: standard SDK Connect V2 connection loading is unchanged
    Given a non–Agentic CLI SDK Connect V2 session is establishing
    When connection loading is shown via the host adapter
    Then the loading notification still auto-dismisses after ~10s by default

Screenshots/Recordings

Before

After

N/A

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
UI notification plumbing refactor with no auth or data-path changes; default 10s autodismiss behavior is preserved for non–Agentic CLI callers.

Overview
Removes the Agentic CLI–specific loading helpers in agenticCliLoading.ts and routes connection loading through the shared SDK Connect V2 host application adapter instead.

showConnectionLoading / hideConnectionLoading on IHostApplicationAdapter now accept optional ShowConnectionLoadingOptions with autodismissMs (default 10s; Agentic CLI uses exported 15s for longer MWP → OTP → dashboard flows). AgenticCliMwpConnectionService calls deps.hostapp.showConnectionLoading / hideConnectionLoading with that timeout rather than dispatching notifications directly. Tests were updated accordingly and adapter coverage was added for custom autodismiss.

Reviewed by Cursor Bugbot for commit aa778c8. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@mm-token-exchange-service mm-token-exchange-service Bot added team-onboarding Onboarding team INVALID-PR-TEMPLATE PR's body doesn't match template labels Jun 5, 2026
@github-actions github-actions Bot added the size-M label Jun 5, 2026
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes in this PR are a pure internal refactoring of the AgenticCli connection loading mechanism:

  1. agenticCliLoading.ts deleted: Standalone loading utility removed - its functionality was duplicated with HostApplicationAdapter.showConnectionLoading/hideConnectionLoading.

  2. AgenticCliMwpConnectionService.ts refactored: Now delegates to deps.hostapp.showConnectionLoading() / hideConnectionLoading() instead of the deleted standalone functions. The autodismiss timeout constant (15,000ms) is preserved and moved to the adapter.

  3. host-application-adapter.ts updated: Added optional ShowConnectionLoadingOptions parameter to showConnectionLoading() with configurable autodismissMs. Default remains 10,000ms; agentic CLI uses 15,000ms (same as before).

  4. Type definition updated: IHostApplicationAdapter interface updated to match the new optional parameter.

Why no E2E tests are needed:

  • This is a pure code refactoring with no behavioral change - the same notifications are shown/hidden with the same timing
  • The AgenticCli deep link flow is not covered by any existing E2E test tags
  • The SDKConnectV2 connection loading notification behavior is unchanged from a user perspective
  • No UI components, navigation, or user-facing flows were modified
  • All changes are internal to the SDK connection infrastructure layer
  • Unit tests (.test.ts files) were updated to cover the refactoring

No performance impact: These changes only affect how a loading notification is dispatched during SDK connection establishment - no rendering, list, or startup changes.

Performance Test Selection:
No performance impact expected. The changes are a pure refactoring of internal connection loading notification logic. No UI rendering, list components, startup sequences, or data loading paths were modified.

View GitHub Actions results

@ieow ieow changed the title fix: fix: Consolidate Agentic CLI connection loading into host adapter fix: Consolidate Agentic CLI connection loading into host adapter Jun 5, 2026
@ieow ieow marked this pull request as ready for review June 5, 2026 05:39
@ieow ieow requested a review from a team as a code owner June 5, 2026 05:39
@github-actions github-actions Bot added the risk:low AI analysis: low risk label Jun 5, 2026
@mm-token-exchange-service mm-token-exchange-service Bot removed the INVALID-PR-TEMPLATE PR's body doesn't match template label Jun 5, 2026
@ieow ieow mentioned this pull request Jun 5, 2026
10 tasks
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.92%. Comparing base (1bc6039) to head (aa778c8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #31123   +/-   ##
=======================================
  Coverage   82.92%   82.92%           
=======================================
  Files        5611     5610    -1     
  Lines      144694   144692    -2     
  Branches    33629    33630    +1     
=======================================
+ Hits       119981   119982    +1     
+ Misses      16632    16631    -1     
+ Partials     8081     8079    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@adonesky1 adonesky1 added this pull request to the merge queue Jun 10, 2026
Merged via the queue into main with commit 6d56f29 Jun 10, 2026
331 of 338 checks passed
@adonesky1 adonesky1 deleted the cw/connection-loading branch June 10, 2026 14:46
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 10, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.82.0 Issue or pull request that will be included in release 7.82.0 label Jun 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.82.0 Issue or pull request that will be included in release 7.82.0 risk:low AI analysis: low risk size-M team-onboarding Onboarding team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants