Skip to content

Commit 0df39ca

Browse files
committed
fix(driver-mxc): serialize isolation_session stop/deprovision as unit variants
Empirical contract finding from the real test lane (build 26300.8553, wxc-exec 2026-06-10): the stop and deprovision experimental blocks are unit variants in the wxc-exec schema and must serialize as null; sending {} is rejected with malformed_request (invalid type: map, expected unit), while provision/start accept maps. The production invoker, the real-lane test, the probe script, and the e2e runner all sent {} - the driver could provision and run an agent but never stop or delete an isolation-session sandbox against this build. Pinned by a unit test. Signed-off-by: Giedrius Burachas <[email protected]>
1 parent b20ac53 commit 0df39ca

4 files changed

Lines changed: 40 additions & 8 deletions

File tree

‎crates/openshell-driver-mxc/examples/probe-mxc-host.ps1‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ if ($wxcInfo.exists) {
227227
sandboxId = $sandboxId
228228
experimental = @{
229229
isolation_session = @{
230-
stop = @{}
230+
# Unit variant: serialize as null, not {} (malformed_request otherwise).
231+
stop = $null
231232
}
232233
}
233234
}
@@ -238,7 +239,7 @@ if ($wxcInfo.exists) {
238239
sandboxId = $sandboxId
239240
experimental = @{
240241
isolation_session = @{
241-
deprovision = @{}
242+
deprovision = $null
242243
}
243244
}
244245
}

‎crates/openshell-driver-mxc/examples/run-mxc-e2e.ps1‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ function Probe-Backend([string] $backendName, [string] $wxc) {
164164
phase = "deprovision"
165165
sandboxId = $sandboxId
166166
experimental = @{
167-
isolation_session = @{ deprovision = @{} }
167+
# Unit variant: null, not @{} (malformed_request otherwise).
168+
isolation_session = @{ deprovision = $null }
168169
}
169170
}
170171
$deprovJson = $deprovConfig | ConvertTo-Json -Depth 20 -Compress

‎crates/openshell-driver-mxc/src/mxc.rs‎

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,29 +605,34 @@ impl WxcExecInvoker {
605605
}
606606

607607
/// Run the stop phase.
608+
///
609+
/// `stop`/`deprovision` are **unit** variants in the wxc-exec schema: they
610+
/// must serialize as `null`, not `{}`. Empirical (build 26300.8553,
611+
/// wxc-exec 2026-06-10): `"stop": {}` is rejected with `malformed_request`
612+
/// ("invalid type: map, expected unit"); `provision`/`start` accept maps.
608613
pub async fn stop(&self, iso_sandbox_id: &str) -> Result<(), InvokerError> {
609614
let config = serde_json::json!({
610615
"version": MXC_SCHEMA_VERSION,
611616
"phase": "stop",
612617
"sandboxId": iso_sandbox_id,
613618
"experimental": {
614619
"isolation_session": {
615-
"stop": {}
620+
"stop": null
616621
}
617622
}
618623
});
619624
self.run_phase(&config).await
620625
}
621626

622-
/// Run the deprovision phase.
627+
/// Run the deprovision phase (unit variant — see [`Self::stop`]).
623628
pub async fn deprovision(&self, iso_sandbox_id: &str) -> Result<(), InvokerError> {
624629
let config = serde_json::json!({
625630
"version": MXC_SCHEMA_VERSION,
626631
"phase": "deprovision",
627632
"sandboxId": iso_sandbox_id,
628633
"experimental": {
629634
"isolation_session": {
630-
"deprovision": {}
635+
"deprovision": null
631636
}
632637
}
633638
});
@@ -804,6 +809,29 @@ mod tests {
804809
assert!(config.get("network").is_none());
805810
}
806811

812+
#[test]
813+
fn stop_and_deprovision_serialize_as_unit_variants() {
814+
// Pins the empirical schema contract (test box, build 26300.8553):
815+
// stop/deprovision are unit variants and must be `null`; `{}` is
816+
// rejected with malformed_request "invalid type: map, expected unit".
817+
for phase in ["stop", "deprovision"] {
818+
let config = serde_json::json!({
819+
"version": MXC_SCHEMA_VERSION,
820+
"phase": phase,
821+
"sandboxId": "iso:wxc-test",
822+
"experimental": {
823+
"isolation_session": {
824+
phase: null
825+
}
826+
}
827+
});
828+
assert!(
829+
config["experimental"]["isolation_session"][phase].is_null(),
830+
"{phase} must serialize as null (unit variant)"
831+
);
832+
}
833+
}
834+
807835
#[test]
808836
fn invoker_error_maps_backend_unavailable_to_unavailable() {
809837
let err = InvokerError::Mxc {

‎crates/openshell-driver-mxc/tests/wxc_exec_real.rs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,8 @@ impl<'a> DeprovisionGuard<'a> {
518518
"sandboxId": sandbox_id,
519519
"experimental": {
520520
"isolation_session": {
521-
"deprovision": {}
521+
// Unit variant: must be null, not {} (malformed_request otherwise).
522+
"deprovision": null
522523
}
523524
}
524525
});
@@ -754,7 +755,8 @@ fn iso_lifecycle_round_trip() {
754755
"sandboxId": sandbox_id,
755756
"experimental": {
756757
"isolation_session": {
757-
"stop": {}
758+
// Unit variant: must be null, not {} (malformed_request otherwise).
759+
"stop": null
758760
}
759761
}
760762
});

0 commit comments

Comments
 (0)