Skip to content

GRPO truncated-support gate test: lift the block that binds _support_kwargs - #15267

Merged
danielhanchen merged 1 commit into
mainfrom
ci-grpo-support-block-anchor
Oct 25, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-grpo-support-block-anchor

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

tests/test_grpo_truncated_support_policy_gate.py fails 6 of 9 on main since #14185 (NameError: name 'os' is not defined raised from rl_replacements.py:2). It shows on the rest shard of every PR based after that merge, for example #15245.

Cause

The test, not the product. It lifts the truncated-support binding block out of _get_per_token_logps_and_entropies and runs it on a stub trainer. To find the block it took the first try in the body whose source mentions grpo_truncated_support_kwargs. #14185 added an earlier try in the same body that imports that name too (the UNSLOTH_GRPO_LOGPROB_RECOMPUTE scorer pick). The test then lifted that block instead, which reads os.environ in a namespace without os. The real block is unchanged.

Fix

  • The block now starts at the try that assigns _support_kwargs.
  • Statements are collected while they read or bind _support_kwargs as a name, not while the substring _support_kwargs appears (which grpo_truncated_support_kwargs also contains).

Verification

  • The lifted block on main is identical, byte for byte, to what the old extractor lifted from the source just before Route ORPO, CPO, KTO, DPO and TRL 1.15's fused head to the zoo fused linear kernel #14185. The new extractor also gives the same block on that older source.
  • tests/test_grpo_truncated_support_policy_gate.py: 6 failed on main, 9 passed here.
  • Sabotage: with _support_mismatch forced to [] in rl_replacements.py (the gate removed), 6 cases fail, so the test still guards the product.

…rt_kwargs

#14185 added an earlier try in _get_per_token_logps_and_entropies that also
imports grpo_truncated_support_kwargs (the UNSLOTH_GRPO_LOGPROB_RECOMPUTE
scorer pick). The test took the first try mentioning that name, so it lifted
the recompute block instead, and every case died on NameError: os. The
extractor now starts at the try that assigns _support_kwargs and keeps the
statements that read it by name, which yields the same block byte for byte as
before #14185.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T13:47:07.434760Z 493a0b1 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 493a0b1c8a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit b9ae4e7 into main Oct 25, 2026
0 of 14 checks passed
@danielhanchen
danielhanchen deleted the ci-grpo-support-block-anchor branch October 25, 2026 13:52
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.

1 participant