Skip to content

refactor(envs): move env-specific CLI + runtime init behind EnvSpec - #41

Merged
qurakchin merged 2 commits into
RLinf:mainfrom
qurakchin:refactor/main_split_env
Jul 24, 2026
Merged

refactor(envs): move env-specific CLI + runtime init behind EnvSpec#41
qurakchin merged 2 commits into
RLinf:mainfrom
qurakchin:refactor/main_split_env

Conversation

@qurakchin

Copy link
Copy Markdown
Collaborator

Introduce two Callable extension points on EnvSpec — parse_args and init_runtime — plus a RunConfig dataclass carrying the derived per-run identifiers (recipe_tag, output_dir, prompt_vars, dashboard_state, task_desc). rpent/cli/main.py is now env-agnostic: it no longer knows about LIBERO's suite/task/seed shape, endpoint parsing, or the env_server/vla_server subprocess wiring. Dropping a package under robots/ is enough to plug in a new env.

@jx-qiu

jx-qiu commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Nice, this is the long-awaited refactor for env interfaces. Let me check if the current EnvSpec abstraction is good enough for lerobot and franka.

@qurakchin
qurakchin requested review from andylin-hao and jx-qiu July 23, 2026 10:25
@qurakchin
qurakchin force-pushed the refactor/main_split_env branch from ea14193 to 6d1cac5 Compare July 23, 2026 10:26
@qurakchin qurakchin closed this Jul 23, 2026
@qurakchin qurakchin reopened this Jul 23, 2026
Comment thread rpent/envs/env_spec.py
Move env-specific CLI registration, config parsing, and runtime init
behind three EnvSpec hooks — add_cli_args / parse_config / init_runtime —
so rpent/cli/main.py no longer knows about LIBERO's suite/task/seed shape,
endpoint parsing, or env_server/vla_server subprocess wiring. A new
RunConfig dataclass carries the derived per-run identifiers (recipe_tag,
output_dir, prompt_vars, dashboard_state, task_desc) back to the runner.

Single argparse pass: main.py calls parse_known_args() first to grab
--env / --dashboard, then env_spec.add_cli_args(parser, use_dashboard=...)
registers env flags on the shared parser (use_dashboard=True makes
otherwise-required flags optional so the launcher can fill them), then
parser.parse_args() owns all validation. parse_config(args) runs after
the optional dashboard launcher to derive the RunConfig. init_runtime
spawns env_server + vla_server (or attaches via --env-endpoint /
--vla-endpoint) and returns (daemons, primitives_kwargs).

Dropping a package under robots/ is now enough to plug in a new env —
no central registry to edit. Docs (architecture / add_robot /
add_primitive, en + zh) synced with the new EnvSpec contract.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@qurakchin
qurakchin force-pushed the refactor/main_split_env branch from 6d1cac5 to 2e378ce Compare July 23, 2026 12:26
@qurakchin
qurakchin requested a review from Sonorous281 July 23, 2026 12:37
@qurakchin
qurakchin merged commit c7d084e into RLinf:main Jul 24, 2026
jx-qiu added a commit to jx-qiu/RPent that referenced this pull request Jul 24, 2026
The env refactor (RLinf#41) made rpent/cli/main.py env-agnostic: env-specific CLI
args and runtime init now live behind EnvSpec's add_cli_args / parse_config /
init_runtime hooks. Port lerobot and franka to that contract, mirroring
robots/libero:

- get_env_spec() now wires _add_cli_args / _parse_config / _init_runtime
  (previously these envs returned a bare EnvSpec(name, prompts), which no
  longer satisfies the now-required hook fields).
- _init_runtime moves the old CLI-side _init_lerobot / _init_franka spawn/attach
  logic into the env package (ProcessDaemon spawn with --transport http, or
  attach via --env-endpoint [socket|http]://host:port; lazy heavy imports).
- _parse_config derives a real-robot run identity (recipe_tag/output_dir/
  task_desc keyed by env name; no suite/task/seed) and returns
  dashboard_state=None (the dashboard is libero-shaped; a warning is logged if
  --dashboard is passed).
- main.py: widen --env choices to libero | lerobot | franka (the only CLI
  change; all other wiring is env-agnostic).

Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
jx-qiu added a commit to jx-qiu/RPent that referenced this pull request Aug 3, 2026
The env refactor (RLinf#41) made rpent/cli/main.py env-agnostic: env-specific CLI
args and runtime init now live behind EnvSpec's add_cli_args / parse_config /
init_runtime hooks. Port lerobot and franka to that contract, mirroring
robots/libero:

- get_env_spec() now wires _add_cli_args / _parse_config / _init_runtime
  (previously these envs returned a bare EnvSpec(name, prompts), which no
  longer satisfies the now-required hook fields).
- _init_runtime moves the old CLI-side _init_lerobot / _init_franka spawn/attach
  logic into the env package (ProcessDaemon spawn with --transport http, or
  attach via --env-endpoint [socket|http]://host:port; lazy heavy imports).
- _parse_config derives a real-robot run identity (recipe_tag/output_dir/
  task_desc keyed by env name; no suite/task/seed) and returns
  dashboard_state=None (the dashboard is libero-shaped; a warning is logged if
  --dashboard is passed).
- main.py: widen --env choices to libero | lerobot | franka (the only CLI
  change; all other wiring is env-agnostic).

Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
jx-qiu added a commit to jx-qiu/RPent that referenced this pull request Aug 6, 2026
The env refactor (RLinf#41) made rpent/cli/main.py env-agnostic: env-specific CLI
args and runtime init now live behind EnvSpec's add_cli_args / parse_config /
init_runtime hooks. Port lerobot and franka to that contract, mirroring
robots/libero:

- get_env_spec() now wires _add_cli_args / _parse_config / _init_runtime
  (previously these envs returned a bare EnvSpec(name, prompts), which no
  longer satisfies the now-required hook fields).
- _init_runtime moves the old CLI-side _init_lerobot / _init_franka spawn/attach
  logic into the env package (ProcessDaemon spawn with --transport http, or
  attach via --env-endpoint [socket|http]://host:port; lazy heavy imports).
- _parse_config derives a real-robot run identity (recipe_tag/output_dir/
  task_desc keyed by env name; no suite/task/seed) and returns
  dashboard_state=None (the dashboard is libero-shaped; a warning is logged if
  --dashboard is passed).
- main.py: widen --env choices to libero | lerobot | franka (the only CLI
  change; all other wiring is env-agnostic).

Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
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.

3 participants