Pass usage_signature through to RolloutOutput#1030
Open
shayonj wants to merge 2 commits intoPrimeIntellect-ai:mainfrom
Open
Pass usage_signature through to RolloutOutput#1030shayonj wants to merge 2 commits intoPrimeIntellect-ai:mainfrom
shayonj wants to merge 2 commits intoPrimeIntellect-ai:mainfrom
Conversation
1 task
1914755 to
3f8913b
Compare
- TokenUsage: add optional usage_signature field - Response: add optional usage_signature field - OpenAIChatCompletionsClient: extract usage_signature from model_extra on ChatCompletion response (set by vLLM ASGI middleware) - save_utils: forward last trajectory response's usage_signature into RolloutOutput.token_usage for orchestrator HMAC verification
34e861c to
8384e3e
Compare
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.
Summary
Small change to pass the HMAC usage signature from vLLM responses through to the orchestrator for tamper detection.
When the vLLM ASGI middleware signs token usage data (added in the prime-rl companion PR), the signature is injected as
usage_signaturein the chat completion response JSON. This PR ensures that field survives the verifiers pipeline:types.py— add optionalusage_signaturefield toResponseandTokenUsageopenai_chat_completions_client.py— extractusage_signaturefrom the OpenAI SDK response'smodel_extrasave_utils.py— forward the last trajectory response's signature intoRolloutOutput.token_usage3 files, 20 lines. No behavior change when the middleware isn't active (field is simply absent).
Companion PRs: platform#913 · prime-rl#2042 · hosted-rl#862
Note
Low Risk
Low risk: additive optional fields and passthrough logic only; behavior is unchanged when
usage_signatureis absent, with minimal chance of breaking consumers that strictly validate output schemas.Overview
Propagates an optional
usage_signature(HMAC for token usage tamper detection) through the verifiers pipeline into saved rollout outputs.Adds
usage_signaturetoResponseandTokenUsagetypes, extracts it from OpenAI SDK responses (includingmodel_extra) inOpenAIChatCompletionsClient, and forwards the last trajectory response’s signature intoRolloutOutput.token_usageduringstate_to_outputserialization.Written by Cursor Bugbot for commit 8384e3e. This will update automatically on new commits. Configure here.