Skip to content

Publish logprob results only after a complete successful write - #149

Merged
0xaron merged 1 commit into
opensetlabs:mainfrom
Afloat16:fix/logprob-results-atomic-publication-20261128
Nov 30, 2026
Merged

0xaron merged 1 commit into
opensetlabs:mainfrom
Afloat16:fix/logprob-results-atomic-publication-20261128

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Fixes #148

Problem

The logprob probe treats the presence of an arm's JSONL file as completion. Writing directly to that final filename leaves an incomplete file if a write or close fails. Every later invocation silently skips the arm, so a transient output failure becomes a permanently incomplete cached result.

A real Linux file-size limit of 1,024 bytes reproduces this: the original script exits with a write error and leaves a 1,024-byte unterminated JSON line. A retry exits successfully without changing those bytes.

Change

Write into a temporary directory beside the destination and publish the result with os.replace only after all rows have been written and the file has closed successfully. The temporary directory is cleaned on failure. Existing completed results retain their skip behavior.

The regression starts a real local HTTP subprocess and executes the production script. It forces an actual file-write failure, verifies that no final result or staging file remains, retries to obtain both complete rows, and checks that a completed result is reused.

Validation

Linux x86-64, Python 3.12.14; Intel Xeon Platinum 8573C. ./install.sh --check reports the AVX-512 VNNI + VBMI fast path.

# Unchanged base ba9197ccdcb43fcf8119346820e5e172320e8764:
python -m unittest bench/test_lp_publication.py
1 test, FAILED (failures=1)

# Fixed source:
python -m unittest bench/test_lp_publication.py
1 test, OK

python -m unittest discover -s tests -p 'test_*.py'
68 tests, OK (skipped=7)

(cd bench && python -m unittest discover -s . -p 'test_*.py')
89 tests, OK

python -m py_compile bench/lp.py bench/test_lp_publication.py
git diff --check
# passed

The seven root-suite skips require the optional GGUF package. The new fault-injection case is Linux-only because it uses RLIMIT_FSIZE. A clean model build and model-backed serving smoke test were not run; this change is confined to result-file publication and does not claim a model or performance measurement. Previously incomplete final files still need removal before retrying.

@0xaron
0xaron merged commit c4d96b5 into opensetlabs:main Nov 30, 2026
1 check passed
@0xaron 0xaron mentioned this pull request Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed logprob-result writes leave an incomplete file that every retry skips

2 participants