Skip to content

feat(motion): add source-neutral generation foundation - #681

Open
yuecideng wants to merge 40 commits into
mainfrom
codex/generation-foundation
Open

yuecideng wants to merge 40 commits into
mainfrom
codex/generation-foundation

Conversation

@yuecideng

@yuecideng yuecideng commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add the source-neutral foundation for high-throughput expert trajectory generation.

This PR defines the shared contracts needed to combine Affordance and trajectory expansion across handwritten experts, MotionGenerator, Atomic Actions, and Task Program adapters. Runtime randomization and observation fan-out profiles are deliberately deferred until their physical and persistence owners exist. It intentionally keeps physical execution, fixed-scene restoration, candidate scheduling, and dataset persistence out of this layer.

Included

  • Add source-neutral SourceAdapter boundary with handwritten-template and MotionGenerator PlanResult adapters.
  • Add same-grid ActionPlanTemplateAdapter for explicit phase permissions.
  • Add source-neutral CandidateSpec:
    • one slot-independent candidate identity;
    • separate Affordance and trajectory provenance;
    • compatibility key and estimated execution cost;
    • post-rollout observation profiles without creating extra physical candidates.
  • Extend TrajectoryGenerationJobCfg into a reusable Generation Profile:
    • handwritten, MotionGenerator, Atomic Action, and Task Program source kinds;
    • reference-family budget;
    • Affordance proposal budget;
    • a single reference-family budget owned by scheduling;
    • FIFO or coverage-per-cost scheduling;
    • bounded in-flight execution settings.
  • Add world-frame Affordance sampling provenance for selected poses, reference poses, row IDs, and geometric success.
  • Add a same-grid ActionPlanTemplateAdapter and Atomic materialization helper.
  • Add a call-scoped Atomic plan_transform hook:
    • normal ActionPlan is validated first;
    • collector-owned transform runs once for that planning call;
    • transformed ActionPlan is validated again before execution.
  • Keep the API independent of Task Program and environment slot identity.

Deliberately excluded

  • Task Program-specific Affordance collection;
  • run-env collector routing;
  • fixed-scene host and initial-state restoration;
  • C>B candidate queues and physical slot scheduling;
  • unified EpisodeSink implementation;
  • measured rollout coordinator;
  • coverage/cost execution policy.

Those belong in the next integration layer and should reuse these contracts instead of adding a second identity or configuration protocol.

Dependencies and relationship to existing PRs

Refs #670, #591, #594, #653

Validation

  • Focused motion, expansion, Affordance, and Atomic tests: 475 passed.
  • python docs/scripts/check_api_docs.py: 2259/2259 exports documented.
  • Changed-file Black checks passed.
  • git diff --check passed.
  • Same-grid ActionPlan/template materialization is covered by focused Atomic tests; no physical/GPU rollout is claimed by this foundation PR.

Type of change

  • Bug fix
  • Enhancement
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • I have run Black on changed files.
  • I have added tests for the new contracts and call-scoped transform.
  • Public API documentation coverage is aligned.
  • Dependencies have been reviewed; no dependency changes are required.
  • The design does not add Task Program DSL or task-specific configuration.

Follow-up decision for #591 / #594

The fixed-scene host, LeRobot sink, PickUp contact validator, and Atomic Runtime execution remain deferred. They belong in the Coordinator/PhysicalExecutor layer and should consume this source adapter and CandidateSpec contract rather than be copied into the foundation.

@yuecideng yuecideng added enhancement New feature or request motion gen Things related to motion generation for robot atomic action atomic action related functionality labels Sep 23, 2026
@yuecideng
yuecideng marked this pull request as ready for review September 23, 2026 15:51
@greptile-apps

greptile-apps Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Adds motion generation foundation and task program integration.

The PR is not yet safe to merge because distinct Affordance branches can still be collapsed into one candidate.

Fix All in CodexFindings

  1. P1 Affordance branches are collapsed ▶
Fix with agent prompt
### Issue 1
embodichain/lab/sim/motion/expansion/coordinator.py:311-316
When two distinct Affordance branches produce identical trajectory samples, this global trajectory-only fingerprint treats the second branch as a duplicate. Because Affordance provenance and the compatibility key are attached only after this check, the second branch never receives its own candidate identity and cannot be scheduled, losing its lineage.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR adds source-neutral generation contracts, source adapters, candidate coordination, and call-scoped Atomic plan transforms, with Task Program integration and a configured showcase. Physical execution remains behind host-owned interfaces.

  • The remaining concern is the previously reported loss of distinct Affordance branches during candidate deduplication.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Source[Source adapter] --> Template[Trajectory template]
  Template --> Coordinator[Candidate coordinator]
  Coordinator --> Session[Generation session]
  Session --> Host[Host-owned execution and persistence]
Loading

Reviews (8) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..."

Comment thread embodichain/lab/sim/atomic_actions/engine.py
Comment thread embodichain/lab/sim/atomic_actions/engine.py Outdated
Comment thread embodichain/lab/sim/atomic_actions/affordance_sampling.py
Comment thread embodichain/lab/sim/motion/expansion/source.py Outdated
Comment thread embodichain/lab/sim/motion/expansion/source.py Outdated
Comment thread embodichain/lab/sim/motion/expansion/coordinator.py
Comment thread embodichain/lab/sim/motion/expansion/coordinator.py Outdated
Comment thread embodichain/lab/sim/motion/expansion/single_slot.py Outdated
Comment thread embodichain/lab/sim/motion/expansion/single_slot.py Outdated
Comment thread examples/sim/motion/task_environment_augmentation_showcase.py
Comment on lines +311 to +316
fingerprint = _trajectory_fingerprint(row_template)
if (
fingerprint in self._seen_fingerprints
or fingerprint in batch_fingerprints
):
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Affordance branches are collapsed

When two distinct Affordance branches produce identical trajectory samples, this global trajectory-only fingerprint treats the second branch as a duplicate. Because Affordance provenance and the compatibility key are attached only after this check, the second branch never receives its own candidate identity and cannot be scheduled, losing its lineage.

Prompt To Fix With AI
This is a comment left during a code review.
Path: embodichain/lab/sim/motion/expansion/coordinator.py
Line: 311-316

Comment:
**Affordance branches are collapsed**

When two distinct Affordance branches produce identical trajectory samples, this global trajectory-only fingerprint treats the second branch as a duplicate. Because Affordance provenance and the compatibility key are attached only after this check, the second branch never receives its own candidate identity and cannot be scheduled, losing its lineage.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex Fix in Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

atomic action atomic action related functionality enhancement New feature or request motion gen Things related to motion generation for robot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant