mirror of
https://github.com/openai/codex.git
synced 2026-10-21 05:22:21 +00:00
Return the prompt hash in upload responses (#44325)
## What changed Add nullable `promptHash` to the upload response, populated from the uploaded `prompt_hash` tag. It identifies the whitespace-normalized SHA-256 of the session base instructions, excludes later developer messages, and is `null` when the reported rollout has no prompt metadata. Update the protocol schemas, precomputed exports, and generated TypeScript and Python types. GitOrigin-RevId: 6fa70fbe7a06604ac1cd0ea363eb4f192083dad9
This commit is contained in:
+8
@@ -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"
|
||||
}
|
||||
|
||||
+8
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+7
-1
@@ -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, };
|
||||
|
||||
@@ -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>,
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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")]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user