Decode prompt token trace payloads#455
Merged
SunnySoldier357 merged 7 commits intoJun 19, 2026
Merged
Conversation
Hydrate prompt_token_ids from Fireworks tracing payloads so RemoteRolloutProcessor can pass token-native prompt IDs through assistant turn metadata. Co-authored-by: Cursor <cursoragent@cursor.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Move the per-payload binary deserializers out of adapters/ into a dependency-light eval_protocol/tracing package: a PayloadType StrEnum, DecodedPayload, and a decode_payloads registry (master decode) usable without EvaluationRow/rollout machinery. Refactor FireworksTracingAdapter to use the registry instead of three copy-pasted decode blocks, and decode pti/v1 as zstd(JSON int array) to match the gateway. Adds tests/tracing and a README. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the 4-line narrating comment over the payload-decode block with a single intent line; the code already shows what it does. Co-authored-by: Cursor <cursoragent@cursor.com>
Export only PayloadType, DecodedPayload, and decode_payloads/decode_payload/ decode_trace from the package __init__. The per-type decoders and PAYLOAD_DECODERS are internal building blocks, still reachable via submodules. Co-authored-by: Cursor <cursoragent@cursor.com>
… module The shared helper had a single caller (prompt_token_ids); logprobs/router_replay already inline the same base64+zstd step. Inline it there too for consistency and remove the dedicated _decompress.py file. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the Dict[str, Any] `extras` field (only ever holding logprobs token_ids) with a typed `token_ids: Optional[List[int]]` field. Callers now get a real type (dp.token_ids) instead of Any from extras.get(...). Update adapter, tests, README. Co-authored-by: Cursor <cursoragent@cursor.com>
Collaborator
|
One compat concern: |
Re-export the moved tracing decoders from their old adapter paths with a DeprecationWarning so existing imports keep working after the tracing refactor. Co-authored-by: Cursor <cursoragent@cursor.com>
xiaoyifan
approved these changes
Jun 19, 2026
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
eval_protocol/tracing/package for decoding Fireworks tracing-gateway payloads, independent ofEvaluationRow/rollout machinery (stdlib +zstandardonly). It is the "folder you can point at" for extracting gateway payloads even without using EP for rollouts.PayloadTypeStrEnum+DecodedPayload+ a masterdecode_payloads(payloads)registry that runs every decoder over a trace'spayloadsin one call (plusdecode_payload()anddecode_trace()). Adding a payload type is one decoder + onePAYLOAD_DECODERSentry.pti/v1aszstd(JSON int array)to match the gateway (fw-ai/fireworks#29923). Thelp/v1andr3/v1decoders are moved verbatim.FireworksTracingAdapterto usedecode_payloadsinstead of three copy-pasted decode blocks;execution_metadata.extrakeys are unchanged. Removedadapters/{pti,lp,r3}_deserializer.py.tests/tracing/test_registry.pyand a packageREADME.md.Test plan
conda run -n pilot python -m pytest tests/tracing/test_registry.py tests/adapters/test_fireworks_tracing_prompt_token_ids.py tests/adapters/test_fireworks_tracing_logprobs.py tests/adapters/test_lp_deserializer.py tests/adapters/test_r3_deserializer.py(pass; one pre-existing skip that needs the mono serializer).accounts/pyroworks-dev/deployments/malaysia2-intended-butterfly:scripts/test_remote_rollout_prompt_token_ids.pyhydratesassistant_turn_payloads[0].prompt_token_idswith 13 ids.prompt_token_idsandlogprobsdecoded live through the new registry;router_replaycovered by unit tests (deployment has MoE stats disabled).Requires fw-ai/fireworks#29923 (the gateway must emit
pti/v1aszstd(JSON)); land together.Note
Medium Risk
Touches the trace-to-EvaluationRow payload path used by remote rollouts; behavior should match prior LP/R3 keys but prompt_token_ids depends on the gateway emitting pti/v1 (coordinated land).
Overview
Introduces
eval_protocol.tracing, a small standalone package withdecode_payloads/decode_trace,PayloadType, and per-type decoders for prompt token IDs (pti/v1as zstd-compressed JSON), logprobs (lp/v1), and router replay (r3/v1). LP/R3 logic moves out of the adapters; oldlp_deserializerandr3_deserializermodules remain as deprecation shims that re-export the new modules.FireworksTracingAdaptertrace conversion now callsdecode_payloadsonce instead of inline R3/LP blocks, and maps results onto the sameexecution_metadata.extrakeys as before, plusprompt_token_idsandprompt_token_ids_metadata.tracing_utils._merge_payloads_into_longest_rowcarriesprompt_token_idsintoassistant_turn_payloadsfor multi-turn rollouts.Adds package README, registry/unit tests, adapter tests for PTI, shim tests, and an optional E2E script for
RemoteRolloutProcessorhydration of prompt token IDs.Reviewed by Cursor Bugbot for commit 68a32dd. Bugbot is set up for automated code reviews on this repo. Configure here.