Vscuse case diagnosis

From OfficeDev/microsoft-365-agents-toolkit · View interactive version

Vscuse case diagnosis is an AI agent skill from the GitHub repository OfficeDev/microsoft-365-agents-toolkit. Use when: running an existing vscuse test case, reproducing a failing vscuse plan, deciding product bug vs test plan drift vs setup failure vs flake, repairing a failing case with vscuse-ui/noVNC when useful, and finishing with vscuse CLI validation.

How to use this skill

Skill file

vscuse Case Diagnosis

Goal

Run an existing local vscuse test case against an explicitly selected product image, show the real execution through the integrated browser, and classify any failure as one of:

Do not make a case green by hiding the classification. The final answer must say what failed, why it failed, what was changed, and what passed afterward.

Required Inputs

If local setup, image build, runner install, or credentials are missing, use the shared setup guidance in local-vscuse-validation first.

Core Rules

Procedure

1. Locate the Owning Case

Read the owning docs/scenario and current implementation, then find the plan and any shared groups it expands. Before running, statically compare the documented question order, feature flags, generated artifacts, removed legacy flows, login/resource prerequisites, and the plan's execution order. Fix clear mismatches immediately, then use the first local run as validation rather than discovery.

Prefer the smallest owning surface:

2. Prepare the Runtime and Select the Product Image

Choose exactly one mode before starting the container.

Local product mode validates the current checkout's VSIX:

From the repository root:

.\set-azure-env.ps1 -Env atk06
$env:TEMPLATE_VERSION = "local"
$branchName = (git branch --show-current).Trim()
$imageBranch = $branchName -replace '^release/', '' -replace '[^A-Za-z0-9_.-]', '-'
$env:VSCUSE_VSCODE_IMAGE = "vscuse-atk-${imageBranch}:local"

$dockerCliDir = "C:\Program Files\Docker\Docker\resources\bin"
if (Test-Path (Join-Path $dockerCliDir "docker.exe")) {
   $env:PATH = "$dockerCliDir;$env:PATH"
}

Published product mode runs the local or dev plan files against a requested CI-built image. Resolve the exact tag and verify provenance using local-vscuse-validation, then set:

$env:VSCUSE_VSCODE_IMAGE = "ghcr.io/officedev/vscuse-atk-vscode:<verified-tag>"
Remove-Item Env:TEMPLATE_VERSION -ErrorAction SilentlyContinue

Only set TEMPLATE_VERSION in published mode when the originating CI run or scenario explicitly used it. A local plan path does not imply local template routing.

If the plan declares feature flags, apply them before running vscuse execute:

$planPath = "packages/tests/vscuse/vscode-test-cases/plans/<plan-name>.json"
$plan = Get-Content $planPath -Raw | ConvertFrom-Json
@($plan.plan_metadata.tags) | Where-Object { $_ -like "feature_flag:*" } | ForEach-Object {
   $pair = $_ -replace "^feature_flag:", ""
   $name, $value = $pair.Split("=", 2)
   Set-Item -Path "Env:$name" -Value $value
}

If those flags are not propagated into the VS Code container by the config used for the run, classify the result as a setup failure or precondition miss, not a product bug. Use a temporary run config that injects only the plan-declared flags under docker.environment, or update the shared config deliberately when the pass-through is meant to be stable for this repository.

Check only whether required secrets are set, never their values:

"M365_ACCOUNT_NAME","M365_ACCOUNT_PASSWORD" | ForEach-Object {
   [PSCustomObject]@{ Name = $_; IsSet = -not [string]::IsNullOrWhiteSpace([Environment]::GetEnvironmentVariable($_)) }
}

3. Execute the Focused Plan

Use the complete repository-root artifact command under Execute a Local Test Plan in local-vscuse-validation, substituting the focused plan path. Confirm the resulting run directory contains both run.log and test_report.html before interpreting or editing the case.

When the user needs to see the process, open the integrated browser to http://localhost:6080/vnc.html, click Connect, and keep it visible near the failing area.

4. Gather Failure Evidence

Use the report and terminal logs to capture:

5. Classify Before Editing

Use this decision table:

| Evidence | Classification | Next Action |

|---|---|---|

| Missing env vars, Docker, GHCR, vscuse wheel, noVNC, or image access | setup failure | Fix setup and rerun the same plan |

| Pulled image tag does not resolve to the requested Actions run revision | setup failure | Resolve the exact published tag and verify OCI revision before running |

| Plan declares feature flags but they were not applied before container/VS Code startup | setup failure | Apply plan-declared flags through the run config and rerun |

| noVNC shows product does not match expected behavior | product bug | Fix product code, rebuild VSIX/image if needed, rerun |

| Product behavior is correct but step text, click target, assertion, wait, or visual hash is stale | test plan drift | Repair plan/group and rerun |

| Same behavior eventually passes; screenshot shows tooltip/toast/loading variance | flake | Stabilize hover/wait/precondition/assertion and rerun |

If execution_order references missing step ids, inspect the plan history and current source-of-truth behavior before restoring deleted step objects. A previous UI-change commit may have intentionally removed obsolete assertions but missed the order list. If restored assertions disagree with current code or unit tests, treat them as test plan drift and update/remove the assertion instead of forcing the old expectation back into the case.

6. Repair the Smallest Surface with vscuse-ui First

Before editing or starting a second full execution, launch the UI workbench from the testcase root so shared groups resolve:

Push-Location packages/tests/vscuse/vscode-test-cases
vscuse-ui --config-file .\config.yaml --project-path .
Pop-Location

As soon as startup prints the service URLs, open http://127.0.0.1:6082 in the integrated browser and confirm that its embedded noVNC view is connected. Do not leave the user waiting on an invisible CLI execution. Keep the UI service running while editing plan/group JSON; reload the plan or use Restart/Clear before interpreting results after an edit.

Interaction repair preferences:

When editing generated or recorded plan content, preserve variables such as ${{var:app_name}}, keep secrets as secret/env references, and remove recorded tenant-specific or one-off values.

Recommended UI-first repair loop:

  1. Start vscuse-ui with the same config, image, template version, and feature flags used for the failing run.
  2. Verify non-secret container env such as TEMPLATE_VERSION and feature_flag:* names before interpreting UI behavior.
  3. Load the failing plan, then use Run, Continue, or Next to reach the failed area.
  4. Inspect the live noVNC state. If the product is correct and the plan is stale, record or edit the changed segment in the UI.
  5. Clean generated content in JSON only after the UI-produced behavior is understood.
  6. Rerun the focused plan with vscuse execute as the final validation.

For SCN-DA-CREATE-WITH-MCP-SERVER with TEAMSFX_MCP_FOR_DA_DT=true, the new dynamic-tool-discovery create flow must not execute legacy fetch-tools steps (Fetch action from MCP, Fetch from MCP, or static operation selection). Repair the plan in vscuse-ui so the full saved case reaches project generation and validates the generated dynamic MCP files first; only then run the clean CLI validation.

7. Validate and Report

Run the same focused plan again. Final report should include:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.