Skip to content

fix(server): preserve requests without valid prompt token IDs - #573

Merged
Zhiyuan He (hzy46) merged 2 commits into
microsoft:mainfrom
rioyu123:codex/fix-invalid-prompt-dedupe
Aug 28, 2026
Merged

fix(server): preserve requests without valid prompt token IDs#573
Zhiyuan He (hzy46) merged 2 commits into
microsoft:mainfrom
rioyu123:codex/fix-invalid-prompt-dedupe

Conversation

@rioyu123

@rioyu123 Rio Yu (rioyu123) commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #572.

What changed

  • Keep the existing last-index map and skip deduplication when prompt IDs do not form a valid, non-empty integer list.
  • Preserve those requests in the final result instead of collapsing or dropping them.
  • Apply the same rule to VERL image alignment.
  • Cover null/empty IDs, nested lists, strings, dictionaries, booleans and floats, plus last-wins behavior across three valid duplicates.

Following the review, the two key helpers and superseded-index tracking have been removed. The early guard retains the request's index before continue; otherwise the final inclusion filter would discard requests with no key. The integer-list check also prevents a truthy nested value such as [[1]] from raising while hashing the key.

Valid prompt-token keys keep the existing last-wins behavior. For providers that omit prompt token IDs, this can increase the number of returned triplets because the server no longer guesses that successful calls are retries. Explicit request identity would be a better way to deduplicate those calls, but is outside this fix.

Verification

  • Linux, Python 3.12, repository dev and verl-cpu dependencies: 92 tests passed, no skips.
  • Full-repository Ruff checks/formatting, Pyright, Python header checks and pre-commit: passed.
  • Source distribution and wheel: built successfully.
  • The 16 invalid-ID regressions fail on unchanged upstream 5518551e with the updated tests overlaid, and pass with this fix.
  • Windows: 35 focused tests passed; the full available suite had 71 passed, 3 skipped for missing optional training dependencies.

Copilot AI balanced review requested due to automatic review settings August 27, 2026 12:23

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.

Pull request overview

Fixes triplet deduplication so requests with missing or malformed prompt token IDs are preserved.

Changes:

  • Deduplicates only non-empty integer token-ID lists.
  • Mirrors deduplication semantics for VERL image alignment.
  • Adds regression coverage for invalid IDs and valid last-wins behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
agentlightning/server/routes/events.py Validates prompt keys before deduplication.
agentlightning/verl/agl_rollout_manager.py Aligns images using matching deduplication rules.
tests/server/test_endpoints.py Covers malformed IDs and repeated valid keys.
tests/verl/test_agl_rollout_manager.py Covers image alignment with malformed IDs.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@rioyu123
Rio Yu (rioyu123) force-pushed the codex/fix-invalid-prompt-dedupe branch from 96f7e40 to bf19304 Compare August 27, 2026 12:57
Signed-off-by: Rio Yu <52408936+rioyu123@users.noreply.github.com>
@hzy46
Zhiyuan He (hzy46) merged commit 88528bf into microsoft:main Aug 28, 2026
6 checks passed
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.

Triplet view collapses requests without valid prompt token IDs

3 participants