feat(gym): add declarative expert program runtime - #497
Open
yuecideng wants to merge 1 commit into
Open
Conversation
This was referenced Aug 11, 2026
yuecideng
marked this pull request as ready for review
August 11, 2026 16:46
Greptile SummaryThe PR adds a strict, versioned Expert Program configuration and compilation pipeline that lazily lowers declarative semantic programs into the existing Gym action lifecycle.
Confidence Score: 5/5The PR appears safe to merge based on the reviewed changes, with no concrete actionable defects remaining. The new compilation, lazy execution, cancellation, vector-row masking, and configuration paths preserve the existing environment-step lifecycle, and investigated failure paths were either explicitly handled or contradicted by repository behavior and tests.
|
| Filename | Overview |
|---|---|
| embodichain/lab/gym/envs/demo.py | Extends segment execution with owned processed actions, per-row failure policies, emergency cancellation, stricter metadata, and preserved exception propagation. |
| embodichain/lab/gym/envs/expert_program/compiler.py | Introduces bounded preflight compilation and deterministic lazy expansion for sequential, repeated, segmented, and parallel programs. |
| embodichain/lab/gym/envs/expert_program/bridge.py | Bridges compiled segments into the existing env.step() cadence with buffered commands, lifecycle tracking, cancellation, and row eligibility. |
| embodichain/lab/gym/envs/expert_program/environment.py | Defines the adapter and factory boundaries used to compile programs, assemble semantic components, preflight execution, and create bridges. |
| embodichain/lab/gym/envs/expert_program/simulation_environment.py | Adds simulation observation, command-state evidence, scene snapshots, and runtime integration for Expert Programs. |
| embodichain/lab/gym/envs/expert_program/simulation_policies.py | Implements bounded simulation post-policies and settling behavior using ordinary environment steps. |
| embodichain/lab/gym/envs/embodied_env.py | Integrates Expert Program configuration and processed demo actions into environment execution and rollout recording. |
| embodichain/lab/scripts/run_env.py | Adds CLI/configuration loading for Expert Programs while preserving normal episode commit and abort handling. |
Sequence Diagram
sequenceDiagram
participant Config as Expert Program Config
participant Loader as Decoder / Loader
participant Compiler as Preflight Compiler
participant Bridge as Lazy Demo Bridge
participant Runtime as Semantic / Atomic Runtime
participant Env as EmbodiedEnv
Config->>Loader: Load strict versioned document
Loader->>Compiler: Decode typed program
Compiler->>Compiler: Validate resources, calls, and policies
Compiler-->>Bridge: Compiled lazy segment stream
loop Each segment and command
Bridge->>Runtime: Observe and ground semantic call
Runtime-->>Bridge: Controller-ready action
Bridge->>Env: env.step(processed action)
Env-->>Bridge: termination, failure, and metadata
end
Bridge-->>Env: Segment validation and completion metadata
Reviews (1): Last reviewed commit: "feat(gym): add declarative expert progra..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Stack
feat/semantic-skill-runtimeAdd the strict, versioned Expert Program configuration, decoder, loader, preflight compiler, lazy segment runtime, Gym demo bridge, simulation factory, settling policies, validators, and completion metadata.
The environment retains its normal
env.step()cadence and dataset lifecycle. Expert Programs compile into the existing semantic/atomic runtime instead of creating a third workflow engine.Refs #471
Refs #474
Type of change
Screenshots
Not applicable.
Validation
tests/gym/envs/expert_program, demo, settling, registration, and run-env integration testsChecklist