Skip to content

Conversation

@pseudo-rnd-thoughts
Copy link
Member

Description

The MultiAgentEnvRunner would previously call the callback twice for the final episode of a batch (when sampling a fixed number of episodes). This PR fixes this problem ensuring that the callback only happens once for finished episode

Related issues

Closes #55452

Mark Towers added 2 commits November 23, 2025 13:38
… final episode when sampling a fixed number of episodes

Signed-off-by: Mark Towers <[email protected]>
Signed-off-by: Mark Towers <[email protected]>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively resolves an issue where a connector callback was being invoked twice for the final episode in a batch. The fix is well-implemented by conditionally skipping the on_episode_created callback for the transient, newly created episode that replaces the final completed one. The added test case, which uses a custom EpisodeTracker connector, is a great way to verify the fix and ensure the callback is only triggered once per completed episode. I have one minor suggestion to improve the test code's style.

@ray-gardener ray-gardener bot added the rllib RLlib related issues label Nov 24, 2025
@pseudo-rnd-thoughts pseudo-rnd-thoughts added the go add ONLY when ready to merge, run all tests label Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests rllib RLlib related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Rllib] MultiAgentEnvRunner in episodes mode calls connectors one time too many.

1 participant