Skip to content

Commit 97986d9

Browse files
authored
fix(server): resume unspecified sandbox phase (#1765)
Legacy or never-initialized sandbox rows decode to the proto-default Unspecified phase. The startup resume sweep skipped them, leaving the backend unreconciled: never resumed, never errored. Unspecified was the only non-terminal phase skipped, since unrecognized values already fall through to Unknown and get resumed. Treat Unspecified as running so the sweep reconciles it from live driver state: resume when the backend resource exists, mark Error when it is gone. Tests - cargo test -p openshell-server \ resume_persisted_sandboxes_resumes_running_phases Signed-off-by: Shiju <shiju@nvidia.com>
1 parent e26a1b1 commit 97986d9

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

  • crates/openshell-server/src/compute

crates/openshell-server/src/compute/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,11 +1643,16 @@ fn rewrite_user_facing_conditions(status: &mut Option<SandboxStatus>, spec: Opti
16431643
/// Phases for which a sandbox should have a running compute resource.
16441644
/// `Deleting` and `Error` are intentionally excluded: deletion is in
16451645
/// progress, or the sandbox has already failed and should not be
1646-
/// silently revived.
1646+
/// silently revived. `Unspecified` is included because it is the proto
1647+
/// default value; persisted rows with that value should be reconciled
1648+
/// from the live driver state rather than skipped forever.
16471649
fn sandbox_phase_should_be_running(phase: SandboxPhase) -> bool {
16481650
matches!(
16491651
phase,
1650-
SandboxPhase::Provisioning | SandboxPhase::Ready | SandboxPhase::Unknown
1652+
SandboxPhase::Unspecified
1653+
| SandboxPhase::Provisioning
1654+
| SandboxPhase::Ready
1655+
| SandboxPhase::Unknown
16511656
)
16521657
}
16531658

@@ -2799,6 +2804,7 @@ mod tests {
27992804
test_runtime_with_resume(Arc::new(TestDriver::default()), Some(resume.clone())).await;
28002805

28012806
for (id, name, phase) in [
2807+
("sb-unspecified", "unspecified", SandboxPhase::Unspecified),
28022808
("sb-prov", "prov", SandboxPhase::Provisioning),
28032809
("sb-ready", "ready", SandboxPhase::Ready),
28042810
("sb-unknown", "unknown", SandboxPhase::Unknown),
@@ -2824,6 +2830,7 @@ mod tests {
28242830
"sb-prov".to_string(),
28252831
"sb-ready".to_string(),
28262832
"sb-unknown".to_string(),
2833+
"sb-unspecified".to_string(),
28272834
]
28282835
);
28292836
}

0 commit comments

Comments
 (0)