diff --git a/CHANGELOG.md b/CHANGELOG.md index c78c675..a8ef337 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed + +- Windows no longer pops up "git-remote-https.exe – 0xc0000142" every few refreshes. Codex + starts a `git ls-remote` for its plugin marketplace when the app server comes up, and the tray + killed the whole process tree the moment the limits arrived — often while that git was still + initialising. The tray now closes the server's stdin and waits up to ten seconds for it to + exit on its own; it only kills a server that lingers. + ## [0.3.2] - 2026-08-19 A patch release for two things one screenshot showed at once: a rate limit the tray had been diff --git a/src/RateTray/Providers/CodexUsageProvider.cs b/src/RateTray/Providers/CodexUsageProvider.cs index fe1c0e0..ed1f20c 100644 --- a/src/RateTray/Providers/CodexUsageProvider.cs +++ b/src/RateTray/Providers/CodexUsageProvider.cs @@ -134,7 +134,7 @@ await process.StandardInput.WriteLineAsync( } finally { - TryKill(process); + await StopAsync(process).ConfigureAwait(false); } var diagnostics = await SafeAwait(stderr).ConfigureAwait(false); @@ -308,6 +308,22 @@ private static void AddWindows(List readings, JsonObject bucket, s return candidates.FirstOrDefault(File.Exists); } + /// + /// Closes stdin so the server exits on its own, and kills only if it lingers. An + /// immediate tree kill hits the git ls-remote codex spawns at startup for its + /// plugin marketplace mid-initialisation, and Windows answers with a 0xc0000142 popup. + /// + private static async Task StopAsync(Process process) + { + try { process.StandardInput.Close(); } + catch (Exception ex) when (ex is IOException or ObjectDisposedException) { } + + try { await process.WaitForExitAsync().WaitAsync(TimeSpan.FromSeconds(10)).ConfigureAwait(false); } + catch (TimeoutException) { } + + TryKill(process); + } + private static void TryKill(Process process) { try diff --git a/tests/RateTray.E2E/RateTray.E2E.csproj b/tests/RateTray.E2E/RateTray.E2E.csproj index 4edeb4f..dd40849 100644 --- a/tests/RateTray.E2E/RateTray.E2E.csproj +++ b/tests/RateTray.E2E/RateTray.E2E.csproj @@ -13,7 +13,7 @@ - + diff --git a/tests/RateTray.Tests/RateTray.Tests.csproj b/tests/RateTray.Tests/RateTray.Tests.csproj index 7221d55..85511a6 100644 --- a/tests/RateTray.Tests/RateTray.Tests.csproj +++ b/tests/RateTray.Tests/RateTray.Tests.csproj @@ -10,8 +10,8 @@ - - + +