Skip to content

fix resume#548

Closed
Chibukach wants to merge 2 commits into
vllm-project:mainfrom
neuralmagic:fix_resume
Closed

fix resume#548
Chibukach wants to merge 2 commits into
vllm-project:mainfrom
neuralmagic:fix_resume

Conversation

@Chibukach

@Chibukach Chibukach commented May 26, 2026

Copy link
Copy Markdown

Purpose

This PR fixes a bug with the --resume flag where it does it correctly locate the ids of rows with already generated responses

Description

The load_seen() function tries to read:
key = obj.get("uuid") or obj.get("idx")

But the output file actually writes:
output = {
"id": item.get("uuid") or f"sample_{idx}", # Top-level "id", not "uuid"

}

This means that the response generation starts from the beginning as the ids do not exist

Related Issue

Tests

I have filled in:

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan/results, such as providing test command and pasting the results.
  • (Optional) The necessary documentation update.
  • I (a human) have written or reviewed the code in this pr to the best of my ability.

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The resume/deduplication logic in the response regeneration script now uses consistent identifier format. The load_seen function reads keys as id (or metadata.idx), and main writes keys as str(uuid) when available, otherwise sample_{index}, ensuring matching key formats between what the worker writes and what the resume logic reads.

Changes

Resume Key Format Alignment

Layer / File(s) Summary
Resume key format alignment
scripts/response_regeneration/script.py
load_seen extracts resume keys as obj["id"] (falling back to obj["metadata"]["idx"]), and main computes resume keys as str(uuid) when uuid exists, otherwise sample_{index}, aligning identifier format between worker output and resume deduplication logic.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

bug

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix resume' is vague and generic, using non-descriptive phrasing that doesn't convey specific information about the fix. Use a more descriptive title that specifies the issue being fixed, e.g., 'Fix resume flag to use correct id field for deduplication'.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description clearly describes the bug being fixed, explaining the mismatch between key names used when reading vs. writing output records.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Linked repositories: Couldn't analyze vllm-project/vllm - clone failed: Clone operation failed: Cloning into '/home/jailuser/git'...
warning: templates not found in /usr/share/git-core/templates
fatal: unable to access 'https://github.com/vllm-project/vllm.git/': Failed to connect to github.com port 443 after 134652 ms: Couldn't connect to server


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added the bug Something isn't working label May 26, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/response_regeneration/script.py`:
- Around line 119-121: load_seen() currently adds fallback keys from
metadata.idx as plain digits but main() expects fallback keys in the form
"sample_{idx}", causing dedup resume to fail; update the logic where key =
obj.get("id") or obj.get("metadata", {}).get("idx") to normalize the fallback by
wrapping numeric metadata.idx values as f"sample_{idx}" before adding to the
seen set (ensure the same normalization is applied in all places that add to
seen, including the other occurrence around lines 300-302) so both load_seen()
and main() use identical key formats.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 22949fdb-97d5-4240-98a3-6476c8754e4e

📥 Commits

Reviewing files that changed from the base of the PR and between 1bc3788 and a8e900d.

📒 Files selected for processing (1)
  • scripts/response_regeneration/script.py

Comment thread scripts/response_regeneration/script.py Outdated
Comment on lines 119 to 121
key = obj.get("id") or obj.get("metadata", {}).get("idx")
if key is not None:
seen.add(str(key))

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Normalize metadata.idx fallback to sample_{idx} to make resume work on legacy files.

load_seen() stores fallback keys from metadata.idx as "123", but main() checks fallback keys as "sample_123". That still skips dedup for files missing top-level id.

Suggested fix
 def load_seen(path: str):
@@
-            key = obj.get("id") or obj.get("metadata", {}).get("idx")
-            if key is not None:
-                seen.add(str(key))
+            key = obj.get("id")
+            if key is None:
+                idx = obj.get("metadata", {}).get("idx")
+                key = f"sample_{idx}" if idx is not None else None
+            if key is not None:
+                seen.add(str(key))
As per coding guidelines "**/*.py: Focus on code correctness...".

Also applies to: 300-302

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/response_regeneration/script.py` around lines 119 - 121, load_seen()
currently adds fallback keys from metadata.idx as plain digits but main()
expects fallback keys in the form "sample_{idx}", causing dedup resume to fail;
update the logic where key = obj.get("id") or obj.get("metadata", {}).get("idx")
to normalize the fallback by wrapping numeric metadata.idx values as
f"sample_{idx}" before adding to the seen set (ensure the same normalization is
applied in all places that add to seen, including the other occurrence around
lines 300-302) so both load_seen() and main() use identical key formats.

@Chibukach Chibukach closed this May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant