Grok review r1 for #674: the #645 CHANGELOG entry is one coherent paragraph
that says rollback is manual wherever no staging descriptor is held,
including Windows (#667). The 20 rollback tests that assumed a held
descriptor branch on the same capability flag the code checks: without a
descriptor they assert the refusal and that nothing moved. Adds a test for an
EMFILE pin failure followed by a post-promotion refusal.
Sync with #658 (fd-held staging cleanup): staging cleanup keeps #658's held
handle plus the keep_staging condition, and rollback takes its identity from
the held staging handle. Review r1 fixes for #664: staging is marked possibly
foreign before the move-aside and cleared only on a positive identity check,
so a failing check or an interrupt keeps staging; the backup is restored with
the no-replace rename helper and kept if the destination is occupied or
no-replace is unsupported; on POSIX an unpinned identity is never recorded, so
rollback refuses. Docs call the plan's host figure a conservative upper bound.
DiskSnapshot.close() stays retryable and raises SnapshotError when files
remain, and a cleanup failure no longer replaces an in-flight error; the
ModelHandle finalizer only logs. Interrupted cleanup names the still-owned
offload directory, the snapshot-policy read records unreadable falsy policies,
and the pipeline offload guard requires ownership `is True`. The entry-point
test closes its handles and checks TMPDIR for leftovers.
Fixes#639Fixes#640Fixes#651
Staging cleanup now removes only the directory held open since creation, so a
directory recreated at the staging path is never deleted. Cancellations after
a no-replace rename stay cancellations, with the outcome as a note; an
interrupted discovery publish names the file as possibly published.
VocabSurgeryStrategy.apply_all enforces the ID-only tokenizer guard itself, a
silent alias owner defers to the top-level tie flag, and
logical_values_identical no longer reshapes non-rank-2 values.
Fixes#649Fixes#655
Codex review r4 for #636: rather than retrying failed removals (which needed
identity checks and a held descriptor, each with its own race), each cleanup
stage is attempted once. The owned offload directory is released through
loader.release_offload_dir (also used by the pipeline's _cleanup_offload_dir):
ownership is dropped first, one removal is attempted, and a failure is logged
at WARNING with the path and the directory left on disk, untracked. The
restore point is detached and marked closed before close() runs, so close is
never repeated; failures are still raised by explicit cleanup.