Skip to content

Add watch/restart support for Rust AppHosts #19376

Open

Description

@adamint

Background

#18906 adds Rust AppHost run and debug support. RuntimeSpec.WatchExecute remains unset, so watch mode currently launches the Rust AppHost normally but does not restart it after source changes.

We should provide the same edit/run loop available to other AppHost languages. This should not depend on the archived cargo-watch, silently require a globally installed tool, or weaken AppHost shutdown behavior.

Requirements

  • Restart the Rust AppHost when relevant Rust, Cargo, or generated module inputs change.
  • Ignore build output and unrelated workspace changes.
  • Stop the previous AppHost gracefully before starting its replacement, including on Windows.
  • Preserve Aspire arguments and environment variables across restarts.
  • Re-establish the CLI backchannel after each restart without leaving orphaned resources or occupied ports.
  • In VS Code debug mode, restart or reattach the native debugger so breakpoints continue to work after the executable PID changes.
  • Keep publish behavior unchanged.
  • Provide actionable prerequisite UX if an external watcher is selected.

Design notes

WatchExecute can select another command, but the current runtime contract does not model optional tool prerequisites, fallback behavior, or watcher-specific child termination. The Rust debugger also builds and launches one executable per debug session, so wrapping cargo run with a watcher is not sufficient for debug parity.

We should evaluate a maintained watcher such as Bacon against an Aspire-owned process supervisor. The implementation should include cross-platform tests for process replacement, backchannel reconnection, and debugger behavior.

Activity

  1. added
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on Aug 14, 2026
  2. added
    area-polyglotIssues related to polyglot apphosts
    and removed
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on Aug 14, 2026
  3. joperezr commented on Aug 14, 2026

    @joperezr
    Member
    🤖 Aspire triage pass — 2026-08-14 03:37 UTC

    Area: area-polyglot (secondary consideration: area-cli — watch loop + CLI backchannel reconnection)
    Kind: feature-request
    Repro: none — enhancement request, not a defect
    Affected version(s): n/a (new capability; latest: 13.4.0). Builds on prior Rust AppHost run/debug work referenced in the body.
    Severity: S3 — Rust AppHost run/debug works, but watch mode silently no-ops (no restart on source change); workaround is manual restart

    Urgency: ⚪ backlog — no milestone
    Reason: feature request (new watch/restart capability for Rust AppHosts) — does not meet the regression / very-bad-bug bar; no milestone while 13.5 stabilizes

    Suggested owner(s): Sébastien Ros (@sebastienros) (score 73), backup David Pine (@IEvangelist) (score 23)
    Evidence:

    Confidence: high
    Needs human?: no

  4. afscrome commented on Sep 23, 2026

    @afscrome
    Contributor

    When this is implemented, add an issue to Community Toolkit to remove it's Bacon integration.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions