You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix 7 critical and high-severity issues from comprehensive PR review
This commit addresses all critical and high-severity issues identified by the
pr-review-toolkit agents (code-reviewer, silent-failure-hunter).
CRITICAL FIXES:
1. viewer_client.py: Fix empty catch block in _cleanup_socket() (lines 66-79)
- Replaced `except Exception: pass` with specific exception handling
- Added logging for both expected (OSError) and unexpected errors
- Prevents silent resource leaks and debugging nightmares
2. rl_integration.py: Fix silent zero padding in _get_observation() (lines 673-701)
- Added validation to check for empty qpos/qvel arrays before processing
- Added observation size validation to prevent dimension mismatch
- Raises RuntimeError with clear error messages instead of silently padding
- Prevents RL training on garbage data
3. viewer_client.py: Fix _check_viewer_process() return type (lines 316-340)
- Changed return type from bool to bool | None
- Returns True if confirmed running, False if confirmed not running,
None if unable to determine (tool unavailable or error)
- Prevents misleading diagnostics when lsof unavailable
HIGH-SEVERITY FIXES:
4. mujoco_viewer_server.py: Fix handle_client() exception handling (lines 479-491)
- Split exception handling into expected (network/protocol) vs unexpected
- Let KeyboardInterrupt/SystemExit propagate (never suppress user interrupts)
- Re-raise unexpected exceptions to prevent masking bugs
5. multi_robot_coordinator.py: Fix _coordination_loop() fail-fast (lines 348-355)
- Distinguish transient errors (ConnectionError, TimeoutError) from critical
- Critical errors now set running=False and re-raise
- Prevents zombie coordination loops running with corrupted state
6. multi_robot_coordinator.py: Add CoordinatedTask validation (lines 95-100)
- Check for empty robot IDs (empty strings) in robots list
- Raises ValueError with clear error message showing problematic indices
- Prevents confusing runtime errors from empty IDs
7. rl_integration.py: Add RLConfig validation (lines 68-77)
- Validate observation_space_size and action_space_size are non-negative
- Validate reward_scale is not zero (would disable all rewards)
- Prevents RL environment initialization with nonsensical parameters
All fixes preserve existing functionality while improving error visibility
and preventing silent failures.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
0 commit comments