Skip to content

fix(sdk): fence cold-start command generations - #54

Open
Chamberlain1998 wants to merge 1 commit into
inclusionAI:mainfrom
Chamberlain1998:codex/local-recovery-cold-start-v2
Open

fix(sdk): fence cold-start command generations#54
Chamberlain1998 wants to merge 1 commit into
inclusionAI:mainfrom
Chamberlain1998:codex/local-recovery-cold-start-v2

Conversation

@Chamberlain1998

Copy link
Copy Markdown

Summary

  • Return an int-compatible tracked process handle carrying the native handle and command generation.
  • Serialize explicit reload against command operations with a writer/readers gate.
  • Invalidate pre-reload tracked handles and raw integer PIDs only after an authoritative cold-start reload commits.
  • Preserve existing handle behavior for snapshot reloads; explicit snapshot-mode native errors remain native errors and do not invalidate the generation.
  • Keep conservative first-native-failure invalidation only for older Sandbox SDKs that do not expose a recovery mode.
  • Preserve the existing Sandbox, commands, files, shell, and PTY facade objects across reload.

Compatibility

  • No public method signature changes.
  • Completed command results remain readable after cold start.
  • Automatic failover has no synchronous reload-mode response and is therefore not presented as the same client-side generation boundary.

Verification

  • Python SDK unit tests: 290/290.
  • Ruff passes for the modified backend and tests.
  • runsc standalone official integration: 7/7.
  • Cold reload invalidates the pending old handle while the same logical Sandbox accepts new commands.
  • Snapshot reload restores checkpoint state and re-establishes the reverse tunnel.

Depends on the coordinated YuanRong change: https://gitcode.com/openeuler/yuanrong/merge_requests/1036

Supersedes closed draft #53, which GitHub cannot reopen because its head branch was force-pushed during review fixes.

Track background command handles by runtime generation and make reload an atomic boundary against concurrent command operations.

Invalidate pre-reload handles and raw PID operations only after an authoritative cold-start result. Preserve snapshot generations across native errors and retain conservative behavior only when older native SDKs omit the recovery mode.

Signed-off-by: ChamberlainJI <jichenglin1@huawei.com>
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.

1 participant