Skip to content

(1/3) refactor(session): move sample assembly into the session package#1758

Open
guapisolo wants to merge 1 commit into
mainfrom
refactor/session-samples-move
Open

(1/3) refactor(session): move sample assembly into the session package#1758
guapisolo wants to merge 1 commit into
mainfrom
refactor/session-samples-move

Conversation

@guapisolo

Copy link
Copy Markdown
Collaborator

Summary

Move sample assembly from the client-side generate_utils module into the session package.

Motivation

The follow-up PR makes the session server assemble samples where the records live; server-owned logic must not live in a driver-named module (core.py importing generate_utils.sample_utils.merge_samples set the dependency-direction precedent). Public API and observable behavior stay unchanged.

Before / After

  • Before / After: compute_samples_from_openai_records, its per-record helper, plus truncate_samples_by_total_tokens move unchanged from miles/rollout/generate_utils/openai_endpoint_utils.py to miles/rollout/session/samples/merge.py.
  • What moved where: their tests move alongside to tests/fast/rollout/session/test_samples.py; review the move with --find-copies.
  • Also deletes tests/e2e/sglang/utils/logprob_verify_generate.py: already unreferenced; built on the records-collection path the follow-up PR retires.

Behavior Preservation

  • How we know: pure relocation; the moved functions are byte-identical; only import paths change.

Verification

  • Existing test suite: tests/fast/rollout/session/test_samples.py plus tests/fast/rollout/generate_utils/test_openai_endpoint_utils.py — 24 passed at this tip.

Review Focus

  • Scrutinize the diff with --find-copies: pure moves plus import-path updates, nothing else.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

compute_samples_from_openai_records, its per-record helper, and truncate_samples_by_total_tokens move from the client-side generate_utils module to miles/rollout/session/samples/merge.py, unchanged: the follow-up commit makes the session server assemble samples where the records live, and server-owned logic must not live in a driver-named module (core.py importing generate_utils.sample_utils.merge_samples set the dependency-direction precedent). Their tests move alongside to tests/fast/rollout/session/test_samples.py.

Also deletes tests/e2e/sglang/utils/logprob_verify_generate.py: already unreferenced, and built on the records-collection path the follow-up commit retires.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@guapisolo
guapisolo force-pushed the refactor/session-samples-move branch from 0d64438 to 8c55e0e Compare July 23, 2026 19:40

@Shi-Dong Shi-Dong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Please fix the doc path before merging.

forwards raw `messages` to SGLang, which tokenizes the prompt and returns the
response. `_compute_sample_from_openai_record` in
[`openai_endpoint_utils.py`](https://github.com/radixark/miles/blob/main/miles/rollout/generate_utils/openai_endpoint_utils.py)
[`samples.py`](https://github.com/radixark/miles/blob/main/miles/rollout/session/samples.py)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This path doesn't seem to exist?

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