From 96cfb15695acffc64bfbad36f56e8bc23bcf2ae7 Mon Sep 17 00:00:00 2001 From: Adam Perry Date: Fri, 10 Jul 2026 03:34:17 +0000 Subject: [PATCH] codex: fix CI failure on PR #32000 --- .../schema/json/ClientRequest.json | 16 +++-- ...CommandExecutionRequestApprovalParams.json | 6 +- .../PermissionsRequestApprovalParams.json | 6 +- .../schema/json/ServerNotification.json | 12 ++-- .../schema/json/ServerRequest.json | 8 +-- .../codex_app_server_protocol.schemas.json | 28 +++++---- .../codex_app_server_protocol.v2.schemas.json | 26 ++++---- .../schema/json/v2/CommandExecParams.json | 9 ++- .../json/v2/ItemCompletedNotification.json | 2 +- ...anApprovalReviewCompletedNotification.json | 12 ++-- ...dianApprovalReviewStartedNotification.json | 12 ++-- .../json/v2/ItemStartedNotification.json | 2 +- .../json/v2/PermissionProfileListParams.json | 19 ++++-- .../schema/json/v2/ReviewStartResponse.json | 2 +- .../schema/json/v2/ThreadForkResponse.json | 4 +- .../schema/json/v2/ThreadListResponse.json | 2 +- .../json/v2/ThreadMetadataUpdateResponse.json | 2 +- .../schema/json/v2/ThreadReadResponse.json | 2 +- .../schema/json/v2/ThreadResumeResponse.json | 4 +- .../json/v2/ThreadRollbackResponse.json | 2 +- .../v2/ThreadSettingsUpdatedNotification.json | 5 +- .../schema/json/v2/ThreadStartResponse.json | 4 +- .../json/v2/ThreadStartedNotification.json | 2 +- .../json/v2/ThreadUnarchiveResponse.json | 2 +- .../json/v2/TurnCompletedNotification.json | 2 +- .../schema/json/v2/TurnStartParams.json | 2 +- .../schema/json/v2/TurnStartResponse.json | 2 +- .../json/v2/TurnStartedNotification.json | 2 +- .../schema/typescript/v2/CommandAction.ts | 4 +- .../v2/GuardianApprovalReviewAction.ts | 4 +- .../v2/PermissionProfileListParams.ts | 3 +- .../v2/PermissionsRequestApprovalParams.ts | 4 +- .../schema/typescript/v2/SandboxPolicy.ts | 4 +- .../src/protocol/item_builders.rs | 56 +++++++++-------- .../src/protocol/item_builders_tests.rs | 19 +++++- .../src/protocol/v2/item.rs | 63 ++++++++++++------- .../src/protocol/v2/tests.rs | 53 +++++++++------- 37 files changed, 228 insertions(+), 179 deletions(-) diff --git a/codex-rs/app-server-protocol/schema/json/ClientRequest.json b/codex-rs/app-server-protocol/schema/json/ClientRequest.json index d391cac165..198c7cd5bb 100644 --- a/codex-rs/app-server-protocol/schema/json/ClientRequest.json +++ b/codex-rs/app-server-protocol/schema/json/ClientRequest.json @@ -1855,11 +1855,15 @@ ] }, "cwd": { - "description": "Optional working directory to resolve project config layers.", - "type": [ - "string", - "null" - ] + "anyOf": [ + { + "$ref": "#/definitions/LegacyAppPathString" + }, + { + "type": "null" + } + ], + "description": "Optional working directory to resolve project config layers." }, "limit": { "description": "Optional page size; defaults to the full result set.", @@ -3375,7 +3379,7 @@ "writableRoots": { "default": [], "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": "array" } diff --git a/codex-rs/app-server-protocol/schema/json/CommandExecutionRequestApprovalParams.json b/codex-rs/app-server-protocol/schema/json/CommandExecutionRequestApprovalParams.json index da480a296e..fd87c4fb32 100644 --- a/codex-rs/app-server-protocol/schema/json/CommandExecutionRequestApprovalParams.json +++ b/codex-rs/app-server-protocol/schema/json/CommandExecutionRequestApprovalParams.json @@ -1,10 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { - "AbsolutePathBuf": { - "description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - "type": "string" - }, "AdditionalFileSystemPermissions": { "properties": { "entries": { @@ -95,7 +91,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ diff --git a/codex-rs/app-server-protocol/schema/json/PermissionsRequestApprovalParams.json b/codex-rs/app-server-protocol/schema/json/PermissionsRequestApprovalParams.json index 73329310c8..8d5298d096 100644 --- a/codex-rs/app-server-protocol/schema/json/PermissionsRequestApprovalParams.json +++ b/codex-rs/app-server-protocol/schema/json/PermissionsRequestApprovalParams.json @@ -1,10 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { - "AbsolutePathBuf": { - "description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - "type": "string" - }, "AdditionalFileSystemPermissions": { "properties": { "entries": { @@ -294,7 +290,7 @@ }, "properties": { "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "environmentId": { "default": null, diff --git a/codex-rs/app-server-protocol/schema/json/ServerNotification.json b/codex-rs/app-server-protocol/schema/json/ServerNotification.json index 314cdbe2f0..a9f5249ff2 100644 --- a/codex-rs/app-server-protocol/schema/json/ServerNotification.json +++ b/codex-rs/app-server-protocol/schema/json/ServerNotification.json @@ -804,7 +804,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ @@ -1748,7 +1748,7 @@ "type": "string" }, "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "source": { "$ref": "#/definitions/GuardianCommandSource" @@ -1779,7 +1779,7 @@ "type": "array" }, "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "program": { "type": "string" @@ -1808,11 +1808,11 @@ { "properties": { "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "files": { "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": "array" }, @@ -3364,7 +3364,7 @@ "writableRoots": { "default": [], "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": "array" } diff --git a/codex-rs/app-server-protocol/schema/json/ServerRequest.json b/codex-rs/app-server-protocol/schema/json/ServerRequest.json index 971dde2498..cd34a631b7 100644 --- a/codex-rs/app-server-protocol/schema/json/ServerRequest.json +++ b/codex-rs/app-server-protocol/schema/json/ServerRequest.json @@ -1,10 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { - "AbsolutePathBuf": { - "description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - "type": "string" - }, "AdditionalFileSystemPermissions": { "properties": { "entries": { @@ -164,7 +160,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ @@ -1628,7 +1624,7 @@ "PermissionsRequestApprovalParams": { "properties": { "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "environmentId": { "default": null, diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json index 8e06315af0..44d5ee9794 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json @@ -3931,7 +3931,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "properties": { "cwd": { - "$ref": "#/definitions/v2/AbsolutePathBuf" + "$ref": "#/definitions/v2/LegacyAppPathString" }, "environmentId": { "default": null, @@ -7347,7 +7347,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/v2/AbsolutePathBuf" + "$ref": "#/definitions/v2/LegacyAppPathString" }, "type": { "enum": [ @@ -10523,7 +10523,7 @@ "type": "string" }, "cwd": { - "$ref": "#/definitions/v2/AbsolutePathBuf" + "$ref": "#/definitions/v2/LegacyAppPathString" }, "source": { "$ref": "#/definitions/v2/GuardianCommandSource" @@ -10554,7 +10554,7 @@ "type": "array" }, "cwd": { - "$ref": "#/definitions/v2/AbsolutePathBuf" + "$ref": "#/definitions/v2/LegacyAppPathString" }, "program": { "type": "string" @@ -10583,11 +10583,11 @@ { "properties": { "cwd": { - "$ref": "#/definitions/v2/AbsolutePathBuf" + "$ref": "#/definitions/v2/LegacyAppPathString" }, "files": { "items": { - "$ref": "#/definitions/v2/AbsolutePathBuf" + "$ref": "#/definitions/v2/LegacyAppPathString" }, "type": "array" }, @@ -13195,11 +13195,15 @@ ] }, "cwd": { - "description": "Optional working directory to resolve project config layers.", - "type": [ - "string", - "null" - ] + "anyOf": [ + { + "$ref": "#/definitions/v2/LegacyAppPathString" + }, + { + "type": "null" + } + ], + "description": "Optional working directory to resolve project config layers." }, "limit": { "description": "Optional page size; defaults to the full result set.", @@ -16337,7 +16341,7 @@ "writableRoots": { "default": [], "items": { - "$ref": "#/definitions/v2/AbsolutePathBuf" + "$ref": "#/definitions/v2/LegacyAppPathString" }, "type": "array" } diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json index 7eec681126..48ac94a6b4 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json @@ -3587,7 +3587,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ @@ -6874,7 +6874,7 @@ "type": "string" }, "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "source": { "$ref": "#/definitions/GuardianCommandSource" @@ -6905,7 +6905,7 @@ "type": "array" }, "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "program": { "type": "string" @@ -6934,11 +6934,11 @@ { "properties": { "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "files": { "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": "array" }, @@ -9599,11 +9599,15 @@ ] }, "cwd": { - "description": "Optional working directory to resolve project config layers.", - "type": [ - "string", - "null" - ] + "anyOf": [ + { + "$ref": "#/definitions/LegacyAppPathString" + }, + { + "type": "null" + } + ], + "description": "Optional working directory to resolve project config layers." }, "limit": { "description": "Optional page size; defaults to the full result set.", @@ -12741,7 +12745,7 @@ "writableRoots": { "default": [], "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": "array" } diff --git a/codex-rs/app-server-protocol/schema/json/v2/CommandExecParams.json b/codex-rs/app-server-protocol/schema/json/v2/CommandExecParams.json index d00a0b60e5..9cbfc244cb 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/CommandExecParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/CommandExecParams.json @@ -1,10 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { - "AbsolutePathBuf": { - "description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - "type": "string" - }, "CommandExecTerminalSize": { "description": "PTY size in character cells for `command/exec` PTY sessions.", "properties": { @@ -27,6 +23,9 @@ ], "type": "object" }, + "LegacyAppPathString": { + "type": "string" + }, "NetworkAccess": { "enum": [ "restricted", @@ -120,7 +119,7 @@ "writableRoots": { "default": [], "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": "array" } diff --git a/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json index dcf6312c7d..b58ebc510f 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json @@ -82,7 +82,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ diff --git a/codex-rs/app-server-protocol/schema/json/v2/ItemGuardianApprovalReviewCompletedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ItemGuardianApprovalReviewCompletedNotification.json index 4e48606611..f7f089a36c 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ItemGuardianApprovalReviewCompletedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ItemGuardianApprovalReviewCompletedNotification.json @@ -1,10 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { - "AbsolutePathBuf": { - "description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - "type": "string" - }, "AdditionalFileSystemPermissions": { "properties": { "entries": { @@ -315,7 +311,7 @@ "type": "string" }, "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "source": { "$ref": "#/definitions/GuardianCommandSource" @@ -346,7 +342,7 @@ "type": "array" }, "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "program": { "type": "string" @@ -375,11 +371,11 @@ { "properties": { "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "files": { "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": "array" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ItemGuardianApprovalReviewStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ItemGuardianApprovalReviewStartedNotification.json index 7d64012fda..00b431ef7f 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ItemGuardianApprovalReviewStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ItemGuardianApprovalReviewStartedNotification.json @@ -1,10 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { - "AbsolutePathBuf": { - "description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - "type": "string" - }, "AdditionalFileSystemPermissions": { "properties": { "entries": { @@ -308,7 +304,7 @@ "type": "string" }, "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "source": { "$ref": "#/definitions/GuardianCommandSource" @@ -339,7 +335,7 @@ "type": "array" }, "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "program": { "type": "string" @@ -368,11 +364,11 @@ { "properties": { "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "files": { "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": "array" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json index 1933225ade..152b7cbc74 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json @@ -82,7 +82,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ diff --git a/codex-rs/app-server-protocol/schema/json/v2/PermissionProfileListParams.json b/codex-rs/app-server-protocol/schema/json/v2/PermissionProfileListParams.json index 402dab6221..69f1ec2c97 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/PermissionProfileListParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/PermissionProfileListParams.json @@ -1,5 +1,10 @@ { "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "LegacyAppPathString": { + "type": "string" + } + }, "properties": { "cursor": { "description": "Opaque pagination cursor returned by a previous call.", @@ -9,11 +14,15 @@ ] }, "cwd": { - "description": "Optional working directory to resolve project config layers.", - "type": [ - "string", - "null" - ] + "anyOf": [ + { + "$ref": "#/definitions/LegacyAppPathString" + }, + { + "type": "null" + } + ], + "description": "Optional working directory to resolve project config layers." }, "limit": { "description": "Optional page size; defaults to the full result set.", diff --git a/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json index 6851ddb487..3af7a69062 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json @@ -220,7 +220,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json index 59a14cc070..d4c95060aa 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json @@ -301,7 +301,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ @@ -877,7 +877,7 @@ "writableRoots": { "default": [], "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": "array" } diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json index e5cbc2e606..7ddb64acb1 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json @@ -223,7 +223,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json index cdd1d47a69..f38ccc1ee4 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json @@ -223,7 +223,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json index 613dd9648e..6f2a36cc1d 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json @@ -223,7 +223,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json index 80fbb183f8..11d2ee7514 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json @@ -301,7 +301,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ @@ -877,7 +877,7 @@ "writableRoots": { "default": [], "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": "array" } diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json index 793f11c226..33b91a60c2 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json @@ -223,7 +223,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadSettingsUpdatedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadSettingsUpdatedNotification.json index f3296fa376..e3f2dca5a0 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadSettingsUpdatedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadSettingsUpdatedNotification.json @@ -99,6 +99,9 @@ ], "type": "object" }, + "LegacyAppPathString": { + "type": "string" + }, "ModeKind": { "description": "Initial collaboration mode to use when the TUI starts.", "enum": [ @@ -258,7 +261,7 @@ "writableRoots": { "default": [], "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": "array" } diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json index 3ef1577038..41243f5104 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json @@ -301,7 +301,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ @@ -877,7 +877,7 @@ "writableRoots": { "default": [], "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": "array" } diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json index a56d59c01d..5cf7ccb3cc 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json @@ -223,7 +223,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json index 6cc9b44cba..669dee645b 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json @@ -223,7 +223,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json index 6ffb343595..0ea966e7e2 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json @@ -220,7 +220,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json b/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json index cc4869e1d1..98d60f8f45 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json @@ -291,7 +291,7 @@ "writableRoots": { "default": [], "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": "array" } diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json index 805a5099a2..1722f1e745 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json @@ -220,7 +220,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json index 1f3f7c7036..88e71c07e7 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json @@ -220,7 +220,7 @@ "type": "string" }, "path": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "#/definitions/LegacyAppPathString" }, "type": { "enum": [ diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/CommandAction.ts b/codex-rs/app-server-protocol/schema/typescript/v2/CommandAction.ts index a17fb06a0c..91c92c9cbf 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/CommandAction.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/CommandAction.ts @@ -1,6 +1,6 @@ // GENERATED CODE! DO NOT MODIFY BY HAND! // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AbsolutePathBuf } from "../AbsolutePathBuf"; +import type { LegacyAppPathString } from "../LegacyAppPathString"; -export type CommandAction = { "type": "read", command: string, name: string, path: AbsolutePathBuf, } | { "type": "listFiles", command: string, path: string | null, } | { "type": "search", command: string, query: string | null, path: string | null, } | { "type": "unknown", command: string, }; +export type CommandAction = { "type": "read", command: string, name: string, path: LegacyAppPathString, } | { "type": "listFiles", command: string, path: string | null, } | { "type": "search", command: string, query: string | null, path: string | null, } | { "type": "unknown", command: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/GuardianApprovalReviewAction.ts b/codex-rs/app-server-protocol/schema/typescript/v2/GuardianApprovalReviewAction.ts index 4f00e37d20..09c3314fb8 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/GuardianApprovalReviewAction.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/GuardianApprovalReviewAction.ts @@ -1,9 +1,9 @@ // GENERATED CODE! DO NOT MODIFY BY HAND! // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AbsolutePathBuf } from "../AbsolutePathBuf"; +import type { LegacyAppPathString } from "../LegacyAppPathString"; import type { GuardianCommandSource } from "./GuardianCommandSource"; import type { NetworkApprovalProtocol } from "./NetworkApprovalProtocol"; import type { RequestPermissionProfile } from "./RequestPermissionProfile"; -export type GuardianApprovalReviewAction = { "type": "command", source: GuardianCommandSource, command: string, cwd: AbsolutePathBuf, } | { "type": "execve", source: GuardianCommandSource, program: string, argv: Array, cwd: AbsolutePathBuf, } | { "type": "applyPatch", cwd: AbsolutePathBuf, files: Array, } | { "type": "networkAccess", target: string, host: string, protocol: NetworkApprovalProtocol, port: number, } | { "type": "mcpToolCall", server: string, toolName: string, connectorId: string | null, connectorName: string | null, toolTitle: string | null, } | { "type": "requestPermissions", reason: string | null, permissions: RequestPermissionProfile, }; +export type GuardianApprovalReviewAction = { "type": "command", source: GuardianCommandSource, command: string, cwd: LegacyAppPathString, } | { "type": "execve", source: GuardianCommandSource, program: string, argv: Array, cwd: LegacyAppPathString, } | { "type": "applyPatch", cwd: LegacyAppPathString, files: Array, } | { "type": "networkAccess", target: string, host: string, protocol: NetworkApprovalProtocol, port: number, } | { "type": "mcpToolCall", server: string, toolName: string, connectorId: string | null, connectorName: string | null, toolTitle: string | null, } | { "type": "requestPermissions", reason: string | null, permissions: RequestPermissionProfile, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/PermissionProfileListParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/PermissionProfileListParams.ts index 24582c9507..3f1c264634 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/PermissionProfileListParams.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/PermissionProfileListParams.ts @@ -1,6 +1,7 @@ // GENERATED CODE! DO NOT MODIFY BY HAND! // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { LegacyAppPathString } from "../LegacyAppPathString"; export type PermissionProfileListParams = { /** @@ -14,4 +15,4 @@ limit?: number | null, /** * Optional working directory to resolve project config layers. */ -cwd?: string | null, }; +cwd?: LegacyAppPathString | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/PermissionsRequestApprovalParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/PermissionsRequestApprovalParams.ts index d0677f5f0c..71b39e2f6b 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/PermissionsRequestApprovalParams.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/PermissionsRequestApprovalParams.ts @@ -1,11 +1,11 @@ // GENERATED CODE! DO NOT MODIFY BY HAND! // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AbsolutePathBuf } from "../AbsolutePathBuf"; +import type { LegacyAppPathString } from "../LegacyAppPathString"; import type { RequestPermissionProfile } from "./RequestPermissionProfile"; export type PermissionsRequestApprovalParams = { threadId: string, turnId: string, itemId: string, environmentId: string | null, /** * Unix timestamp (in milliseconds) when this approval request started. */ -startedAtMs: number, cwd: AbsolutePathBuf, reason: string | null, permissions: RequestPermissionProfile, }; +startedAtMs: number, cwd: LegacyAppPathString, reason: string | null, permissions: RequestPermissionProfile, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/SandboxPolicy.ts b/codex-rs/app-server-protocol/schema/typescript/v2/SandboxPolicy.ts index 5575701ff2..61bce39c5c 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/SandboxPolicy.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/SandboxPolicy.ts @@ -1,7 +1,7 @@ // GENERATED CODE! DO NOT MODIFY BY HAND! // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AbsolutePathBuf } from "../AbsolutePathBuf"; +import type { LegacyAppPathString } from "../LegacyAppPathString"; import type { NetworkAccess } from "./NetworkAccess"; -export type SandboxPolicy = { "type": "dangerFullAccess" } | { "type": "readOnly", networkAccess: boolean, } | { "type": "externalSandbox", networkAccess: NetworkAccess, } | { "type": "workspaceWrite", writableRoots: Array, networkAccess: boolean, excludeTmpdirEnvVar: boolean, excludeSlashTmp: boolean, }; +export type SandboxPolicy = { "type": "dangerFullAccess" } | { "type": "readOnly", networkAccess: boolean, } | { "type": "externalSandbox", networkAccess: NetworkAccess, } | { "type": "workspaceWrite", writableRoots: Array, networkAccess: boolean, excludeTmpdirEnvVar: boolean, excludeSlashTmp: boolean, }; diff --git a/codex-rs/app-server-protocol/src/protocol/item_builders.rs b/codex-rs/app-server-protocol/src/protocol/item_builders.rs index 751bf4f67b..c5e4792ce7 100644 --- a/codex-rs/app-server-protocol/src/protocol/item_builders.rs +++ b/codex-rs/app-server-protocol/src/protocol/item_builders.rs @@ -141,33 +141,40 @@ pub(crate) fn command_actions_for_path_uri( parsed_cmd: &[ParsedCommand], cwd: &PathUri, ) -> Vec { - // TODO(anp): Carry PathUri into CommandAction so foreign Read actions retain resolved paths. - // Until then, omit those actions rather than project a foreign cwd onto the host. - let native_cwd = if cwd.infer_path_convention() == Some(PathConvention::native()) { - cwd.to_abs_path().ok() - } else { - None - }; - parsed_cmd .iter() .cloned() .filter_map(|parsed| match parsed { - ParsedCommand::Read { cmd, name, path } => match native_cwd.as_ref() { - Some(native_cwd) => Some(CommandAction::Read { - command: cmd, - name, - path: native_cwd.join(path), - }), - None => { - warn!( - command = cmd, - %cwd, - "omitting read command action whose path cannot be resolved against a foreign cwd" - ); - None + ParsedCommand::Read { cmd, name, path } => { + let path = path.to_string_lossy(); + let target_convention = cwd.infer_path_convention(); + let is_home_relative = path == "~" + || path.starts_with("~/") + || (target_convention == Some(PathConvention::Windows) + && path.starts_with(r"~\")); + let resolved = if is_home_relative { + Err("the target home directory is unavailable from a path URI".to_string()) + } else { + cwd.join(path.as_ref()).map_err(|err| err.to_string()) + }; + match resolved { + Ok(path) => Some(CommandAction::Read { + command: cmd, + name, + path: path.into(), + }), + Err(err) => { + warn!( + command = cmd, + path = %path, + %cwd, + %err, + "omitting read command action whose path cannot be resolved against cwd" + ); + None + } } - }, + } ParsedCommand::ListFiles { cmd, path } => { Some(CommandAction::ListFiles { command: cmd, path }) } @@ -227,10 +234,7 @@ pub fn build_item_from_guardian_event( command: command.clone(), }] } else { - parsed_cmd - .into_iter() - .map(|parsed| CommandAction::from_core_with_cwd(parsed, cwd)) - .collect() + command_actions_for_path_uri(&parsed_cmd, cwd) }; Some(ThreadItem::CommandExecution { id: id.clone(), diff --git a/codex-rs/app-server-protocol/src/protocol/item_builders_tests.rs b/codex-rs/app-server-protocol/src/protocol/item_builders_tests.rs index b892fcf505..b714bdf3f5 100644 --- a/codex-rs/app-server-protocol/src/protocol/item_builders_tests.rs +++ b/codex-rs/app-server-protocol/src/protocol/item_builders_tests.rs @@ -2,17 +2,26 @@ use super::*; use pretty_assertions::assert_eq; #[test] -fn foreign_read_is_omitted_without_dropping_other_command_actions() { +fn foreign_read_is_retained_with_other_command_actions() { #[cfg(windows)] let cwd = PathUri::parse("file:///usr/local/src").expect("valid foreign POSIX cwd"); #[cfg(not(windows))] let cwd = PathUri::parse("file:///C:/src").expect("valid foreign Windows cwd"); + #[cfg(windows)] + let home_relative_path = "~/secret"; + #[cfg(not(windows))] + let home_relative_path = r"~\secret"; let parsed_cmd = vec![ ParsedCommand::Read { cmd: "cat file.txt".to_string(), name: "file.txt".to_string(), path: PathBuf::from("file.txt"), }, + ParsedCommand::Read { + cmd: format!("cat {home_relative_path}"), + name: "secret".to_string(), + path: PathBuf::from(home_relative_path), + }, ParsedCommand::ListFiles { cmd: "ls".to_string(), path: Some("subdir".to_string()), @@ -23,10 +32,18 @@ fn foreign_read_is_omitted_without_dropping_other_command_actions() { path: Some("src".to_string()), }, ]; + let read_path = cwd + .join("file.txt") + .expect("relative path should resolve against foreign cwd"); assert_eq!( command_actions_for_path_uri(&parsed_cmd, &cwd), vec![ + CommandAction::Read { + command: "cat file.txt".to_string(), + name: "file.txt".to_string(), + path: read_path.into(), + }, CommandAction::ListFiles { command: "ls".to_string(), path: Some("subdir".to_string()), diff --git a/codex-rs/app-server-protocol/src/protocol/v2/item.rs b/codex-rs/app-server-protocol/src/protocol/v2/item.rs index 7a5e4dc1f4..0052a741c8 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2/item.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2/item.rs @@ -41,8 +41,8 @@ use codex_protocol::protocol::PatchApplyStatus as CorePatchApplyStatus; use codex_protocol::protocol::ReviewDecision as CoreReviewDecision; use codex_protocol::protocol::SubAgentActivityKind as CoreSubAgentActivityKind; use codex_shell_command::parse_command::shlex_join; -use codex_utils_absolute_path::AbsolutePathBuf; use codex_utils_path_uri::LegacyAppPathString; +use codex_utils_path_uri::PathUri; use schemars::JsonSchema; use serde::Deserialize; use serde::Serialize; @@ -121,7 +121,7 @@ pub enum CommandAction { Read { command: String, name: String, - path: AbsolutePathBuf, + path: LegacyAppPathString, }, ListFiles { command: String, @@ -185,7 +185,7 @@ impl CommandAction { } => CoreParsedCommand::Read { cmd, name, - path: path.into_path_buf(), + path: PathBuf::from(path.into_string()), }, CommandAction::ListFiles { command: cmd, path } => { CoreParsedCommand::ListFiles { cmd, path } @@ -199,12 +199,15 @@ impl CommandAction { } } - pub fn from_core_with_cwd(value: CoreParsedCommand, cwd: &AbsolutePathBuf) -> Self { + pub fn from_core_with_cwd(value: CoreParsedCommand, cwd: &PathUri) -> Self { match value { CoreParsedCommand::Read { cmd, name, path } => CommandAction::Read { command: cmd, name, - path: cwd.join(path), + path: cwd + .join(path.to_string_lossy().as_ref()) + .map(LegacyAppPathString::from) + .unwrap_or_else(|_| LegacyAppPathString::from_path(&path)), }, CoreParsedCommand::ListFiles { cmd, path } => { CommandAction::ListFiles { command: cmd, path } @@ -558,7 +561,7 @@ impl From for CoreGuardianCommandSource { pub struct GuardianCommandReviewAction { pub source: GuardianCommandSource, pub command: String, - pub cwd: AbsolutePathBuf, + pub cwd: LegacyAppPathString, } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] @@ -568,15 +571,15 @@ pub struct GuardianExecveReviewAction { pub source: GuardianCommandSource, pub program: String, pub argv: Vec, - pub cwd: AbsolutePathBuf, + pub cwd: LegacyAppPathString, } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] #[serde(rename_all = "camelCase")] #[ts(export_to = "v2/")] pub struct GuardianApplyPatchReviewAction { - pub cwd: AbsolutePathBuf, - pub files: Vec, + pub cwd: LegacyAppPathString, + pub files: Vec, } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] @@ -618,7 +621,7 @@ pub enum GuardianApprovalReviewAction { Command { source: GuardianCommandSource, command: String, - cwd: AbsolutePathBuf, + cwd: LegacyAppPathString, }, #[serde(rename_all = "camelCase")] #[ts(rename_all = "camelCase")] @@ -626,13 +629,13 @@ pub enum GuardianApprovalReviewAction { source: GuardianCommandSource, program: String, argv: Vec, - cwd: AbsolutePathBuf, + cwd: LegacyAppPathString, }, #[serde(rename_all = "camelCase")] #[ts(rename_all = "camelCase")] ApplyPatch { - cwd: AbsolutePathBuf, - files: Vec, + cwd: LegacyAppPathString, + files: Vec, }, #[serde(rename_all = "camelCase")] #[ts(rename_all = "camelCase")] @@ -669,7 +672,7 @@ impl From for GuardianApprovalReviewAction { } => Self::Command { source: source.into(), command, - cwd, + cwd: cwd.into(), }, CoreGuardianAssessmentAction::Execve { source, @@ -680,11 +683,12 @@ impl From for GuardianApprovalReviewAction { source: source.into(), program, argv, - cwd, + cwd: cwd.into(), + }, + CoreGuardianAssessmentAction::ApplyPatch { cwd, files } => Self::ApplyPatch { + cwd: cwd.into(), + files: files.into_iter().map(Into::into).collect(), }, - CoreGuardianAssessmentAction::ApplyPatch { cwd, files } => { - Self::ApplyPatch { cwd, files } - } CoreGuardianAssessmentAction::NetworkAccess { target, host, @@ -732,7 +736,9 @@ impl TryFrom for CoreGuardianAssessmentAction { } => Self::Command { source: source.into(), command, - cwd, + cwd: cwd + .try_into() + .map_err(|err| io::Error::new(io::ErrorKind::InvalidInput, err))?, }, GuardianApprovalReviewAction::Execve { source, @@ -743,11 +749,22 @@ impl TryFrom for CoreGuardianAssessmentAction { source: source.into(), program, argv, - cwd, + cwd: cwd + .try_into() + .map_err(|err| io::Error::new(io::ErrorKind::InvalidInput, err))?, + }, + GuardianApprovalReviewAction::ApplyPatch { cwd, files } => Self::ApplyPatch { + cwd: cwd + .try_into() + .map_err(|err| io::Error::new(io::ErrorKind::InvalidInput, err))?, + files: files + .into_iter() + .map(|path| { + path.try_into() + .map_err(|err| io::Error::new(io::ErrorKind::InvalidInput, err)) + }) + .collect::>()?, }, - GuardianApprovalReviewAction::ApplyPatch { cwd, files } => { - Self::ApplyPatch { cwd, files } - } GuardianApprovalReviewAction::NetworkAccess { target, host, diff --git a/codex-rs/app-server-protocol/src/protocol/v2/tests.rs b/codex-rs/app-server-protocol/src/protocol/v2/tests.rs index d35d39fe46..93ec11d7ce 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2/tests.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2/tests.rs @@ -488,7 +488,7 @@ fn permissions_request_approval_uses_request_permission_profile() { })) .expect("permissions request should deserialize"); - assert_eq!(params.cwd, absolute_path("repo")); + assert_eq!(params.cwd, absolute_path("repo").into()); assert_eq!(params.environment_id.as_deref(), Some("remote")); assert_eq!( params.permissions, @@ -519,14 +519,14 @@ fn permissions_request_approval_uses_request_permission_profile() { enabled: Some(true), }), file_system: Some(CoreFileSystemPermissions::from_read_write_roots( - Some(vec![ - AbsolutePathBuf::try_from(PathBuf::from(read_only_path)) + Some(vec![PathUri::from_abs_path( + &AbsolutePathBuf::try_from(PathBuf::from(read_only_path)) .expect("path must be absolute"), - ]), - Some(vec![ - AbsolutePathBuf::try_from(PathBuf::from(read_write_path)) + )]), + Some(vec![PathUri::from_abs_path( + &AbsolutePathBuf::try_from(PathBuf::from(read_write_path)) .expect("path must be absolute"), - ]), + )]), )), } ); @@ -565,7 +565,7 @@ fn permissions_request_approval_rejects_macos_permissions() { #[test] fn additional_file_system_permissions_preserves_canonical_entries() { - let core_permissions = CoreFileSystemPermissions { + let core_permissions: CoreFileSystemPermissions = CoreFileSystemPermissions { entries: vec![ CoreFileSystemSandboxEntry { path: CoreFileSystemPath::Special { @@ -617,10 +617,11 @@ fn additional_file_system_permissions_preserves_canonical_entries() { fn additional_file_system_permissions_populates_entries_for_legacy_roots() { let read_only_path = absolute_path("read-only"); let read_write_path = absolute_path("read-write"); - let core_permissions = CoreFileSystemPermissions::from_read_write_roots( - Some(vec![read_only_path.clone()]), - Some(vec![read_write_path.clone()]), - ); + let core_permissions: CoreFileSystemPermissions = + CoreFileSystemPermissions::from_read_write_roots( + Some(vec![PathUri::from_abs_path(&read_only_path)]), + Some(vec![PathUri::from_abs_path(&read_write_path)]), + ); let permissions = AdditionalFileSystemPermissions::from(core_permissions.clone()); let read_only_api_path = LegacyAppPathString::from_abs_path(&read_only_path); @@ -740,14 +741,14 @@ fn permissions_request_approval_response_uses_granted_permission_profile_without enabled: Some(true), }), file_system: Some(CoreFileSystemPermissions::from_read_write_roots( - Some(vec![ - AbsolutePathBuf::try_from(PathBuf::from(read_only_path)) + Some(vec![PathUri::from_abs_path( + &AbsolutePathBuf::try_from(PathBuf::from(read_only_path)) .expect("path must be absolute"), - ]), - Some(vec![ - AbsolutePathBuf::try_from(PathBuf::from(read_write_path)) + )]), + Some(vec![PathUri::from_abs_path( + &AbsolutePathBuf::try_from(PathBuf::from(read_write_path)) .expect("path must be absolute"), - ]), + )]), )), } ); @@ -1593,7 +1594,9 @@ fn sandbox_policy_round_trips_external_sandbox_network_access() { network_access: NetworkAccess::Enabled, }; - let core_policy = v2_policy.to_core(); + let core_policy = v2_policy + .try_to_core() + .expect("convert external sandbox policy to core"); assert_eq!( core_policy, codex_protocol::protocol::SandboxPolicy::ExternalSandbox { @@ -1611,7 +1614,9 @@ fn sandbox_policy_round_trips_read_only_network_access() { network_access: true, }; - let core_policy = v2_policy.to_core(); + let core_policy = v2_policy + .try_to_core() + .expect("convert read-only sandbox policy to core"); assert_eq!( core_policy, codex_protocol::protocol::SandboxPolicy::ReadOnly { @@ -2286,7 +2291,9 @@ fn sandbox_policy_round_trips_workspace_write_access() { exclude_slash_tmp: false, }; - let core_policy = v2_policy.to_core(); + let core_policy = v2_policy + .try_to_core() + .expect("convert workspace-write sandbox policy to core"); assert_eq!( core_policy, codex_protocol::protocol::SandboxPolicy::WorkspaceWrite { @@ -2336,7 +2343,7 @@ fn sandbox_policy_deserializes_legacy_workspace_write_full_access_field() { assert_eq!( policy, SandboxPolicy::WorkspaceWrite { - writable_roots: vec![absolute_path("/workspace")], + writable_roots: vec![absolute_path("/workspace").into()], network_access: true, exclude_tmpdir_env_var: true, exclude_slash_tmp: true, @@ -2412,7 +2419,7 @@ fn guardian_approval_review_action_round_trips_command_shape() { GuardianApprovalReviewAction::Command { source: GuardianCommandSource::Shell, command: "rm -rf /tmp/example.sqlite".to_string(), - cwd: absolute_path("tmp"), + cwd: absolute_path("tmp").into(), } ); assert_eq!(