fix: address the first agent review of PR #2
agent-review agent review: pass

Blocking findings:
1. A Codex RPC error or early exit threw past LimitProbe and stopped the
   refresh loop, so Claude stopped updating too (D2). Every probe failure
   is now a failed probe result, the loop records an unexpected tick
   failure and keeps ticking, shutdown cancellation still propagates,
   the app reports failed operations, and the CLI exits 1 instead of
   crashing. Fake app-server modes in the GUI process host test errors,
   EOF and garbage.
2. Totals converted local midnight directly and threw where midnight
   does not exist (Cairo, Santiago, Beirut). Today and the week start
   through CalendarDays now.
3. Daily chart labels used UTC dates for local-day buckets; labels and
   tooltips now share the local date.

Review notes fixed as well: Claude Code installed with npm on Windows is
found through its native binary or cli.js; the plugin ends cleanly on a
bad host frame; Linux autostart honours XDG_CONFIG_HOME; the unused stub
installer and the worker names in docs are gone.

Refs #1
This commit is contained in:
Florian Schmidt
2026-10-14 21:50:09 +02:00
parent 9f33dd8896
commit fd30dfcea4
23 changed files with 296 additions and 32 deletions
+2
View File
@@ -4,3 +4,5 @@ handles, then runs Core's ProcessRunner. Child modes check handles and synthetic
live Claude mode keeps provider output in memory and writes only diagnostic metadata.
No provider text or real transcript fixtures belong here. JSON uses source generation.
Built with Core tests; run `dotnet test --project tests/FinalToken.Core.Tests -c Release`.
Portable `--rpc-*` modes provide synthetic app-server exchanges, errors, EOF and malformed output.
The `app-server` mode returns an RPC error for published-CLI checks; it never contacts a provider.
+28
View File
@@ -11,6 +11,8 @@ public static class Program
{
public static async Task<int> Main(string[] args)
{
if (args.FirstOrDefault() is { } mode && (mode.StartsWith("--rpc-", StringComparison.Ordinal) || mode == "app-server"))
return await RpcAsync(mode == "app-server" ? "--rpc-error" : mode);
if (!OperatingSystem.IsWindows()) return 0;
if (args is ["--handles"])
return new[] { -10, -11, -12 }.All(id => Native.GetFileType(Native.GetStdHandle(id)) != 0) ? 0 : 17;
@@ -42,6 +44,32 @@ public static class Program
await AtomicFile.WriteAsync(args[1], JsonSerializer.Serialize(report, ProbeJsonContext.Default.ProbeReport));
return live ? report.WindowCount > 0 ? 0 : 18 : utf8 ? report.Utf8Matched ? 0 : 19 : result.ExitCode;
}
private static async Task<int> RpcAsync(string mode)
{
Console.InputEncoding = System.Text.Encoding.UTF8;
Console.OutputEncoding = new System.Text.UTF8Encoding(false);
if (mode == "--rpc-eof") return 0;
var initialize = await Console.In.ReadLineAsync();
using var first = JsonDocument.Parse(initialize ?? "null");
if (first.RootElement.GetProperty("method").GetString() != "initialize") return 20;
if (mode == "--rpc-init-error") { await Console.Out.WriteLineAsync("{\"id\":1,\"error\":{\"code\":-1,\"message\":\"synthetic error\"}}"); return 0; }
await Console.Out.WriteLineAsync("{\"id\":1,\"result\":{}}");
using var initialized = JsonDocument.Parse(await Console.In.ReadLineAsync() ?? "null");
using var request = JsonDocument.Parse(await Console.In.ReadLineAsync() ?? "null");
if (initialized.RootElement.GetProperty("method").GetString() != "initialized" ||
request.RootElement.GetProperty("method").GetString() != "account/rateLimits/read") return 21;
await Console.Out.WriteLineAsync("{\"method\":\"syntheticNotification\"}");
var response = mode switch
{
"--rpc-error" => "{\"id\":2,\"error\":{\"code\":-1,\"message\":\"synthetic error\"}}",
"--rpc-garbage" => "not JSON",
"--rpc-shape" => "[]",
"--rpc-bound" => new string('x', 1024 * 1024 + 1),
_ => "{\"id\":2,\"result\":{\"rateLimits\":{\"limitId\":\"codex\",\"primary\":{\"usedPercent\":24,\"windowDurationMins\":10080,\"resetsAt\":1792479531}}}}"
};
await Console.Out.WriteLineAsync(response);
return 0;
}
}
public sealed record ProbeReport