The 0.67.0 release stopped at its macOS check: aft warmup built the meaning-search index, printed that it was ready, and then crashed at exit with SIGSEGV (exit 139). Nothing was published.
Cause, from a symbolized crash report of the shipped binary: warmup's status polling had started a second fill round, which was creating an ONNX Runtime session when warmup returned from main. The process exit then ran ONNX Runtime's C++ static destructors underneath that thread. The long-running server and daemon already wait for in-flight ONNX Runtime work before they exit; the one-shot warmup and index commands did not.
Fix: both commands now end through one helper, run_ort_capable_command in main.rs, which refuses new ONNX Runtime work and waits for work in flight (as the other shutdown paths do), then exits with the same code and output as before. No other CLI command loads ONNX Runtime.
Test: cli_ort_exit_test holds a fill inside model creation through a test-hooks-only hook and checks that warmup does not end until the fill leaves ONNX Runtime. It fails against the old main.rs and passes with the fix.
The search-quality descriptor marks this non-ranking: the only change in data_layer/meaning.rs is that test hook.
Summary by cubic
Fixes a crash in aft warmup and aft index that stopped the 0.67.0 release at its macOS check: both commands ended while a background fill was still creating an ONNX Runtime session, so the process exit ran ORT's C++ static destructors under that thread and died with SIGSEGV (exit 139) after printing its output.
Both commands now end through a shared helper, run_ort_capable_command in main.rs, that refuses new ONNX Runtime work and waits for work in flight, mirroring the existing server and daemon shutdown paths. Exit codes and output are unchanged. The only change in data_layer/meaning.rs is a test-hooks-only hold that release builds do not compile.
Testing
Added cli_ort_exit_test, which keeps a fill inside ONNX Runtime model creation and verifies warmup does not exit until the fill leaves the section; it fails against the old main.rs and passes with the fix.
Confidence Score: 4/5
The change appears safe to merge, with a non-blocking gap in successful-exit test coverage.
Routes aft warmup and aft index through run_ort_capable_command before they exit.
Warmup and index wait for ONNX Runtime work before ending.
Review used source inspection; no tests were run.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["warmup or index finishes"] --> B["run_ort_capable_command"]
B --> C{"Exit code is 0?"}
C -->|Yes| D["quiesce_before_return"]
C -->|No| E["exit_process"]
D --> F["Close gate and wait"]
E --> F
F --> G{"Active work finished?"}
G -->|Yes| H["Normal return or exit"]
G -->|No| I["Exit without native teardown"]