Subtractive report · NVIDIA/hyperflare-inference #178

Raw Markdown for agents: https://autobot.eidonix.com/p/048461d2-941f-459d-8631-426c587d5be3.md

PR #178 (subtraction review) — Keep the default Windows Ctrl-C termination while loading

Key findings

  1. Blocking — every line of the diff lands in a file that no longer exists on main (all 14 diff lines: +8/−6). flare/src/main.rs was moved to flare-cli/src/main.rs in fa158284 (2026-11-09, "Add a native Windows desktop backed by the shared Flare library"), six days after this PR branched at 902c88e. The live file already holds the exact registration the PR deletes. 100% of the change must be redone; the smaller version is a 13-line relocation in flare-cli/src/main.rs.
  2. Should fix — delete the second added comment line (1 line). "A registration failure must return before replay starts." restates the return Err four lines below and claims a drain benefit that is backwards.
  3. Nit — docs/windows.md:141-142 is left claiming a drain that stops being true while loading (0 lines saved, same-length rewrite).

Nothing else in the PR is a candidate for subtraction: it adds no flag, helper, type, constant, test or dependency. The intent is already minimal; only its address is wrong.

The change, measured

1 file changed, +8/−6 (14 diff lines), all in flare/src/main.rs, head 85fb08c on base 902c88e.

No flags, options, parameters, fallbacks, abstractions or tests are added. The change is a relocation.

Findings, ranked by lines saved

1. Blocking — the whole diff targets a deleted file: ~14 lines (all of it)

Where: flare/src/main.rs (both hunks; deletion at 147-152, insertion at 574-580 in the old tree).

What goes: all of it. Nothing can replace it in that file.

Why nothing is lost by redoing it elsewhere: the file is not on main.

The live code already has the registration the PR deletes — flare-cli/src/main.rs:187-192:

#[cfg(windows)]
unsafe {
    if windows_sys::Win32::System::Console::SetConsoleCtrlHandler(Some(stop_console), 1) == 0 {
        return Err(std::io::Error::last_os_error().into());
    }
}

stop_console is at flare-cli/src/main.rs:736-745; SetConsoleCtrlHandler appears at only two sites on main (flare-cli/src/main.rs:189, heliopause/src/processes_windows.rs:38), so there is exactly one registration to move.

Where the insertion belongs on main: flare-cli/src/main.rs:178-186 rejects --rank, --rendezvous, --hosts, --roce-ring, --roce-chain on Windows, so serve() (592) always takes the cluster.is_none() branch into serve_local (602-604). serve_local starts the server at 702 (loaded.start()), after the "Start server" phase opens at 701 — register immediately before that. Every Windows serving run goes through serve_local, so one site covers all of them.

Smaller version to land (13 lines of diff: −6, +6 code, +1 comment): delete 187-192, insert before line 702:

// Loading keeps the default Ctrl-C termination: nothing observes STOP before serving.
#[cfg(windows)]
unsafe {
    if windows_sys::Win32::System::Console::SetConsoleCtrlHandler(Some(stop_console), 1) == 0 {
        return Err(std::io::Error::last_os_error().into());
    }
}

Not a subtraction I endorse: dropping the == 0 failure branch (3 of the 8 added lines) would suppress an OS error; AGENTS.md forbids that, so the check stays.

2. Should fix — drop the second added comment line: 1 line

Where: flare/src/main.rs:574-575 (old tree); in the ported version it is the second line of the two-line comment before loaded.start().

// Loading keeps the default Ctrl-C termination because nothing observes STOP before serving.
// A registration failure must return before replay starts.

What goes: the second sentence.

Why nothing is lost: it restates the return Err(...) that now sits four lines above Server::start, and the ordering it describes is visible from the code. Worse, the benefit it implies does not exist:

The first sentence is the genuinely non-obvious constraint and should stay: nothing reads STOP before the serving loop, whose other reader (distribution's rendezvous wait) is #[cfg(unix)] — flare-cli/src/main.rs:209-260 on main.

Smaller version: keep one line, delete the other.

3. Nit — docs/windows.md:141-142 still promises a drain during loading: ~0 lines

Where: docs/windows.md:141-142 (main): "Ctrl-C and Ctrl-Break drain native work before releasing CUDA resources."

What goes: the unconditional claim, rewritten in place at the same length — do not add a paragraph to a 6-line fix (AGENTS.md: "Scale detail to the change"; "State the substantive fact directly"). After the change, only serving-time Ctrl-C drains; during download and loading Windows keeps the default console termination, which ends the process with no drain. Reviewer yatesdr raised the same gap (2026-11-18, point 3).

Replacement, same length: "Ctrl-C and Ctrl-Break end loading immediately, and drain native work once serving has started."

Checked and left alone: docs/model-preparation.md:470 (not opened) ("Stop Flare with Ctrl-C or SIGTERM so native replay drains") and AGENTS.md:134 describe the serving loop, which is unchanged. No other doc or test asserts the loading-time behavior, so nothing else is made dead.

Verified as not subtraction candidates

Open questions / not verified

Tally