Skip to content

Pass usage_signature through to RolloutOutput#1030

Open
shayonj wants to merge 2 commits intoPrimeIntellect-ai:mainfrom
shayonj:feature/rft-billing-v1
Open

Pass usage_signature through to RolloutOutput#1030
shayonj wants to merge 2 commits intoPrimeIntellect-ai:mainfrom
shayonj:feature/rft-billing-v1

Conversation

@shayonj
Copy link
Copy Markdown
Contributor

@shayonj shayonj commented Mar 18, 2026

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_signature in the chat completion response JSON. This PR ensures that field survives the verifiers pipeline:

  • types.py — add optional usage_signature field to Response and TokenUsage
  • openai_chat_completions_client.py — extract usage_signature from the OpenAI SDK response's model_extra
  • save_utils.py — forward the last trajectory response's signature into RolloutOutput.token_usage

3 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_signature is 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_signature to Response and TokenUsage types, extracts it from OpenAI SDK responses (including model_extra) in OpenAIChatCompletionsClient, and forwards the last trajectory response’s signature into RolloutOutput.token_usage during state_to_output serialization.

Written by Cursor Bugbot for commit 8384e3e. This will update automatically on new commits. Configure here.

shayonj added 2 commits March 27, 2026 15:00
- 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
@shayonj shayonj force-pushed the feature/rft-billing-v1 branch from 34e861c to 8384e3e Compare March 27, 2026 19:00
Copy link
Copy Markdown
Member

@mikasenghaas mikasenghaas left a comment

Choose a reason for hiding this comment

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

this lgtm!

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