Repository navigation
fix(server): invalidate deleted terminal rollout slots - #707
Open
A_Zhe (1137423918) wants to merge 1 commit into
Open
A_Zhe (1137423918) wants to merge 1 commit into
A_Zhe (1137423918) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the rollout ID-reuse pagination fix.
No open issues 🎉
What changed in this PR
This PR fixes terminal rollout pagination when a deleted rollout’s ID is reused, preventing old completion slots from returning the replacement while preserving existing cursors.
Changes:
- Track completion positions per rollout ID and tombstone slots on deletion.
- Skip deleted slots and document that cursors and totals include them.
- Add regression coverage for replacement states, cursor stability, and repeated deletion.
| File | Description |
|---|---|
tests/server/test_endpoints.py |
Adds ID-reuse, deletion, and cursor regression tests. |
tests/server/conftest.py |
Clears the completion-position index between tests. |
agentlightning/server/store.py |
Adds nullable completion slots and a per-ID position index. |
agentlightning/server/routes/rollouts.py |
Records positions, tombstones deleted completions, and skips empty slots. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deleting a terminal rollout removes its stored object, but leaves its ID in the completion log. If a caller then creates a new rollout with the same client-assigned ID, the old completion slot resolves to the replacement:
/api/rollouts/terminalcan return a queued/running rollout, or return the new completion twice.Tombstone the original slot when deleting a terminal rollout, using a per-ID position index. Keep log offsets stable so previously issued cursors continue to work. A replacement enters the log only when it reaches a terminal state. Add regressions for queued, running, succeeded and failed replacements, plus deletion/cursor and repeated-delete coverage.
Validation ran on a Linux CPU server with Python 3.12.16 and the unchanged repository
uv.lock(devextra/group, withoutverl-cpu):2070bad5113e52f1aa2e5bdba822d4b24b197c05: focused regression selection 4 failed, 1 passed; related selection excluding the four new failing states 49 passed.python -m pytest -v tests/server tests/test_client.py— 53 passed, no skips. The five focused cases are a subset of these 53.python -m ruff check ...,python -m ruff format --diff ...andpython -m pyright ...passed. Pyright 1.1.410 ran with an isolated, pinned Node 22.23.5.python scripts/check_headers.pypassed on the copied source/test snapshot.Sanitized baseline/candidate logs, exact source hashes and validation details.