Repository navigation
feat(v1): by-handle payload segments on traces - #2765
Closed
faresobeid wants to merge 10 commits into
Closed
faresobeid wants to merge 10 commits into
faresobeid wants to merge 10 commits into
Conversation
This was referenced Oct 3, 2026
faresobeid
force-pushed
the
feat/payload-by-handle
branch
from
October 10, 2026 15:21
93cc96a to
62b0e32
Compare
faresobeid
marked this pull request as ready for review
October 13, 2026 17:49
Contributor
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — Adds a new by-handle payload contract spanning response parsing, node/branch attribution, and trace delta streaming, with handles pointing to short-lived shared files. Although legacy inline payload paths remain unchanged and focused tests are included, the new runtime and cross-component data path is broader than a small isolated additive change. No code changes detected at You can add or adjust custom eligibility rules. Learn more. |
# Conflicts: # verifiers/v1/types.py
# Conflicts: # verifiers/v1/clients/train.py # verifiers/v1/types.py
# Conflicts: # verifiers/v1/__init__.py
# Conflicts: # verifiers/v1/trace.py
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.
Adds by-handle payload segments to v1 traces. An inference server can write per-token side arrays (router-replay ids, sampling masks) to a shared file and return
payloadsegments instead of inlinerouted_experts/sampling_mask; verifiers then moves only the handles.PayloadSegment(field, file, offset, pos, rows, dtype, shape):rowsfixed-width rows of one per-token array at byteoffsetoffile;posis the first row's token position.clip()cuts a segment to a position range and movesoffset.TurnTokens.payload: the request's segments (request-absolute positions), filled by the train client from the generate result'spayload.Trace.payload: list[NodeSegment], append-only: each turn'scommitclips the request segments to the nodes created this turn (node-local positions). The prefix's final token goes to the prefix's last node when that node was sampled (the previous turn never forwarded it). Rows of other re-forwarded prefix positions are dropped, as on the inline path. No row is ever rewritten.Branch.payload: the trace's segments on that path, rebased to branch positions, in append order.payloadstreams as an append-only delta list field and is excluded fromto_record(handles are short-lived).Inline fields are unchanged; a turn carries one form or the other, depending on the server.
Validation
tests/unit/test_graph.py::test_payload_segments_attributed_per_node_and_rebased_per_branch: bridged turn (prior sampled node gets request rowpath_len-1), fork off a non-sampled prefix node (re-forwarded rows dropped),Branch.payloadrebasing on both branches.uv run pytest tests/unit232 passed, 19 skipped (Docker/Prime/harbor);ruff check,ruff format --check,ty check verifiersclean.Dependencies / before merge
payloadthroughrenderers.client.generate(); land together.Note
Medium Risk
Touches turn commit attribution and branch construction for training data; payload handles are wire-only and omitted from persisted traces, so consumers must read shared files before they expire.
Overview
Adds by-handle per-token side arrays to v1 traces so inference can return file offsets instead of inlining large tensors (e.g.
routed_experts,sampling_mask).Introduces
PayloadSegment/NodeSegmentwith clipping and rebasing. The train client maps generatepayloadinto transientTurnTokens.payload. Turncommitappends node-attributed segments onTrace.payload(including the bridged “previous turn final token” row without rewriting earlier rows, and dropping re-forwarded prefix rows).Branch.payloadexposes branch-aligned handles for training.payloadstreams as an append-only delta field but is excluded from disk records (EXCLUDE_FIELDS). Inlinerouted_experts/sampling_maskpaths are unchanged.A new graph unit test covers bridged attribution, prefix reuse, and per-branch rebasing.
Reviewed by Cursor Bugbot for commit bacf577. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add by-handle payload segments to traces
Introduces a
PayloadSegmenttype that describes a payload range (field, byte offset, row position/count, dtype, shape) with a clip operation for shifting ranges. Turn commits now attribute payload ranges to graph nodes and store them asNodeSegmententries onTrace.payloadin graph.py.TurnTokensgains a transient payload field populated byresponse_from_generatein train.py and excluded from serializationBranchbuilt in trace.py keeps only payload entries on its path, rebased to branch-global token positionsLIST_FIELDSin delta.pypayloadfield entirely (added toEXCLUDE_FIELDSin trace.py);PayloadSegmentandNodeSegmentare newly exported fromverifiers.v1Macroscope summarized e88c744.