Skip to content

fix: error handling for wallet is already present error#1543

Merged
pranalidhanavade merged 1 commit intomainfrom
fix/wallet-already-present-error-handling
Jan 15, 2026
Merged

fix: error handling for wallet is already present error#1543
pranalidhanavade merged 1 commit intomainfrom
fix/wallet-already-present-error-handling

Conversation

@pranalidhanavade
Copy link
Contributor

@pranalidhanavade pranalidhanavade commented Jan 15, 2026

What

  • fix: error handling for wallet is already present error

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced wallet provisioning validation to recognize wallet creation in additional states, improving the system's ability to prevent duplicate provisioning and provide appropriate error feedback.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: pranalidhanavade <pranali.dhanavade@ayanworks.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 15, 2026

📝 Walkthrough

Walkthrough

The wallet provisioning validation logic in the agent service was expanded to treat both WALLET_CREATED and DID_CREATED statuses as indicators that a wallet already exists. Previously only WALLET_CREATED triggered the existing wallet error; now either status results in the same BadRequestException.

Changes

Cohort / File(s) Summary
Wallet provisioning validation
apps/agent-service/src/agent-service.service.ts
Expanded conditional check to include DID_CREATED status alongside WALLET_CREATED when validating wallet existence during provisioning (+4/-1 lines)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • tipusinghaw
  • ankita-p17

Poem

🐰 A wallet's journey, now twice-checked with care,
When DID or WALLET statuses appear,
No double creation shall come to pass,
The rabbit approves this logic, steadfast! 🪙

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing error handling for the wallet-already-present scenario in the wallet provisioning logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb18631 and db32161.

📒 Files selected for processing (1)
  • apps/agent-service/src/agent-service.service.ts
🔇 Additional comments (1)
apps/agent-service/src/agent-service.service.ts (1)

188-196: LGTM! Correctly expanded wallet existence check.

The fix appropriately treats both WALLET_CREATED and DID_CREATED as indicators that a wallet already exists. Since DID_CREATED is a progression from WALLET_CREATED, both states should prevent duplicate wallet provisioning attempts.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/agent-service/src/agent-service.service.ts (1)

731-739: Inconsistent wallet existence check in createTenant.

The createTenant method only checks for WALLET_CREATED status, while the updated provisionWallet method now checks for both WALLET_CREATED and DID_CREATED. Consider applying the same fix here for consistency.

🔧 Suggested fix
-      if (AgentSpinUpStatus.WALLET_CREATED === getOrgAgent?.agentSpinUpStatus) {
+      if (
+        AgentSpinUpStatus.WALLET_CREATED === getOrgAgent?.agentSpinUpStatus ||
+        AgentSpinUpStatus.DID_CREATED === getOrgAgent?.agentSpinUpStatus
+      ) {
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb18631 and db32161.

📒 Files selected for processing (1)
  • apps/agent-service/src/agent-service.service.ts
🔇 Additional comments (1)
apps/agent-service/src/agent-service.service.ts (1)

188-196: LGTM! Correctly expanded wallet existence check.

The fix appropriately treats both WALLET_CREATED and DID_CREATED as indicators that a wallet already exists. Since DID_CREATED is a progression from WALLET_CREATED, both states should prevent duplicate wallet provisioning attempts.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@pranalidhanavade pranalidhanavade merged commit 0fe864b into main Jan 15, 2026
8 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jan 15, 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.

2 participants