Repository navigation
[RLlib] Pass the documented argument names to on_offline_eval_runners_recreated - #67770
Merged
pseudo-rnd-thoughts merged 1 commit intoNov 6, 2026
Merged
Conversation
…_recreated `Algorithm._run_one_offline_evaluation` fired the `on_offline_eval_runners_recreated` callback with `env_runner_group=` and `env_runner_indices=`. `RLlibCallback.on_offline_eval_runners_recreated` declares `offline_eval_runner_group` and `offline_eval_runner_indices` as required keyword-only arguments, so any callback that follows the documented signature raised `TypeError` when offline evaluation runners were restored. Pass the documented names and add a regression test. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the _run_one_offline_evaluation method in Algorithm to pass offline_eval_runner_group and offline_eval_runner_indices instead of env_runner_group and env_runner_indices to the callback. It also introduces a new callback class OfflineEvalRunnersRecreatedCallback and a corresponding unit test to verify that the offline evaluation runner recreation callback is correctly triggered with the updated arguments. There are no review comments, so I have no feedback to provide.
pseudo-rnd-thoughts
approved these changes
Nov 6, 2026
Member
|
LGTM |
pseudo-rnd-thoughts
deleted the
doc-1926-rllib-offline-eval-callback-kwargs
branch
November 6, 2026 12:58
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.
Description
Algorithm._run_one_offline_evaluationfires theon_offline_eval_runners_recreatedcallback after it restores offline evaluation runners. It passesenv_runner_group=andenv_runner_indices=. ButRLlibCallback.on_offline_eval_runners_recreateddeclaresoffline_eval_runner_groupandoffline_eval_runner_indicesas required keyword-only arguments. TheAlgorithmConfig.callbacks()docs point callable callbacks to that signature too. So any callback that follows the documented signature raisesTypeErrorwhen offline evaluation runners are restored:This PR passes the documented argument names. This call site is the only place RLlib fires the callback, and the only other implementation, the
_MultiCallbackscontainer incallbacks/utils.py, takes**kwargs. Ray 2.59.0 has the same bug.This PR also adds
test_on_offline_eval_runners_recreated_callbacktocallbacks/tests/test_callbacks_on_algorithm.py. The test calls_run_one_offline_evaluationon a stand-in algorithm whose offline evaluation runners report two restored runners. It checks that both anRLlibCallbacksubclass and a callable, each written against the documented signature, receive the runner group and indices. It doesn't need offline data or crashing runners, so it runs in seconds.I found this while fixing the
on_offline_eval_runners_recreateddocstring example in #67762.Related issues
Related to #67762.
Additional information
Not a duplicate. I searched open PRs for
on_offline_eval_runners_recreatedand found only #67762, which changes that hook's docstring example, not this call site.Tests run
These ran in a Python 3.12 virtualenv with
ray[rllib]==2.59.0andtorch, withray/rlliblinked to this branch's source:TypeErrorabove.pytest python/ray/rllib/callbacks/tests/test_callbacks_on_algorithm.py, after the fix: "3 passed in 68.47s." That includes the existingtest_on_env_runners_recreated_callbackandtest_on_init_and_checkpoint_loaded.pre-commit run --fileson both changed files: all hooks pass.AI assistance (Claude Code) was used for this PR.
🤖 Generated with Claude Code