Commit 3fc92b8
fix(registry): make reward manager registration idempotent
In distributed environments like Ray, modules may be imported multiple
times across workers. This caused `ValueError` when the same reward
manager class was registered more than once, even though the classes
were functionally identical.
The fix compares class identifiers (module + qualname) instead of class
objects directly. Re-registering the same class (by qualified name) is
now silently accepted, while registering different classes with the same
name still raises an error.
- Added `_get_class_identifier()` helper function
- Updated `register()` decorator with idempotent behavior
- Added test for idempotent registration
Fixes #4718
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent 56d18ec commit 3fc92b8
File tree
2 files changed
+44
-4
lines changed- tests/workers/reward_manager
- verl/workers/reward_manager
2 files changed
+44
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
24 | 33 | | |
25 | 34 | | |
26 | 35 | | |
27 | 36 | | |
28 | 37 | | |
29 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
30 | 45 | | |
31 | 46 | | |
32 | 47 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
37 | 59 | | |
38 | 60 | | |
39 | 61 | | |
| |||
0 commit comments