mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Improve Windows sandbox error details and registry cleanup (#46237)
## Why Provisioning errors omitted underlying causes, and removing a legacy installation record could leave an empty registry key behind. ## What changed - Include error chains in provisioning responses and failure logs, retaining control-character replacement and the response byte limit. - Attempt to delete the legacy installation registry key after removing and flushing its record, preserving any remaining values or subkeys. ## Testing Add a regression test for nested error causes, control-character replacement, and UTF-8 truncation within the response byte limit. GitOrigin-RevId: 8fccfb49c708be5f5d5be7180289cb74a66498a2
This commit is contained in:
1 parent
7abf2a3b5c
commit
c11fdc944f
4 files changed
+32
-3
No files matched your search
@@ -10,6 +10,7 @@ use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use windows_sys::Win32::Foundation as foundation;
|
||||
use windows_sys::Win32::System::Registry as registry;
|
||||
use windows_sys::Win32::UI::Shell::SHDeleteEmptyKeyW;
|
||||
|
||||
/// Selects legacy helper materialization or verified app-contained Core for setup.
|
||||
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
|
||||
@@ -188,7 +189,17 @@ pub fn remove_installation() -> Result<()> {
|
||||
match status {
|
||||
foundation::ERROR_SUCCESS
|
||||
| foundation::ERROR_FILE_NOT_FOUND
|
||||
| foundation::ERROR_PATH_NOT_FOUND => flush_installation(INSTALLATION_KEY),
|
||||
| foundation::ERROR_PATH_NOT_FOUND => {
|
||||
flush_installation(INSTALLATION_KEY)?;
|
||||
// Best-effort pruning preserves any remaining values or subkeys.
|
||||
let _ = unsafe {
|
||||
SHDeleteEmptyKeyW(
|
||||
registry::HKEY_LOCAL_MACHINE,
|
||||
to_wide(INSTALLATION_KEY).as_ptr(),
|
||||
)
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
status => Err(io::Error::from_raw_os_error(status as i32))
|
||||
.context("remove protected legacy sandbox installation record"),
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user