Skip to content

Legacy upgrade leaves healthy patched container with sandbox stuck Deleting #9531

Closed

Description

@rsliter

Summary

The v0.0.89 x86-64 upgrade E2E rebuilt a healthy patched container, but the OpenShell sandbox remained in Deleting until the 900-second final handoff deadline expired. The installer then failed recovery and preserved the backup.

This is a product or integration regression with an intermittent trigger, not a flaky assertion. The same exact job passed in four recent full E2E runs.

Current evidence

The final handoff diagnostic reported:

OpenShell supervisor did not reach Ready (last phase: Deleting).
sandbox_phase=Deleting
patched_container_status=running
patched_container_running=true
patched_container_exit_code=0
patched_container_health=healthy

The installer waited the full 900-second handoff budget, failed recovery, retained the registry entry and backup, and exited 1. No retry ran.

Recurrence evidence

The same exact job passed recently:

Closed #4664 and #5662 cover earlier GPU-patch handoff failures where a healthy container and OpenShell phase diverged. This occurrence is distinct because the sandbox remained in Deleting during a legacy-upgrade recovery path.

Required behavior

  1. Determine whether NemoClaw's container handoff or the OpenShell state machine owns the persistent Deleting phase.
  2. If OpenShell owns it, attach sanitized upstream evidence and record the upstream issue here.
  3. A healthy patched container must not remain indefinitely detached from the sandbox lifecycle record.
  4. Recovery must either converge to the same ready sandbox identity or fail with the preserved backup and a stable ownership diagnostic.
  5. Add deterministic coverage at the smallest lifecycle-state boundary for a healthy container paired with a persistent Deleting sandbox phase.
  6. Keep the live E2E assertion on restored survivor state and lifecycle readiness.

Non-goals

  • Increasing the 900-second timeout without evidence.
  • Retrying the complete workflow or upgrade mutation.
  • Treating a healthy Docker container as success while OpenShell remains non-ready.
  • Adding another live E2E target.

Release signal

Classification: product or integration regression with an intermittent trigger. It is terminal for the candidate and recovered zero times.

Activity

  1. self-assigned this
    on Aug 18, 2026
  2. added
    area: install
    area: sandbox
    integration: openclaw
    on Aug 18, 2026
  3. added theissue type on Aug 18, 2026
  4. ericksoa commented on Aug 20, 2026

    @ericksoa
    Member

    Additional same-SHA gateway reproduction and proposed design

    This also reproduced in the gateway recovery qualification for #9140 / PR #9323, and the red-to-green retry isolates the failure as an event-ordering race rather than runner slowness or an assertion timeout.

    Same-SHA evidence

    In both attempts, the fixture successfully replaced the exact pinned container identity, proved the replacement executable through OpenShell, removed the backup, and returned success.

    After it returned:

    • Red attempt: all 12 readiness probes observed phase: Deleting; none recovered.
    • Green attempt: the first probe observed phase: Error, and the second reached Ready.

    The same code and candidate SHA therefore produced different controller outcomes after an otherwise successful handoff.

    Confirmed code-level race

    The immediate recreation path in recreateOpenShellDockerSandboxContainer:

    1. waits for the replacement supervisor to become executable;
    2. calls reconcileSupervisorReconnect;
    3. on success, removes the old backup container as the final Docker lifecycle event;
    4. returns success immediately afterward.

    That final backup-removal event can cause OpenShell to demote the already-working replacement to Deleting.

    The repository already documents and avoids this ordering in finalizeDockerGpuPatchBackup: it stops the replacement, removes the backup, then starts the exact replacement again so the replacement registration is the final authoritative lifecycle event. The immediate and deferred finalization paths currently implement different handoff semantics.

    Proposed design

    Unify immediate and deferred recreation behind one identity-pinned final-handoff operation:

    1. Pin the transaction identities

      • Carry the exact old container ID, exact replacement container ID, original name, and backup name through the handoff.
      • Refuse to commit if any observed identity differs.
    2. Prove the replacement before destructive commit

      • Confirm the replacement supervisor is reachable.
      • Keep the backup until that proof succeeds.
    3. Use one authoritative commit ordering

      • Stop the exact replacement container.
      • Remove the exact backup container.
      • Start the exact replacement container.
      • This makes replacement registration, not backup deletion, the final lifecycle event.
    4. Require a post-commit acknowledgement

      • Do not return success merely because docker start succeeded.
      • Return success only after OpenShell acknowledges the final replacement as Ready and, where the OpenShell contract exposes it, reports the expected runtime/container identity or generation.
      • If the current status API cannot bind readiness to identity, add a lifecycle receipt or generation field at this boundary rather than inferring ownership from elapsed time.
    5. Classify controller states

      • Deleting after the final replacement start is a terminal ownership failure and should fail immediately with the exact transaction identities.
      • A transient Error may be observed only while the exact replacement is alive and controller registration is still progressing.
      • A deadline may remain as process protection, but neither additional sleep nor repeated workflow retries is an acceptance condition.
    6. Make the E2E assert the production contract once

      • After the recreate helper returns, perform one openshell sandbox exec ... -- true assertion and verify the exact replacement identity.
      • Remove the current blind 12-attempt readiness loop. If the helper returns while the sandbox is Deleting, the E2E should fail immediately as a product-contract violation.

    Acceptance criteria

    • Immediate and deferred handoffs share the same finalization implementation and lifecycle ordering.
    • Unit coverage proves stop(replacement) -> remove(backup) -> start(replacement) ordering using exact identities.
    • Unit coverage proves Deleting is not retried as generic readiness.
    • The recreate helper cannot report success before post-commit OpenShell acknowledgement.
    • The gateway recovery E2E no longer uses a blind retry loop after helper success.
    • The gateway recovery job passes repeated executions without increasing timeouts or retrying the workflow.
    • Diagnostics preserve the old ID, replacement ID, backup name, last OpenShell phase, and rollback disposition.

    Non-goals

    • Increasing the readiness or handoff timeout.
    • Retrying the complete E2E job.
    • Treating Docker health alone as successful OpenShell recovery.
    • Adding another E2E target.
  5. senthilr-nv commented on Aug 23, 2026

    @senthilr-nv
    Collaborator

    New automatic main evidence reached the same final-handoff ownership boundary in two targets.

    • Source: E2E run 32621454757, attempt 1, commit 75be76bf33525c983faa67040fa9f6b4961e4fe8
    • Backup job: 97151455496, failing while onboarding the source sandbox
    • Rebuild job: 97151455504, failing while rebuilding the OpenClaw sandbox after its backup succeeded

    Both jobs report that managed startup passed Ready, but the final runtime handoff did not converge. Their stable diagnostics agree:

    sandbox_phase=Deleting
    patched_container_status=exited
    patched_container_running=false
    patched_container_exit_code=143
    patched_container_health=unhealthy
    

    This matches #9531's persistent Deleting final-handoff boundary, while adding a different terminal container state from the original healthy/running reproduction. It is one existing root cause, not two causes inferred from job names. Issue #9531 and its current owner retain ownership.

    The separate managed-image DNS-resolution failure in job 97154036894 is not part of this issue. Automatic successor E2E run 32623009512 is exercising Backup and Rebuild again; no manual rerun was dispatched.

  6. senthilr-nv commented on Aug 23, 2026

    @senthilr-nv
    Collaborator

    Automatic successor evidence recovered both affected targets on a descendant commit without a manual rerun.

    This is recovery evidence for the tested descendant commit. It does not close the intermittent final-handoff race described in this issue. The same E2E run failed a separate Personal stock evidence contract in job 97156591641; that failure is not part of #9531.

  7. apurvvkumaria commented on Aug 23, 2026

    @apurvvkumaria
    Collaborator

    PR #9726's final exact-candidate E2E reproduced this final-handoff race on both v0.0.55 upgrade architectures.

    Both jobs completed the legacy install and reached managed startup Ready during the current upgrade. The replacement then failed final handoff with the same stable state on both architectures:

    patched_container_status=exited
    patched_container_running=false
    patched_container_exit_code=143
    patched_container_health=unhealthy
    

    The final sandbox phase was Error in this run. Both artifact cleanup records report no failures. The other approved targets passed: v0.0.36 x86-64, v0.0.74 x86-64, v0.0.89 x86-64, and Deep Agents repository install.

    This is new exact evidence for #9531, not a service-identity failure in #9726. No rerun, timeout increase, or product workaround was added.

  8. apurvvkumaria commented on Aug 24, 2026

    @apurvvkumaria
    Collaborator

    Maintainer decision: keep the recovery contract small.

    The previous container remains the rollback target until its removal. Removing that container is the irreversible final-handoff commit point required before the replacement final start. If lifecycle release, replacement restart, or final acknowledgement fails after that point, automatic rollback is unavailable and NemoClaw directs the operator to rebuild the sandbox before retrying.

    PR #10044 now implements that boundary explicitly. It does not add a durable recreation artifact, persistence format, fallback framework, or new configuration.

  9. added a commit that references this issue on Aug 25, 2026
    8f7a2ca
  10. added
    platform: container
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area: installarea: sandboxintegration: openclawplatform: container

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions