Skip to content

refactor(task-engine): execute GenSim semantic graphs via Task Program - #578

Merged
skywhite1024 merged 13 commits into
ljd/action_engine_refactorfrom
refactor/gen-sim-task-program-phase1
Sep 8, 2026
Merged

refactor(task-engine): execute GenSim semantic graphs via Task Program#578
skywhite1024 merged 13 commits into
ljd/action_engine_refactorfrom
refactor/gen-sim-task-program-phase1

Conversation

@yuecideng

@yuecideng yuecideng commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Description

This stacked PR targets ljd/action_engine_refactor (PR #531). The target was
first synchronized with current main, then this branch was restacked on that
exact target:

  • target sync: 503026bf (main -> ljd/action_engine_refactor);
  • PR stack sync: c96912b1 (ljd/action_engine_refactor -> this branch);
  • current PR head: 2620929c.

The resulting architecture makes Task Program / Semantic Skill the only GenSim
path from semantic intent to physical execution.

Functional changes

  • feat(task-program): support coordinated dual-arm workflows
    • extends the canonical Task Program lowering/runtime path for coordinated
      transport, handover, named park postures, fresh observations, verified
      effects, and dual-arm execution policies;
    • adds reusable dual-Franka embodiment and execution-policy components;
    • fixes TCP-frame inversion and coordinated grasp/reachability behavior used
      by the reference task.
  • refactor(task-engine): execute semantic graphs via task programs
    • introduces immutable JSON-safe SemanticTaskGraph contracts and
      deterministic semantic planning;
    • generates fingerprint-bound configured Task Program bundles and executes
      them through the canonical bridge/runtime;
    • replaces GenSim-owned physical lowering/reporting with canonical semantic
      calls and runtime results;
    • adds architecture guards preventing Task Engine from owning Atomic Action
      execution.
  • refactor(gen-sim): remove legacy action execution stack
    • deletes the duplicate embodichain.gen_sim.action_engine production
      package and implementation-specific tests;
    • removes the legacy capability registry, physical grounder, Atomic Action
      adapter, physical executor, command scheduler, robot-part/motion-policy
      compatibility layers, duplicate physical state, and legacy reports;
    • preserves only source-scene normalization and task-conditioned canonical
      scene binding under task_engine.orchestration.

Post-sync correctness fixes

  • Preserve row-local runtime success in execution reports. A partial vectorized
    result no longer creates a synthetic batch-wide failure that incorrectly
    breaks any and at_least success policies; real infrastructure exceptions
    still mask every row.
  • Keep simulation.place_relative late-bound to SceneEntityPose, including
    reference orientation and world displacement, so a fresh observation can
    re-ground a moved or rotated reference entity.
  • Validate registered DETACHED effects against HeldObjectState.env_mask for
    every eligible row before lowering.
  • Settle simulation.coordinated_transport from observed pose deltas with the
    unchanged 0.03 m/s and 0.20 rad/s thresholds. This avoids stale contact
    velocity-cache values after coordinated release without accepting an object
    that is geometrically moving.

This intentionally breaks the unmerged #531 GenSim runtime/artifact contract.
Compatibility adapters around its direct Atomic Action execution path are not
retained.

Dependency/landing order: merge this PR into ljd/action_engine_refactor, then
land/update PR #531 against main.

Type of change

Validation

  • black --check .: 891 files unchanged.
  • git diff --check: passed.
  • python docs/scripts/check_api_docs.py: 1981/1981 exports documented.
  • Focused settle-policy and semantic-graph regressions: 28 passed.
  • Task Engine + Task Program + Gym bridge: 890 passed, 3 deselected.
  • Atomic Actions: 760 passed, 1 skipped, 3 deselected.
  • The explicitly deselected open_drawer configuration case is blocked before
    execution because the external Drawer.zip mirror does not match the
    repository-pinned MD5.
  • Architecture checks retain zero tracked production files under
    embodichain/gen_sim/action_engine and prevent the removed physical executor
    classes from returning.

End-to-end acceptance

The requested scene-mode command was rerun unchanged on exact pushed head
2620929c:

python -m embodichain.gen_sim.task_engine run-all \
  --mode scene \
  --task-id task1_2 \
  --instruction "用左臂把魔方递给右臂,用右臂把魔方放到苹果右边,然后把苹果放到盘子前面,然后用左臂把苹果放到盘子里,然后用右臂把魔方放到盘子里,最后用双臂把盘子端起来向前移动并放下" \
  --scene /root/task1_2/gym_export \
  --output-root outputs/gen_sim/task1_2 \
  --robot-profile dual_franka

Result:

  • run ID: 20260903_154102;
  • status: succeeded (process exit code 0);
  • 16/16 Semantic Calls completed;
  • 6/6 TaskGroups completed;
  • 2626 simulation steps;
  • 525 recorded frames, 26.25 seconds, 640x368 at 20 fps;
  • no workflow recovery or terminal failure;
  • coordinated-transport settle passed after 14 steps from observed pose motion
    (0.00209 m/s, 0.02114 rad/s).

Ignored local artifacts are under
outputs/gen_sim/task1_2/20260903_154102/.

Checklist

  • I have run Black across the repository.
  • I have updated public API documentation.
  • I have added focused tests for each corrected boundary.
  • I have run proportional subsystem and cross-layer regression suites.
  • I have rerun the accepted end-to-end task on the exact pushed head.
  • No dependency package changes are required.

@yuecideng yuecideng added refactor agent Features related to agentic system atomic action atomic action related functionality labels Sep 3, 2026
@greptile-apps

greptile-apps Bot commented Sep 3, 2026

Copy link
Copy Markdown

Greptile Summary

This PR routes GenSim semantic task graphs through generated, fingerprint-bound Task Program deployments and extends the canonical runtime for coordinated dual-arm workflows.

  • Adds immutable semantic graph, planning, bundle-generation, execution-report, and subprocess-runner contracts.
  • Adds coordinated manipulation, handover, park-posture, observation/effect, and dual-arm policy support.
  • Adds reusable dual-Franka configuration and corresponding runtime, integration, and architecture tests.

Confidence Score: 4/5

The PR should not merge until vectorized runs preserve successful rows instead of converting every partial result into a global failure.

The runner defeats its own any and threshold acceptance policies because one failed replica sets a global failure that clears success for all reported environments.

Files Needing Attention: embodichain/gen_sim/task_engine/_bundle_runner.py

Important Files Changed

Filename Overview
embodichain/gen_sim/task_engine/_bundle_runner.py Introduces canonical Gym-based bundle execution and reporting, but collapses partial vector outcomes into a global failure that defeats threshold success policies.
embodichain/gen_sim/task_engine/task_program_bundle.py Generates program, scene, integration, and fingerprint artifacts with runtime projection checks.
embodichain/gen_sim/task_engine/semantic_graph.py Adds immutable JSON-safe semantic graph validation and deterministic hashing.
embodichain/gen_sim/task_engine/semantic_planner.py Converts supported task candidates and scene bindings into provider-free semantic calls with explicit unsupported-capability failures.
embodichain/lab/gym/envs/task_program/bridge.py Extends canonical Task Program execution while preserving Gym action-consumption and row-local lifecycle boundaries.
embodichain/lab/sim/atomic_actions/primitives/coordinated_pickment.py Adds coordinated dual-arm grasp selection, synchronized planning, masking, and verified attachment effects.
embodichain/lab/sim/atomic_actions/primitives/hand_over.py Expands handover planning and execution for coordinated source/destination workflows.
embodichain/gen_sim/task_engine/config.py Defines vector execution acceptance policies whose partial-success semantics are not preserved by the new bundle runner.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Semantic task candidate] --> B[SemanticTaskGraph]
  B --> C[Fingerprint-bound Task Program bundle]
  C --> D[Configured Gym environment]
  D --> E[Task Program bridge]
  E --> F[Atomic Action runtime]
  F --> G[Per-environment results]
  G --> H[Task Engine execution report]
Loading

Fix all with Greploop Fix All in Codex Fix All in Claude Code

Prompt To Fix All With AI
### Issue 1
embodichain/gen_sim/task_engine/_bundle_runner.py:135-138
**Global failure erases row success**

When a vectorized execution has both successful and failed environments, this branch creates a global `failure`, and report construction consequently marks every environment unsuccessful. This causes `any` and `at_least` policies to reject runs that satisfy their configured success threshold and discards the successful replicas with the failed batch.

---

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

Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/ljd..." | Re-trigger Greptile

Comment on lines +135 to +138
failure = {
"type": "TaskProgramRuntimeFailure",
"terminal_reason": str(result.terminal_reason),
}

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 Global failure erases row success

When a vectorized execution has both successful and failed environments, this branch creates a global failure, and report construction consequently marks every environment unsuccessful. This causes any and at_least policies to reject runs that satisfy their configured success threshold and discards the successful replicas with the failed batch.

Knowledge Base Used: Gym environments and task integration

Prompt To Fix With AI
This is a comment left during a code review.
Path: embodichain/gen_sim/task_engine/_bundle_runner.py
Line: 135-138

Comment:
**Global failure erases row success**

When a vectorized execution has both successful and failed environments, this branch creates a global `failure`, and report construction consequently marks every environment unsuccessful. This causes `any` and `at_least` policies to reject runs that satisfy their configured success threshold and discards the successful replicas with the failed batch.

**Knowledge Base Used:** [Gym environments and task integration](https://app.greptile.com/dexforce/-/custom-context/knowledge-base/dexforce/embodichain/-/docs/gym-environments.md)

---

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

@greptile-apps

greptile-apps Bot commented Sep 3, 2026

Copy link
Copy Markdown

Too many files changed for review (232 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

@skywhite1024
skywhite1024 merged commit 35c3351 into ljd/action_engine_refactor Sep 8, 2026
@skywhite1024
skywhite1024 deleted the refactor/gen-sim-task-program-phase1 branch September 8, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Features related to agentic system atomic action atomic action related functionality refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants