Skip to content

Add Aspire editor assistance language model tools - #19414

Merged
Ella Hathaway (ellahathaway) merged 96 commits into
microsoft:mainfrom
adamint:feature/track-b-editor-assistance
Oct 6, 2026
Merged

Ella Hathaway (ellahathaway) merged 96 commits into
microsoft:mainfrom
adamint:feature/track-b-editor-assistance

Conversation

@adamint

@adamint Adam Ratzman (adamint) commented Aug 15, 2026 •

Copy link
Copy Markdown
Member

What changed

Adds six new editor-assistance language-model tools and hardens the existing aspire_apphost_start and aspire_apphost_stop tools, which already landed in #19134. Eight tools are covered here; only six are introduced by this PR.

Enable the Aspire tools in Copilot Chat's tool picker in a trusted workspace. Replace apphost.cs with an exact discovered AppHost path. Multi-root workspaces require the folder prefix, such as Lifecycle/apphost.cs.

Six new tools

Tool What it does Example input
aspire_debug_session_status Inspects one AppHost, or an exact resource's runtime state, health, and debug context. {"appHostPath":"apphost.cs","resourceName":"api"}
aspire_explain_launch_failure Returns the latest retained failure's stage, bounded category, and suggested actions. Does not return raw compiler errors. {"appHostPath":"apphost.cs"}
aspire_open_dashboard Opens an editor-controlled AppHost's Dashboard using the configured presentation, or an external browser by default. Does not return its URL. {"appHostPath":"apphost.cs"}
aspire_open_output Opens the Output panel and selects Aspire Extension after confirmation. Does not read or return channel contents. {}
aspire_list_debug_sessions Lists active AppHosts controlled by this editor, with their state, mode, and controller. Does not enumerate child resources. {}
aspire_hot_reload_status Reports whether C# Dev Kit Hot Reload is enabled and potentially applicable, with evidence and fallback actions. Never applies or verifies an edit. {"appHostPath":"apphost.cs","resourceName":"api"}

Existing lifecycle tools, hardened here

Tool What it does Example input
aspire_apphost_start Starts through the editor in run or debug mode. Does not launch a second copy when already starting/running. {"appHostPath":"apphost.cs","mode":"run"}
aspire_apphost_stop Stops that AppHost through the editor, or uses a path-targeted CLI stop for an externally started host. Never kills arbitrary processes. {"appHostPath":"apphost.cs"}

Start also accepts isolated and an exact launchProfile name. Linked git worktrees default to isolation unless explicitly overridden. A started result means the launch was accepted, not that every resource is healthy; use status afterward.

Targets must match discovered AppHosts in a trusted workspace. Arbitrary paths and commands are rejected. Results exclude raw logs, environment variables, process IDs, debug configurations, and authentication URLs.

UI and returned data

Context for the inspection tools: actual tool-started AppHost using locally built packages on c9015d8. Local paths and authentication URLs are redacted. The resource view itself is existing UI, not a new panel added by this PR.

API and ticker running in the Aspire editor view

New Output tool: consent opens a UI surface, not a channel-content response to the model. This crop is from the earlier real-editor E2E host.

Confirmation before opening the Aspire Output panel

Actual responses from the new inspection and Dashboard tools

These are recorded public-tool responses from the c9015d8 playground, formatted for readability. The inspection tools return structured data rather than opening separate UI panels.

List sessions

Three editor-controlled AppHosts were running concurrently. Each keeps its own workspace-qualified identity:

{
  "success": true,
  "tool": "aspire_list_debug_sessions",
  "outcome": "sessionsFound",
  "sessions": [
    {
      "appHost": "Lifecycle/apphost.cs",
      "state": "running",
      "mode": "run",
      "controller": "editor"
    },
    {
      "appHost": "Two AppHosts/alpha/apphost.cs",
      "state": "running",
      "mode": "run",
      "controller": "editor"
    },
    {
      "appHost": "Two AppHosts/beta/apphost.cs",
      "state": "running",
      "mode": "run",
      "controller": "editor"
    }
  ]
}

Resource status

The API is running and healthy. The result includes a safe source filename, not raw resource metadata:

{
  "success": true,
  "tool": "aspire_debug_session_status",
  "outcome": "running",
  "scope": "resource",
  "controller": "editor",
  "appHost": "Lifecycle/apphost.cs",
  "resourceName": "api",
  "resource": {
    "resourceType": "Project",
    "state": "Running",
    "healthStatus": "Healthy",
    "source": "PlaygroundApi.csproj"
  },
  "mode": "run"
}

Explain a failed launch

The deliberately broken sample produced a recorded process-exit category and a fixed next action. The compiler text is not copied into the response:

{
  "success": true,
  "tool": "aspire_explain_launch_failure",
  "outcome": "failureFound",
  "appHost": "Intentional failure/apphost.cs",
  "stage": "cliLaunch",
  "category": "processExited",
  "controller": "cli",
  "mode": "run",
  "providerKind": "dotnet",
  "exitCodeBucket": "other",
  "recommendedActions": ["checkAspireOutput"]
}

Hot Reload applicability

Enabled does not mean applicable: C# Dev Kit and Hot Reload are enabled, but this resource was started without a debugger. The tool reports that distinction and suggests restarting the resource before rebuilding/restarting the AppHost:

{
  "success": true,
  "tool": "aspire_hot_reload_status",
  "outcome": "notApplicable",
  "appHost": "Lifecycle/apphost.cs",
  "resourceName": "api-akmnrnrd",
  "controller": "editor",
  "hotReloadEnabled": true,
  "evidence": [
    "devKitInstalled",
    "hotReloadSettingEnabled",
    "hotReloadOnSaveEnabled",
    "editorSessionWithoutDebugger",
    "dotnetProjectResource"
  ],
  "fallback": ["restartResource", "rebuildAndRestartAppHost"]
}

Dashboard handoff

The recorded handoff used an external browser. The response reports the presentation without exposing a login URL:

{
  "success": true,
  "tool": "aspire_open_dashboard",
  "outcome": "opened",
  "presentation": "externalBrowser"
}
Existing start/stop tools: lifecycle confirmation screenshots

These are confirmations from the earlier real-editor E2E host for the existing lifecycle tools hardened by this PR. They do not establish current playground debug readiness.

Start: the confirmation identifies the AppHost and requested mode.

Start confirmation naming the exact AppHost and debug mode

Stop: confirmation is scoped to one AppHost.

Stop confirmation naming the exact AppHost

Follow-up fixes and verification

Follow-up fixes preserve CLI-first startup failures, keep multi-root identities reusable, update MCP labels when ownership changes, and handle cancellation and synchronous spawn errors. Resource waits and confirmation expiry use monotonic time. Filesystem normalization handles caseless Unicode aliases and refuses to guess between conflicting entries. Tool registration and other shared helpers were extracted without a broader architecture refactor.

Failure retention is now one sanitized result per AppHost, not a journal: 30-minute monotonic expiry, capped at 50 AppHosts. Removed history, sequence numbers, and record timestamps; shared the failure-mode mapping and safe-field projection instead of repeating them across producers and telemetry. Detailed errors stay in existing Output, CLI logs, and resource logs. No new log parser or diagnostics framework.

  • Current head 86ec1239a31e27dd17c3300fb71373c1863037b2: CI passed, with no failed or pending checks at verification. CI passed on attempt 2 after automatic failed-job retries.
  • 3,484 extension unit tests passed, with 5 existing pending tests, plus TypeScript compilation, extension build, and lint. Independent review of the latest-failure simplification reported no findings.
  • A fresh local Git fixture produced a real CLI compilation failure. After all debug sessions were disposed, the public vscode.lm.invokeTool call still returned failureFound, without the raw compiler marker or absolute workspace path.
  • Earlier real-editor coverage exercised lifecycle, linked worktrees, multiple AppHosts, failure reporting, Dashboard/Output handoff, and Hot Reload applicability. The media and transcripts above retain their original source revisions; subsequent corrections have regression coverage and current-head CI.
  • The persistent DevDrive playground is verified in run mode. Debug startup stalls in its local C# setup, so active debugging/Hot Reload were not re-verified there.

All 56 review threads are resolved. The latest automated review reports no concrete finding but requests final human review of the broader lifecycle and process-control changes. This remains a draft; it has not been approved or merged.

Fixes #19460

Adam Ratzman and others added 16 commits August 14, 2026 20:54
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 2b9501ad-f5ba-4bc8-a7c2-ccdfaf15061c
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 2b9501ad-f5ba-4bc8-a7c2-ccdfaf15061c
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 2b9501ad-f5ba-4bc8-a7c2-ccdfaf15061c
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 2b9501ad-f5ba-4bc8-a7c2-ccdfaf15061c
Co-authored-by: Copilot <[email protected]>
Copilot-Session: e3c8fa3a-d5fd-427d-baa5-3d0c1334a513
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 2b9501ad-f5ba-4bc8-a7c2-ccdfaf15061c
Co-authored-by: Copilot <[email protected]>
Copilot-Session: e3c8fa3a-d5fd-427d-baa5-3d0c1334a513
Copilot AI balanced review requested due to automatic review settings August 15, 2026 17:13
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19414

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19414"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds five privacy-bounded VS Code language-model tools for inspecting Aspire debug state, explaining launch failures, and opening relevant UI.

Changes:

  • Adds editor-state snapshots, safe AppHost resolution, failure journaling, and telemetry.
  • Adds confirmation-gated Dashboard and Output handoffs.
  • Extends debugger metadata and comprehensive unit/E2E coverage.
Show a summary per file
File Description
extension/telemetry.json Defines new telemetry events.
extension/src/views/AspireAppHostTreeProvider.ts Reuses Dashboard URL validation.
extension/src/utils/telemetryRegistry.ts Types new telemetry schemas.
extension/src/utils/appHostIdentity.ts Adds opaque lexical identities.
extension/src/types/extensionApi.ts Extends E2E invocation controls.
extension/src/testing/e2eStateFileBridge.ts Supports testing all LM tools.
extension/src/testing/e2eStateFileBridge.production.ts Updates production bridge signature.
extension/src/test/telemetryInventory.test.ts Adjusts telemetry inventory test.
extension/src/test/strings.test.ts Verifies localized confirmations.
extension/src/test/rustDebugger.test.ts Tests typed Rust build failures.
extension/src/test/launchFailureTelemetry.test.ts Tests sanitized failure telemetry.
extension/src/test/dotnetDebugger.test.ts Tests typed .NET build failures.
extension/src/test/dcpTypes.test.ts Tests safe launch-path extraction.
extension/src/test/AspireExtensionContext.test.ts Tests assistance-state lifecycle.
extension/src/test/aspireDebugConfigurationProvider.test.ts Tests discovery-failure journaling.
extension/src/test/appHostLifecycleTools.test.ts Updates lifecycle-tool coverage.
extension/src/test/appHostDataRepository.test.ts Tests one-shot resource queries.
extension/src/test/adapterTracker.test.ts Tests AppHost termination attribution.
extension/src/test-e2e/packageSurface.e2e.test.ts Verifies packaged tool contributions.
extension/src/test-e2e/appHostLifecycleTools.e2e.test.ts Exercises assistance tools end-to-end.
extension/src/services/launchFailureJournal.ts Implements bounded failure journal.
extension/src/services/editorAssistanceWindowState.ts Resets activation-scoped state.
extension/src/services/AppHostLaunchService.ts Exposes safe session state and journaling.
extension/src/services/appHostLaunchReservations.ts Reports pending external runs.
extension/src/services/appHostLaunchContracts.ts Defines safe session snapshots.
extension/src/server/interactionService.ts Reuses Dashboard-launch helpers.
extension/src/loc/strings.ts Adds localized confirmation strings.
extension/src/lm/safeAppHostTargetResolver.ts Resolves trusted workspace AppHosts.
extension/src/lm/languageModelToolUi.ts Escapes confirmation Markdown.
extension/src/lm/editorUiHandoffService.ts Handles Dashboard and Output UI.
extension/src/lm/editorStateSnapshotService.ts Produces bounded session summaries.
extension/src/lm/editorAssistanceToolContracts.ts Defines tool contracts and validation.
extension/src/lm/editorAssistanceToolAdapters.ts Registers the five tools.
extension/src/lm/editorAssistanceTelemetry.ts Emits bounded result telemetry.
extension/src/lm/appHostLifecycleToolService.ts Shares safe target resolution.
extension/src/lm/appHostLifecycleTools.ts Updates lifecycle exports.
extension/src/lm/appHostLifecycleToolContracts.ts Extends lifecycle service contracts.
extension/src/lm/appHostLifecycleToolAdapters.ts Shares UI escaping and E2E access.
extension/src/extension.ts Wires editor-assistance services.
extension/src/debugger/languages/rust.ts Uses typed build failures.
extension/src/debugger/languages/dotnet.ts Uses typed build failures.
extension/src/debugger/debuggerExtensions.ts Captures structured resource identity.
extension/src/debugger/AspireDebugConfigurationProviderInternal.ts Tracks recorded discovery failures.
extension/src/debugger/AspireDebugConfigurationProvider.ts Journals terminal launch failures.
extension/src/debugger/appHostBuildFailureError.ts Defines build-failure boundary type.
extension/src/debugger/adapterTracker.ts Tracks explicit AppHost termination.
extension/src/dcp/types.ts Extracts safe target/executable paths.
extension/src/data/AppHostDataRepository.ts Exposes cancellable resource snapshots.
extension/src/AspireExtensionContext.ts Exposes safe editor session projections.
extension/package.nls.json Adds localized manifest strings.
extension/package.json Contributes and activates new tools.
extension/loc/xlf/aspire-vscode.xlf Updates localization catalog.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 58/59 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Adam Ratzman and others added 9 commits August 15, 2026 13:28
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 2b9501ad-f5ba-4bc8-a7c2-ccdfaf15061c
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 2b9501ad-f5ba-4bc8-a7c2-ccdfaf15061c
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 2b9501ad-f5ba-4bc8-a7c2-ccdfaf15061c
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 2b9501ad-f5ba-4bc8-a7c2-ccdfaf15061c
Keep lifecycle result selectors qualified in multi-root workspaces and regenerate MCP labels when their owning folder changes.

Co-authored-by: Copilot App <[email protected]>
@adamint

Copy link
Copy Markdown
Member Author

Fixed both points from this review in 2a187b8. Lifecycle results now keep the workspace-qualified selector, and MCP labels update when the owning folder changes. Added regressions for reusing returned selectors and removing the outer folder of nested roots; all 358 affected tests pass.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Lifecycle confirmations use wall-clock expiry, allowing clock rollback to extend authorization beyond the intended five-minute lifetime.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity

Open (1)

Keep the five-minute start and stop confirmation lifetime independent of wall-clock corrections, with forward/backward clock-jump boundary coverage.

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Filesystem normalization remains incomplete for caseless Unicode segments, and launch-failure expiry still depends on non-monotonic wall-clock time.

Review effort: Balanced
Findings: None

Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Use monotonic timestamps for failure TTL expiry

extension/​src/​services/​launchFailureJournal.ts:235

The TTL still uses Date.now(), so a forward wall-clock correction of 30 minutes or more makes the next read/record immediately delete failures that were just captured. Scanning all entries fixes rollback ordering only; it does not satisfy the PR's stated clock-change hardening. Use a monotonic timestamp for expiry (while retaining wall-clock time separately if it is needed for display).

Use monotonic journal timestamps and recognize filesystem normalization aliases independently of letter case. Cover both wall-clock jump directions and Hangul path segments.

Co-authored-by: Copilot App <[email protected]>
Preserve the requested path rather than choosing between distinct case and Unicode-normalization aliases, with coexistence coverage for both resolvers.

Co-authored-by: Copilot App <[email protected]>
@adamint

Copy link
Copy Markdown
Member Author

Confirmed both points in the latest review. The journal now uses monotonic time, and the path normalizer handles caseless Unicode aliases such as Hangul. Independent review also caught a case/normalization collision; the resolver now refuses to guess between different entries.

Pushed through 3051ff8. All 386 affected extension tests and 12 CLI path tests pass locally. Four path tests require a different platform/filesystem, including the Windows coexistence case; those are left to CI.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The broad security-sensitive lifecycle, process-control, path-identity, and authenticated-URL changes warrant final human review despite extensive automated coverage.

Review effort: Balanced
Findings: None

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Keep one bounded, sanitized latest failure per AppHost instead of a history. Share failure mode and safe projection policy while preserving identity checks, expiry, and duplicate-capture coverage.

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The broad security-sensitive lifecycle, process-control, filesystem-identity, and authentication changes warrant final human review despite extensive coverage.

Review effort: Balanced
Findings: None

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two resource-discovery gaps to address: command metadata for execute_resource_command, and pagination or targeted lookup beyond the 64-resource limit.

Expose API-visible command metadata without current or default argument values. Add validated, deterministic resource pagination and preserve cross-page relationships.

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The broad lifecycle, process-control, path-identity, authentication, and cross-component MCP changes warrant final human validation despite extensive coverage.

Review effort: Balanced
Findings: None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two remaining error-recovery issues: preserve lifecycle preflight diagnostics and distinguish duplicate AppHost instances from unavailable selections.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Two projections ignore the explicit empty-source suppression contract and can expose source information intentionally hidden by a resource producer.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The broad lifecycle and process-control changes require human review, and source-suppression plus stale verification findings remain unresolved.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Low severity Update verification details for the current PR head

extension/​package.json:57

The PR description says 86ec1239... is the current head and that CI/test verification applies there, but the PR head is now 602600403.... Update the verification section (and rerun the cited checks if needed) so reviewers can tell whether the latest 95-commit revision is covered.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Resource source suppression is bypassed by the new tree-display fallback, exposing metadata that the resource explicitly opted out of displaying.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@ellahathaway

Copy link
Copy Markdown
Contributor

From local testing, all editor tools behaved correctly when actually invoked through vscode.lm.invokeTool:

  • aspire_apphost_start started a real AppHost, rejected invalid/missing targets, avoided duplicate and concurrent launches, and handled cancellation safely.

  • aspire_apphost_stop stopped editor-owned AppHosts through the coordinated debug lifecycle and successfully stopped an AppHost started externally by the CLI.

  • aspire_debug_session_status correctly reported stopped/running session state and bounded resource state, health, exit code, and ownership source without exposing sensitive process or configuration data.

  • aspire_explain_launch_failure retained and classified a real CLI-owned compilation failure after shutdown, returning bounded categories and recommended actions rather than raw output.

  • aspire_list_debug_sessions returned the active editor-controlled AppHosts with the expected safe summaries.

  • aspire_open_dashboard correctly performed the Dashboard UI handoff for the selected running AppHost.

  • aspire_open_output correctly handled both accepted and denied user confirmation before opening the Aspire Output channel.

  • aspire_hot_reload_status correctly reported non-applicability, applicability evidence, and ordered restart/rebuild recovery guidance without claiming an edit had actually been applied.

Additional testing covered invalid inputs, missing targets, resource projection, editor-versus-CLI ownership, cancellation, concurrent starts, and shutdown state retention. Everything succeeded.

Separately, a CLI MCP test confirmed wait_for_resources succeeds for healthy resources, immediately reports missing resources, and returns a bounded timeout result when the requested state is not reached.

Based on the above, no execution or contract defect was found in the added tools. Marking this PR ready for review.

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[VS Code] Expose editor-owned Aspire state and UI handoffs to agents

3 participants