Repository navigation
Add configurable dev tunnel idle expiration - #19987
Damian Edwards (DamianEdwards) merged 5 commits into
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19987Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19987" |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The TypeScript example uses the wrong tunnel-reference API, and the new polyglot export lacks generated-SDK coverage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
src/Aspire.Hosting.DevTunnels/DevTunnelResourceBuilderExtensions.cs — The new exported API is only invoked directly from C#, so the generated polyglot method name and… |
|
src/Aspire.Hosting.DevTunnels/README.md — This TypeScript call does not expose the referenced resource through the tunnel. The generated Dev… |
What changed in this PR
Adds configurable idle expiration to the run-only Dev Tunnels integration while preserving service defaults when unset.
Changes:
- Adds validated
Expirationoptions and fluent API. - Passes expiration to create and update CLI commands.
- Adds documentation, argument tests, and snapshots.
| File | Description |
|---|---|
src/Aspire.Hosting.DevTunnels/DevTunnelCli.cs |
Emits CLI expiration arguments. |
src/Aspire.Hosting.DevTunnels/DevTunnelOptions.cs |
Adds validated expiration configuration. |
src/Aspire.Hosting.DevTunnels/DevTunnelResourceBuilderExtensions.cs |
Adds exported fluent API. |
src/Aspire.Hosting.DevTunnels/README.md |
Documents C# and TypeScript usage. |
tests/Aspire.Hosting.DevTunnels.Tests/Aspire.Hosting.DevTunnels.Tests.csproj |
Enables shared Verify initialization. |
tests/Aspire.Hosting.DevTunnels.Tests/DevTunnelExpirationTests.cs |
Tests expiration behavior. |
tests/Aspire.Hosting.DevTunnels.Tests/TestDevTunnelCli.cs |
Captures CLI arguments and reset calls. |
tests/Aspire.Hosting.DevTunnels.Tests/Snapshots/DevTunnelExpirationTests.ToLoggerString_IncludesExpiration.verified.txt |
Verifies logging output. |
tests/Aspire.Hosting.DevTunnels.Tests/Snapshots/DevTunnelExpirationTests.CreateTunnelAsync_WhenTunnelExists_PassesExpirationToUpdate_hours=null.verified.txt |
Verifies reuse without expiration. |
tests/Aspire.Hosting.DevTunnels.Tests/Snapshots/DevTunnelExpirationTests.CreateTunnelAsync_WhenTunnelExists_PassesExpirationToUpdate_hours=24.verified.txt |
Verifies reuse with expiration. |
tests/Aspire.Hosting.DevTunnels.Tests/Snapshots/DevTunnelExpirationTests.CreateAndUpdate_WithNullOptions_OmitExpiration.verified.txt |
Verifies null-option omission. |
tests/Aspire.Hosting.DevTunnels.Tests/Snapshots/DevTunnelExpirationTests.CreateAndUpdate_PassExpirationInHours_hours=null.verified.txt |
Verifies unset expiration. |
tests/Aspire.Hosting.DevTunnels.Tests/Snapshots/DevTunnelExpirationTests.CreateAndUpdate_PassExpirationInHours_hours=1.verified.txt |
Verifies minimum expiration. |
tests/Aspire.Hosting.DevTunnels.Tests/Snapshots/DevTunnelExpirationTests.CreateAndUpdate_PassExpirationInHours_hours=24.verified.txt |
Verifies day-length expiration. |
tests/Aspire.Hosting.DevTunnels.Tests/Snapshots/DevTunnelExpirationTests.CreateAndUpdate_PassExpirationInHours_hours=25.verified.txt |
Verifies non-day whole hours. |
tests/Aspire.Hosting.DevTunnels.Tests/Snapshots/DevTunnelExpirationTests.CreateAndUpdate_PassExpirationInHours_hours=720.verified.txt |
Verifies maximum expiration. |
tests/Aspire.Hosting.DevTunnels.Tests/Snapshots/DevTunnelExpirationTests.CreateAndUpdate_FormatExpirationInvariantly.verified.txt |
Verifies invariant formatting. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Regarding the dogfood instructions: no code change is needed for this informational comment; this fix uses focused local regression coverage without live tunnel operations. Regarding the CI retry notice: no code change is needed for the retry notification itself. Required checks passed on the previous head; the polyglot review fixes are now pushed for a fresh CI run. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation matches the documented CLI contract and includes focused boundary, reuse, omission, formatting, and polyglot coverage.
Review tier: Balanced
Findings: None
Issues resolved since last review (2)
| Severity | Finding |
|---|---|
src/Aspire.Hosting.DevTunnels/README.md — This TypeScript call does not expose the referenced resource through the tunnel. The generated Dev… View resolved comment |
|
src/Aspire.Hosting.DevTunnels/DevTunnelResourceBuilderExtensions.cs — The new exported API is only invoked directly from C#, so the generated polyglot method name and… View resolved comment |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The integer-hours fluent API conflicts with the promised TimeSpan contract and example.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/Aspire.Hosting.DevTunnels/DevTunnelResourceBuilderExtensions.cs — The PR description and its C# example promise WithExpiration(TimeSpan), but this public API… |
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation matches the documented CLI contract and includes comprehensive boundary, reuse, omission, culture, and polyglot coverage.
Review tier: Balanced
Findings: None
Issues resolved since last review (1)
| Severity | Finding |
|---|---|
src/Aspire.Hosting.DevTunnels/DevTunnelResourceBuilderExtensions.cs — The PR description and its C# example promise WithExpiration(TimeSpan), but this public API… View resolved comment |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Damian Edwards <[email protected]>
9c2af96
into
microsoft:main
|
The CI build failed due to test failure(s) that appear unrelated to the PR changes. These may be flaky tests. Suspected flaky test(s): Suggested actions:
You can re-run the failed jobs from the workflow run page. |


Description
Expose the devtunnel CLI's idle expiration setting without changing the default expiration policy.
DevTunnelOptions.ExpirationHoursand an exportedWithExpiration(int expirationHours)fluent method for C# and polyglot AppHosts.--expirationto bothcreateandupdate, so existing tunnels reused by an AppHost receive the configured period too.This is idle expiration, not a maximum hosting duration or an access-token lifetime. The devtunnel CLI reference documents the create/update option and supported range.
In Aspire with agents creating more and more work trees for inner-loop testing, I've found it very easy to hit the 10-tunnel limit for devspaces within 30 days. By exposing an optional and explicit expiration value that devtunnels support, setting that to something short is helpful at keeping things under 10 without trying to delete tunnels explicitly.
Testing
All 71 tests in
Aspire.Hosting.DevTunnels.Testspass. Coverage includes default omission, create and update arguments, reuse after a create conflict, supported boundaries, invalid option values, culture-invariant formatting, and the fluent configuration method. CLI calls are captured by the shared test fake; no live tunnel operations are required.Generated C# and ATS API release baselines are unchanged per repository policy.