Skip to content

fix(sandbox): discard obsolete migration preparation - #361

Merged
FumingZhang merged 7 commits into
mainfrom
fix/stale-migration-hold
Oct 30, 2026
Merged

FumingZhang merged 7 commits into
mainfrom
fix/stale-migration-hold

Conversation

@FumingZhang

@FumingZhang FumingZhang commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Distinguish obsolete migration/Sandbox intent from a current control-plane dependency failure. Preparation and observation errors from an older reconciliation now return for a fresh read without applying a dependency hold to the newer migration request's source. Other common failure paths reuse the existing authoritative Agent-revision check before holding; a read failure still follows the fail-closed hold and is reported.

The live failure occurred when a second healthy-source request arrived during an older steady-state reconciliation. The intent guard correctly rejected the old operation, but its generic error path stopped the still-ready source; the new request then could not capture that source. Keep all current authorization, source-stop, storage-release and deadline checks unchanged.

Further immediate round trips exposed a second timing window after the initial migration check. The follow-up covers the later Sandbox guard and Agent-source read as well. A recreated current policy binding remains a real source failure and still stops compute/blocks the retained key; it is not exempted as obsolete work.

Related issue

Focused validation follow-up to #354. This PR targets feat/custom-sandbox-runtime because it wires the shared error handling through that branch's Custom path as well as managed harnesses. It does not merge its prerequisite.

Validation

Offline checks used Go 1.27.3 and Helm 3.22, with USE_EXISTING_CLUSTER=false and an empty kubeconfig.

Command: go -C app/cetirun-operator test ./internal/controller -run '^TestPlannedMigrationStalePreparationDoesNotHoldNewRequest$' -count=1
Result: reproduced the stale preparation stopping the newer source on OpenClaw and Hermes before the fix.

Command: go -C app/cetirun-operator test ./internal/controller -run '^TestPlannedMigration(StalePreparationDoesNotHoldNewRequest|PreCaptureHoldRecoversSource)$' -count=1
Result: passed; known stale work preserves source/key/spend and the new request captures successfully, while actual dependency outages still hold.

Command: go -C app/cetirun-operator test ./internal/controller -run 'Test.*Migration' -count=1 -timeout=10m
Result: passed, 261.046s.

Command: go -C app/cetirun-operator test -race ./internal/controller -run '^TestPlannedMigration(StalePreparationDoesNotHoldNewRequest|PreCaptureHoldRecoversSource)$' -count=1 -timeout=5m
Result: passed, 246.882s.

Command: go -C app/cetirun-operator test ./internal/controller -run '^TestPlannedMigrationLateIntentChangeDoesNotHoldNewRequest$' -count=1
Result: reproduced the actual later-guard failure on Custom Kata and container before the follow-up (7.042s); managed negative controls did not stop their source.

Command: go -C app/cetirun-operator test ./internal/controller -run '^TestPlannedMigrationLateAgentSourceChangeDoesNotHoldNewRequest$' -count=1
Result: reproduced the remaining Agent-source read failure on both Custom backends before the final currentness check (3.197s).

Command: go -C app/cetirun-operator test ./internal/controller -run '^TestPlannedMigration(StalePreparationDoesNotHoldNewRequest|LateIntentChangeDoesNotHoldNewRequest|LateAgentSourceChangeDoesNotHoldNewRequest|LateBindingChangeStillHoldsSource|PreCaptureHoldRecoversSource)$' -count=1 -timeout=5m
Result: passed, 47.926s.

Command: go -C app/cetirun-operator test ./internal/controller -run 'Test.*Migration|TestReconciledSandbox.*(Hold|Unavailable|StatusFailure)' -count=1 -timeout=10m
Result: passed, 278.858s.

Command: go -C app/cetirun-operator test -race ./internal/controller -run '^TestPlannedMigration(StalePreparationDoesNotHoldNewRequest|LateIntentChangeDoesNotHoldNewRequest|LateAgentSourceChangeDoesNotHoldNewRequest|LateBindingChangeStillHoldsSource|PreCaptureHoldRecoversSource)$' -count=1 -timeout=10m
Result: passed, 346.531s. This is the offline test-process budget, not an Agent deadline increase.

Command: go -C app/cetirun-operator vet ./internal/controller
Result: passed.

Command: go -C app/cetirun-operator build ./...
Result: passed.

Command: make docs-check
Result: passed, including 43 generated HTML pages and source headers.

Command: git diff --cached --check
Result: passed.

Command: make check
Result: passed on the declared local composition 5cf384e9b, including this complete follow-up and the other validation inputs.

Command: make -C app/cetirun-operator verify-generated
Result: passed on that composition; no generated delta.

Command: make -C app/cetirun-operator test-envtest
Result: passed on that composition against isolated local API servers.

Not run: unavailable-node failover, physical fencing or external provider qualification; none is claimed by this fix.

Authorized live evidence: two distinct return requests, on the original and partially repaired compositions, hit the original 1200-second failure bound; both results were retained. In between, bounded successful migrations did not conceal the remaining race. The sources were recovered by correcting only each uncaptured Agent request back to its recorded completed intent through admission. No direct workload scaling, finalizer stripping or forced volume detachment was used. A separate target-capacity delay was recovered by ordinary owner suspension of a test co-tenant, without changing the migration clock or resource profile. No private diagnostic bundle is attached.

On the complete repair's pinned Operator/admission image, four immediately
consecutive runc migrations completed in 72.208s, 78.877s, 78.557s and 78.597s;
a Kata round trip completed in 106.079s and 92.719s. A retained runc suspension/
resume also passed. All retained identities matched, source/ordinary CSI
transitions were observed, and both original HOME files plus a fresh append
were independently verified through the normal owner terminals. The earlier
failures and a separate pre-adoption request rejection remain in the report.

Compatibility and operational impact

No CRD, dependency or timeout change. Only a specifically identified obsolete intent/checkpoint avoids the generic dependency hold. Other errors still fail closed. Existing migration ownership, generation, checkpoint, healthy-source, normal CSI and authorization requirements remain unchanged.

This does not add unavailable-node failover or physical fencing. Maintainer review and the new PR's CI/CLA checks are still required.

Checklist

  • The change is focused and preserves unrelated work.
  • Tests cover the changed behavior, or I explained why no new test is needed.
  • Documentation and examples match any public behavior changes.
  • Generated artifacts were updated from source, or none are affected.
  • Dependency changes include lockfiles, source attribution, and license information, or none are affected.
  • I checked the diff and attachments for secrets, private endpoints or identifiers, customer data, agent conversations, and internal information.
  • I followed the applicable CLA instructions, or asked a maintainer about an unclear check.
  • I identified checks that need credentials or a live environment and did not run them without authorization.

FumingZhang and others added 5 commits October 29, 2026 06:58
Reuse the common executor for governed Custom creation, retained lifecycle, typed Gateway and network controls, private Chat and isolated terminal access. Preserve image entrypoints and non-root identities while retaining existing managed and non-Sandbox behavior.\n\nInclude generated policy schemas, Portal wiring, static probe packaging and offline regression coverage. Keep unsupported identity, mTLS and desktop combinations fail-closed and document the live qualification boundary.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Retain Custom ingress and terminal contracts alongside native identity pinning and expectation validation. Update the Entra renderer tests for the shared validation signature and preserve fail-closed handling of unsupported Custom Entra projection.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Yield to the Node scheduler within act before arming the window access trap. Preserve the stale-dispatch negative control and late Chat completion assertions without retries or a longer timeout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Distinguish a known obsolete migration intent from a current dependency outage. Retry stale preparation without applying a dependency hold to the newer request's source, while retaining fail-closed authorization and recovery behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve a new migration's ready source when a later preparation or Agent-source guard rejects an obsolete reconciliation. Keep current authorization and binding failures fail-closed, and retain read errors when currentness cannot be established. Cover the actual Custom Kata and container paths and current-binding negative controls.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Base automatically changed from feat/custom-sandbox-runtime to main October 29, 2026 23:19

@feiskyer Pengfei Ni (feiskyer) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

FumingZhang and others added 2 commits October 30, 2026 01:20
Resolve PR #361 conflicts while preserving stale migration safeguards and current main changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The expanded controller suite reaches its 20-minute package limit while tests are still passing. Raise the full unit-test budget to 30 minutes and retain all test selections, the existing envtest budget, and the 60-minute CI job limit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@FumingZhang
FumingZhang merged commit 56165f4 into main Oct 30, 2026
33 checks passed
@FumingZhang
FumingZhang deleted the fix/stale-migration-hold branch October 30, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants