refactor(manager): generalize action terms and joint-position actions - #93
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The deleted wbt/mdp/action.py is still imported by wbt/cfg.py and humanoid/cfg.py, and two tests import Link* write/query symbols that do not exist in the source, so multiple modules and tests fail at import.
Review effort: Balanced
Findings: 4
Open (7)
Test imports renamed Link query classes that do not exist · New Test imports renamed Link write classes that do not exist · New Humanoid cfg still imports deleted WbtControlCfg APIs · New WBT cfg still imports deleted WbtJointPositionActionCfg · New Add test coverage for non-zero action delay path · New Fix grammar: use an ActionState · New Error message misuses queue width for action dimension · New
What changed in this PR
This PR refactors the manager-based action pipeline in motrix_env_core. It splits the old per-term action object into a host-side ActionTerm (owns the action space and lifecycle process()/reset()) and a @kernel_data ActionState that holds a manager-owned raw-action ring buffer (action_queue) plus a shared cursor (action_ptr), exposing current()/previous() as kernel-lowerable views. The reusable JointPositionAction implementation and action-space helpers are moved into motrix_env_core.mdp.action/action_space, a shared function_fingerprint is extracted to numba/fingerprint.py, and kernel_data gains @dispatch method lowering so these views compile into the kernel ABI. Consumers (WBT, ball_balance, humanoid-walk), the compiler/env lowering, docs, and tests are updated accordingly.
Changes:
- Introduce manager-owned
ActionStatering buffer +ActionTermhost wrapper; relocate genericJointPositionAction*to core. - Add
@dispatchkernel-data method lowering and a sharedfunction_fingerprint, with new tests. - Migrate action consumers and update WBT/manager tests and manager design docs.
| File | Description |
|---|---|
| numba/manager/actions.py | New ActionState (current/previous) and reworked ActionTerm base lifecycle. |
| numba/manager/env.py | Build action terms, validate action_queue shape, use term.action_space. |
| numba/manager/compiler/{compiler,fingerprint}.py | Lower term.state; move function_fingerprint out of compiler fingerprint. |
| numba/fingerprint.py | New shared function-dependency fingerprint via marshal. |
| numba/kernel_data/lowering.py | Lower @dispatch methods into the kernel ABI; fold method fingerprints into cache keys. |
| mdp/action.py, mdp/action_space.py | Generic JointPositionActionCfg/Term/State (+ delay path) and documented space helpers. |
| mdp/observations.py, mdp/rewards.py | Read actions via current()/previous() and .state. |
| manager/__init__.py | Re-export ActionState. |
| wbt/mdp/{action.py,rewards,terminations,reset}.py, k1.py, dex_evt.py | Delete WBT action module; repoint consumers to core symbols. |
| ball_balance/microduck.py, humanoid/walk_manager_mdp/rewards.py | Migrate to JointPositionActionCfg / new action API. |
| tests/* | New test_action_state, test_function_fingerprint, test_kernel_data_methods; update manager/WBT/obs/write/query tests. |
| wiki/design/manager/{runtime,task-authoring}.md | Document the new ActionState/ActionTerm contract. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
de4fe7a to
8865688
Compare
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It reworks core manager action ABI plus Numba kernel-data method lowering and fingerprint-based cache invalidation—correctness-critical, hard-to-verify infrastructure that warrants human review despite the thorough test suite.
Review effort: Balanced
Findings: 1
Open (1)
Resolved since last review (7)
WBT cfg still imports deleted WbtJointPositionActionCfg Humanoid cfg still imports deleted WbtControlCfg APIs Test imports renamed Link write classes that do not exist Test imports renamed Link query classes that do not exist Error message misuses queue width for action dimension Fix grammar: use an ActionState Add test coverage for non-zero action delay path
8865688 to
c51ad58
Compare
c51ad58 to
cba2f49
Compare
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It reworks core numba kernel-data lowering/fingerprinting and the manager action ABI across many consumers, which warrants human review despite the code logic appearing correct and well-tested.
Review effort: Balanced
Findings: 3


Summary
Validation
motrix_env_core/tests/test_action_state.pymotrix_env_core/tests/test_function_fingerprint.pymotrix_env_core/tests/test_kernel_data_methods.pymotrix_env_core/tests/test_numba_manager.pymotrix_envs/tests/test_wbt_numba.py(71 passed across focused action/manager/WBT runs)This PR intentionally excludes the unrelated G1 terrain/randomization changes and the untracked
configs/task/g1-walk-terrain/file.