Review: PR #178 — "Keep the default Windows Ctrl-C termination while loading"
Lens: correctness (does the change work everywhere it reaches — callers, platforms, resource lifetimes, error paths, edge cases).
Key findings
- Blocking — the diff does not touch a file that exists on main. The PR edits
flare/src/main.rs. That file was removed on 2026-11-09 byfa158284("Add a native Windows desktop backed by the shared Flare library"); the CLI now lives inflare-cli/src/main.rs. Nothing in the diff can reach Windows as written. (Same point as maintainer item 1, yatesdr, 2026-11-18.) - Blocking — a verbatim port into
serve()would still not fix Windows. On main,serve()returns intoserve_local()for every single-host session (flare-cli/src/main.rs:602-604), and Windows rejects every multi-host flag (flare-cli/src/main.rs:178-186), so theServer::startinsideserve()(flare-cli/src/main.rs:630-648) is never executed on Windows. The registration has to land at CLI level or at the top ofserve_local. - Should fix — the new registration point creates a new swallow window inside
Server::start.Server::startblocks until the worker thread is ready (helios/src/server.rs:417) and that thread constructsRankExecutor/GraphExecutor(helios/src/server/runtime.rs:584,helios/src/execution/transport.rs:474-481), which runs each referenced tuning graph with a 120-second completion deadline (transport.rs:598-604). During all of that,stop_consolereturns "handled",STOPhas no reader, and the process appears frozen. This is the #113 symptom relocated, not removed. - Should fix — documentation now contradicts behaviour.
docs/windows.md:141-142promises "Ctrl-C and Ctrl-Break drain native work before releasing CUDA resources", which stops being true during download and loading after this change. - No correctness objection to the core idea. Interrupted acquisition is resumable and digest-verified with test coverage, and abrupt exit during load is already the anticipated behaviour on Unix, so terminating during download/load is safe. Details below.
The description's own validation statement — "code review only … neither compiled for nor run on Windows" — is honest, but the review is of code that no longer exists on main, and the charter asks for root-cause fixes and real evidence.
Blocking findings
B1. flare/src/main.rs (entire diff, +8/−6): the target file does not exist on main
Verified at main:
list_files */src/main.rsreturns onlyflare-cli/src/main.rsandselene-manager/src/main.rs(not opened);search_history path=flare/src/main.rsshowsfa158284(2026-11-09) as the newest commit touching it, and the orientation packet lists that commit as landed on the default branch after this PR branched (902c88e).flare/src/at main holdsapplication.rs (not opened), cache_support.rs (not opened), catalog.rs (not opened), configuration.rs (not opened), controller.rs, dashboard.rs, details.rs (not opened), download_cache.rs (not opened), environment.rs, hardware.rs (not opened), hardware_monitor.rs (not opened), http_client.rs (not opened), hub.rs, identity.rs (not opened), lib.rs (not opened), options.rs (not opened), preview.rs (not opened), recommendations.rs (not opened), runtime_settings.rs (not opened), settings.rs (not opened), trust.rs (not opened), windows.rs(not opened) — nomain.rs.
The code the PR deletes still exists verbatim in the new location:
flare-cli/src/main.rs:187-192—SetConsoleCtrlHandler(Some(stop_console), 1)immediately after the Windows multi-host rejection at178-186, i.e. still registered before download and loading.flare-cli/src/main.rs:736-745—stop_console, returning1forCTRL_C_EVENT | CTRL_BREAK_EVENTand0otherwise.
Severity: blocking. Why it matters: the change cannot be merged and, if merged, would not change any Windows behaviour. Fix: rework the hunk onto flare-cli/src/main.rs. Before spending another round, the author should also resolve B2, because the placement that is correct for the PR's base is wrong for main.
B2. flare-cli/src/main.rs:602-604: "immediately before Server::start" inside serve() is unreachable on Windows
The PR's placement is correct for the PR's own base — at the PR head, Windows single-host flows straight through serve() — but it does not transfer:
flare-cli/src/main.rs:178-186returns an error for any Windows invocation with rank, rendezvous, hosts, RoCE ring or chain.flare-cli/src/main.rs:602-604:fn serve(...)opens withif cluster.is_none() { return serve_local(owner, config, progress); }.- Because Windows always ends up with a
Nonecluster, every Windows serve goes toserve_local(flare-cli/src/main.rs:692), where the start isloaded.start()atflare-cli/src/main.rs:702, which isLoadedSession::start→Server::startathelios/src/server/session.rs:60-69. - The
Server::startinserve()(flare-cli/src/main.rs:630-648) is only ever reached on the multi-host path, which Windows cannot take.
Severity: blocking (for the port). Why it matters: porting the hunk verbatim to main's serve() at line 628 would compile, read correctly in review, and fix nothing — the exact trap that costs another review cycle. Fix: put the registration at CLI level immediately before serve(...)/serve_local(...) is called, or at the top of serve_local before LoadedSession::new (flare-cli/src/main.rs:698). It cannot be inserted directly before the inner Server::start: LoadedSession::start(self) consumes the session (helios/src/server/session.rs:50-80), so nothing can be placed between that call and the start.
Related detail worth noting for whoever ports it: serve_local has its own DrainGuard discipline at helios/src/server/session.rs:55-57, so its failure path already retains the owner rather than freeing referenced storage.
Should-fix findings
S1. flare-cli/src/main.rs:702 (after the port) — Server::start becomes an uninterruptible-looking window, not a quick exit
The description claims: "A Ctrl-C during Server::start sets STOP, so the serving loop exits at once." Setting STOP is not enough — nothing reads it until the loop at flare-cli/src/main.rs:714, which is only reached after Server::start returns. What can run inside that call:
helios/src/server.rs:417:ready_rx.recv()blocks until the model worker reports readiness.helios/src/server/runtime.rs:584-615: the worker thread buildsRankExecutor::new, the scheduler, graph durations and policy before sending readiness.helios/src/execution/transport.rs:474-481:GraphExecutor::newloops overreferenced_tuning_graphs()and callsrun_tuning_graphfor each before returning.helios/src/execution/transport.rs:598-604:run_tuning_graphspins in a 50 µs sleep loop with a 120-second deadline per graph and consults no stop flag. It is a normal, measured startup phase (report_startup,transport.rs:594-599).
So stop_console (flare-cli/src/main.rs:736-745) returns 1 ("handled") for the entire span while the user sees no progress, and a second Ctrl-C merely re-stores the same flag, so repeated presses do not get the process down either.
Severity: should fix. Why it matters: the PR exists to stop swallowing Ctrl-C, and it introduces a fresh swallow window of potentially minutes. Fix options, in increasing size: (a) register after Server::start and, on registration failure, mem::forget the owner/transport — the existing pattern already does exactly that on the undrained path (flare-cli/src/main.rs:641-647 for serve, and serve_local's session.rs:55-57 guard equivalent); (b) keep the placement and make the tuning loop / readiness wait poll a stop flag; (c) accept the window, document it, and drop the "exits at once" claim. Note that (a) is the option the description argues against; that objection is real but is already answered by the forget-on-unconfirmed-drain pattern used on the neighbouring error paths.
S2. docs/windows.md:141-142 — the documented Ctrl-C contract no longer holds
The doc states: "Ctrl-C and Ctrl-Break drain native work before releasing CUDA resources." After this change that is false during download and loading, where Ctrl-C now terminates the process immediately (correctly — see N1 — but undocumented). It is also no longer symmetric with Unix:
- Unix installs its handlers after
Server::start(flare-cli/src/main.rs:653-657inserve,705-709inserve_local), so a Ctrl-C inside UnixServer::startgets the default SIGINT disposition and kills the process mid-tuning. - Windows, after this PR, silently ignores the same window (S1).
So the description's "as on Unix before its handlers are installed" holds for download and load but not for the Server::start window, where the two platforms diverge in opposite directions. Raised as item 3 of the maintainer review.
Fix: add a sentence to docs/windows.md saying that before the server starts, Ctrl-C/Ctrl-Break ends the process rather than draining, and (if S1 is accepted rather than fixed) say what happens during server startup.
Verified non-issues (checked, deliberately not reported as findings)
The behavioural change itself — Ctrl-C terminating during download and loading — is safe:
- Interrupted downloads are resumable and verified.
flare/src/hub.rs:576-606documents that an interrupted transfer resumes from its partial file and that long responses sync the partial periodically "so a crash keeps the progress";Resume::open(hub.rs:2771-2813) verifies the resume prefix and rejects a shrunken one;check_cancel(hub.rs:120) is consulted throughout acquisition; completed blobs are digest-verified before reuse (hub.rs:1288-1309); anda_killed_acquisition_resumes_the_partial_and_reuses_completed_files(hub.rs:9125-9252) covers the "killed mid-transfer" case directly. Abrupt exit during download is already an anticipated case. - Abrupt exit during loading is safe. Process exit tears down the CUDA context; the PR's reason for keeping the handler out of that region (no
STOPreader, no drain owner yet) is sound, and Unix relies on the same property today. - No double-registration problem.
SetConsoleCtrlHandleraccepts multiple handlers, and the only other registration is in the separateheliopausebinary (heliopause/src/processes_windows.rs:38).
Nits
- Nit: on a terminal, an abrupt Ctrl-C can leave banner/cursor escape state unrestored;
stop_consoledoes nothing about it. The project's own precedent isheliopause/src/processes_windows.rs:16-27, whereexit_cliwritesb"\x1b[0m\x1b[?25h\r\n", callscrate::server::restore_terminal_for_exit()andExitProcess(130)before dying. Adding the same tostop_consolewould make the new terminate-on-Ctrl-C path visually clean.
Charter basis for the judgements
- "Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error (#397)" — S1 is a new swallow window, and B1/B2 mean the stated root cause is not actually being reached.
- "Bring real evidence" — the PR's evidence is code review only, of code that no longer exists on main, on a
#[cfg(windows)]path no test exercises.
Open questions / what could not be settled from code
- What is the porting intent — rebase onto main (and re-decide the placement given B2), or close and re-open against
flare-cli/src/main.rs? The PR has been open 23 days with the file move landing 14 days into that window. - Is S1 acceptable to the maintainers as a documented limitation, or should the tuning loop learn a stop flag? Nothing in the repository documents a policy for interruptible startup tuning.
- Nothing verifies the Windows console behaviour mechanically: no test exercises
stop_console, and.github/workflows/native-serving.yml:73(not opened) (cargo test --manifest-path flare-cli/Cargo.toml, windows-2022) would only compile it. Only a Windows run can settle the observable behaviour; the PR explicitly did not perform one.