fix(rmcp-client): make OAuth lock root Windows-safe

This commit is contained in:
Adam Perry
2026-06-05 08:57:18 +00:00
parent 9dd315fff7
commit e410df00c9
2 changed files with 9 additions and 3 deletions
+3 -2
View File
@@ -670,12 +670,12 @@ fn windows_local_app_data_dir() -> Result<PathBuf> {
use std::os::windows::ffi::OsStringExt;
use windows_sys::Win32::System::Com::CoTaskMemFree;
use windows_sys::Win32::UI::Shell::FOLDERID_LocalAppData;
use windows_sys::Win32::UI::Shell::KF_FLAG_DEFAULT;
use windows_sys::Win32::UI::Shell::KF_FLAG_DONT_VERIFY;
use windows_sys::Win32::UI::Shell::SHGetKnownFolderPath;
let mut path_ptr = std::ptr::null_mut::<u16>();
let known_folder_flags =
u32::try_from(KF_FLAG_DEFAULT).context("KF_FLAG_DEFAULT did not fit in u32")?;
u32::try_from(KF_FLAG_DONT_VERIFY).context("KF_FLAG_DONT_VERIFY did not fit in u32")?;
let hr = unsafe {
SHGetKnownFolderPath(&FOLDERID_LocalAppData, known_folder_flags, 0, &mut path_ptr)
};
@@ -1541,6 +1541,7 @@ mod tests {
use std::os::unix::fs::PermissionsExt;
let _env = TempCodexHome::new();
#[cfg(unix)]
let first_home = PathBuf::from(std::env::var_os("HOME").expect("HOME should be set"));
let first_tmpdir = tempdir()?;
unsafe {
@@ -609,7 +609,12 @@ async fn oauth_external_update_during_refresh_child() -> anyhow::Result<()> {
)?;
let client = initialized_oauth_client(&server_url).await?;
save_test_tokens(&server_url, OLD_ACCESS_TOKEN, OLD_REFRESH_TOKEN, 0)?;
save_test_tokens(
&server_url,
OLD_ACCESS_TOKEN,
OLD_REFRESH_TOKEN,
/*expires_at*/ 0,
)?;
client
.call_tool(
"trigger-refresh-contention".to_string(),