{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreihiqb3enmzbvwz3egd2c6m5num2b4o2xeqpzua3yozypb75xudrfu",
    "uri": "at://did:plc:lk3jfj3zq4k4wxnk474axylu/app.bsky.feed.post/3mkvjh3x3uqd2"
  },
  "path": "/t/responses-corrupts-previous-conversations-assistant-item/1380154#post_6",
  "publishedAt": "2026-05-02T20:01:11.000Z",
  "site": "https://community.openai.com",
  "textContent": "The role=`system` messages are red herrings. I could switch them all to role=`developer` and it wouldn’t make a difference. It could omit them and it still wouldn’t make a difference. I also tried switching the hard coded assistant messages from `EasyInputMessage` to a `ResponseOutputMessage`, that didn’t make a difference either.\n\nIt seems like all hard coded assistant messages synthetically inserted into a Conversation using the `conversations/conversation_id/items` POST endpoint, prior to a `responses` call that produces an AI generated message will be wiped as soon as the response from that call is returned.\n\nThe only way to synthetically insert an assistant message into a Conversation is to create it by making a deterministic call to `responses` where the message is presented to the AI with a request to simply reply with the exact message. It feels a little hacky in my opinion, but it seems to be the only thing that works. Something like this:\n\n\n    {\n      \"model\": \"gpt-5.4-mini\",\n      \"conversation\": \"conv_...\",\n      \"temperature\": 0,\n      \"input\": [\n        {\n          \"role\": \"developer\",\n          \"content\": \"Reply EXACTLY with the following text, no deviation:\\n\\n[HARD CODED ASSISTANT MESSAGE]\"\n        },\n        {\n          \"role\": \"user\",\n          \"content\": \"Start\"\n        }\n      ]\n    }\n\n\nTo wrap up, here’s an extended bash script that inserts three hard coded assistant messages with different phases, followed by a user message, and then a Responses call, and all the assistant messages get wiped.\n\n\n    #!/usr/bin/env bash\n    set -eu\n\n    : \"${OPENAI_API_KEY:?Set OPENAI_API_KEY first}\"\n\n    BASE=\"https://api.openai.com/v1\"\n    MODEL=\"gpt-5.4-mini\"\n\n    AUTH=(\n      -H \"Authorization: Bearer $OPENAI_API_KEY\"\n      -H \"Content-Type: application/json\"\n    )\n\n    SYSTEM_TEXT=\"System message containing instructions.\"\n    USER_TEXT=\"Initial user message\"\n    SECOND_USER_TEXT=\"Second user message before Responses call\"\n    DEVELOPER_TEXT=\"Has the user provided answers to the outstanding fields? \"\n\n    list_items() {\n      curl -sS --globoff \\\n        \"$BASE/conversations/$CONV_ID/items?order=asc&limit=100\" \\\n        \"${AUTH[@]}\"\n    }\n\n    retrieve_item() {\n      ITEM_ID=\"$1\"\n      curl -sS --globoff \\\n        \"$BASE/conversations/$CONV_ID/items/$ITEM_ID\" \\\n        \"${AUTH[@]}\"\n    }\n\n    echo \"1) Create conversation with system message\"\n    CREATE_CONV_RESPONSE=$(\n      curl -sS \"$BASE/conversations\" \\\n        \"${AUTH[@]}\" \\\n        -d \"$(jq -n --arg text \"$SYSTEM_TEXT\" '{\n          items: [\n            {\n              role: \"system\",\n              content: $text,\n              type: \"message\"\n            }\n          ]\n        }')\"\n    )\n\n    echo \"$CREATE_CONV_RESPONSE\" | jq .\n    CONV_ID=$(echo \"$CREATE_CONV_RESPONSE\" | jq -r '.id')\n    echo \"CONV_ID=$CONV_ID\"\n\n    echo\n    echo \"2) Add first user message\"\n    curl -sS \"$BASE/conversations/$CONV_ID/items\" \\\n      \"${AUTH[@]}\" \\\n      -d \"$(jq -n --arg text \"$USER_TEXT\" '{\n        items: [\n          {\n            type: \"message\",\n            role: \"user\",\n            content: [\n              {\n                type: \"input_text\",\n                text: $text\n              }\n            ]\n          }\n        ]\n      }')\" | jq .\n\n    echo\n    echo \"3) Add assistant messages with different phase variants\"\n\n    ASSISTANT_IDS=()\n\n    for PHASE in \"final_answer\" \"commentary\" \"\"; do\n      LABEL=\"${PHASE:-none}\"\n      TEXT=\"Assistant (${LABEL}) message\"\n\n      echo \"Adding assistant message with phase: ${LABEL}\"\n\n      ADD_ASSISTANT_RESPONSE=$(\n        curl -sS \"$BASE/conversations/$CONV_ID/items\" \\\n          \"${AUTH[@]}\" \\\n          -d \"$(jq -n \\\n            --arg text \"$TEXT\" \\\n            --arg phase \"$PHASE\" \\\n            '{\n              items: [\n                (\n                  {\n                    type: \"message\",\n                    role: \"assistant\",\n                    content: [\n                      {\n                        type: \"output_text\",\n                        text: $text\n                      }\n                    ]\n                  }\n                  + (if $phase != \"\" then {phase: $phase} else {} end)\n                )\n              ]\n            }')\"\n      )\n\n      echo \"$ADD_ASSISTANT_RESPONSE\" | jq .\n\n      ID=$(echo \"$ADD_ASSISTANT_RESPONSE\" | jq -r '.data[0].id')\n      ASSISTANT_IDS+=(\"$ID\")\n    done\n\n    echo\n    echo \"4) Add SECOND user message\"\n    curl -sS \"$BASE/conversations/$CONV_ID/items\" \\\n      \"${AUTH[@]}\" \\\n      -d \"$(jq -n --arg text \"$SECOND_USER_TEXT\" '{\n        items: [\n          {\n            type: \"message\",\n            role: \"user\",\n            content: [\n              {\n                type: \"input_text\",\n                text: $text\n              }\n            ]\n          }\n        ]\n      }')\" | jq .\n\n    echo\n    echo \"5) List all items BEFORE Responses call\"\n    LIST_BEFORE=$(list_items)\n    echo \"$LIST_BEFORE\" | jq .\n\n    echo\n    echo \"6) Verify assistant items exist BEFORE Responses\"\n    for ID in \"${ASSISTANT_IDS[@]}\"; do\n      if echo \"$LIST_BEFORE\" | jq -e --arg id \"$ID\" '.data[] | select(.id == $id)' >/dev/null; then\n        echo \"OK: $ID present\"\n      else\n        echo \"ERROR: $ID missing before Responses\"\n      fi\n    done\n\n    echo\n    echo \"7) Create response using SAME conversation\"\n    CREATE_RESPONSE_RESPONSE=$(\n      curl -sS \"$BASE/responses\" \\\n        \"${AUTH[@]}\" \\\n        -d \"$(jq -n \\\n          --arg model \"$MODEL\" \\\n          --arg conv \"$CONV_ID\" \\\n          --arg text \"$DEVELOPER_TEXT\" \\\n          '{\n            model: $model,\n            conversation: $conv,\n            store: true,\n            input: [\n              {\n                role: \"developer\",\n                type: \"message\",\n                content: $text\n              }\n            ]\n          }')\"\n    )\n\n    echo \"$CREATE_RESPONSE_RESPONSE\" | jq .\n\n    echo\n    echo \"8) List all items AFTER Responses call\"\n    LIST_AFTER=$(list_items)\n    echo \"$LIST_AFTER\" | jq .\n\n    echo\n    echo \"9) Check assistant messages after Responses\"\n\n    for ID in \"${ASSISTANT_IDS[@]}\"; do\n      echo\n      echo \"Checking $ID\"\n\n      if echo \"$LIST_AFTER\" | jq -e --arg id \"$ID\" '.data[] | select(.id == $id)' >/dev/null; then\n        echo \"❌ Still present in list\"\n      else\n        echo \"✅ Missing from list (DISAPPEARED)\"\n      fi\n\n      RETRIEVE=$(retrieve_item \"$ID\")\n      echo \"$RETRIEVE\" | jq .\n\n      if echo \"$RETRIEVE\" | jq -e '\n        .role == \"unknown\"\n        and (.content[0].text == \"<unknown message>\")\n      ' >/dev/null; then\n        echo \"✅ Corrupted to <unknown message>\"\n      else\n        echo \"❌ Still valid\"\n      fi\n    done\n\n    echo\n    echo \"Done.\"\n    echo \"CONV_ID=$CONV_ID\"\n    echo \"ASSISTANT_IDS=${ASSISTANT_IDS[*]}\"\n\n\nI am sure they have a very good reason for why they don’t allow synthetic assistant messages in a conversation, but it is a little frustrating either way. Thank you all for your help figuring this one out!",
  "title": "`responses` corrupts previous conversations `assistant` item"
}