feat(patch): compose server-side spans + one-call auto-capture in sweeps#235
Merged
Merged
Conversation
This was referenced Jul 5, 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.
Makes "one request, no token indices" work from both the raw HTTP surface and the
PatchStudyclient by composing the two recently-merged ergonomic features that previously didn't interoperate: substring spans were client-only, and one-call auto-capture was server-only.Server-side span positions in
/v1/patch_sweepPatchSweepRequest.positionsnow accepts span objects mixed with integers:A new
SpanPositionmodel resolves server-side against the corrupt prompt (the destination run), tokenized identically to the sweep. Offsets come from the fast tokenizer's offset mapping when available (offsets index the original prompt), falling back to incremental detokenization of growing id prefixes; special tokens (e.g. BOS) map to an empty span and are never selected. Expansion is order-preserving with dedup across the whole list. Empty spans, missing substrings, and out-of-range occurrences are clean 400s. The response'spositionsremains the resolved integer axis.The pure resolution math is relocated to a shared
vllm/entrypoints/serve/patch/spans.py(resolve_span_positions,dedup_positions,incremental_char_offsets,prompt_char_offsets); the client imports it too, so there is a single copy in the tree.PatchStudyone-call wiringsweep_layers_positionsgains aclean_promptkeyword and makesrunoptional. Withserver_side=Trueandclean_prompt(and no capturedclean/run), the client generates a fresh per-call run name and lets the server auto-capture, surfacingauto_captured/captured_source_runonSweepResult.Spanmarkers are forwarded to the server forserver_side=Truesweeps (resolved there) and only resolved client-side on the per-cell path. An existing run wins over auto-capture;clean_prompton the per-cell path without a captured handle raises a clearValueError.Docs and the runnable example are updated with the new JSON shape and a one-call
PatchStudysnippet.