Skip to content

fix(vscode): stop debug startup on Azurite readiness timeout#9147

Open
lambrianmsft wants to merge 5 commits into
Azure:mainfrom
lambrianmsft:lambrian/azurite_race_condition
Open

fix(vscode): stop debug startup on Azurite readiness timeout#9147
lambrianmsft wants to merge 5 commits into
Azure:mainfrom
lambrianmsft:lambrian/azurite_race_condition

Conversation

@lambrianmsft
Copy link
Copy Markdown
Contributor

@lambrianmsft lambrianmsft commented May 7, 2026

Commit Type

  • feature - New functionality
  • fix - Bug fix
  • refactor - Code restructuring without behavior change
  • perf - Performance improvement
  • docs - Documentation update
  • test - Test-related changes
  • chore - Maintenance/tooling

Risk Level

  • Low - Minor changes, limited scope
  • Medium - Moderate changes, some user impact
  • High - Major changes, significant user/system impact

Medium risk because this changes the VS Code debug/runtime startup path, Azurite extension activation handling, telemetry/error propagation, and the E2E runner coverage for the regression.

What & Why

This change ensures the Azurite extension is activated and Azurite is reachable before Logic Apps debug/runtime startup continues. If automatic Azurite startup fails or times out, startup now stops with the Azurite readiness error instead of continuing into AzureWebJobsStorage validation and showing the misleading storage-emulator prompt. The fix preserves the original startup error through telemetry wrappers, distinguishes missing/inactive Azurite extension states, and adds unit plus VS Code E2E coverage for the regression.

The screenshot below shows the confusing failure users could hit when Azurite was still starting or unavailable but debug continued into storage validation:
image

Impact of Change

  • Users: Debug startup now fails fast when Azurite cannot be started automatically; users see the Azurite timeout/startup error instead of the confusing AzureWebJobsStorage warning or Debug anyway path.
  • Developers: Reviewers should focus on executeOnAzuriteExt, activateAzurite, pickFuncProcess, startRuntimeApi, and validatePreDebug error propagation. The VS Code E2E runner now has a Phase 4.9 azuriteonly path with a fake Azurite extension for failure coverage.
  • System: Automatic startup failure waits up to the readiness timeout before surfacing the Azurite error. The E2E harness binds Azurite ports and uses AZURITE_E2E_STEP / AZURITE_E2E_WORKSPACE_PARENT to split workspace creation from the debug assertion.

Test Plan

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested in: VS Code extension unit tests, extension build, E2E compile, E2E_MODE=azuriteonly, E2E_MODE=nonlogicappstartup, and E2E_MODE=conversioncreateonly

Local validation included targeted Azurite unit coverage, pnpm run build:extension, npx tsup --config tsup.e2e.test.config.ts, and the new Azurite E2E create/assert flow. The Azurite E2E creates a real workspace through the Create Workspace webview, reopens the generated .code-workspace in a fresh VS Code session, installs a fake Azurite extension that does not start the emulator, blocks Azurite ports, and asserts the Azurite timeout appears while the AzureWebJobsStorage warning and Debug anyway do not.

Contributors

AI-assisted implementation, validation, and review orchestration with GitHub Copilot.

Screenshots/Videos

No visual UI changes. The screenshot above documents the previous misleading error state.

Copilot AI review requested due to automatic review settings May 7, 2026 17:22
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

🤖 AI PR Validation Report

PR Review Results

Thank you for your submission! Here's detailed feedback on your PR title and body compliance:

PR Title

  • Current: fix(vscode): stop debug startup on Azurite readiness timeout
  • Issue: None — clear, concise, follows conventional commit style and explains the intent.
  • Recommendation: Keep as-is. (Optional: you could add a very short note like "(debug/runtime)" if you want to emphasize runtime domain, but not necessary.)

Commit Type

  • Properly selected (fix) and only one option is checked.
  • Note: This matches the change set which fixes startup behavior.

Risk Level

  • The PR body selects Medium and the repository label includes risk:medium.
  • Assessment: Correct. The code changes affect debug/runtime startup and telemetry and add E2E coverage, so Medium is appropriate.

What & Why

  • Current: This section is present and clearly explains the change: ensure Azurite extension activation/readiness is validated and fail fast on readiness timeout instead of showing misleading storage prompts.
  • Issue: None.
  • Recommendation: Excellent — keep this succinct summary.

Impact of Change

  • The Impact section lists Users, Developers, and System impacts and points to areas reviewers should focus on. It aligns with the code changes.
  • Recommendation:
    • Users: Good description. Consider adding a short note about expected user-visible message text for the primary failure path (so support can triage easier).
    • Developers: You already call out key modules to review; well done.
    • System: Clear.

Test Plan

  • Assessment: Matches the code diff. The PR genuinely adds/updates unit tests and extensive VS Code E2E tests (new vitest unit test files and new ExTester E2E files and run-e2e.js wiring). Manual testing is described and looks reasonable.
  • Recommendation: Ensure CI job/labels are updated to run the new E2E Phase 4.9 in the CI matrix (if you expect these to run in CI). If the E2E tests are heavy/flaky, consider gating or marking them explicitly to prevent CI noise.

⚠️ Contributors

  • Assessment: Present but minimal — lists "AI-assisted implementation... with GitHub Copilot."
  • Recommendation: Optionally add names of reviewers, PMs, or designers who contributed to the design or validation (if any). Not required to pass.

Screenshots/Videos

  • Assessment: A screenshot demonstrating the previous misleading error state is included in the PR body and the description correctly states no UI changes were made.
  • Recommendation: None.

Summary Table

Section Status Recommendation
Title Keep as-is.
Commit Type Correct (fix).
Risk Level Medium is appropriate.
What & Why Good concise explanation.
Impact of Change Good; optionally add user-visible message example.
Test Plan Tests added/updated — ensure CI wiring for E2E.
Contributors ⚠️ Consider listing human reviewers/owners.
Screenshots/Videos Present and adequate.

Final message
This PR passes the PR title & body validation. The advised risk level (risk:medium) matches the submitter's selection and the repository label. The PR follows the required template, includes unit + E2E tests, and the code diff implements the described behavior.

Suggested small improvements before merging:

  • Confirm CI runs the new Phase 4.9 E2E mode in the appropriate pipeline (or document why it should remain out of CI). The E2E additions are large and may be flaky on some CI agents; consider gating or adding retries if needed.
  • Optionally add a quick example of the user-visible Azurite timeout message to the Impact or What & Why section for easier triage by support.
  • (Optional) Add human contributor names to the Contributors section if others helped with design/review.

Please update if you want me to re-check any of the suggested optional items or verify that the new E2E phase is wired into CI.


Last updated: Wed, 13 May 2026 23:15:51 GMT

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a VS Code debugging race condition where Azurite is auto-started but the debug session proceeds before the storage emulator is actually reachable, leading to intermittent AzureWebJobsStorage connection failures.

Changes:

  • Add a post-start “wait until Azurite is ready” retry loop before continuing.
  • Update pre-debug validation to (a) block debug when AzureWebJobsStorage is missing and (b) suppress “Debug anyway” when Azurite was supposed to be auto-started.
  • Add unit tests covering the new Azurite-wait and pre-debug behaviors; ensure Azurite start command is awaited.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
apps/vs-code-designer/src/app/utils/azurite/activateAzurite.ts Adds retry-based readiness wait after starting Azurite and updates telemetry.
apps/vs-code-designer/src/app/utils/azurite/test/activateAzurite.test.ts Adds a unit test asserting Azurite readiness polling after auto-start.
apps/vs-code-designer/src/app/debug/validatePreDebug.ts Adds missing-AzureWebJobsStorage blocking and new options for emulator validation (incl. disabling “Debug anyway”).
apps/vs-code-designer/src/app/debug/test/validatePreDebug.test.ts Adds unit tests for missing storage, and “Debug anyway” behavior when auto-start is enabled/disabled.
apps/vs-code-designer/src/app/azuriteExtension/executeOnAzuriteExt.ts Awaits the Azurite command execution (but needs a small fix to arg forwarding).

Comment on lines 15 to 17
await vscode.commands.executeCommand(command, {
...args,
});
Comment on lines +108 to +117
for (let attempt = 1; attempt <= azuriteStartupRetryCount; attempt++) {
context.telemetry.properties.azuriteStartupAttempt = attempt.toString();
if (await validateEmulatorIsRunning(context, projectPath, false)) {
context.telemetry.properties.azuriteReady = 'true';
return;
}

if (attempt < azuriteStartupRetryCount) {
await delay(azuriteStartupRetryDelayMs);
}
Comment on lines +124 to +125
'Azurite did not become ready within "{0}" seconds. Make sure the Azurite extension is installed and running, then try debugging again.',
(azuriteStartupRetryCount * azuriteStartupRetryDelayMs) / 1000
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lambrianmsft lambrianmsft added the risk:low Low risk change with minimal impact label May 13, 2026
lambrianmsft and others added 2 commits May 13, 2026 14:02
Preserves Azurite startup failure handling while incorporating Azure main.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Regenerates AI instructions from docs/ai-setup after the Azurite E2E guidance update.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lambrianmsft lambrianmsft changed the title fix(vscode): Azurite race condition fix fix(vscode): stop debug startup on Azurite readiness timeout May 13, 2026
@lambrianmsft lambrianmsft added risk:medium Medium risk change with potential impact and removed risk:low Low risk change with minimal impact labels May 13, 2026
Runs the Azurite regression before workspace conversion phases and bounds the create-workspace step to prevent full-suite CI cancellation on VS Code hangs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-validated risk:medium Medium risk change with potential impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants