Skip to content

Plan bounded skill handoffs and refine rejected joint residuals - #1250

Open
yuecideng wants to merge 4 commits into
mainfrom
codex/skill-boundary-takeover
Open

yuecideng wants to merge 4 commits into
mainfrom
codex/skill-boundary-takeover

Conversation

@yuecideng

@yuecideng yuecideng commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

Follow-up to merged #1192. Resetting the next skill's first target to measured qpos creates a controller-reference jump when the previous target has steady tracking error. Native expansion now retains a qualified stop and plans a bounded reference prefix before the original trajectory, without replacing measured observations or smoothing exported recordings.

Final implementation

  • Capture owned controller position/velocity targets only when the profile requests reference handoff. Measured qpos/qvel remain separate. Hypothetical planning projection advances references consistently.
  • Use existing minimum-jerk interpolation from the previous stationary reference to the original first sample. Check ordered joint limits, speed/acceleration across the join and velocity-target derivatives. Failed rows do not affect bridge sizing.
  • Keep the original first phase name, held-object guards, grasp/release barriers, original suffix and command ownership. Shift lengths and scene-monitor indices together. Protect prefix/join stencils against expansion, same-grid rebuilding and retiming; rebuilding cannot prepend twice.
  • Clear stale collision certificates for changed plans and retain original measured geometry/contact/task acceptance. New samples execute normally, consume budgets and appear in T+1 evidence.
  • The stop gate remains explicit and unchanged. Default bridge activation inherits its flag; explicit opt-out is preserved. Native free entry phases require an explicit acceleration budget, revision zero, stationary references and disabled action replanning/retry budgets. Unsupported phases, external nominal sources and moving/recovery conditions retain their original behavior with diagnostics; this is not a general flow-through planner.
  • Add repeatable serial comparisons, raw six-joint plots, neighborhood acceleration diagnostics and an HTML/JSON/PDF report.
  • Preserve joint-residual full-amplitude sampling first; after its original raw budget is exhausted, deterministically refine one closest motion rejection under unchanged joint, acceleration, minimum-delta, FK and physical checks. Timing and protected samples remain exact; provenance records the raw draw and accepted scale.

Drive-bias evidence

Four matched layouts retain bitwise-identical Pick terminal command targets. The mean of each episode's maximum arm-joint reference error is 5.842 mrad at stiffness/damping 10000/1000, 2.900 mrad at 20000/1000, and 4.387 mrad at 10000/500. These diagnosis-only interventions support gain-dependent steady tracking bias; they are excluded from performance comparisons. No claim attributes the entire residual to gravity or saturation: the effort channel does not supply measured drive torque, and a gravity-toggle probe lacked independently verified post-reset readback.

The planner fixes the reference reset, not the underlying tracking bias. Main comparisons retain original gains and acceptance criteria.

Fresh paired results

Baseline: stop-only commit 532fe6ef4. Default CPU physics, independent Newton CPU geometry checks, UR5 open pick-place, seed 7, B=4, 16-rollout / 512-proposal budgets. Before/after then after/before, serial execution, fixed eight CPU cores, one numerical thread and visible GPU 1. AMD EPYC 9K65 / RTX PRO 5000 72GB; DexSim 0.6.0+879e1dae. Wall time includes setup, execution, validation and export, not Python import.

Group Confirmed/executed before → after Mean wall s Command jump P95 rad Window command acceleration P95 rad/s²
A: bounded/FIFO 30/32 → 30/32 52.31 → 54.61 .009534 → 0 5.961 → .446
D: workspace/coverage 18/26 → 18/26 48.76 → 50.16 .005695 → 0 3.560 → .400

All qualified Pick→Place boundaries have zero command position jump. Window maxima are .459 and .400 rad/s², below the unchanged .5 bound; the window normally spans −.04 to +.48 s and is recorded per row. Mean wall time increases 4.4% and 2.9%. These are two orders of one seed, not general performance guarantees.

Broader qualification limits: D's existing stop-gate rejection and candidate-budget shortfall remain. Relative to original main, the stop gate still excludes a high-bias sample; no threshold was loosened. The earlier joint-residual yield issue is addressed by the separately qualified repair below.

Joint-residual budget-exhaustion repair

The nominal Place/retract phase passes but already uses about 99% of its acceleration budget. Joint-range-normalized draws do not account for this thin dynamic margin; preserving endpoints alone does not bound discrete acceleration. Small reference changes can make the closest full-amplitude draw cross the limit, and the old exception reports only the last rejected draw. Some exploratory baseline runs pass 4/4; the frozen before/after/after/before comparison reproduces 3/4 in both baseline runs.

The repair retains the original 64 raw random draws and their order. Only exhaustion activates at most eight deterministic halvings of one retained best rejection (O(TD) storage). Every materialized variant must pass the original joint/motion validators and minimum delta, followed by unchanged FK, restoration, plan rebuilding, collision and physical/task checks. Passing original draws remain unscaled. The raw proposal count and deterministic refinement are recorded separately; no rollout or IK budget is increased.

Fresh baseline 6cd7da36b, same Default CPU pick-place group A, seed 7, B=4, 4 rollouts / 128 scene candidates / 240 seconds, two serial orders:

Metric Before After
Confirmed/executed 6/8 (3/4 each) 8/8 (4/4 each)
Mean setup-through-export wall s 21.776 21.208
Qualified episodes/min 8.27 11.32
Maximum Pick→Place command jump 0 rad 0 rad
Maximum handoff-window command acceleration .415 rad/s² .411 rad/s²

Restored ordinal 2: closest raw proposal index 4 has acceleration ratio 1.000464, above the unchanged 1+1e-6 threshold. Scale 0.5 yields 0.993311 (0.993013 in the other run), with actual delta 0.009999 rad, above the original 0.002 rad minimum. Time grid, endpoints, hand columns and noneditable samples remain unchanged. The 2.6% wall-time difference is descriptive for this small sample; the effective-throughput gain comes primarily from recovering the fourth qualified episode.

The raw rejected candidate was not executed. Its planned residual/acceleration is shown separately from the measured handoff comparison:

Rejected draw and qualified refinement

Measured handoff remains continuous

Repair validation: 294 passed, 16 deselected in affected expansion/Task Program/trajectory suites; final focused tests 44 passed; final native smoke 4/4. Independent numerical/lifecycle review found no actionable defect. Source manifests, original failures and unchanged thresholds are retained. No general all-seed/all-operator success guarantee is claimed.

Mechanism, limits and both qualification stages

Raw reference-conditioned handoff comparison

The plot uses A/repeat0/ordinal15, the largest baseline jump among successful matching-layout pairs. Initial object poses and preceding references match exactly; measured handoff qpos differs by at most 6.56e-7 rad. Blue is before, orange after; solid commands, dashed measurements, gray planned-prefix interval. Velocities are control-grid finite differences, not native instantaneous readings. Raw signals are not smoothed.

Validation

  • 549 affected regression cases passed; separate observation/bridge/endpoint suite: 135 passed. Final focused reruns cover shifted physical gates, projection, failed rows, zero-gap/rebuild behavior, protected stencils and unsupported moving-reference fallback. Counts overlap and are not summed.
  • Final configured B=4 smoke: 4/4 accepted and confirmed. Matrix snapshots are pinned per run; subsequent fail-closed guards and compatibility changes have targeted coverage without changing the qualified reference law.
  • Black 26.10.1 black ., API documentation 5165/5165, context and whitespace checks pass.
  • Updated Atomic/expansion context and usage guide. No new dependency. No live hardware, GPU-physics or all-operator qualification claim.

Type of change

  • Enhancement with stricter default boundary qualification and optional bounded native reference handoff.

Checklist

  • Repository-pinned formatting and API/context gates.
  • Focused independent numerical and lifecycle regressions.
  • Original physical checks, ownership and grasp/release barriers retained.
  • Incomplete quotas, failed variants and measurement limits documented.

Bounded via-point refinement

Native via_points now shares the deterministic refinement after the existing full-amplitude proposal budget is exhausted. It tries up to eight halvings on the closest motion-limit rejection and checks each materialized trajectory against the original limits and minimum delta. The selected trajectory retains the same time grid and protected samples, then follows the existing reconstruction, collision, and grasp/release acceptance.

The UR5 open pick-place baseline scan used five existing seeds with the original 64-proposal budget and persisted 18/20. The two seed-27 rejections were Pick planning and Place stop-gate timeout. The deterministic one-proposal regression covers candidate-budget exhaustion directly. Its fixed via knot is rejected before the change at 2.898 times the acceleration cap and accepted at quarter scale under the same cap.

Same-configuration comparison Persisted / executed End-to-end wall time Pick-to-Place command jump
Seed 7, three serial pairs including reversed order 12/12 → 12/12 Median 22.93 → 23.09 s 0 → 0 rad
Seed 27, one serial pair 2/4 → 2/4 23.13 → 23.31 s 0 → 0 rad

The matched baseline is 26cc8ddd5. All native accepted draws used scale 1. Seed 7's after trials were 22.17, 37.17 and 23.09 s. The slow trial includes approximately 10 extra seconds in environment initialization and remains in the results. Seed 7's maximum command acceleration within the handoff window is 0.411 → 0.412 rad/s². Every persisted episode passed the existing collision and lift/release-event checks.

Method and results

Raw six-joint via-point handoff traces on the same layout

Validation covers 196 targeted tests and 42 context tests. Deployment preflight, Black 26.10.1, API docs coverage (5165/5165), and whitespace checks passed.

@yuecideng yuecideng added enhancement Improvements to existing capabilities; use feature for new capabilities. atomic-skill Atomic Skill goals, planning, execution, verification and recovery. benchmark Benchmark protocols, suites, metrics, evaluation tools and technical reports. labels Nov 19, 2026
@yuecideng yuecideng changed the title Qualify expansion skill handoffs with measured boundary stops Plan bounded reference handoffs between native skills Nov 19, 2026
@yuecideng
yuecideng requested a review from matafela November 19, 2026 16:06
@yuecideng
yuecideng marked this pull request as ready for review November 19, 2026 16:06
@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 3/5

[Medium impact] The changes affect native task-program expansion and its simulated skill handoffs.

The PR should not merge until both earlier problems are fixed.

Fix All in CodexFindings

  1. P1 Native edits hit protected samples. ▶
  2. P1 Settled rows lose their targets. ▶
Fix with agent prompt
### Issue 1
embodichain/lab/sim/atomic_skills/engine.py:1398-1405
A supported `joint_residual` job can select `pick_up: [approach]`, but `_NativePlanExpansion._transform` still protects only the first two phase samples. It can change index 2, while this new check protects indices 0–2 even when `prefix_samples` is zero. A nonempty prefix protects more. Candidates that pass motion checks then raise here instead of executing. Apply the bridge-aware phase narrowing to the native transform before it generates candidates; retain this safety check.

### Issue 2
embodichain/lab/sim/atomic_skills/execution.py:1274-1275
With timed terminal acceptance and `boundary_stop=True`, one row can become ready while a peer still waits. `pending` excludes the ready row, so the terminal frame marks it inactive. `SimulationExecutionAdapter.send` replaces inactive targets with measured positions, including contact-blocked fingers. This drops grasp pressure and changes the arm reference before the batch finishes. Keep still-eligible rows on the terminal command while peers wait, without reactivating failed rows.

---

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

Summary

This PR plans bounded command handoffs between skills and adds a bounded fallback for rejected motion variants.

  • Configured expansion jobs wait for robot joints to settle between skills.
  • Supported native plans ease into the next skill from the prior controller target.
  • Exhausted residual and via-point proposals can refine one rejected candidate.

No new actionable issues were found in the changes since the previous review. Both previous findings remain outstanding.

Reviews (3) · Last reviewed commit: "fix(expansion): refine via-point proposa..." · Reviewed by Greptile

Comment on lines +1398 to +1405
bridge = owned_plan.diagnostics.metadata.get("reference_bridge")
if bridge:
protected = int(bridge["prefix_samples"]) + 3
if not torch.equal(
trajectory.positions[:, :protected], original.positions[:, :protected]
):
raise ValueError(
"Plan rebuilding cannot change the reference takeover or its join stencil"

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 Native edits hit protected samples. A supported joint_residual job can select pick_up: [approach], but _NativePlanExpansion._transform still protects only the first two phase samples. It can change index 2, while this new check protects indices 0–2 even when prefix_samples is zero. A nonempty prefix protects more. Candidates that pass motion checks then raise here instead of executing. Apply the bridge-aware phase narrowing to the native transform before it generates candidates; retain this safety check.

Knowledge Base Used: Atomic skill execution

Prompt To Fix With AI
This is a comment left during a code review.
Path: embodichain/lab/sim/atomic_skills/engine.py
Line: 1398-1405

Comment:
**Native edits hit protected samples.** A supported `joint_residual` job can select `pick_up: [approach]`, but `_NativePlanExpansion._transform` still protects only the first two phase samples. It can change index 2, while this new check protects indices 0–2 even when `prefix_samples` is zero. A nonempty prefix protects more. Candidates that pass motion checks then raise here instead of executing. Apply the bridge-aware phase narrowing to the native transform before it generates candidates; retain this safety check.

**Knowledge Base Used:** [Atomic skill execution](https://app.greptile.com/-/switch-tenant?tenant=dexforce&next=%2Fcustom-context%2Fknowledge-base%2Fdexforce%2Fembodichain%2F-%2Fdocs%2Fatomic-action-execution.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

Comment on lines +1274 to +1275
pending = execution_mask & (self._boundary_stable < 2)
timed_out = pending & (elapsed_terminal >= boundary.boundary_timeout)

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 Settled rows lose their targets. With timed terminal acceptance and boundary_stop=True, one row can become ready while a peer still waits. pending excludes the ready row, so the terminal frame marks it inactive. SimulationExecutionAdapter.send replaces inactive targets with measured positions, including contact-blocked fingers. This drops grasp pressure and changes the arm reference before the batch finishes. Keep still-eligible rows on the terminal command while peers wait, without reactivating failed rows.

Knowledge Base Used: Atomic skill execution

Prompt To Fix With AI
This is a comment left during a code review.
Path: embodichain/lab/sim/atomic_skills/execution.py
Line: 1274-1275

Comment:
**Settled rows lose their targets.** With timed terminal acceptance and `boundary_stop=True`, one row can become ready while a peer still waits. `pending` excludes the ready row, so the terminal frame marks it inactive. `SimulationExecutionAdapter.send` replaces inactive targets with measured positions, including contact-blocked fingers. This drops grasp pressure and changes the arm reference before the batch finishes. Keep still-eligible rows on the terminal command while peers wait, without reactivating failed rows.

**Knowledge Base Used:** [Atomic skill execution](https://app.greptile.com/-/switch-tenant?tenant=dexforce&next=%2Fcustom-context%2Fknowledge-base%2Fdexforce%2Fembodichain%2F-%2Fdocs%2Fatomic-action-execution.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

@yuecideng yuecideng changed the title Plan bounded reference handoffs between native skills Plan bounded skill handoffs and refine rejected joint residuals Nov 19, 2026

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-skill Atomic Skill goals, planning, execution, verification and recovery. benchmark Benchmark protocols, suites, metrics, evaluation tools and technical reports. enhancement Improvements to existing capabilities; use feature for new capabilities.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants