draft: refactor spawn - #516
Conversation
Greptile SummaryThe PR replaces legacy scene construction with a Spawn-backed declaration, preparation, and facade-binding lifecycle while preserving the existing simulation APIs.
Confidence Score: 2/5The PR does not appear safe to merge while Spawn attribute operations, articulation physics overrides, and failed-binding retries remain broken. Spawn-bound friction access still reaches methods that raise, articulation preparation still drops configured physics values, and a binding exception can leave a facade partially initialized and skipped on retry. Files Needing Attention: embodichain/lab/sim/objects/backends/spawn.py, embodichain/lab/sim/objects/rigid_object.py, embodichain/lab/sim/objects/articulation.py, embodichain/lab/sim/spawn/scene.py, and embodichain/lab/sim/sim_manager.py
|
| Filename | Overview |
|---|---|
| embodichain/lab/sim/sim_manager.py | Introduces the unified Spawn preparation boundary, but failed facade binding can still leave a non-retryable partial facade. |
| embodichain/lab/sim/spawn/scene.py | Coordinates declaration, commit, and facade binding; retry behavior still depends on mutable facade declaration state. |
| embodichain/lab/sim/objects/backends/spawn.py | Adds Spawn-backed ready views, while exposed rigid-body friction operations remain unsupported. |
| embodichain/lab/sim/objects/articulation.py | Adapts articulation binding and post-Spawn configuration, but configured physics overrides remain incompletely applied. |
| embodichain/lab/gym/envs/base_env.py | Splits scene declaration from post-prepare robot and sensor setup to consume runtime metadata only after materialization. |
| embodichain/lab/sim/spawn/descriptors.py | Introduces Spawn descriptor conversion for EmbodiChain physical object configurations. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Declare physical scene] --> B[Spawn descriptors]
B --> C[SimulationManager.prepare]
C --> D[Finalize Spawn scene]
D --> E[Prepare backend runtime]
E --> F[Bind EmbodiChain facades]
F --> G[Configure robot and sensors]
G --> H[Reset and step environment]
Reviews (13): Last reviewed commit: "modify default cfg" | Re-trigger Greptile
Review conclusionThe overall direction is sound: moving EmbodiChain to a single Spawn-owned declaration → prepare → bind lifecycle is the right architectural change. However, this PR is not ready to merge yet. The following items are EmbodiChain-side blockers. Merge blockers
Design simplifications
Required validation before mergePlease add coverage for failed-then-successful prepare/bind, direct-manager CPU usage, runtime add/remove, dynamic and kinematic rigid bodies, full and partial batch writes, rigid property round trips, articulation config overrides, fixed/floating roots, and state retention across rebuilds. The matrix should include PhysX CPU, PhysX Direct GPU, Newton semi-implicit, and Newton MuJoCo-Warp. The current PR has only the Greptile check, no functional CI or human approval, and it deletes the previous Newton lifecycle test without replacing it with tests for the new lifecycle. |
|
Want your agent to iterate on Greptile's feedback? Start a greploop in Codex and it will work through the open comments and keep going until this PR reviews clean. |
Summary
add_*APIs and stable object facades through a declaration → prepare → bind lifecycle.sim.prepare(), including rigid, articulation, robot, soft-body, cloth, and rigid-object-group integration.Validation
Type of change
Dependency
Requires the matching DexSim Spawn implementation.