mirror of
https://github.com/openai/codex.git
synced 2026-11-17 22:10:37 +00:00
Send base instructions as Responses input messages (#51156)
## What changed Move base instructions from the top-level `instructions` field into a prefixed `developer` message in `input` for standard Responses requests, matching Responses Lite. Remove the field from HTTP and WebSocket request types and assign instruction messages stable IDs derived from the thread and instruction text. ## Testing Extend standard and Responses Lite tests to cover instruction message serialization, stable IDs, and resume consistency. Update WebSocket tests to verify that changed instructions trigger a full request without `previous_response_id`. GitOrigin-RevId: e2de4b8e30a9339377fac133ceda981abd1a112b
This commit is contained in:
@@ -339,7 +339,6 @@ async fn responses_client_stream_request_preserves_item_ids() -> Result<()> {
|
||||
let client = ResponsesClient::new(transport, provider("openai"), Arc::new(NoAuth));
|
||||
let request = ResponsesApiRequest {
|
||||
model: "gpt-test".into(),
|
||||
instructions: "Say hi".into(),
|
||||
input: vec![ResponseItem::Message {
|
||||
id: Some(ResponseItemId::with_suffix("msg", "1")),
|
||||
role: "user".into(),
|
||||
@@ -394,7 +393,6 @@ async fn responses_client_stream_request_sends_routing_fields_ahead_of_large_inp
|
||||
let large_input = "x".repeat(2 * 1024 * 1024);
|
||||
let request = ResponsesApiRequest {
|
||||
model: "gpt-test".into(),
|
||||
instructions: "Say hi".into(),
|
||||
input: vec![ResponseItem::Message {
|
||||
id: None,
|
||||
role: "user".into(),
|
||||
@@ -434,7 +432,7 @@ async fn responses_client_stream_request_sends_routing_fields_ahead_of_large_inp
|
||||
);
|
||||
}
|
||||
assert!(body.starts_with(
|
||||
r#"{"model":"gpt-test","stream":true,"service_tier":"priority","instructions":"Say hi","input":[{"type":"message""#
|
||||
r#"{"model":"gpt-test","stream":true,"service_tier":"priority","input":[{"type":"message""#
|
||||
));
|
||||
assert!(body.len() > 2 * 1024 * 1024);
|
||||
assert_eq!(serde_json::from_str::<serde_json::Value>(body)?, expected);
|
||||
@@ -491,7 +489,6 @@ async fn streaming_client_retries_on_transport_error() -> Result<()> {
|
||||
|
||||
let request = ResponsesApiRequest {
|
||||
model: "gpt-test".into(),
|
||||
instructions: "Say hi".into(),
|
||||
input: Vec::new(),
|
||||
tools: Some(empty_tools().into()),
|
||||
tool_choice: "auto".into(),
|
||||
@@ -606,7 +603,6 @@ async fn azure_store_sends_ids_and_headers() -> Result<()> {
|
||||
|
||||
let request = ResponsesApiRequest {
|
||||
model: "gpt-test".into(),
|
||||
instructions: "Say hi".into(),
|
||||
input: vec![ResponseItem::Message {
|
||||
id: Some(ResponseItemId::with_suffix("msg", "1")),
|
||||
role: "user".into(),
|
||||
|
||||
Reference in New Issue
Block a user