Skip to content

Conversation

@corbt
Copy link
Contributor

@corbt corbt commented Aug 7, 2025

Fixes a bug where the after_each callback in gather_trajectory_groups was causing group duplication by appending returned groups to the existing processed_groups list.

Problem

When using gather_trajectory_groups with an after_each callback, the function was duplicating trajectory groups. The callback would return the same groups it received (possibly after processing), but these returned groups were being appended to the existing processed_groups list rather than replacing it.

This resulted in:

  • Original groups: 12 (as configured by groups_per_step)
  • Final groups: 24 (original + callback returned groups)

Solution

Reset processed_groups to an empty list before collecting the after_each callback results, ensuring only the callback-returned groups are included in the final output.

Testing

Verified that model 237 in art-e now correctly shows 12 groups submitted instead of the previous 20-24.

The after_each callback in gather_trajectory_groups was causing group
duplication by appending returned groups to the existing processed_groups
list. This resulted in both the original groups and the groups returned
by the callback being included in the final result.

Fixed by resetting processed_groups to an empty list before collecting
the after_each callback results, ensuring only the callback-returned
groups are included in the final output.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-46ce9369-cd67-44ca-b963-75c14498132e
@corbt
Copy link
Contributor Author

corbt commented Aug 7, 2025

This was a bug that I recently (inadvertently) introduced on main, so I'm just going to merge.

@corbt corbt merged commit 82bc896 into main Aug 7, 2025
2 checks passed
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.

2 participants