Commit fe1c480
fix(libero_90): harden Libero90BaseTask._get_initial_states like its sibling (#789)
`Libero90BaseTask._get_initial_states` called
`get_traj(self.traj_filepath, self.scenario.robots[0], self.handler)` with no
guards, so a missing/empty trajectory raised an uncaught
FileNotFoundError/ValueError and a robotless scenario raised IndexError —
unlike the already-hardened `LiberoBaseTask._get_initial_states`, which
degrades to None (handler defaults) in those cases. The missing/empty-traj
crash is a real reachable path (e.g. a failed/absent demo download); the
robotless one is latent (all real libero_90 tasks declare robots=["franka"];
the only robotless files are empty 0-byte stubs).
Fix: lift the hardened pattern verbatim — return None when traj_filepath is
falsy, resolve `robot_ref` defensively, wrap `get_traj` in
`try/except (FileNotFoundError, KeyError, ValueError)`, and return None on an
empty result, before the unchanged replicate-to-num_envs logic. None is the
established base contract (`BaseTaskEnv._get_initial_states` already returns
None; `set_states(None)` is a no-op fallback), so no downstream regression;
the happy path is byte-identical.
Test: new `test_libero_90_get_initial_states_degrades_gracefully` exercises
all three guards (no-traj, get_traj raises, empty result) — red before the
fix (IndexError at robots[0]). `tests/test_libero_fixes.py` 4 passed; the
libero suite 22 passed, 14 skipped. Reviewed by 3 fresh-context agents.
Co-authored-by: geng-haoran <ghr@somastacks.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 495bc90 commit fe1c480
2 files changed
Lines changed: 69 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
49 | 67 | | |
50 | 68 | | |
51 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
0 commit comments