mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
feat: synchronize runtime workspace roots in thread settings
This commit is contained in:
@@ -4583,6 +4583,16 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"runtimeWorkspaceRoots": {
|
||||
"default": null,
|
||||
"items": {
|
||||
"$ref": "#/definitions/AbsolutePathBuf"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"sandboxPolicy": {
|
||||
"$ref": "#/definitions/SandboxPolicy"
|
||||
},
|
||||
|
||||
+10
@@ -17688,6 +17688,16 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"runtimeWorkspaceRoots": {
|
||||
"default": null,
|
||||
"items": {
|
||||
"$ref": "#/definitions/v2/AbsolutePathBuf"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"sandboxPolicy": {
|
||||
"$ref": "#/definitions/v2/SandboxPolicy"
|
||||
},
|
||||
|
||||
+10
@@ -15512,6 +15512,16 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"runtimeWorkspaceRoots": {
|
||||
"default": null,
|
||||
"items": {
|
||||
"$ref": "#/definitions/AbsolutePathBuf"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"sandboxPolicy": {
|
||||
"$ref": "#/definitions/SandboxPolicy"
|
||||
},
|
||||
|
||||
+10
@@ -332,6 +332,16 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"runtimeWorkspaceRoots": {
|
||||
"default": null,
|
||||
"items": {
|
||||
"$ref": "#/definitions/AbsolutePathBuf"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"sandboxPolicy": {
|
||||
"$ref": "#/definitions/SandboxPolicy"
|
||||
},
|
||||
|
||||
@@ -11,4 +11,4 @@ import type { ApprovalsReviewer } from "./ApprovalsReviewer";
|
||||
import type { AskForApproval } from "./AskForApproval";
|
||||
import type { SandboxPolicy } from "./SandboxPolicy";
|
||||
|
||||
export type ThreadSettings = { cwd: AbsolutePathBuf, approvalPolicy: AskForApproval, approvalsReviewer: ApprovalsReviewer, sandboxPolicy: SandboxPolicy, activePermissionProfile: ActivePermissionProfile | null, model: string, modelProvider: string, serviceTier: string | null, effort: ReasoningEffort | null, summary: ReasoningSummary | null, collaborationMode: CollaborationMode, personality: Personality | null, };
|
||||
export type ThreadSettings = { cwd: AbsolutePathBuf, runtimeWorkspaceRoots: Array<AbsolutePathBuf> | null, approvalPolicy: AskForApproval, approvalsReviewer: ApprovalsReviewer, sandboxPolicy: SandboxPolicy, activePermissionProfile: ActivePermissionProfile | null, model: string, modelProvider: string, serviceTier: string | null, effort: ReasoningEffort | null, summary: ReasoningSummary | null, collaborationMode: CollaborationMode, personality: Personality | null, };
|
||||
|
||||
@@ -3167,6 +3167,7 @@ mod tests {
|
||||
thread_id: "thr_123".to_string(),
|
||||
thread_settings: v2::ThreadSettings {
|
||||
cwd: absolute_path("/tmp/repo"),
|
||||
runtime_workspace_roots: None,
|
||||
approval_policy: v2::AskForApproval::Never,
|
||||
approvals_reviewer: v2::ApprovalsReviewer::User,
|
||||
sandbox_policy: v2::SandboxPolicy::DangerFullAccess,
|
||||
@@ -3192,6 +3193,12 @@ mod tests {
|
||||
crate::experimental_api::ExperimentalApi::experimental_reason(¬ification),
|
||||
Some("thread/settings/updated")
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::to_value(notification)
|
||||
.expect("thread settings notification should serialize")
|
||||
.pointer("/params/threadSettings/runtimeWorkspaceRoots"),
|
||||
Some(&serde_json::Value::Null)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -3644,6 +3644,16 @@ fn thread_settings_update_params_preserve_explicit_null_service_tier() {
|
||||
|
||||
#[test]
|
||||
fn thread_settings_update_params_preserve_field_level_experimental_gates() {
|
||||
let runtime_workspace_roots = ThreadSettingsUpdateParams {
|
||||
thread_id: "thread_123".to_string(),
|
||||
runtime_workspace_roots: Some(vec![PathBuf::from("repo")]),
|
||||
..Default::default()
|
||||
};
|
||||
assert_eq!(
|
||||
crate::experimental_api::ExperimentalApi::experimental_reason(&runtime_workspace_roots),
|
||||
Some("thread/settings/update.runtimeWorkspaceRoots")
|
||||
);
|
||||
|
||||
let permissions = ThreadSettingsUpdateParams {
|
||||
thread_id: "thread_123".to_string(),
|
||||
permissions: Some(":workspace".to_string()),
|
||||
|
||||
@@ -234,6 +234,11 @@ pub struct ThreadSettingsUpdateParams {
|
||||
/// Override the working directory for subsequent turns.
|
||||
#[ts(optional = nullable)]
|
||||
pub cwd: Option<PathBuf>,
|
||||
/// Replace the thread's runtime workspace roots for subsequent turns.
|
||||
/// Relative paths are resolved against the effective cwd.
|
||||
#[experimental("thread/settings/update.runtimeWorkspaceRoots")]
|
||||
#[ts(optional = nullable)]
|
||||
pub runtime_workspace_roots: Option<Vec<PathBuf>>,
|
||||
/// Override the approval policy for subsequent turns.
|
||||
#[experimental(nested)]
|
||||
#[ts(optional = nullable)]
|
||||
@@ -290,6 +295,10 @@ pub struct ThreadSettingsUpdateResponse {}
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadSettings {
|
||||
pub cwd: AbsolutePathBuf,
|
||||
// New servers populate this field. `None` accepts older payloads that
|
||||
// predate runtime workspace root synchronization.
|
||||
#[serde(default)]
|
||||
pub runtime_workspace_roots: Option<Vec<AbsolutePathBuf>>,
|
||||
pub approval_policy: AskForApproval,
|
||||
pub approvals_reviewer: ApprovalsReviewer,
|
||||
pub sandbox_policy: SandboxPolicy,
|
||||
|
||||
Reference in New Issue
Block a user