Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Return the prompt hash in upload responses (#44325)

Felicia Chen0adfc1f2f202
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 7de4646ea2..0a4acaadaa 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
@@ -11502,6 +11502,14 @@
"FeedbackUploadResponse": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
+ "promptHash": {
+ "default": null,
+ "description": "Whitespace-normalized SHA-256 of the session base instructions, matching the uploaded `prompt_hash` tag. Does not include later developer messages. Null when the reported rollout has no prompt metadata.",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
"threadId": {
"type": "string"
}
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 1c2e7d2edf..38d0b00fe5 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
@@ -7402,6 +7402,14 @@
"FeedbackUploadResponse": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
+ "promptHash": {
+ "default": null,
+ "description": "Whitespace-normalized SHA-256 of the session base instructions, matching the uploaded `prompt_hash` tag. Does not include later developer messages. Null when the reported rollout has no prompt metadata.",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
"threadId": {
"type": "string"
}
diff --git a/codex-rs/app-server-protocol/schema/json/v2/FeedbackUploadResponse.json b/codex-rs/app-server-protocol/schema/json/v2/FeedbackUploadResponse.json
index 647b613f0b..06af26787b 100644
--- a/codex-rs/app-server-protocol/schema/json/v2/FeedbackUploadResponse.json
+++ b/codex-rs/app-server-protocol/schema/json/v2/FeedbackUploadResponse.json
@@ -1,6 +1,14 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
+ "promptHash": {
+ "default": null,
+ "description": "Whitespace-normalized SHA-256 of the session base instructions, matching the uploaded `prompt_hash` tag. Does not include later developer messages. Null when the reported rollout has no prompt metadata.",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
"threadId": {
"type": "string"
}
diff --git a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zst b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zst
index 400ef070be..e21cebce6a 100644
Binary files a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zst and b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zst differ
diff --git a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zst b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zst
index 41a1f67de2..5752920d94 100644
Binary files a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zst and b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zst differ
diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/FeedbackUploadResponse.ts b/codex-rs/app-server-protocol/schema/typescript/v2/FeedbackUploadResponse.ts
index f0ad9784c0..d4f03973c5 100644
--- a/codex-rs/app-server-protocol/schema/typescript/v2/FeedbackUploadResponse.ts
+++ b/codex-rs/app-server-protocol/schema/typescript/v2/FeedbackUploadResponse.ts
@@ -2,4 +2,10 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
-export type FeedbackUploadResponse = { threadId: string, };
+export type FeedbackUploadResponse = { threadId: string,
+/**
+ * Whitespace-normalized SHA-256 of the session base instructions, matching the
+ * uploaded `prompt_hash` tag. Does not include later developer messages.
+ * Null when the reported rollout has no prompt metadata.
+ */
+promptHash: string | null, };
diff --git a/codex-rs/app-server-protocol/src/protocol/v2/feedback.rs b/codex-rs/app-server-protocol/src/protocol/v2/feedback.rs
index 4c5fae4059..c055fc0358 100644
--- a/codex-rs/app-server-protocol/src/protocol/v2/feedback.rs
+++ b/codex-rs/app-server-protocol/src/protocol/v2/feedback.rs
@@ -27,4 +27,9 @@ pub struct FeedbackUploadParams {
#[ts(export_to = "v2/")]
pub struct FeedbackUploadResponse {
pub thread_id: String,
+ /// Whitespace-normalized SHA-256 of the session base instructions, matching the
+ /// uploaded `prompt_hash` tag. Does not include later developer messages.
+ /// Null when the reported rollout has no prompt metadata.
+ #[serde(default)]
+ pub prompt_hash: Option<String>,
}
diff --git a/codex-rs/app-server/src/request_processors/feedback_processor.rs b/codex-rs/app-server/src/request_processors/feedback_processor.rs
index 4179b8d500..c03fa3b060 100644
--- a/codex-rs/app-server/src/request_processors/feedback_processor.rs
+++ b/codex-rs/app-server/src/request_processors/feedback_processor.rs
@@ -108,6 +108,7 @@ impl FeedbackRequestProcessor {
None
};
apply_feedback_turn_metadata(&mut upload_tags, turn_metadata);
+ let prompt_hash = upload_tags.get("prompt_hash").cloned();
if let Some(chatgpt_user_id) = auth
.as_ref()
@@ -314,7 +315,10 @@ impl FeedbackRequestProcessor {
upload_result
.map_err(|err| internal_error(format!("failed to upload feedback: {err:#}")))?;
- Ok(FeedbackUploadResponse { thread_id })
+ Ok(FeedbackUploadResponse {
+ thread_id,
+ prompt_hash,
+ })
}
async fn resolve_rollout_path(
diff --git a/sdk/python/src/openai_codex/generated/v2_all.py b/sdk/python/src/openai_codex/generated/v2_all.py
index dc33688b25..3189e26589 100644
--- a/sdk/python/src/openai_codex/generated/v2_all.py
+++ b/sdk/python/src/openai_codex/generated/v2_all.py
@@ -1442,6 +1442,13 @@ class FeedbackUploadResponse(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
+ prompt_hash: Annotated[
+ str | None,
+ Field(
+ alias="promptHash",
+ description="Whitespace-normalized SHA-256 of the session base instructions, matching the uploaded `prompt_hash` tag. Does not include later developer messages. Null when the reported rollout has no prompt metadata.",
+ ),
+ ] = None
thread_id: Annotated[str, Field(alias="threadId")]