mirror of
https://github.com/openai/codex.git
synced 2026-10-20 00:18:49 +00:00
Add context to Windows sandbox runtime registration errors (#48531)
Identify the failing setup step when starting, completing, or verifying managed runtime package registration, granting metadata permissions, or persisting the completed registration. Preserve the underlying errors with `anyhow::Context`. GitOrigin-RevId: 85f712faf2519e95704d7e8cea15d2deeed0d51e
This commit is contained in:
@@ -163,7 +163,8 @@ pub(crate) fn provision(
|
||||
None,
|
||||
DeploymentOptions::None,
|
||||
)?)
|
||||
})?;
|
||||
})
|
||||
.context("start managed runtime package registration")?;
|
||||
// As with provisioning, retain the request's resources until Windows finishes.
|
||||
// A client timeout or an unreadable status cannot safely release the profile.
|
||||
let mut status_error_logged = false;
|
||||
@@ -193,18 +194,26 @@ pub(crate) fn provision(
|
||||
}
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
}
|
||||
operation.GetResults()?.ExtendedErrorCode()?.ok()?;
|
||||
operation
|
||||
.GetResults()
|
||||
.and_then(|result| result.ExtendedErrorCode())
|
||||
.and_then(windows::core::HRESULT::ok)
|
||||
.context("finish managed runtime package registration")?;
|
||||
ensure!(
|
||||
registered_packages(&profile.user_sid, &family)?.contains(full_name),
|
||||
registered_packages(&profile.user_sid, &family)
|
||||
.context("verify managed runtime package registration")?
|
||||
.contains(full_name),
|
||||
"runtime registration completed without the expected package"
|
||||
);
|
||||
}
|
||||
metadata::grant(identity.token.0, &profile.user_sid, record)?;
|
||||
metadata::grant(identity.token.0, &profile.user_sid, record)
|
||||
.context("grant managed runtime metadata permissions")?;
|
||||
profile.unload_profile()?;
|
||||
}
|
||||
if !receipt_current {
|
||||
record.runtime_mut()?.ready_package = Some(full_name.to_string());
|
||||
crate::installation_record::save_runtime(record)?;
|
||||
crate::installation_record::save_runtime(record)
|
||||
.context("persist completed managed runtime registration")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user