Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0aefab6
Keep system proxy registered across hot-reload restarts
waldekmastykarz Nov 21, 2026
e9d879d
Only skip re-enabling the system proxy after a confirmed apply
waldekmastykarz Nov 21, 2026
40f5ebe
Merge branch 'main' into keep-system-proxy-across-reloads
waldekmastykarz Nov 24, 2026
a41063d
Merge branch 'main' into keep-system-proxy-across-reloads
waldekmastykarz Nov 25, 2026
abec57b
Merge branch 'main' into keep-system-proxy-across-reloads
waldekmastykarz Nov 26, 2026
7265319
Keep startup HTTP requests off the retained system proxy
waldekmastykarz Nov 26, 2026
61d1d02
Normalize endpoints when matching the retained system proxy
waldekmastykarz Nov 26, 2026
64fb970
Document known system proxy limitations during hot reload
waldekmastykarz Nov 26, 2026
0a64eb8
Merge branch 'main' into keep-system-proxy-across-reloads
waldekmastykarz Nov 26, 2026
f6c87ea
Keep bypassing previous proxy endpoint after a failed port change
waldekmastykarz Nov 26, 2026
7024f01
Merge branch 'main' into keep-system-proxy-across-reloads
waldekmastykarz Nov 26, 2026
99dc65a
Merge branch 'main' into keep-system-proxy-across-reloads
waldekmastykarz Nov 27, 2026
7a483bc
Bypass retained system proxy for language model HTTP client
waldekmastykarz Nov 27, 2026
1746071
Merge branch 'main' into keep-system-proxy-across-reloads
waldekmastykarz Dec 2, 2026
67f093b
Keep system proxy cleanup ownership until removal succeeds
waldekmastykarz Dec 2, 2026
104351a
Keep the system proxy record when a stopped instance couldn't remove it
waldekmastykarz Dec 2, 2026
c04689e
Merge dotnet/dev-proxy main into keep-system-proxy-across-reloads
waldekmastykarz Dec 2, 2026
9b731a8
Match the kept system proxy record by process identity
waldekmastykarz Dec 2, 2026
10a98bb
Merge dotnet/dev-proxy main into keep-system-proxy-across-reloads
waldekmastykarz Dec 2, 2026
f6f87dc
Re-register after takeover on reload; bypass kept proxy during shutdown
waldekmastykarz Dec 2, 2026
6ac1a8f
Don't take the system proxy back from another instance on reload
waldekmastykarz Dec 2, 2026
59df68a
Merge dotnet/dev-proxy main into keep-system-proxy-across-reloads
waldekmastykarz Dec 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,23 @@ public static ILanguageModelClient Create(IServiceProvider serviceProvider, ICon
// Redirects are disabled so that credentials (eg. the api-key header,
// which HttpClient doesn't strip on redirect) aren't forwarded to
// another origin
public static HttpClient CreateHttpClient() =>
public static HttpClient CreateHttpClient() => CreateHttpClient(null);

// proxy overrides the default (system) proxy; null keeps the default
public static HttpClient CreateHttpClient(System.Net.IWebProxy? proxy)
{
#pragma warning disable CA2000 // The handler is owned by the long-lived HttpClient
new(new SocketsHttpHandler
var handler = new SocketsHttpHandler
{
AllowAutoRedirect = false,
PooledConnectionLifetime = TimeSpan.FromMinutes(5)
}, disposeHandler: true);
};
#pragma warning restore CA2000
if (proxy is not null)
{
handler.Proxy = proxy;
}

return new(handler, disposeHandler: true);
}
}
15 changes: 15 additions & 0 deletions DevProxy.Tests/StopCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ public async Task Stop_JsonOutput_NoInstanceWithPid_EmitsStructuredResult()
Assert.Equal($"No running Dev Proxy instance with PID {UnusedPid}.", json.RootElement.GetProperty("message").GetString());
}

[Fact]
public void FindKeptSystemProxyRecord_MatchesOnlyTheStoppedProcess()
{
var processStartTime = DateTimeOffset.UtcNow.AddMinutes(-10);
var stopped = new ProxyInstanceState { Pid = 100, AsSystemProxy = true, ProcessStartTime = processStartTime, StartedAt = processStartTime };
// A config reload restarts the host in the same process, so only StartedAt changes.
var keptAfterReload = new ProxyInstanceState { Pid = 100, AsSystemProxy = true, ProcessStartTime = processStartTime, StartedAt = processStartTime.AddMinutes(5) };
var otherInstance = new ProxyInstanceState { Pid = 200, AsSystemProxy = true, ProcessStartTime = processStartTime, StartedAt = processStartTime };
var reusedPid = new ProxyInstanceState { Pid = 100, AsSystemProxy = true, ProcessStartTime = processStartTime.AddMinutes(5), StartedAt = processStartTime };

Assert.Same(keptAfterReload, StopCommand.FindKeptSystemProxyRecord([otherInstance, keptAfterReload], stopped));
Assert.Null(StopCommand.FindKeptSystemProxyRecord([otherInstance, reusedPid], stopped));
Assert.Null(StopCommand.FindKeptSystemProxyRecord([], stopped));
}

internal static RootCommand CreateRootCommand(Command command) =>
[
new Option<OutputFormat?>(DevProxyCommand.OutputOptionName) { Recursive = true },
Expand Down
Loading
Loading