Skip to content

Simplify error troubleshooting workflow with two-step guidance#6941

Open
hemarina wants to merge 6 commits intoAzure:mainfrom
hemarina:error-troubleshoot-workflow
Open

Simplify error troubleshooting workflow with two-step guidance#6941
hemarina wants to merge 6 commits intoAzure:mainfrom
hemarina:error-troubleshoot-workflow

Conversation

@hemarina
Copy link
Contributor

@hemarina hemarina commented Feb 28, 2026

Iterate #6834 based on @kristenwomack's feedback

Summary

Simplifies the error troubleshooting prompt workflow for a clearer, more guided user experience.

Changes

Streamlined troubleshooting prompt

  • Reduced the Generate troubleshooting steps? options from 8 choices to just 3:
    • Explain the error — runs the MCP tool and shows a structured explanation
    • Skip — skips troubleshooting
    • Always skip — persists skip preference

Two-step guidance flow

  • After the error explanation is displayed, users are now prompted:
    Do you want to generate step by step fix guidance?
    • Yes — generates actionable fix steps (max 5)
    • No, I know what to do (exit agent mode) — exits immediately

Improved error explanation formatting

  • The explain prompt now instructs the LLM to structure output with bold section titles:
    • What's happening — 1-2 sentence error explanation
    • Why it's happening — 1-3 sentence root cause analysis

Removed

  • Removed guide, summarize, and their always variants from the initial prompt
  • Removed saved always-preference logic for explain/guide/summarize (only always-skip is kept)

- Reduce 'Generate troubleshooting steps?' options to: Explain the error, Skip, Always skip
- After explain, prompt 'Do you want to generate step by step fix guidance?' with Yes/No
- Selecting 'No, I know what to do' exits agent mode immediately
- Structure explain output with bold 'What's happening' and 'Why it's happening' sections
- Remove guide/summarize/always-explain/always-guide/always-summarize options
Copy link
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 simplifies the interactive “agent mode” troubleshooting workflow by reducing the initial troubleshooting prompt options and introducing a two-step flow: first explain the error, then optionally generate concise fix guidance.

Changes:

  • Streamlines the troubleshooting scope selection to Explain / Skip / Always skip and removes other scope “always” preferences.
  • Adds a follow-up prompt after the explanation to optionally generate step-by-step fix guidance (max 5 steps).
  • Updates the LLM prompt formatting requirements for clearer, sectioned error explanations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

hemarina and others added 5 commits February 27, 2026 18:28
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 439 to +441
// promptTroubleshootingWithConsent combines consent and scope selection into a single prompt.
// Checks if a saved preference exists (e.g. mcp.errorHandling.troubleshooting.explain).
// Returns the scope ("explain", "fix", "summary") or "" if skipped.
// Returns the scope ("explain") or "" if skipped.
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

This function-level comment is now inaccurate: promptTroubleshootingWithConsent no longer checks for saved scope preferences like "...troubleshooting.explain" (it only honors the saved skip preference). Please update the comment to reflect the new behavior to avoid future confusion.

Copilot uses AI. Check for mistakes.
Comment on lines +204 to 210
guidePrompt := fmt.Sprintf(
`Steps to follow:
1. Use available tools including azd_error_troubleshooting tool to identify this error.
2. Provide only the actionable fix steps as a short numbered list (max 5 steps).
Each step should be one sentence. Include exact commands if applicable.
DO NOT return JSON. Do not explain the error. Do not perform any file changes.
Error details: %s`, errorInput)
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The guide prompt tells the agent to use azd_error_troubleshooting again even though the immediately preceding explanation step likely already invoked the tool in the same conversation. This can increase latency/cost and may re-introduce verbosity; consider instructing the agent to reuse prior context/tool results and only call the troubleshooting tool again if needed.

Copilot uses AI. Check for mistakes.
))
return "", nil
}

Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

promptTroubleshootingWithConsent no longer auto-returns saved scopes like "guide"/"summarize" from config, but there are existing unit tests in cli/azd/cmd/middleware/error_test.go that assert those saved scopes are returned. Unless the tests are updated/removed, CI will fail (the function will now attempt to prompt interactively). Please update the tests to reflect the new supported scopes and add coverage for promptForFixGuidance / the two-step flow.

Suggested change
// Check for saved troubleshooting scope (e.g. "explain") and honor it without prompting.
if val, ok := userConfig.GetString(configPrefix + ".explain"); ok && val == "allow" {
return "explain", nil
}

Copilot uses AI. Check for mistakes.
Comment on lines 459 to 463
choices := []*uxlib.SelectChoice{
{Value: "explain", Label: "Explain the error"},
{Value: "guide", Label: "Provide step-by-step fix guidance"},
{Value: "summarize", Label: "Summary (explanation + guidance)"},
{Value: "skip", Label: "Skip"},
{Value: "always.explain", Label: "Always explain the error"},
{Value: "always.guide", Label: "Always provide fix guidance"},
{Value: "always.summarize", Label: "Always provide summary"},
{Value: "always.skip", Label: "Always skip"},
}
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

With the remaining option now being "Explain the error" (and fix guidance coming in a separate follow-up), the surrounding prompt text still saying "Generate troubleshooting steps" can be misleading. Consider updating the prompt/help copy to reflect the new two-step explanation→guidance flow so users know what to expect.

Copilot uses AI. Check for mistakes.
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.

3 participants