Skip to content

fix(exl3): make scoped frontier discard restart-safe - #3715

Merged
Qubitium merged 1 commit into
mainfrom
fix/exl3-discard-tombstone
Nov 9, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/exl3-discard-tombstone

Conversation

@Qubitium

@Qubitium Qubitium commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

TL;DR

Make scoped EXL3 capture-frontier discard restart-safe. A committed frontier is now atomically renamed to a recognized tombstone before any payload deletion, and interrupted tombstones are pruned on restart.

1. The problem

The old discard_through recursively deleted the committed directory in place. A crash could leave a committed-looking directory without manifest.json; scoped resume then failed while _prune_incomplete ignored that state.

stateDiagram-v2
    state "Committed frontier" as Committed
    state "Partial committed directory" as Partial
    state "Resume blocked" as Blocked
    Committed --> Partial: "shutil.rmtree starts"
    Partial --> Blocked: "manifest missing on restart"
    style Partial fill:#fee,stroke:#b22
    style Blocked fill:#fee,stroke:#b22
Loading

2. The new flow

stateDiagram-v2
    state "Committed frontier" as Committed
    state "Discard tombstone" as Tombstone
    state "Deleted" as Deleted
    [*] --> Committed
    Committed --> Tombstone: "os.rename and fsync root"
    Tombstone --> Deleted: "shutil.rmtree"
    Tombstone --> Tombstone: "process stops"
    Tombstone --> Deleted: "_prune_incomplete on restart"
Loading

The new flow and before/after table are committed in docs/exl3-capture-frontiers.md.

3. Failure contract

Situation Result
Interruption before rename committed frontier remains valid
Interruption after rename .discard-*.tmp tombstone remains
Restart _prune_incomplete finishes deleting the tombstone
Symlink or non-directory tombstone EXL3CaptureFrontierError

Tests

  • test_scoped_discard_uses_restart_safe_tombstone
  • Existing commit, restore, namespace-scoped discard, tamper, and streaming tests

Validation

TMPDIR=/dev/shm PYTHONDONTWRITEBYTECODE=1 /root/venv/bin/python -m pytest tests/test_exl3_capture_frontier.py -q -p no:cacheprovider
8 passed, 2 skipped

ruff check gptqmodel/utils/exl3_capture_frontier.py tests/test_exl3_capture_frontier.py
All checks passed

@Qubitium
Qubitium merged commit 19102ce into main Nov 9, 2026
4 of 5 checks passed
@Qubitium
Qubitium deleted the fix/exl3-discard-tombstone branch November 9, 2026 12:29
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.

1 participant