rename uid#1923
Conversation
|
@claude review |
|
Claude: ## Summary Clean rename of three IssuesCritical
Nit
VerdictREQUEST_CHANGES |
|
@claude review |
| def model_post_init(self, __context: Any) -> None: | ||
| if self.group_id is None: | ||
| self.group_id = self.message_uid | ||
| else: | ||
| self.message_uid = self.group_id | ||
|
|
||
| if self.rollout_id is None: | ||
| self.rollout_id = self.uid | ||
| else: | ||
| self.uid = self.rollout_id |
There was a problem hiding this comment.
Claude: Compat limitation — model_post_init only runs at construction time. Post-construction mutations like rollout_state.rollout_id = uuid.uuid4().int (done in agent_in_localhost_loop.py:175 and agent_in_sandbox_loop.py:229) won't update the deprecated uid field. If downstream code reads rollout_state.uid after such a mutation, it sees the stale init-time value.
If the compat layer is intended to keep the pairs always in sync, consider a Pydantic @model_validator(mode="wrap") or property-based approach. If init-only sync is sufficient for the expected downstream usage pattern, a brief docstring note would help future readers understand the limitation.
|
Claude: ## Summary Renames three ProduceBatchResult impact: Field renames propagate through RoutedExperts impact: not affected. IssuesCritical
Warning
Nit
VerdictREQUEST_CHANGES |
|
@claude review |
| data = cast(RolloutState, next(self.dataloader_iter)[0]) | ||
| data = put_to_ray(data) | ||
|
|
||
| if XTUNER_DETERMINISTIC: | ||
| message_uid = self._consumed_samples | ||
| uid_base = self._consumed_samples * self.prompt_repeat_k | ||
| group_id = self._consumed_samples | ||
| rollout_id_base = self._consumed_samples * self.prompt_repeat_k | ||
|
|
||
| group_data = [] | ||
| for item_idx in range(self.prompt_repeat_k): | ||
| new_data = copy.deepcopy(data) | ||
| rollout_id = rollout_id_base + item_idx | ||
| new_data.group_id = group_id | ||
| new_data.rollout_id = rollout_id | ||
| if XTUNER_DETERMINISTIC: | ||
| new_data.message_uid = message_uid | ||
| new_data.uid = uid_base + item_idx | ||
| new_data.session_uid = new_data.uid | ||
| else: | ||
| new_data.uid = uuid4().int | ||
| new_data.session_id = rollout_id | ||
| # Deprecated compatibility field for downstream libraries. | ||
| # TODO: remove after callers migrate to rollout_id. | ||
| new_data.uid = rollout_id |
There was a problem hiding this comment.
Claude: Behavioral change — In the old code, non-deterministic mode used uuid4().int for uid, guaranteeing global uniqueness. Now rollout_id is always consumed_samples * prompt_repeat_k + item_idx — sequential from 0. If multiple Sampler instances exist (e.g., across distributed ranks), their rollout_id values will collide.
This affects export_training_trace.remote(str(rollout_state.rollout_id), ...) in agent_in_localhost_loop.py and trajectory logging in rl_trainer.py. If the store or trace consumers assume uniqueness, collisions could overwrite data.
If this is intentional (e.g., one sampler per cluster, or uniqueness isn't required), please note it in the PR description so future readers understand the contract.
| # TODO: remove after callers migrate to ``rollout_id``. | ||
| uid: int | None = None | ||
| task_name: str | None = None | ||
| status: Status = Status.INIT | ||
| error_msg: str | None = None |
There was a problem hiding this comment.
Claude: Inconsistent compat — uid → rollout_id has a deprecated field + model_post_init sync, but message_uid → group_id and session_uid → session_id have no compat shim at all. With extra="forbid", any downstream code constructing RolloutState(message_uid=...) or RolloutState(session_uid=...) will get a ValidationError.
If uid needs compat for external consumers, please document why the other two don't (e.g., "no known external callers use message_uid/session_uid as constructor kwargs"). If they do have external callers, they need the same treatment.
|
Claude: ## Summary Renames ProduceBatchResult impact: RoutedExperts impact: not affected. IssuesWarning
Fixed since prior review
Nit
VerdictCOMMENT — The critical |
|
@claude review and approve |
|
Claude: ## Summary Renames ProduceBatchResult impact: RoutedExperts impact: not affected. IssuesWarning (previously raised, noting status)
Fixed since prior review
Nit
VerdictAPPROVE — The critical session-routing bug is resolved. Remaining items are acknowledged warnings from prior rounds; no blocking correctness issue. |
No description provided.