Skip to content

fix(kyc-controller): Make SessionStatus.finalStatus: pending only possible after sumsub has been fully submitted again - #11094

Merged
jiexi merged 8 commits into
mainfrom
jl/KYC-67/kyc-controller-use-current-step-to-augment
Oct 29, 2026
Merged

jiexi merged 8 commits into
mainfrom
jl/KYC-67/kyc-controller-use-current-step-to-augment

Conversation

@jiexi

@jiexi jiexi commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Previously SessionStatus.finalStatus: pending was only possible after sumsub was fully submitted. This made it possible for the consumer to know if the user should be shown the sumsub flow again or not. Relay now sends this value as pending when any sumsub data has been submitted, breaking our sumsub resumption logic. This PR patches the old behavior back by also checking the SessionStatus.currentStep value. This is meant to be a temporary patch until we are able to discuss a larger refactor to rely on currentStep entirely instead of finalStatus.

Fixes: https://consensyssoftware.atlassian.net/browse/KYC-67

Screen.Recording.2026-10-29.at.11.58.30.AM.mov
Screenshot 2026-10-29 at 12 00 55 PM

Note

Medium Risk
Changes how finalStatus is derived from the relay for in-progress KYC sessions, which drives SumSub resumption and related UI; incorrect mapping could show or hide the provider flow at the wrong time.

Overview
Adds optional currentStep on KycSessionStatus (parsed from kyc-api, exported as KYC_CURRENT_STEPS / KycCurrentStep) so clients can see where the applicant is in the flow.

patchKycSessionStatus remaps API responses where finalStatus is pending and currentStep is kyc to finalStatus new, restoring the old rule that pending meant documents were already fully submitted. KycService applies this patch on getSessionStatus, getSessionStatusForVendor, and setAuthorizations.

After SumSub completes, KycController still stores pending but now sets currentStep to processing, matching post-submit vendor processing rather than the in-flow kyc step.

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

@jiexi
jiexi requested review from a team as code owners October 26, 2026 20:40
@jiexi
jiexi temporarily deployed to default-branch October 26, 2026 20:40 — with GitHub Actions Inactive
@jiexi jiexi changed the title jl/KYC 67/kyc controller use current step to augment fix(kyc-controller): Make SessionStatus.finalStatus: pending only possible after sumsub has been fully submitted again Oct 26, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

…-augment

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment on lines +205 to +219
export function patchKycSessionStatus(
sessionStatus: KycSessionStatus,
): KycSessionStatus {
if (
sessionStatus.finalStatus === KYC_STATUSES.pending &&
sessionStatus.currentStep === KYC_CURRENT_STEPS.kyc
) {
return {
...sessionStatus,
finalStatus: 'new',
};
}
return sessionStatus;
}

@Akaryatrh Akaryatrh Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks odd to me to expose this function inside a types file? I see we also have needsCapabilityAuthorizationRefresh function inside this file, is it done on purpose?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah. These are effectively helpers for reading/modifying the KycSessionStatus type. They seem thin/simple enough that they don't warrant their own file yet. We could put these in a separate kycSessionStatus.ts file (or somewhere else) if you feel strongly

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's not a blocker at all, let's keep them here for now.

Akaryatrh
Akaryatrh previously approved these changes Oct 28, 2026

@Akaryatrh Akaryatrh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

…-augment

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d0145b5. Configure here.

Comment thread packages/kyc-controller/src/types.ts Resolved
@jiexi

jiexi commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

@metamaskbot publish-preview

@github-actions

Copy link
Copy Markdown
Contributor

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/account-tree-controller@11.2.0-preview-d0145b59e
@metamask-previews/accounts-controller@40.1.0-preview-d0145b59e
@metamask-previews/address-book-controller@8.0.0-preview-d0145b59e
@metamask-previews/advanced-chart-core@1.0.0-preview-d0145b59e
@metamask-previews/ai-controllers@2.0.0-preview-d0145b59e
@metamask-previews/analytics-controller@4.1.0-preview-d0145b59e
@metamask-previews/analytics-data-regulation-controller@0.0.0-preview-d0145b59e
@metamask-previews/announcement-controller@9.0.0-preview-d0145b59e
@metamask-previews/app-metadata-controller@3.0.0-preview-d0145b59e
@metamask-previews/approval-controller@10.0.0-preview-d0145b59e
@metamask-previews/assets-controller@20.0.1-preview-d0145b59e
@metamask-previews/assets-controllers@113.0.0-preview-d0145b59e
@metamask-previews/authenticated-user-storage@4.1.0-preview-d0145b59e
@metamask-previews/base-controller@10.1.0-preview-d0145b59e
@metamask-previews/base-data-service@2.1.0-preview-d0145b59e
@metamask-previews/bitcoin-regtest-up@2.0.0-preview-d0145b59e
@metamask-previews/bridge-controller@83.1.2-preview-d0145b59e
@metamask-previews/bridge-status-controller@78.0.0-preview-d0145b59e
@metamask-previews/build-utils@4.0.0-preview-d0145b59e
@metamask-previews/byte-utils@0.1.0-preview-d0145b59e
@metamask-previews/chain-agnostic-permission@2.1.0-preview-d0145b59e
@metamask-previews/chomp-api-service@7.0.0-preview-d0145b59e
@metamask-previews/claims-controller@1.1.0-preview-d0145b59e
@metamask-previews/client-controller@2.0.0-preview-d0145b59e
@metamask-previews/client-utils@3.0.4-preview-d0145b59e
@metamask-previews/compliance-controller@3.0.0-preview-d0145b59e
@metamask-previews/composable-controller@13.0.0-preview-d0145b59e
@metamask-previews/config-registry-controller@5.0.0-preview-d0145b59e
@metamask-previews/connectivity-controller@1.0.0-preview-d0145b59e
@metamask-previews/controller-utils@13.0.0-preview-d0145b59e
@metamask-previews/core-backend@12.3.0-preview-d0145b59e
@metamask-previews/cryptography@1.1.2-preview-d0145b59e
@metamask-previews/delegation-controller@4.0.0-preview-d0145b59e
@metamask-previews/earn-controller@13.0.2-preview-d0145b59e
@metamask-previews/eip-5792-middleware@4.0.1-preview-d0145b59e
@metamask-previews/eip-7702-internal-rpc-middleware@1.0.0-preview-d0145b59e
@metamask-previews/eip1193-permission-middleware@3.0.0-preview-d0145b59e
@metamask-previews/error-utils@0.1.0-preview-d0145b59e
@metamask-previews/eth-block-tracker@16.0.0-preview-d0145b59e
@metamask-previews/eth-json-rpc-middleware@26.0.0-preview-d0145b59e
@metamask-previews/eth-json-rpc-provider@7.0.0-preview-d0145b59e
@metamask-previews/foundryup@2.0.0-preview-d0145b59e
@metamask-previews/gas-fee-controller@27.0.0-preview-d0145b59e
@metamask-previews/gator-permissions-controller@6.0.1-preview-d0145b59e
@metamask-previews/geolocation-controller@2.0.0-preview-d0145b59e
@metamask-previews/java-tron-up@2.0.0-preview-d0145b59e
@metamask-previews/json-rpc-engine@11.0.0-preview-d0145b59e
@metamask-previews/json-rpc-middleware-stream@9.0.0-preview-d0145b59e
@metamask-previews/keyring-controller@28.2.0-preview-d0145b59e
@metamask-previews/kyc-controller@0.13.0-preview-d0145b59e
@metamask-previews/local-node-utils@2.0.0-preview-d0145b59e
@metamask-previews/logging-controller@10.0.0-preview-d0145b59e
@metamask-previews/marketing-consent-controller@1.1.0-preview-d0145b59e
@metamask-previews/message-manager@15.0.0-preview-d0145b59e
@metamask-previews/messenger@3.0.0-preview-d0145b59e
@metamask-previews/messenger-cli@1.0.0-preview-d0145b59e
@metamask-previews/mfa-recovery-controller@0.0.0-preview-d0145b59e
@metamask-previews/money-account-api-data-service@2.3.1-preview-d0145b59e
@metamask-previews/money-account-balance-service@3.1.2-preview-d0145b59e
@metamask-previews/money-account-controller@3.0.0-preview-d0145b59e
@metamask-previews/money-account-mfa-whitelist@0.1.0-preview-d0145b59e
@metamask-previews/money-account-upgrade-controller@6.0.0-preview-d0145b59e
@metamask-previews/money-account-utils@2.1.0-preview-d0145b59e
@metamask-previews/multichain-account-service@14.1.0-preview-d0145b59e
@metamask-previews/multichain-api-middleware@5.0.0-preview-d0145b59e
@metamask-previews/multichain-network-controller@4.0.0-preview-d0145b59e
@metamask-previews/multichain-transactions-controller@8.0.0-preview-d0145b59e
@metamask-previews/name-controller@10.0.0-preview-d0145b59e
@metamask-previews/network-connection-banner-controller@1.0.0-preview-d0145b59e
@metamask-previews/network-controller@37.1.1-preview-d0145b59e
@metamask-previews/network-enablement-controller@7.0.2-preview-d0145b59e
@metamask-previews/node-utils@0.1.0-preview-d0145b59e
@metamask-previews/notification-services-controller@30.1.0-preview-d0145b59e
@metamask-previews/passkey-controller@4.1.0-preview-d0145b59e
@metamask-previews/permission-controller@14.1.0-preview-d0145b59e
@metamask-previews/permission-log-controller@6.0.0-preview-d0145b59e
@metamask-previews/perps-controller@22.0.0-preview-d0145b59e
@metamask-previews/phishing-controller@18.2.1-preview-d0145b59e
@metamask-previews/platform-api-docs@0.2.1-preview-d0145b59e
@metamask-previews/polling-controller@17.0.0-preview-d0145b59e
@metamask-previews/preferences-controller@24.0.0-preview-d0145b59e
@metamask-previews/profile-controller@1.2.0-preview-d0145b59e
@metamask-previews/profile-metrics-controller@5.2.0-preview-d0145b59e
@metamask-previews/profile-sync-controller@36.0.0-preview-d0145b59e
@metamask-previews/ramps-controller@28.1.0-preview-d0145b59e
@metamask-previews/rate-limit-controller@8.0.0-preview-d0145b59e
@metamask-previews/react-data-query@2.0.0-preview-d0145b59e
@metamask-previews/remote-feature-flag-controller@7.0.0-preview-d0145b59e
@metamask-previews/sample-controllers@6.0.0-preview-d0145b59e
@metamask-previews/seedless-onboarding-controller@12.0.0-preview-d0145b59e
@metamask-previews/selected-network-controller@27.0.0-preview-d0145b59e
@metamask-previews/sentinel-api-service@2.1.0-preview-d0145b59e
@metamask-previews/shield-controller@7.1.0-preview-d0145b59e
@metamask-previews/signature-controller@40.0.0-preview-d0145b59e
@metamask-previews/smart-transactions-controller@27.2.0-preview-d0145b59e
@metamask-previews/snap-account-service@4.0.0-preview-d0145b59e
@metamask-previews/social-controllers@3.13.0-preview-d0145b59e
@metamask-previews/solana-test-validator-up@2.0.0-preview-d0145b59e
@metamask-previews/stellar-quickstart-up@0.0.0-preview-d0145b59e
@metamask-previews/storage-service@2.0.0-preview-d0145b59e
@metamask-previews/subscription-controller@15.1.1-preview-d0145b59e
@metamask-previews/transaction-controller@72.3.0-preview-d0145b59e
@metamask-previews/transaction-pay-controller@30.3.1-preview-d0145b59e
@metamask-previews/transaction-pay-middleware@2.0.0-preview-d0145b59e
@metamask-previews/type-utils@0.1.0-preview-d0145b59e
@metamask-previews/user-operation-controller@42.0.1-preview-d0145b59e
@metamask-previews/utils@12.0.1-preview-d0145b59e
@metamask-previews/wallet@20.0.0-preview-d0145b59e
@metamask-previews/watch-only-account-service@0.1.0-preview-d0145b59e

georgeweiler
georgeweiler previously approved these changes Oct 29, 2026
…-augment

Co-authored-by: Cursor <cursoragent@cursor.com>
@jiexi
jiexi disabled auto-merge October 29, 2026 19:54
@jiexi
jiexi added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit fe4655c Oct 29, 2026
46 checks passed
@jiexi
jiexi deleted the jl/KYC-67/kyc-controller-use-current-step-to-augment branch October 29, 2026 19:55
@georgeweiler georgeweiler mentioned this pull request Oct 29, 2026
3 of 4 tasks
@Akaryatrh Akaryatrh mentioned this pull request Nov 2, 2026
1 of 4 tasks
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Nov 4, 2026
## Explanation

Reverts MetaMask#11205 (`Release 1378.0.0`), which was merged before its
predecessor
[Release/1377.0.0](MetaMask#11203) had been
released. The release numbering assumed 1377 would land first, so this
release has to come off `main`.

The revert restores:

- Root version `1378.0.0` → `1376.0.0`
- `@metamask/kyc-controller` `0.14.0` → `0.13.0`
- The `ensureLocalUserSecret` (MetaMask#11099), `getDataShares` (MetaMask#11158) and
`currentStep` (MetaMask#11094) entries move back under `[Unreleased]`

Nothing was published. The `main` run for the merge failed on an
unrelated `rate-limit-controller` test, so the `Publish release` job was
skipped. No tags were created, and npm still lists
`@metamask/kyc-controller` at `0.13.0`.

## References

- Reverts MetaMask#11205

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

Made with [Cursor](https://cursor.com)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Version and changelog-only revert with no code changes; aligns `main`
with unpublished release state.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
9311ab8. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Nov 4, 2026
## Explanation

Release **1380.0.0**. This PR bumps `@metamask/kyc-controller` from
`0.13.0` to `0.14.0` (minor). The unreleased changelog adds public API:
optional `currentStep` on `KycSessionStatus`,
`KycController.ensureLocalUserSecret`, and `getDataShares` on both the
service and the controller, plus their exported types. It also maps a
session that reports `finalStatus: pending` with `currentStep: kyc` back
to `finalStatus: new`, which restores the previous meaning of `pending`
(only after SumSub is fully submitted). That behavior change is not
marked breaking. The root monorepo version is bumped to `1380.0.0`.

No other package in this repo depends on `@metamask/kyc-controller`, so
no other packages are included. Dev-only commits since `0.13.0` (the
`nock` bump and a test import change) are left out of the changelog.

## References

- Ships [MetaMask#11094](MetaMask#11094),
[MetaMask#11099](MetaMask#11099), and
[MetaMask#11158](MetaMask#11158)
- Previous merged release:
[MetaMask#11210](MetaMask#11210)

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
(N/A: version bump and changelog only)
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate (N/A)
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them (N/A: no breaking changes)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Version and changelog-only release with no new runtime changes in this
PR; consumer impact comes from the already-merged kyc-controller APIs
and status mapping described in the changelog.
> 
> **Overview**
> This PR cuts **release 1380.0.0** for the core monorepo by bumping the
root version from `1379.0.0` to **1380.0.0**
> 
> It publishes **`@metamask/kyc-controller` `0.14.0`**, moving the
existing Unreleased changelog into a **`[0.14.0]`** section and updating
compare links. There is **no application code in the diff**—only version
and changelog housekeeping.
> 
> The **0.14.0** notes document what consumers get from earlier merged
work: optional **`currentStep`** on **`KycSessionStatus`**,
**`ensureLocalUserSecret`**, **`getDataShares`** on the service and
controller, related exports, and a **behavior tweak** that maps API
**`pending` + `currentStep: kyc`** back to **`finalStatus: new`** so
partially submitted flows are not treated like post–SumSub pending.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
1727a26. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Signed-off-by: Sébastien Van Eyck <sebastien.vaneyck@consensys.net>
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.

4 participants