mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Use AbsolutePathBuf in skill loading and codex_home (#17407)
Helps with FS migration later
This commit is contained in:
@@ -398,8 +398,8 @@ async fn submission_prefers_selected_duplicate_skill_path() {
|
||||
});
|
||||
drain_insert_history(&mut rx);
|
||||
|
||||
let repo_skill_path = PathBuf::from("/tmp/repo/figma/SKILL.md");
|
||||
let user_skill_path = PathBuf::from("/tmp/user/figma/SKILL.md");
|
||||
let repo_skill_path = test_path_buf("/tmp/repo/figma/SKILL.md").abs();
|
||||
let user_skill_path = test_path_buf("/tmp/user/figma/SKILL.md").abs();
|
||||
chat.set_skills(Some(vec![
|
||||
SkillMetadata {
|
||||
name: "figma".to_string(),
|
||||
@@ -445,7 +445,7 @@ async fn submission_prefers_selected_duplicate_skill_path() {
|
||||
_ => None,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
assert_eq!(selected_skill_paths, vec![user_skill_path]);
|
||||
assert_eq!(selected_skill_paths, vec![user_skill_path.to_path_buf()]);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -11,7 +11,7 @@ pub(super) async fn test_config() -> Config {
|
||||
let mut config =
|
||||
Config::load_default_with_cli_overrides_for_codex_home(codex_home.clone(), Vec::new())
|
||||
.expect("config");
|
||||
config.codex_home = codex_home.clone();
|
||||
config.codex_home = codex_home.abs();
|
||||
config.sqlite_home = codex_home.clone();
|
||||
config.log_dir = codex_home.join("log");
|
||||
config.cwd = PathBuf::from(test_path_display("/tmp/project")).abs();
|
||||
@@ -951,7 +951,7 @@ pub(super) fn plugins_test_detail(
|
||||
description: format!("{name} description"),
|
||||
short_description: None,
|
||||
interface: None,
|
||||
path: PathBuf::from(format!("/skills/{name}/SKILL.md")),
|
||||
path: plugins_test_absolute_path(&format!("skills/{name}/SKILL.md")),
|
||||
enabled: true,
|
||||
})
|
||||
.collect(),
|
||||
|
||||
@@ -245,10 +245,10 @@ async fn session_configured_syncs_widget_config_permissions_and_cwd() {
|
||||
.sandbox_policy
|
||||
.set(SandboxPolicy::new_workspace_write_policy())
|
||||
.expect("set sandbox policy");
|
||||
chat.config.cwd = PathBuf::from("/home/user/main").abs();
|
||||
chat.config.cwd = test_path_buf("/home/user/main").abs();
|
||||
|
||||
let expected_sandbox = SandboxPolicy::new_read_only_policy();
|
||||
let expected_cwd = PathBuf::from("/home/user/sub-agent").abs();
|
||||
let expected_cwd = test_path_buf("/home/user/sub-agent").abs();
|
||||
let configured = codex_protocol::protocol::SessionConfiguredEvent {
|
||||
session_id: ThreadId::new(),
|
||||
forked_from_id: None,
|
||||
@@ -392,7 +392,9 @@ async fn forked_thread_history_line_includes_name_and_id_snapshot() {
|
||||
let (chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
let mut chat = chat;
|
||||
let temp = tempdir().expect("tempdir");
|
||||
chat.config.codex_home = temp.path().to_path_buf();
|
||||
chat.config.codex_home =
|
||||
codex_utils_absolute_path::AbsolutePathBuf::from_absolute_path(temp.path())
|
||||
.expect("temp dir is absolute");
|
||||
|
||||
let forked_from_id =
|
||||
ThreadId::from_string("e9f18a88-8081-4e51-9d4e-8af5cde2d8dd").expect("forked id");
|
||||
@@ -429,7 +431,9 @@ async fn forked_thread_history_line_without_name_shows_id_once_snapshot() {
|
||||
let (chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
let mut chat = chat;
|
||||
let temp = tempdir().expect("tempdir");
|
||||
chat.config.codex_home = temp.path().to_path_buf();
|
||||
chat.config.codex_home =
|
||||
codex_utils_absolute_path::AbsolutePathBuf::from_absolute_path(temp.path())
|
||||
.expect("temp dir is absolute");
|
||||
|
||||
let forked_from_id =
|
||||
ThreadId::from_string("019c2d47-4935-7423-a190-05691f566092").expect("forked id");
|
||||
|
||||
@@ -51,8 +51,9 @@ async fn preset_matching_accepts_workspace_write_with_extra_roots() {
|
||||
.into_iter()
|
||||
.find(|p| p.id == "auto")
|
||||
.expect("auto preset exists");
|
||||
let extra_root = test_path_buf("/tmp/extra").abs();
|
||||
let current_sandbox = SandboxPolicy::WorkspaceWrite {
|
||||
writable_roots: vec![PathBuf::from("C:\\extra").abs()],
|
||||
writable_roots: vec![extra_root],
|
||||
read_only_access: Default::default(),
|
||||
network_access: false,
|
||||
exclude_tmpdir_env_var: false,
|
||||
@@ -496,7 +497,7 @@ async fn permissions_selection_marks_guardian_approvals_current_with_custom_work
|
||||
.features
|
||||
.set_enabled(Feature::GuardianApproval, /*enabled*/ true);
|
||||
|
||||
let extra_root = PathBuf::from("/tmp/guardian-approvals-extra").abs();
|
||||
let extra_root = test_path_buf("/tmp/guardian-approvals-extra").abs();
|
||||
|
||||
chat.handle_codex_event(Event {
|
||||
id: "session-configured-custom-workspace".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user