Skip to content

fix(server): invalidate deleted terminal rollout slots - #707

Open
A_Zhe (1137423918) wants to merge 1 commit into
microsoft:mainfrom
1137423918:fix/terminal-rollout-id-reuse
Open

A_Zhe (1137423918) wants to merge 1 commit into
microsoft:mainfrom
1137423918:fix/terminal-rollout-id-reuse

Conversation

@1137423918

@1137423918 A_Zhe (1137423918) commented Nov 23, 2026 •

Copy link
Copy Markdown

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/terminal can 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 (dev extra/group, without verl-cpu):

  • Original production code at 2070bad5113e52f1aa2e5bdba822d4b24b197c05: focused regression selection 4 failed, 1 passed; related selection excluding the four new failing states 49 passed.
  • Candidate: python -m pytest -v tests/server tests/test_client.py — 53 passed, no skips. The five focused cases are a subset of these 53.
  • Changed files: python -m ruff check ..., python -m ruff format --diff ... and python -m pyright ... passed. Pyright 1.1.410 ran with an isolated, pinned Node 22.23.5.
  • python scripts/check_headers.py passed on the copied source/test snapshot.

Sanitized baseline/candidate logs, exact source hashes and validation details.

@1137423918
A_Zhe (1137423918) marked this pull request as ready for review November 23, 2026 10:57
Copilot AI balanced review requested due to automatic review settings November 23, 2026 10:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

No deployments
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.

2 participants