Skip to content

refactor(manager): generalize action terms and joint-position actions - #93

Merged
wlgys8 merged 1 commit into
mainfrom
refactor/action-term-joint-position
Oct 2, 2026
Merged

wlgys8 merged 1 commit into
mainfrom
refactor/action-term-joint-position

Conversation

@wlgys8

@wlgys8 wlgys8 commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • generalize manager ActionTerm with shared ActionState history and host-side processing/reset lifecycle
  • move reusable JointPositionAction implementation and action-space helpers into motrix_env_core
  • migrate WBT and related consumers, compiler/kernel-data lowering, fingerprints, tests, and manager docs
  • simplify JointPositionAction routing and fix actuator-subset joint-limit handling

Validation

  • motrix_env_core/tests/test_action_state.py
  • motrix_env_core/tests/test_function_fingerprint.py
  • motrix_env_core/tests/test_kernel_data_methods.py
  • motrix_env_core/tests/test_numba_manager.py
  • motrix_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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 High severity · 3 Low severity

Open (7)
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 ActionState ring buffer + ActionTerm host wrapper; relocate generic JointPositionAction* to core.
  • Add @dispatch kernel-data method lowering and a shared function_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.

Comment thread motrix_env_core/tests/test_model_query_dispatch.py Outdated
Comment thread motrix_env_core/tests/test_sim_write_dispatch.py Outdated
Comment thread motrix_envs/tests/test_wbt_numba.py
Comment thread motrix_env_core/src/motrix_env_core/mdp/action.py
Comment thread motrix_env_core/src/motrix_env_core/numba/manager/actions.py Outdated
Comment thread motrix_env_core/src/motrix_env_core/numba/manager/env.py Outdated
@wlgys8
wlgys8 force-pushed the refactor/action-term-joint-position branch 3 times, most recently from de4fe7a to 8865688 Compare October 2, 2026 05:00
@wlgys8
wlgys8 requested a balanced review from Copilot October 2, 2026 05:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Low severity

Open (1)
Resolved since last review (7)

Comment thread motrix_env_core/tests/test_model_query_dispatch.py Outdated
@wlgys8
wlgys8 force-pushed the refactor/action-term-joint-position branch from 8865688 to c51ad58 Compare October 2, 2026 05:51
@wlgys8
wlgys8 force-pushed the refactor/action-term-joint-position branch from c51ad58 to cba2f49 Compare October 2, 2026 05:57
@wlgys8
wlgys8 requested a balanced review from Copilot October 2, 2026 06:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Low severity

Open (3)

Comment thread wiki/design/manager/runtime.md
Comment thread wiki/design/manager/task-authoring.md
@wlgys8
wlgys8 merged commit 9fd494c into main Oct 2, 2026
6 checks passed
@wlgys8
wlgys8 deleted the refactor/action-term-joint-position branch October 3, 2026 14:30
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