mirror of
https://github.com/openai/codex.git
synced 2026-11-29 07:35:16 +00:00
Stop migrating Cursor sandbox settings (#39325)
## What changed - Ignore `.cursor/sandbox.json` during external agent config migration. - Continue importing supported settings from `.cursor/cli-config.json`. ## Testing - Update app-server migration coverage to verify that environment variables from `cli-config.json` are imported. GitOrigin-RevId: 6094f1cb6f698392d58056f826da21c1f1389a1b
This commit is contained in:
1 parent
b537d5a097
commit
67ed4e717a
5 files changed
+10
-156
No files matched your search
@@ -7,71 +7,6 @@ use crate::model::PluginsMigration;
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::collections::HashSet;
|
||||
use tempfile::TempDir;
|
||||
use toml::Value as TomlValue;
|
||||
|
||||
#[test]
|
||||
fn effective_settings_merge_sandbox_configuration() {
|
||||
let root = TempDir::new().expect("tempdir");
|
||||
let source_dir = root.path().join(CurSource::CONFIG_DIR);
|
||||
let source_settings = source_dir.join(CurSource::HOME_CONFIG_FILE);
|
||||
fs::create_dir_all(&source_dir).expect("source directory");
|
||||
fs::write(&source_settings, r#"{"env":{"FOO":"bar"}}"#).expect("source settings");
|
||||
fs::write(
|
||||
source_dir.join(CurSource::SANDBOX_CONFIG_FILE),
|
||||
r#"{"type":"read_only"}"#,
|
||||
)
|
||||
.expect("sandbox settings");
|
||||
|
||||
assert_eq!(
|
||||
CurSource::effective_settings(&source_dir, &source_settings).expect("effective settings"),
|
||||
Some(serde_json::json!({
|
||||
"env": {"FOO": "bar"},
|
||||
(CurSource::SANDBOX_SETTINGS_KEY): {"type": "read_only"}
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn append_config_maps_workspace_permissions() {
|
||||
let root = TempDir::new().expect("tempdir");
|
||||
let writable_root = root.path().join("generated");
|
||||
let settings = serde_json::json!({
|
||||
(CurSource::SANDBOX_SETTINGS_KEY): {
|
||||
"type": "workspace_readwrite",
|
||||
"additionalReadwritePaths": [writable_root.display().to_string(), "relative/path"],
|
||||
"disableTmpWrite": true,
|
||||
"networkPolicy": {"default": "allow"}
|
||||
}
|
||||
});
|
||||
let mut config = toml::map::Map::new();
|
||||
|
||||
CurSource::append_config(&mut config, settings.as_object().expect("settings object"));
|
||||
|
||||
let mut workspace_write = toml::map::Map::new();
|
||||
workspace_write.insert(
|
||||
"writable_roots".to_string(),
|
||||
TomlValue::Array(vec![TomlValue::String(
|
||||
writable_root.to_string_lossy().into_owned(),
|
||||
)]),
|
||||
);
|
||||
workspace_write.insert("exclude_slash_tmp".to_string(), TomlValue::Boolean(true));
|
||||
workspace_write.insert(
|
||||
"exclude_tmpdir_env_var".to_string(),
|
||||
TomlValue::Boolean(true),
|
||||
);
|
||||
workspace_write.insert("network_access".to_string(), TomlValue::Boolean(true));
|
||||
let mut expected = toml::map::Map::new();
|
||||
expected.insert(
|
||||
"sandbox_mode".to_string(),
|
||||
TomlValue::String("workspace-write".to_string()),
|
||||
);
|
||||
expected.insert(
|
||||
"sandbox_workspace_write".to_string(),
|
||||
TomlValue::Table(workspace_write),
|
||||
);
|
||||
|
||||
assert_eq!(TomlValue::Table(config), TomlValue::Table(expected));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cached_marketplace_plugins_require_manifest_and_cache_entries() {
|
||||
|
||||
Reference in new issue
Block a user