Skip to content

CI: skip an experimental TRL trainer whose own module needs an optional extra - #17687

Merged
danielhanchen merged 1 commit into
mainfrom
fix/trl-118-experimental-optional-dep
Nov 13, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix/trl-118-experimental-optional-dep

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Core (HF=latest + TRL=latest) fails on every PR since TRL 1.18.0 was released today (for example on the staging runs for #17521, #17534 and #16421):

FAILED tests/_trl_trainer_discovery_shim.py::test_unsloth_patches_experimental_trainers_via_thin_wrappers
AssertionError: experimental *Trainer classes declared in source but not importable: [('async_grpo', 'HarnessAsyncGRPOTrainer')]

TRL 1.18 added trl/experimental/async_grpo/openenv_harness.py, which defines HarnessAsyncGRPOTrainer and imports the optional openenv package at module level. The CI job does not install openenv, so that one submodule cannot be imported. The inline test (in consolidated-tests-ci.yml) finds every class *Trainer in trl.experimental.* by regex, walks the package's submodules to locate each one, and swallows submodule import errors. So the class is reported as "declared in source but not importable", as if TRL's public surface had drifted.

TRL is right, and Unsloth does not patch this trainer. The test already skips a whole experimental package whose __init__ needs an optional dependency (IMPORT-SKIP), but it had no equivalent for a single submodule.

Reproduced with TRL 1.18.0 and transformers 5.23.0: 1 failed, 4 passed.

Change

In the submodule walk, a ModuleNotFoundError for a non-trl module counts as an optional-extra skip, but only when the submodule that failed is the file declaring the class. It is logged as an IMPORT-SKIP line naming the module and the missing package. Every other case still lands in missing:

  • a class that is not defined anywhere;
  • a submodule failing for another reason;
  • a missing trl.* module.

Testing

Running the inline test extracted from the workflow:

  • TRL 1.18.0: 5 passed, with IMPORT-SKIP trl.experimental.async_grpo.openenv_harness.HarnessAsyncGRPOTrainer: needs the optional openenv.
  • TRL 1.17.1: 5 passed, unchanged.
  • Sabotage: a trl/experimental/async_grpo/zz_ghost.py that raises RuntimeError before declaring GhostTrainer still fails with [('async_grpo', 'GhostTrainer')].
  • The workflow YAML parses, and the workflow-content tests (test_cache_budget_discipline.py, test_pip_cache_naming.py, test_zoo_suite_parallel_isolation.py, test_trl_cap_sites.py): 295 passed, 3 skipped.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T17:00:40.675133Z d3f53c3 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. 🚀

Reviewed commit: d3f53c31c5

ℹ️ 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 4e08258 into main Nov 13, 2026
@danielhanchen
danielhanchen deleted the fix/trl-118-experimental-optional-dep branch November 13, 2026 17:07
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