Skip to content

[release/13.4] Stabilize PrebuiltAppHostServer staging globalPackagesFolder path - #17573

Merged
Jose Perez Rodriguez (joperezr) merged 3 commits into
release/13.4from
danegsta/fix-staging-nuget-hang
May 28, 2026
Merged

Jose Perez Rodriguez (joperezr) merged 3 commits into
release/13.4from
danegsta/fix-staging-nuget-hang

Conversation

@danegsta

Copy link
Copy Markdown
Member

Description

Polyglot AppHosts running a stable-shaped staging CLI (e.g. 13.4.0+<sha>) were hanging during DI / assembly loading after a successful integration restore. Observed on macOS osx-arm64 against staging builds; the same code path is at risk on every OS.

Root cause: PackagingService builds the staging channel with ConfigureGlobalPackagesFolder=true so each darc/override feed restore is cache-isolated. That isolation matters because two staging builds of the same release branch ship as the same stable-shaped semver (e.g. 13.4.0) from different feeds, and NuGet keys by (id, version) only -- without per-feed isolation a second build's restore silently reuses the first build's now-stale assemblies. PrebuiltAppHostServer threaded that flag into TemporaryNuGetConfig, whose default globalPackagesFolder value is the relative .nugetpackages. NuGet resolved it under the temp config's own directory, BundleNuGetService baked those temp paths into integration-package-probe-manifest.json, and TemporaryNuGetConfig.Dispose then recursively deleted the cache out from under the manifest. aspire-managed then tried to load assemblies the dispose had just removed.

Approach: keep the per-feed cache isolation (it's load-bearing for staging) and anchor the override at a stable absolute path instead of a relative one that the temp config owns. The override now points at:

<ASPIRE_HOME>/.nugetpackages/<first-8-of-CLI-commit-sha>

A few notes on the design:

  • The cache is keyed by the truncated CLI commit SHA so each staging build gets its own cache. 8 hex chars matches the existing darc-pub-microsoft-aspire-<hash> feed URL convention in PackagingService.GetStagingFeedUrl, short enough to avoid Windows MAX_PATH blow-ups on deep integration cache trees while keeping collision probability negligible. Clean release builds (no +sha suffix) fall back to default.
  • The cache lives under ASPIRE_HOME rather than the per-AppHost _workingDirectory so multiple AppHosts on the same machine running against the same staging build can share one restore. The unit of isolation here is the staging build, not the individual restore command.
  • A single CliPathHelper.GetStagingNuGetPackagesDirectory helper is the source of truth for the path so the producer (PrebuiltAppHostServer) and consumer (CacheCommand) can't drift.
  • aspire cache clear now wipes the SHA-keyed subdirs under <ASPIRE_HOME>/.nugetpackages, so a wedged staging restore is recoverable through the same UX as every other CLI cache.

Tests cover the new invariants:

  • Existing PrebuiltAppHostServerTests staging cases now assert the emitted globalPackagesFolder is absolute and lives outside the temp config directory.
  • New PrebuiltAppHostServerTests case wires a real PackagingService with overrideStagingFeed on a stable-shaped CLI and pins the same invariant end to end.
  • New TemporaryNuGetConfigTests cover the override propagation and the no-override-when-disabled case.
  • New CacheCommandTests cover the staging cache wipe and the missing-cache no-op path.

Targeted MTP run (excluding quarantine/outerloop) is green: 221/221 across PackagingServiceTests, PrebuiltAppHostServerTests, TemporaryNuGetConfigTests, NuGetConfigMergerTests, and CacheCommandTests.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

PackagingService creates the staging channel with
ConfigureGlobalPackagesFolder=true so each darc/override feed restore
lands in an isolated cache (two staging builds of the same release
branch ship as 13.4.0 but from different feeds, and NuGet keys by
(id,version) only). PrebuiltAppHostServer was wiring that flag into a
TemporaryNuGetConfig whose default globalPackagesFolder value is the
relative '.nugetpackages' -- NuGet resolved it under the temp config's
own directory, BundleNuGetService baked those temp paths into
integration-package-probe-manifest.json, and TemporaryNuGetConfig.Dispose
then recursively deleted the cache out from under the manifest. On macOS
osx-arm64 polyglot staging builds this surfaced as a hang during DI /
assembly loading in aspire-managed.

Preserve the per-feed cache isolation behavior and anchor the override
at a stable absolute path instead:

  <ASPIRE_HOME>/.nugetpackages/<first-8-of-CLI-commit-sha>

Keying by the truncated commit hash matches the existing
darc-pub-microsoft-aspire-<hash> feed URL convention in
PackagingService.GetStagingFeedUrl, so the cache key and feed key stay
aligned at 8 hex chars. 8 chars is short enough to avoid Windows
MAX_PATH blow-ups on deep integration cache trees while keeping SHA
collisions negligible. The cache lives under ASPIRE_HOME (not the
per-AppHost working directory) so multiple AppHosts on the same machine
running against the same staging build can share a single restore --
the unit of isolation here is the staging build, not the individual
restore command.

Mechanics:
- TemporaryNuGetConfig.CreateAsync now accepts an optional
  globalPackagesFolderValue and propagates it through
  AddGlobalPackagesFolderToConfigAsync into the merger.
- NuGetConfigMerger.AddGlobalPackagesFolderConfiguration takes the
  optional override and falls back to the workspace-relative default
  ('.nugetpackages') for the non-temp workspace-merge path.
- PrebuiltAppHostServer.ResolveStableGlobalPackagesFolder routes both
  temp config branches (channel and package-source-override) through
  the new helper.
- VersionHelper.TryGetCurrentCommitHashShort surfaces the truncated
  SHA from the running CLI's AssemblyInformationalVersion (returns
  null on clean release builds with no '+sha' suffix; callers fall
  back to 'default').
- CliPathHelper centralizes the '<ASPIRE_HOME>/.nugetpackages' path so
  the producer (PrebuiltAppHostServer) and consumer (CacheCommand)
  can't drift.
- CacheCommand.ClearCommand now wipes <ASPIRE_HOME>/.nugetpackages so
  a wedged staging restore is recoverable through the same UX as every
  other CLI cache.

Tests:
- Updated existing PrebuiltAppHostServerTests staging cases to assert
  the globalPackagesFolder value is absolute and lives outside the
  temp config directory.
- New PrebuiltAppHostServerTests case wires a real PackagingService
  with overrideStagingFeed on a stable-shaped CLI and pins the same
  invariant end-to-end.
- New TemporaryNuGetConfigTests for the override propagation and for
  the no-override-when-disabled invariant.
- New CacheCommandTests covering the staging cache wipe and the
  missing-cache no-op path.

Co-authored-by: Copilot <[email protected]>
@github-actions

github-actions Bot commented May 28, 2026 •

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 -- 17573

Or

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

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

This PR stabilizes staging-channel NuGet package restore behavior for prebuilt AppHost scenarios by moving temporary globalPackagesFolder output to a persistent Aspire home cache and extending cache clearing/tests around that behavior.

Changes:

  • Adds a staging NuGet package cache path under ASPIRE_HOME.
  • Threads an explicit globalPackagesFolder override through temporary NuGet config generation.
  • Adds/updates tests for persistent staging cache paths and aspire cache clear.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Aspire.Cli/Projects/PrebuiltAppHostServer.cs Resolves a persistent staging globalPackagesFolder path for temporary NuGet configs.
src/Aspire.Cli/Packaging/TemporaryNuGetConfig.cs Allows callers to provide an explicit global packages folder value.
src/Aspire.Cli/Packaging/NuGetConfigMerger.cs Centralizes default global packages folder value and accepts overrides.
src/Aspire.Cli/Utils/CliPathHelper.cs Adds helper/constant for the staging NuGet package cache root.
src/Aspire.Cli/Utils/VersionHelper.cs Adds helper for deriving a short commit hash from the CLI informational version.
src/Aspire.Cli/Commands/CacheCommand.cs Clears staging NuGet cache contents as part of aspire cache clear.
tests/Aspire.Cli.Tests/Projects/PrebuiltAppHostServerTests.cs Adds assertions that staging temp configs use absolute persistent package cache paths.
tests/Aspire.Cli.Tests/Packaging/TemporaryNuGetConfigTests.cs Covers explicit global packages folder override behavior.
tests/Aspire.Cli.Tests/Commands/CacheCommandTests.cs Covers clearing and missing staging NuGet package cache scenarios.

The staging globalPackagesFolder fix in the previous commit keyed the
\`.nugetpackages\` subdirectory off the CLI's own commit SHA (first 8
hex chars of \`AssemblyInformationalVersionAttribute\`). That handles
two darc-shipped staging builds of the same release branch, but it
breaks the local-dev case where one CLI is repeatedly retargeted at
different \`overrideStagingFeed\` values: the URL changes but the SHA
doesn't, so every override silently shares one cache bucket and the
second restore reuses the first feed's now-stale \`13.4.0\` assemblies.

Switch the cache key to the first 8 hex chars of \`XxHash3\` over the
trimmed, lower-cased resolved feed URL:

- Override branch passes the explicit \`--source\` URL.
- Channel branch passes the channel's \`Aspire*\` mapping source (or
  the first mapping for forward compatibility).

Trim + lower-case before hashing so a stray whitespace from a config
file or a hostname-case change doesn't fragment the cache.
Non-cryptographic hashing is fine here — the key is a directory name,
not a security boundary — and 8 hex chars keep deep integration cache
paths well under Windows MAX_PATH while giving ~4 billion buckets, so
collisions are negligible across the handful of staging feeds any user
ever sees.

Removes the now-unused \`VersionHelper.TryGetCurrentCommitHashShort\`
helper (added in the previous commit, no remaining callers).

Tests:
- New \`CliPathHelperTests.ComputeStagingFeedCacheKey_*\` cover
  determinism, normalization, length defaults, and null/empty input.
- Existing \`PrebuiltAppHostServerTests\` strengthened to assert the
  emitted globalPackagesFolder equals \`<aspireHome>/.nugetpackages/<hash(feed)>\`.

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

Copy link
Copy Markdown
Member Author

Tier-2 smoke test on a binary CLI + bundle (PASS)

Built a real customer-shaped osx-arm64 CLI archive against this branch and drove aspire restore through the exact bundled-NuGet path that was hanging. Confirms the fix end-to-end against the f89b2b7 darc feed.

Build (~6 min total)

./build.sh -ci -restore -build -pack -p:BuildBundleDepsOnly=true -p:StabilizePackageVersion=true -p:AspireCliChannel=staging
./dotnet.sh msbuild eng/Bundle.proj /restore /p:TargetRid=osx-arm64 /p:BundleVersion=ci-bundlepayload /p:SkipNativeBuild=true /p:StabilizePackageVersion=true
./build.sh -ci -build -pack -p:SkipManagedBuild=true /p:TargetRids=osx-arm64 /p:BundlePayloadPath=artifacts/bundle/aspire-ci-bundlepayload-osx-arm64.tar.gz -p:AspireCliChannel=staging -p:StabilizePackageVersion=true

Output: artifacts/packages/Debug/Shipping/aspire-cli-osx-arm64-13.4.0.tar.gz (114 MB, stable-shaped 13.4.0 so PackagingService.IsStableShapedCliVersion() returns true and staging resolves to the SHA darc feed).

Smoke run

Extracted the tarball to /tmp/aspire-smoke-install/ (outside the worktree so DotNetBasedAppHostServerProject._repoRoot resolution misses and Aspire.Hosting.* becomes a PackageReference, hitting the bundled NuGet restore path instead of the in-source ProjectReference fallback).

/tmp/aspire-smoke-install/aspire --version   # 13.4.0
cd /tmp/aspire-smoke-app
/tmp/aspire-smoke-install/aspire new aspire-ts-empty --name PolyglotSmoke --output PolyglotSmoke --non-interactive --channel staging
cd PolyglotSmoke
/tmp/aspire-smoke-install/aspire restore --non-interactive --log-level Debug

Global config had channel=staging, features.stagingChannelEnabled=true, overrideStagingFeed=https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-microsoft-aspire-f89b2b7e/nuget/v3/index.json.

Debug-log trace through the fix path

PackagingService: Resolved 'staging' channel: feed=https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-microsoft-aspire-f89b2b7e/nuget/v3/index.json, quality=Stable
PrebuiltAppHostServer: Restoring 2 integration packages via bundled NuGet
BundleNuGetService: Package manifest created at .../integration-package-probe-manifest.json
PrebuiltAppHostServer: Setting ASPIRE_INTEGRATION_PROBE_MANIFEST_PATH to ...
PrebuiltAppHostServer(18397) stdout: Application started.    <-- pre-fix this is where the hang occurred
PrebuiltAppHostServer(18397) stdout: Starting RemoteAppHost JsonRpc Server on /Users/dnegstad/.aspire/cli/bch/hrnBrbXe2...

Verifications after the run

Check Result
Cache landed at expected stable path ~/.aspire/.nugetpackages/a27cd5ee/ (73 packages, 388 MB)
Cache key matches CliPathHelper.ComputeStagingFeedCacheKey(feed) XxHash3("https://.../darc-pub-microsoft-aspire-f89b2b7e/...".Trim().ToLowerInvariant())[:8] = a27cd5ee
Probe manifest paths 123 / 123 resolve to real DLLs on disk
Sample manifest path /Users/dnegstad/.aspire/.nugetpackages/a27cd5ee/aspire.hosting/13.4.0/lib/net8.0/Aspire.Hosting.dll (2.7 MB, real)
Temp NuGet.config directories surviving the run 0 under /var/folders or /tmp (temp config disposed cleanly; cache survives because it's outside the temp dir)
aspire restore exit code 0 (no hang)
AppHost server stdout Application started. ... Hosting environment: Production

What this proves

Before the fix, TemporaryNuGetConfig wrote globalPackagesFolder=.nugetpackages (relative, under the temp directory). The probe manifest baked that temp path in. When the temp NuGet.config was disposed the temp dir got deleted with it, leaving the manifest pointing at deleted assemblies and the AppHost hanging during assembly resolution.

After the fix, PrebuiltAppHostServer.ResolveStableGlobalPackagesFolder(feedUrl) resolves to <ASPIRE_HOME>/.nugetpackages/<XxHash3(feed)[:8]>/, which is an absolute path outside the temp dir. The probe manifest paths survive the temp config dispose, the bundled NuGet restore can be reused across aspire invocations targeting the same feed, and concurrent staging builds against different feeds get isolated caches without cross-contamination.

PR #17564 introduced a new fallback in TryGetCurrentCliTemplateVersionPackage
that pins the template package to the running CLI's SDK version whenever the
selected channel is explicit and not local-build. That preserved the intended
fix for prerelease channels (daily, staging) where the channel feed filters
the running CLI's package out of search results even though the feed can
still restore it.

But it also fired for the stable channel, where the filter does not apply.
For a non-stable-shape CLI (PR build like '13.4.0-pr.X.gY' or a daily-shape
preview) invoked with '--channel stable', it forced an unpublishable version
into the generated apphost.cs, breaking the SmokeTests
LatestCliCanStartStableChannelAppHost and
LatestCliCanStartStableChannelTypeScriptAppHost.

Exclude the stable channel from the new fallback so that case falls through
to the OrderByDescending picker and the user gets the highest shipped stable
package they explicitly asked for. The original prerelease-channel motivation
('Aspire.TypeSystem version mismatch when 13.4 CLI floats templates to a
13.5 daily preview') is preserved unchanged.

Test updates:
 - NewCommandChannelResolutionTests.NewCommand_NoChannelArg_ResolvesTemplateFromIdentityChannel
   gets an expectedVersion theory parameter so the daily case still pins to
   the CLI version while the stable case asserts the highest shipped stable.
 - NewCommandChannelResolutionTests.NewCommand_ExplicitChannelArg_OverridesIdentityChannel
   asserts highest shipped stable (matching the SmokeTest contract).
 - New NewCommand_ExplicitStableChannel_NonStableCliVersion_FallsBackToHighestShippedStable
   regression test covers both daily-shape and PR-shape CLI identities.
 - NewCommandTests.NewCommandWithTypeScriptEmptyTemplatePassesResolvedVersionAndChannelToScaffolding
   reverts to its pre-#17564 assertion of '9.2.0' from the stable feed.

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

Copy link
Copy Markdown
Member Author

Pushed c8f74e39c to narrow the #17564 CLI-pin fallback so it no longer fires for --channel stable. That's the source of the SmokeTest Expected stable Aspire.AppHost.Sdk version, got '13.4.0-pr.17573.gf265ec09' failures.

Behavior change is scoped to one case: --channel stable with a non-stable-shape CLI (PR build or daily-shape preview). Those now fall through to the highest shipped stable package from the channel feed, matching the user's explicit --channel stable request.

The original #17564 motivation is fully preserved: prerelease channels (daily, staging) still pin templates to the running CLI's SDK version so the bundled AppHost server and the restored Aspire packages stay in lock-step, preventing the Aspire.TypeSystem, Version=13.5.0.0 assembly load errors.

Test updates locked the new contract in:

  • NewCommandChannelResolutionTests.NewCommand_NoChannelArg_ResolvesTemplateFromIdentityChannel — daily case still asserts GetDefaultSdkVersion(), stable case now asserts highest stable.
  • NewCommandChannelResolutionTests.NewCommand_ExplicitChannelArg_OverridesIdentityChannel — asserts highest shipped stable.
  • New theory NewCommand_ExplicitStableChannel_NonStableCliVersion_FallsBackToHighestShippedStable covers both daily-shape and PR-shape (13.4.0-pr.17573.gabc1234) CLI identities — direct regression guard for the SmokeTest failure.
  • NewCommandTests.NewCommandWithTypeScriptEmptyTemplatePassesResolvedVersionAndChannelToScaffolding reverts to its pre-Prefer current CLI template version for aspire new #17564 "9.2.0" assertion.

Local: 3,833 Aspire.Cli.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.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Comment on lines 193 to 195
selectedChannel.Type is PackageChannelType.Explicit &&
!string.Equals(selectedChannel.Name, PackageChannelNames.Stable, StringComparisons.ChannelName) &&
!VersionHelper.IsLocalBuildChannel(selectedChannel.Name))
return null;
}

var normalized = feedUrl.Trim().ToLowerInvariant();
@joperezr
Jose Perez Rodriguez (joperezr) merged commit 5d0da8b into release/13.4 May 28, 2026
312 checks passed
@joperezr
Jose Perez Rodriguez (joperezr) deleted the danegsta/fix-staging-nuget-hang branch May 28, 2026 03:45
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.4 milestone May 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❓ CLI E2E Tests unknown — 107 passed, 0 failed, 2 unknown (commit c8f74e3)

View all recordings
Status Test Recording Job Artifacts
✅ AddPackageInteractiveWhileAppHostRunningDetached Recording #78218908508 Logs
✅ AddPackageWhileAppHostRunningDetached Recording #78218908508 Logs
✅ AgentCommands_AllHelpOutputs_AreCorrect Recording #78218908738 Logs
✅ AgentInitCommand_DefaultSelection_InstallsDefaultSkills Recording #78218908738 Logs
✅ AgentInitCommand_MigratesDeprecatedConfig Recording #78218908738 Logs
✅ AgentMcpListStructuredLogsReturnsLogsFromStarterApp Recording #78218908599 Logs
✅ AgentMcpListStructuredLogsReturnsLogsFromStarterApp_DevLocalhost Recording #78218908599 Logs
✅ AgentMcpListStructuredLogsReturnsLogsFromStarterApp_Isolated Recording #78218908599 Logs
✅ AllPublishMethodsBuildDockerImages Recording #78218908480 Logs
✅ AspireAddAndStartWorkAgainstLegacyAppHostTs Recording #78218908393 Logs
✅ AspireAddPackageVersionToDirectoryPackagesProps Recording #78218908608 Logs
✅ AspireInitSingleFileAppHostRunsViaDotnetRunAppHost Recording #78218908310 Logs
✅ AspireInitWithExistingAppHostDirRecreatesMissingNuGetConfigAndPreservesFiles Recording #78218908714 Logs
❔ AspireInitWithSolutionFileGeneratesAppHostThatBuildsAgainstChannelHive Recording #78218908714 Logs
✅ AspireStartUpdatesStaleTypeScriptAppHostPath Recording #78218908402 Logs
✅ AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps Recording #78218908608 Logs
✅ AspireUpdateRemovesOrphanAppHostPackageVersionWhenSdkAlreadyCurrent Recording #78218908608 Logs
✅ Banner_DisplayedOnFirstRun Recording #78218908265 Logs
✅ Banner_DisplayedWithExplicitFlag Recording #78218908265 Logs
✅ Banner_NotDisplayedWithNoLogoFlag Recording #78218908265 Logs
✅ CertificatesClean_RemovesCertificates Recording #78218908640 Logs
✅ CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate Recording #78218908640 Logs
✅ CertificatesTrust_WithUntrustedCert_TrustsCertificate Recording #78218908640 Logs
✅ ConfigSetGet_CreatesNestedJsonFormat Recording #78218908746 Logs
✅ CreateAndRunAspireStarterProject Recording #78218908447 Logs
✅ CreateAndRunAspireStarterProjectWithBundle Recording #78218908506 Logs
✅ CreateAndRunEmptyAppHostProject Recording #78218908293 Logs
✅ CreateAndRunJavaEmptyAppHostProject Recording #78218908576 Logs
✅ CreateAndRunJsReactProject Recording #78218908775 Logs
✅ CreateAndRunPythonReactProject Recording #78218908332 Logs
✅ CreateAndRunTypeScriptEmptyAppHostProject Recording #78218908309 Logs
✅ CreateAndRunTypeScriptStarterProject Recording #78218908502 Logs
✅ CreateJavaAppHostWithViteApp Recording #78218908515 Logs
✅ CreateTypeScriptAppHostWithViteApp_AllowsGuestAppPackageManagerToDiffer Recording #78218908757 Logs
✅ CreateTypeScriptAppHostWithViteApp_UsesConfiguredToolchain Recording #78218908757 Logs
✅ DashboardRunWithAgentMcpListTracesReturnsNoTraces Recording #78218908790 Logs
✅ DashboardRunWithAgentMcpListTracesReturnsNoTraces_DevLocalhost Recording #78218908790 Logs
✅ DashboardRunWithOtelTracesReturnsNoTraces Recording #78218908790 Logs
✅ DashboardRunWithOtelTracesReturnsNoTraces_DevLocalhost Recording #78218908790 Logs
✅ DeployK8sBasicApiService Recording #78218908513 Logs
✅ DeployK8sWithExternalHelmChart Recording #78218908644 Logs
✅ DeployK8sWithGarnet Recording #78218908408 Logs
✅ DeployK8sWithMongoDB Recording #78218908774 Logs
✅ DeployK8sWithMySql Recording #78218908334 Logs
✅ DeployK8sWithPostgres Recording #78218908680 Logs
✅ DeployK8sWithRabbitMQ Recording #78218908690 Logs
✅ DeployK8sWithRedis Recording #78218908713 Logs
✅ DeployK8sWithSqlServer Recording #78218908324 Logs
✅ DeployK8sWithValkey Recording #78218908716 Logs
✅ DeployTypeScriptAppToKubernetes Recording #78218908763 Logs
✅ DescribeCommandResolvesReplicaNames Recording #78218908427 Logs
✅ DescribeCommandShowsRunningResources Recording #78218908427 Logs
✅ DetachFormatJsonProducesValidJson Recording #78218908570 Logs
✅ DetachFormatJsonProducesValidJsonWhenRestartingExistingInstance Recording #78218908570 Logs
✅ DoPublishAndDeployListStepsWork Recording #78218908476 Logs
✅ DocsCommand_RendersInteractiveMarkdownFromLocalSource Recording #78218908544 Logs
✅ DoctorCommand_DetectsDeprecatedAgentConfig Recording #78218908738 Logs
✅ DoctorCommand_TypeScriptAppHostReportsMissingConfiguredToolchain Recording #78218908260 Logs
✅ DoctorCommand_WithSslCertDir_ShowsTrusted Recording #78218908260 Logs
✅ DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted Recording #78218908260 Logs
✅ GatewayWithoutExternalEndpoint_FailsPublishWithGuidance Recording #78218908701 Logs
✅ GeneratedAspireDevScript_StartsWatchMode_WithConfiguredToolchain Recording #78218908757 Logs
✅ GlobalMigration_HandlesCommentsAndTrailingCommas Recording #78218908746 Logs
✅ GlobalMigration_HandlesMalformedLegacyJson Recording #78218908746 Logs
✅ GlobalMigration_PreservesAllValueTypes Recording #78218908746 Logs
✅ GlobalMigration_SkipsWhenNewConfigExists Recording #78218908746 Logs
✅ GlobalSettings_MigratedFromLegacyFormat Recording #78218908746 Logs
✅ IngressWithoutExternalEndpoint_FailsPublishWithGuidance Recording #78218908701 Logs
✅ InitTypeScriptAppHost_AugmentsExistingViteRepoInWorkspaceSubdirectory Recording #78218908757 Logs
✅ InteractiveCSharpInitCreatesExpectedFiles Recording #78218908559 Logs
✅ InvalidAppHostPathWithComments_IsHealedOnRun Recording #78218908327 Logs
✅ JavaScriptHostingApisRunFromTypeScriptAppHost Recording #78218908480 Logs
✅ LatestCliCanStartStableChannelAppHost Recording #78218908447 Logs
✅ LatestCliCanStartStableChannelTypeScriptAppHost Recording #78218908447 Logs
✅ LegacySettingsMigration_AdjustsRelativeAppHostPath Recording #78218908402 Logs
✅ LogsCommandShowsResourceLogs Recording #78218908415 Logs
✅ OtelLogsReturnsStructuredLogsFromStarterApp Recording #78218908755 Logs
✅ OtelLogsReturnsStructuredLogsFromStarterAppIsolated Recording #78218908755 Logs
✅ PsCommandListsRunningAppHost Recording #78218908521 Logs
✅ PsFormatJsonOutputsOnlyJsonToStdout Recording #78218908521 Logs
✅ PublishJavaScriptPatternsGeneratesExpectedDockerComposeArtifacts Recording #78218908711 Logs
✅ PublishWithConfigureEnvFileUpdatesEnvOutput Recording #78218908711 Logs
✅ PublishWithDockerComposeServiceCallbackSucceeds Recording #78218908711 Logs
✅ PublishWithoutOutputPathUsesAppHostDirectoryDefault Recording #78218908711 Logs
✅ ResourceCommand_FailedExecution_DisplaysAppHostLogPathAndLogContainsEntries Recording #78218908751 Logs
✅ ResourceCommand_SetAndDeleteParameterUpdatesDescribeOutput Recording #78218908751 Logs
✅ RestoreGeneratesSdkFiles Recording #78218908256 Logs
✅ RestoreGeneratesSdkFiles_WithConfiguredToolchain Recording #78218908715 Logs
✅ RestoreRefreshesGeneratedSdkAfterAddingIntegration Recording #78218908715 Logs
✅ RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes Recording #78218908747 Logs
✅ RunFromParentDirectory_UsesExistingConfigNearAppHost Recording #78218908373 Logs
✅ RunReportsSyntaxErrorsForDotNetAppHost Recording #78218908494 Logs
✅ RunReportsSyntaxErrorsForTypeScriptAppHost Recording #78218908494 Logs
✅ SecretCrudOnDotNetAppHost Recording #78218908764 Logs
✅ SecretCrudOnTypeScriptAppHost Recording #78218908478 Logs
✅ StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels Recording #78218908742 Logs
✅ StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets Recording #78218908312 Logs
✅ StartReportsSyntaxErrorsForDotNetAppHost Recording #78218908494 Logs
✅ StartReportsSyntaxErrorsForTypeScriptAppHost Recording #78218908494 Logs
✅ StopAllAppHostsFromAppHostDirectory Recording #78218908374 Logs
✅ StopJavaPolyglotAppHostUsingApphostDirectory Recording #78218908357 Logs
✅ StopNonInteractiveSingleAppHost Recording #78218908374 Logs
✅ StopTypeScriptPolyglotAppHostUsingApphostDirectory Recording #78218908745 Logs
✅ StopWithNoRunningAppHostExitsSuccessfully Recording #78218908508 Logs
✅ UnAwaitedChainsCompileWithAutoResolvePromises Recording #78218908715 Logs
❔ UpdateProjectChannelToStable_CSharpEmptyAppHost_PreservesAspireConfigChannel Recording #78218908709 Logs
✅ UpdateProjectChannelToStable_CSharpSingleFileInit_PreservesAspireConfigChannel Recording #78218908709 Logs
✅ UpdateProjectChannelToStable_TypeScriptSingleFileInit_PreservesAspireConfigChannel Recording #78218908709 Logs
✅ UpdateProjectChannelToStable_TypeScript_PreviewsStablePackagesAndPreservesChannel Recording #78218908709 Logs

📹 Recordings uploaded automatically from CI run #26552542309

aspire-repo-bot Bot added a commit to microsoft/aspire.dev that referenced this pull request May 28, 2026
aspire cache clear now also removes staging channel NuGet package
caches stored under <ASPIRE_HOME>/.nugetpackages/. These per-build
caches are keyed by the staging feed URL hash and can become wedged,
causing assembly loading failures. Running aspire cache clear is now
the supported recovery path.

Documents changes from microsoft/aspire#17573.

Co-authored-by: Copilot <[email protected]>
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #1108

Generated by PR Documentation Check

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 Documentation has been drafted in microsoft/aspire.dev#1108 targeting release/13.4.

Updated src/frontend/src/content/docs/reference/cli/commands/aspire-cache-clear.mdx to document that aspire cache clear now also clears staging NuGet package caches (per-build caches under <ASPIRE_HOME>/.nugetpackages/). Added a staging-specific bullet to "When to clear cache" explaining that the command is the recovery path for wedged staging restores — the key user-facing change from #17573 (CacheCommand.cs modification, signal: cli_command_file_changed).

Note

This draft PR needs human review before merging.

@sebastienros

Copy link
Copy Markdown
Contributor

David Negstad (@danegsta) copilot flagged some problems, not sure you have seen these

@danegsta

Copy link
Copy Markdown
Member Author

David Negstad (@danegsta) copilot flagged some problems, not sure you have seen these

I think only the first one is worth considering a follow-up PR to better align with your original fix. The second comment is something we can fix when we backport to main as this particular failure mode only happens with staging builds.

Mitch Denny (mitchdenny) pushed a commit that referenced this pull request May 28, 2026
…Folder path (#17573)

* Stabilize PrebuiltAppHostServer staging globalPackagesFolder path

PackagingService creates the staging channel with
ConfigureGlobalPackagesFolder=true so each darc/override feed restore
lands in an isolated cache (two staging builds of the same release
branch ship as 13.4.0 but from different feeds, and NuGet keys by
(id,version) only). PrebuiltAppHostServer was wiring that flag into a
TemporaryNuGetConfig whose default globalPackagesFolder value is the
relative '.nugetpackages' -- NuGet resolved it under the temp config's
own directory, BundleNuGetService baked those temp paths into
integration-package-probe-manifest.json, and TemporaryNuGetConfig.Dispose
then recursively deleted the cache out from under the manifest. On macOS
osx-arm64 polyglot staging builds this surfaced as a hang during DI /
assembly loading in aspire-managed.

Preserve the per-feed cache isolation behavior and anchor the override
at a stable absolute path instead:

  <ASPIRE_HOME>/.nugetpackages/<first-8-of-CLI-commit-sha>

Keying by the truncated commit hash matches the existing
darc-pub-microsoft-aspire-<hash> feed URL convention in
PackagingService.GetStagingFeedUrl, so the cache key and feed key stay
aligned at 8 hex chars. 8 chars is short enough to avoid Windows
MAX_PATH blow-ups on deep integration cache trees while keeping SHA
collisions negligible. The cache lives under ASPIRE_HOME (not the
per-AppHost working directory) so multiple AppHosts on the same machine
running against the same staging build can share a single restore --
the unit of isolation here is the staging build, not the individual
restore command.

Mechanics:
- TemporaryNuGetConfig.CreateAsync now accepts an optional
  globalPackagesFolderValue and propagates it through
  AddGlobalPackagesFolderToConfigAsync into the merger.
- NuGetConfigMerger.AddGlobalPackagesFolderConfiguration takes the
  optional override and falls back to the workspace-relative default
  ('.nugetpackages') for the non-temp workspace-merge path.
- PrebuiltAppHostServer.ResolveStableGlobalPackagesFolder routes both
  temp config branches (channel and package-source-override) through
  the new helper.
- VersionHelper.TryGetCurrentCommitHashShort surfaces the truncated
  SHA from the running CLI's AssemblyInformationalVersion (returns
  null on clean release builds with no '+sha' suffix; callers fall
  back to 'default').
- CliPathHelper centralizes the '<ASPIRE_HOME>/.nugetpackages' path so
  the producer (PrebuiltAppHostServer) and consumer (CacheCommand)
  can't drift.
- CacheCommand.ClearCommand now wipes <ASPIRE_HOME>/.nugetpackages so
  a wedged staging restore is recoverable through the same UX as every
  other CLI cache.

Tests:
- Updated existing PrebuiltAppHostServerTests staging cases to assert
  the globalPackagesFolder value is absolute and lives outside the
  temp config directory.
- New PrebuiltAppHostServerTests case wires a real PackagingService
  with overrideStagingFeed on a stable-shaped CLI and pins the same
  invariant end-to-end.
- New TemporaryNuGetConfigTests for the override propagation and for
  the no-override-when-disabled invariant.
- New CacheCommandTests covering the staging cache wipe and the
  missing-cache no-op path.

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

* Key staging globalPackagesFolder cache by feed URL hash

The staging globalPackagesFolder fix in the previous commit keyed the
\`.nugetpackages\` subdirectory off the CLI's own commit SHA (first 8
hex chars of \`AssemblyInformationalVersionAttribute\`). That handles
two darc-shipped staging builds of the same release branch, but it
breaks the local-dev case where one CLI is repeatedly retargeted at
different \`overrideStagingFeed\` values: the URL changes but the SHA
doesn't, so every override silently shares one cache bucket and the
second restore reuses the first feed's now-stale \`13.4.0\` assemblies.

Switch the cache key to the first 8 hex chars of \`XxHash3\` over the
trimmed, lower-cased resolved feed URL:

- Override branch passes the explicit \`--source\` URL.
- Channel branch passes the channel's \`Aspire*\` mapping source (or
  the first mapping for forward compatibility).

Trim + lower-case before hashing so a stray whitespace from a config
file or a hostname-case change doesn't fragment the cache.
Non-cryptographic hashing is fine here — the key is a directory name,
not a security boundary — and 8 hex chars keep deep integration cache
paths well under Windows MAX_PATH while giving ~4 billion buckets, so
collisions are negligible across the handful of staging feeds any user
ever sees.

Removes the now-unused \`VersionHelper.TryGetCurrentCommitHashShort\`
helper (added in the previous commit, no remaining callers).

Tests:
- New \`CliPathHelperTests.ComputeStagingFeedCacheKey_*\` cover
  determinism, normalization, length defaults, and null/empty input.
- Existing \`PrebuiltAppHostServerTests\` strengthened to assert the
  emitted globalPackagesFolder equals \`<aspireHome>/.nugetpackages/<hash(feed)>\`.

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

* Narrow #17564 CLI-pin fallback to prerelease channels

PR #17564 introduced a new fallback in TryGetCurrentCliTemplateVersionPackage
that pins the template package to the running CLI's SDK version whenever the
selected channel is explicit and not local-build. That preserved the intended
fix for prerelease channels (daily, staging) where the channel feed filters
the running CLI's package out of search results even though the feed can
still restore it.

But it also fired for the stable channel, where the filter does not apply.
For a non-stable-shape CLI (PR build like '13.4.0-pr.X.gY' or a daily-shape
preview) invoked with '--channel stable', it forced an unpublishable version
into the generated apphost.cs, breaking the SmokeTests
LatestCliCanStartStableChannelAppHost and
LatestCliCanStartStableChannelTypeScriptAppHost.

Exclude the stable channel from the new fallback so that case falls through
to the OrderByDescending picker and the user gets the highest shipped stable
package they explicitly asked for. The original prerelease-channel motivation
('Aspire.TypeSystem version mismatch when 13.4 CLI floats templates to a
13.5 daily preview') is preserved unchanged.

Test updates:
 - NewCommandChannelResolutionTests.NewCommand_NoChannelArg_ResolvesTemplateFromIdentityChannel
   gets an expectedVersion theory parameter so the daily case still pins to
   the CLI version while the stable case asserts the highest shipped stable.
 - NewCommandChannelResolutionTests.NewCommand_ExplicitChannelArg_OverridesIdentityChannel
   asserts highest shipped stable (matching the SmokeTest contract).
 - New NewCommand_ExplicitStableChannel_NonStableCliVersion_FallsBackToHighestShippedStable
   regression test covers both daily-shape and PR-shape CLI identities.
 - NewCommandTests.NewCommandWithTypeScriptEmptyTemplatePassesResolvedVersionAndChannelToScaffolding
   reverts to its pre-#17564 assertion of '9.2.0' from the stable feed.

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

---------

Co-authored-by: Copilot <[email protected]>
Mitch Denny (mitchdenny) added a commit that referenced this pull request May 28, 2026
The cherry-picks of #17564 and #17573 alone do not address the
`aspire new` + C# Blazor scenario from #17596 because that path
runs through `TemplateNuGetConfigService.ResolveTemplatePackageAsync`
(DotNet templates), not `NewCommand.ResolveCliTemplateVersionAsync`
(CLI-runtime templates) where #17564's `TryGetCurrentCliTemplateVersionPackage`
synthesis lives.

Teach `ResolveTemplatePackageAsync` to mirror the identity-channel
preference that `ResolveCliTemplateVersionAsync` (NewCommand.cs:376-389)
already does for CLI templates: when no `--channel` is supplied and no
PR hives exist, prefer the channel whose name matches the running CLI's
`CliExecutionContext.IdentityChannel` before falling back to Implicit.

Without this, a daily 13.5 CLI on a clean `~/.aspire` silently restricts
the template search to nuget.org and returns the shipped stable
`Aspire.ProjectTemplates 13.3.5` instead of the matching
`13.5.0-preview.1.*` daily prerelease from the `dotnet9` feed.

The Implicit fallback preserves prior behavior when the identity channel
isn't a registered channel (e.g. a "local" CLI without a corresponding
local-build hive).

See #17596 for full repro.

Co-authored-by: Copilot <[email protected]>
Mitch Denny (mitchdenny) added a commit that referenced this pull request Jun 1, 2026
A shipped (identity=stable) CLI running 'aspire new' was writing
aspire.config.json#channel = "stable", which routed subsequent
'aspire add' calls through the Stable PackageChannel
(PackageChannelQuality.Stable, * -> nuget.org). That filter hides
prerelease packages on nuget.org, so a community 13.4.0-preview
integration the team hadn't yet shipped as stable became invisible
after scaffolding — for both the TypeScript polyglot starter (cell 7)
and the C# aspire-starter family (cell 8).

'aspire init' already avoided the trap via
PackageChannel.ShouldPersistChannelName (Type == Explicit AND name !=
"stable"). 'aspire new' had two persistence sites that only checked
Type == Explicit:
  * ResolveCliTemplateVersionAsync (CLI-runtime polyglot path)
  * ResolveIdentityChannelNameAsync (DotNet-runtime path consumed by
    DotNetTemplateFactory)

Both now use ShouldPersistChannelName, matching aspire init. Explicit
'--channel stable' still wins via the channel-arg leg of the resolution
coalesce — only the identity-fallback case is changed.

Two pre-existing InlineData rows in NewCommandChannelResolutionTests
codified the buggy behavior (one in #17573 alongside daily stabilization
work, one in #17637 alongside the DotNet-runtime forwarding fix); both
were rolled in defensively rather than as a deliberate stable-pin
invariant. Removed and replaced with two dedicated negative tests
(_DoesNotPersistStablePin_Cli / _DoesNotPersistStablePin_DotNet) that
were red before the production fix.

Co-authored-by: Copilot <[email protected]>
pull Bot pushed a commit to tooniez/aspire that referenced this pull request Jun 2, 2026
Brings 43 release-branch commits forward onto main now that 13.4.0 has shipped.
This PR replaces the original automated merge (microsoft#17804) which had to be closed so
that conflict resolution and post-merge cleanups could be made on a non-protected
branch.

Conflict resolution summary (33 files):

* Equivalent backports (took main's commit identity): ChannelUpdateWorkflowTests,
  LoggingHelpersTests, the four extension test files, AspireEditorCommandProvider,
  appHostDiscovery.

* Release-only forwards (preserved): microsoft#17732 / microsoft#17756 Foundry hosted-agent protocol
  selection and cross-compute-environment endpoint references, microsoft#17573 stabilize
  PrebuiltAppHostServer staging globalPackagesFolder path, microsoft#17743 staging-identity
  CLI darc feed routing.

* Main-only forwards (preserved): microsoft#17506 Show discovered AppHosts in Aspire pane,
  microsoft#17547 Localize Aspire skills metadata errors, microsoft#17801 VS Code v1.12.0, microsoft#17297
  Aspire CLI npm package release integration, microsoft#17576 TerminalRun IAsyncDisposable,
  microsoft#17721 / microsoft#17723 VS Code telemetry, microsoft#17671 ATS baseline fix (re-applied manually
  on top of Foundry source taken from release).

* Hybrid (manually spliced): docs/contributing.md - kept main's restructured
  layout and inserted release's staging-validation paragraph; HostedAgentBuilder-
  Extension - took release base then re-applied microsoft#17671 asHostedAgent rename;
  UpdateCommandTests - took main and injected microsoft#17743's
  OverrideCliInformationalVersionConfigKey block.

Post-merge cleanups included in this PR:

* eng/Versions.props: revert StabilizePackageVersion to false (was flipped to
  true on release/13.4 by microsoft#17520 for shipping 13.4.0; main must stay in preview
  mode).

* .github/workflows/generate-api-diffs.yml: retarget back to main (was pointed
  at release/13.4 by microsoft#17696 release prep).

* .github/workflows/backmerge-release.yml: update from release/13.3 to
  release/13.4 (was stale - missed the 13.4 release-time bump).

* .github/workflows/milestone-assignment.yml: audited - already correct
  (main -> 13.5, release/13.4 -> 13.4.x); no change.

This merge commit must be preserved - do not squash on merge.

Co-authored-by: Copilot <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants