Skip to content

Behavior - #133

Open
scilwb wants to merge 88 commits into
RLinf:mainfrom
scilwb:behavior
Open

scilwb wants to merge 88 commits into
RLinf:mainfrom
scilwb:behavior

Conversation

@scilwb

@scilwb scilwb commented Aug 31, 2026

Copy link
Copy Markdown

Rework progress

Branch rebuilt on latest main (includes #136, #132, #142, #148).

Validation

  • Official task success on turning_on_radio (seed 0), twice: real Codex planner, info["done"]["success"] == true, terminal receipt SHA-verified, recipe_<tag>.jsonl (LIBERO format), bounded streaming episode.mp4
  • Dashboard: three physical cameras mapped correctly, solved text gated on official success, TaskRun recipe flow works for BEHAVIOR
  • Fresh dual-venv install + checkpoint SHA-256 binding + assets verified; pytest 259 passed, pre-commit, en/zh Sphinx -W

Key commits

  • VLA on the shared pi05 component (feat: support pi05 for different env #136) — private VLA client/server and FastAPI transport deleted; BEHAVIOR registered inline (3 cameras, R1Pro proprio, 32→23 dims, norm_stats_path); checkpoint single-sourced via --checkpoint-manifest: dc8f9cb 0a7a0c3 75e4352 6185b57
  • ENV/DINO on shared RPC basesBaseEnvFacade/BaseEnvClient with standard step/chunk_step, DINO on RpcFacade with dino.get_meta, try_spawn_server/try_wait_server, gripper RPCs renamed: 6a016ce b4f6dba 29e53ca 17e8b7d
  • ENV serving via upstream MainThreadServeMixin (feat: support session-aware rpc client / server #132) — custom main-thread server class deleted: bd405b8
  • Memory unified — official MemoryManager (inbox_write/read_only), shared EnvState for receipts/frames, recipe as recipe_<tag>.jsonl (LIBERO contract), --auto-merge-memory arg matching LIBERO: 02a9727 f8b0db9 7a6619d
  • Primitives contracted to 9save_robot_state_checkpoint/move_both_to/get_prepared_motion_status removed; move_to absorbs dual-hand; shared ToolResult flat multi-view fields; BehaviorToolResult deleted; prompts mark motion stubs unavailable: e298654 c27a15d
  • Explore via standard entryrpent --robot behavior --behavior-mode explore --explore; per-session env sidecar restart, VLA/DINO shared;
  • Dashboard aligned — robot-local dashboard code/buttons removed (declarative spec only); three-camera mapping and solved-text gating fixed in shared dashboard; solved/recipe flow applies to BEHAVIOR TaskRuns: c863207 bf90cbb 58be838
  • Bounded streaming episode video — dead video_path removed; EnvState.open_video_writer (≤2000 frames): 5e9818d e1f34f0
  • Official success validation hardened — success only from the fixed terminal_receipt.json with SHA verification: 98f9bd8
  • Install & docs aligned — console scripts replace shell scripts (behavior-install-runtime/behavior-download-assets/behavior-build-memory); .[behavior] documented as RPent-side only; BEHAVIOR below RoboTwin; prompts aligned with LIBERO (_RuntimeText removed): 6535b20 f566960 e14f3f0
  • Planner fix (pre-existing main bug) — recoverable stream errors after a successful finish no longer poison result.error (successful runs could exit 1 and skip memory merge): 943dcd3
  • Directory organization & test hygienedino_v2/ + memory/ packages, rlinf_env.py, factory env vars deleted, sibling-style contract tests only: e3643a2 100f02a

Deferred

  • Motion primitives (navigate_to/move_to/rotate_wrist/open/close/press) return motion_unavailable; cuRobo motion stack ports in a follow-up PR

Copilot AI lite review requested due to automatic review settings August 31, 2026 13:17

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.

Pull request overview

Adds a new robots/behavior integration to run BEHAVIOR-1K tasks in RPent, including runtime sidecars (ENV/VLA/DINO), Dashboard support, pinned asset/checkpoint verification, and end-to-end English/Chinese documentation for installation and usage.

Changes:

  • Introduce BEHAVIOR robot plugin (RobotSpec, toolkit/primitives, task specs, success semantics, outer explore harness).
  • Add runtime sidecars + clients for ENV RPC, Pi0.5 VLA HTTP serving, and DINOv2 memory embeddings with pinned asset identities.
  • Add reproducible dual-venv install/verification/dashboard scripts and update docs/READMEs + pyproject extras.

Reviewed changes

Copilot reviewed 48 out of 48 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/verify_behavior_assets.sh Validates required BEHAVIOR assets + DINO/Policy checkpoint contracts.
scripts/run_behavior_dashboard.sh Launch wrapper for BEHAVIOR Dashboard sessions (env/model GPU binding, paths).
scripts/install_behavior_runtime.sh Reproducible dual-venv installer + pinning/manifest generation for BEHAVIOR runtime.
rpent/dashboard/static/dashboard.js Dashboard realtime frame refresh logic update for unavailable-frame retry behavior.
rpent/dashboard/state.py Applies frame-path projection from tool results to keep Dashboard frames in sync.
rpent/cli/dashboard.py Allows robot-provided Dashboard server/state classes + runtime backend binding hooks.
robots/behavior/vla_server.py Pi0.5 FastAPI sidecar for BEHAVIOR action inference (/predict + action gating).
robots/behavior/vla_client.py HTTP client wrapper for the BEHAVIOR VLA sidecar.
robots/behavior/tools.py BEHAVIOR primitive handlers + result sanitization and official-success latching.
robots/behavior/toolkit.py Toolkit bridge exposing BEHAVIOR tools + dashboard event emission + receipt writing.
robots/behavior/terminal_success.py Implements “official success only” semantics and receipt validation helpers.
robots/behavior/task_specs.py Source-controlled task/seed mapping + per-task policies (radio/trash tasks).
robots/behavior/selfcheck.py Lightweight import/config/tool-surface selfcheck for the BEHAVIOR plugin.
robots/behavior/robot_spec.py BEHAVIOR RobotSpec + dashboard spec + toolkit factory wiring.
robots/behavior/prompts/user.py BEHAVIOR user prompt section body.
robots/behavior/prompts/system.py BEHAVIOR system prompt section bodies (evidence/termination discipline).
robots/behavior/prompts/init.py Package marker for BEHAVIOR prompt sections.
robots/behavior/prompt_bundle.py Prompt assembly from runtime variables with safe opaque runtime text blocks.
robots/behavior/policy_checkpoint.py Checkpoint identity contract + binding/verification for Pi0.5 BEHAVIOR checkpoint.
robots/behavior/memory_schema.py Deterministic validation helpers for episode-memory schema hashing/canonical JSON.
robots/behavior/memory_embeddings_dinov2.py Pinned DINOv2 embedding identity + safe source extraction + CUDA backend encoder.
robots/behavior/harness.py Outer multi-attempt Explore harness (process-isolated retries + receipt summarization).
robots/behavior/env_server.py Main-thread HTTP RPC server for OmniGibson/BEHAVIOR env backend adapter.
robots/behavior/env_client.py RPC client enforcing terminal-success semantics and decoding bytes payloads.
robots/behavior/dino_server.py DINOv2 encoder RPC server with pinned asset validation + CUDA requirement.
robots/behavior/dino_client.py RPC client wrapper for the optional DINO component (normalization + meta checks).
robots/behavior/dashboard/static/behavior_controls.css BEHAVIOR-specific Dashboard controls styling and layout.
robots/behavior/init.py Exports BEHAVIOR entrypoints (get_robot_spec, get_toolkit).
README.zh-CN.md Adds BEHAVIOR entry to Chinese “What’s new” + feature matrix.
README.md Adds BEHAVIOR entry to English “What’s new” + feature matrix.
pyproject.toml Adds behavior extra dependency set for BEHAVIOR-facing RPent deps.
docs/source-zh/rst_source/usage/behavior.rst Full Chinese BEHAVIOR install/asset/runtime/dashboard workflow docs.
docs/source-zh/rst_source/installation.rst Documents BEHAVIOR extra and explains why it’s excluded from .[full].
docs/source-zh/rst_source/development/architecture.rst Updates architecture docs to include behavior robot package.
docs/source-zh/rst_source/development/add_robot.rst Updates add-robot docs to reflect current standard robot packages.
docs/source-zh/index.rst Adds BEHAVIOR to Chinese docs index and front-page overview text.
docs/source-en/rst_source/usage/behavior.rst Full English BEHAVIOR install/asset/runtime/dashboard workflow docs.
docs/source-en/rst_source/installation.rst Documents BEHAVIOR extra and explains why it’s excluded from .[full].
docs/source-en/rst_source/development/architecture.rst Updates architecture docs to include behavior robot package.
docs/source-en/rst_source/development/add_robot.rst Updates add-robot docs to reflect current standard robot packages.
docs/source-en/index.rst Adds BEHAVIOR to English docs index and front-page overview text.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread robots/behavior/vla_client.py Outdated
Comment thread robots/behavior/vla_server.py Outdated
Comment thread README.zh-CN.md Outdated
Comment thread robots/behavior/task_specs.py
Comment thread docs/source-en/rst_source/usage/behavior.rst Outdated
Comment thread docs/source-en/rst_source/usage/behavior.rst Outdated
Comment thread robots/behavior/dino_v2/server.py
Comment thread robots/behavior/env_server.py Outdated
Comment thread robots/behavior/env_server.py Outdated
Comment thread robots/behavior/harness.py Outdated
return 0 if successful_attempts else 1


def main(argv: Sequence[str] | None = None) -> int:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this file for explore mode? please use the style like libero.

Comment thread robots/behavior/dino_v2/encoder.py
Comment thread robots/behavior/memory/schema.py
Comment thread robots/behavior/prompts/system.py
Comment thread robots/behavior/prompt_bundle.py Outdated
Comment thread robots/behavior/runtime.py
Comment thread robots/behavior/vla_client.py Outdated
Comment thread docs/source-en/rst_source/usage/behavior.rst Outdated
Comment thread docs/source-en/rst_source/usage/behavior.rst Outdated
Comment thread docs/source-en/rst_source/usage/behavior.rst Outdated

See :doc:`../development/add_primitive` for the tool-extension walkthrough.

Reproducing results

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please show the reproduced results

Comment thread docs/source-en/rst_source/installation.rst Outdated
Comment thread docs/source-en/index.rst Outdated
Comment thread robots/behavior/dashboard/static/behavior_controls.css Outdated
Comment thread robots/behavior/dino_server.py Outdated
Comment thread docs/source-en/rst_source/usage/behavior.rst Outdated
- Explore 只构造一个 ``inbox_write`` MemoryManager,写入范围限定为
``<memory-dir>/_inbox/<recipe-tag>``;
- ``MEMORY.md``、``global/``、``suite/``、``task/``、``_inbox/`` 和
``_merged/`` 保持 RPent 标准语义。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are these memory paths still aligned with the current memory contract? the implementation now uses _internal/inbox and task_only, while this section still documents _inbox, task, and _merged.

Comment thread robots/behavior/env_client.py Outdated
Comment thread robots/behavior/sft_offline_converter.py Outdated
Comment thread robots/behavior/sft_offline_converter.py Outdated
help="Alias for --public-seed for dashboard and legacy launchers.",
)
parser.add_argument(
"--behavior-mode",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do we need both --explore and --behavior-mode to represent exploration? could behavior use the shared exploration state like libero, so cli and dashboard do not need separate mode handling?

output_dir = Path(output_dir).expanduser().resolve()
requested_memory_profile = getattr(args, "memory_profile", None)
memory_profile = str(requested_memory_profile or "local")
if memory_profile != "local":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there a behavior-specific reason to require the local memory profile for normal evaluation? libero follows the shared pattern of hf for normal evaluation and local memory for exploration.


owned_daemons: dict[str, ProcessDaemon] = {}
primitives_kwargs: dict[str, Any] = {}
pending_env: tuple[ProcessDaemon | None, RpcClient] | None = None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could this use the same starters, connectors, and timeouts pattern as libero and robocasa? the shared spawn helpers are already used, but the env, vla, and dino paths are still expanded separately.

"env.press": 1800.0,
}

def __init__(self, client: RpcClient, *, expected_meta: dict[str, Any]) -> None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this subclass currently bypasses base envclient initialization and reimplements much of the reset, step, chunk_step, and camera flow.

"side_or_indeterminate",
)

PUBLIC_TOOL_CONTRACTS: dict[int, tuple[str, ...]] = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need to keep public tool contract versions 1 through 4 for a new integration that has not shipped yet? could we keep only the current tool surface unless there is an actual compatibility requirement?

self._last_info = info_dict
return info_dict

def _reset_raw(self) -> tuple[Any, dict[str, Any]]:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since this integration installs a pinned rlinf revision, do we need to support reset_raw, env_reset, and generic reset at the same time?

Comment thread rpent/dashboard/state.py
return ()


def _result_official_success(result: dict[str, Any], *, terminated: bool) -> bool:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could the behavior layer normalize this into a generic official_success field instead? that would avoid making the shared dashboard understand the behavior-specific receipt schema and info done success path.

)
from rpent.robots.components.pi05_vla_client import Pi05VLAClient

expected_binding = validate_policy_checkpoint(args.policy_checkpoint)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need to hash the full checkpoint again in _connect_vla after the manifest was already generated and validated before the server started?

compile_catalog.add_argument("--source-archive", required=True, type=Path)
compile_catalog.add_argument("--weights", required=True, type=Path)
compile_catalog.add_argument("--cache-dir", type=Path, default=None)
compile_catalog.add_argument("--cuda-device", choices=("2", "7"), required=True)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do we still need a second cli here now that behavior-build-memory is the public entry point? this one also hardcodes cuda devices 2 and 7, which looks machine-specific.

).encode("utf-8")


def official_success_receipt_sha256(receipt: Mapping[str, Any]) -> str:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do we need a separate sha-verified receipt for success inside the same runtime path?

):
assert value in system or value in user

ordered_sections = [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could this test focus on successful rendering and required variables rather than the exact prompt section order and wording? otherwise normal prompt cleanup would require updating the test as well.

========

`BEHAVIOR-1K <https://behavior.stanford.edu/>`_ 基于 OmniGibson 提供长程家庭任务。
RPent 当前把 ``turning_on_radio`` 和 ``picking_up_trash`` 作为标准 sibling

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could we make the chinese wording here more natural and keep english mainly for established api or project names? phrases such as 接入合同, 标准 sibling robot plugin,源码 editable...

Comment thread pyproject.toml
[tool.setuptools.packages.find]
where = ["."]
include = ["rpent*"]
include = ["rpent*", "robots", "robots.behavior*"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there a reason to package only robots.behavior while the sibling robot integrations remain source-checkout plugins? could the behavior entry points follow the same packaging model as the other robots?

Comment thread pyproject.toml
"rpent[rlinf]",
"rpent-openpi @ git+https://github.com/RLinf/openpi.git@rpent",
# OpenPI's tool.uv source is not propagated through package metadata.
"lerobot @ git+https://github.com/huggingface/lerobot.git@0cf864870cf29f4738d3ade893e6fd13fbd7cdb5",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we drop the explicit LeRobot pin here as well to stay aligned with latest main? #154 removed the same pin from the OpenPI-based LIBERO extras

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.

5 participants