Skip to content

On app selecetion keep retrying when failing but avoid capturing unrelated errors#6904

Open
alfonso-noriega wants to merge 1 commit intomainfrom
02-27-on_app_selecetion_keep_retrying_when_failing_but_avoid_capturing_unrelated_errors
Open

On app selecetion keep retrying when failing but avoid capturing unrelated errors#6904
alfonso-noriega wants to merge 1 commit intomainfrom
02-27-on_app_selecetion_keep_retrying_when_failing_but_avoid_capturing_unrelated_errors

Conversation

@alfonso-noriega
Copy link
Contributor

@alfonso-noriega alfonso-noriega commented Feb 27, 2026

WHY are these changes introduced?

Vault Error

GH Issue #15725

Observe link

The app selection logic contained redundant error handling and retry mechanisms that were making the code unnecessarily complex and potentially masking actual issues during the selection process.

WHAT is this pull request doing?

  • Removes redundant error checking in selectAppPrompt function that was checking for null after using the non-null assertion operator
  • Simplifies the retry logic in selectOrCreateApp by removing try-catch blocks and letting natural control flow handle retries
  • Updates error message from "interrupted" to "failed" to better reflect the actual failure condition
  • Streamlines the app selection flow while maintaining the same retry behavior

How to test your changes?

  1. Run shopify app dev in a project directory
  2. Go through the app selection prompt
  3. Verify that app selection works normally
  4. Test edge cases where app selection might fail to ensure retry logic still functions
  5. Confirm error messages are clear and helpful when selection ultimately fails

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2026

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 78.82% 14497/18392
🟡 Branches 73.13% 7208/9856
🟡 Functions 79.02% 3688/4667
🟡 Lines 79.16% 13705/17312

Test suite run success

3774 tests passing in 1448 suites.

Report generated by 🧪jest coverage report action from 47e6658

@alfonso-noriega alfonso-noriega force-pushed the 02-27-on_app_selecetion_keep_retrying_when_failing_but_avoid_capturing_unrelated_errors branch from f35bc45 to 47e6658 Compare February 27, 2026 12:53
@alfonso-noriega alfonso-noriega marked this pull request as ready for review February 27, 2026 12:58
@alfonso-noriega alfonso-noriega requested a review from a team as a code owner February 27, 2026 12:58
@github-actions
Copy link
Contributor

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run pnpm changeset add to track your changes and include them in the next release CHANGELOG.

Caution

DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.

)
}
return appChoice
return currentAppChoices.find((app) => app.apiKey === apiKey)!

Choose a reason for hiding this comment

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

Non-null assertion can crash with unhelpful error (diagnostics regression)

selectAppPrompt now returns currentAppChoices.find((app) => app.apiKey === apiKey)!. If renderAutocompletePrompt returns a value not present in currentAppChoices (the incident described in the PR links), find(...) returns undefined and ! can cause a runtime failure with a generic error instead of a targeted, actionable message.

Impact:

  • User: shopify app dev can crash during selection with a confusing error, blocking development.
  • Support/diagnostics: reduced ability to diagnose prompt/list mismatch issues.
  • Scale: affects any environment where prompt selection can desync from the in-memory list.
  • Consequences: hard crash + loss of diagnostic context.

apps,
hasMorePages,
{directory: options.directory},
)

Choose a reason for hiding this comment

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

Retry behavior removed for prompt failures; loop no longer matches intent

The PR removes the try/catch around await selectAppPrompt(...) and around appFromIdentifiers. If selectAppPrompt throws (prompt interrupted/UI failure/etc.), the exception exits selectOrCreateApp immediately and no retry occurs, even though the loop is still present. This contradicts the PR intent (“keep retrying…”) and the previous behavior (retrying non-BugError failures). The old code already avoided retrying BugError; removing the catch stops retries on prompt errors entirely.

Impact:

  • User: transient prompt interruptions won’t be retried; immediate failure.
  • Infra/support: more repeated command invocations/tickets; less observability.
  • Scale: any user with flaky terminal/container/WSL interruptions.
  • Consequences: higher failure rate and worse UX.

@binks-code-reviewer
Copy link

🤖 Code Review · #projects-dev-ai for questions
React with 👍/👎 or reply — all feedback helps improve the agent.

Complete - 2 findings

📋 History

✅ 2 findings

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.

1 participant