{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreig2snhk66ytnlnmhgp22zzk5xqriaslum6rn3msgk2jgqcxpglzvy",
    "uri": "at://did:plc:lk3jfj3zq4k4wxnk474axylu/app.bsky.feed.post/3ml3mkx34tgf2"
  },
  "path": "/t/openaiconversationssession-loses-prior-assistant-items-on-gpt-5-4-gpt-5-5/1380324#post_1",
  "publishedAt": "2026-05-05T06:28:07.000Z",
  "site": "https://community.openai.com",
  "tags": [
    "Overview - OpenAI Agents SDK"
  ],
  "textContent": "* * *\n\n### Please read this first\n\n  * **Have you read the docs?** Yes — Overview - OpenAI Agents SDK\n\n  * **Have you searched for related issues?** Yes. This looks like the next iteration of the family addressed by #1709, #1882 (PR #1883), and PR #3026. Those fixed item-shape mismatches that returned 400 errors on newer models. This one is the same family but the failure is silent — no error, just lost items.\n\n\n\n\n### Describe the bug\n\nWhen using `OpenAIConversationsSession` with `gpt-5.4` or `gpt-5.5`, prior assistant messages get unlinked from the conversation as new turns are added. After `N` turns of `[user → assistant]`, only the most recent assistant message survives — the conversation ends up shaped like `[u, u, u, u, a]` instead of `[u, a, u, a, u, a, u, a]`.\n\nThe same code works correctly on `gpt-4.1` and `gpt-5.2`.\n\nThe Response objects still exist in the platform dashboard under Logs → Responses (verified visually). They’re just no longer returned by `conversations.items.list`. So this is server-side unlinking, not deletion — but from the SDK user’s perspective, `session.get_items()` silently drops them, which breaks the documented Sessions contract: _“Sessions stores conversation history for a specific session, allowing agents to maintain context without requiring explicit manual memory management.”_\n\n### Repro\n\n\n    import argparse, asyncio, os\n    from agents import Agent, OpenAIConversationsSession, Runner\n    from dotenv import load_dotenv\n\n    TURNS = [\"hi\", \"what can you do?\", \"give me one example\", \"thanks\"]\n\n    def role_summary(items):\n        out = []\n        for it in items:\n            if isinstance(it, dict) and it.get(\"type\") == \"message\":\n                r = it.get(\"role\", \"?\")\n                out.append(\"u\" if r == \"user\" else \"a\" if r == \"assistant\" else r[0])\n        return \", \".join(out) if out else \"(empty)\"\n\n    async def run_repro(model):\n        session = OpenAIConversationsSession()\n        agent = Agent(name=\"Repro\", model=model, instructions=\"Reply in one short sentence.\")\n        print(f\"\\n=== Model: {model} ===\")\n        for i, msg in enumerate(TURNS, 1):\n            before = await session.get_items()\n            print(f\"\\nTurn {i}  user={msg!r}\")\n            print(f\"  before-turn items ({len(before)}): [{role_summary(before)}]\")\n            result = await Runner.run(agent, msg, session=session)\n            after = await session.get_items()\n            print(f\"  assistant: {str(result.final_output)[:80]}\")\n            print(f\"  after-turn  items ({len(after)}): [{role_summary(after)}]\")\n        final = await session.get_items()\n        a_count = sum(1 for x in final if isinstance(x, dict) and x.get(\"role\") == \"assistant\")\n        print(f\"\\nConversation ID: {session.session_id}\")\n        print(f\"Assistant items surviving: {a_count} / {len(TURNS)}\")\n\n    if __name__ == \"__main__\":\n        load_dotenv()\n        p = argparse.ArgumentParser()\n        p.add_argument(\"--model\", default=\"gpt-5.4\")\n        asyncio.run(run_repro(p.parse_args().model))\n\n\n\n\n    pip install openai openai-agents python-dotenv\n    export OPENAI_API_KEY=...\n    python repro.py --model gpt-5.4   # broken\n    python repro.py --model gpt-5.5   # broken\n    python repro.py --model gpt-5.2   # control: works\n\n\n\n### Actual output\n\n**`gpt-5.4`** — conv `conv_69f98929db2c819682c44bcf7033a55c03376a9838e32d28`\n\n\n    Turn 1  before: (empty)            after: [u, a]\n    Turn 2  before: [u, a]             after: [u, u, a]      ← turn 1's assistant gone\n    Turn 3  before: [u, u, a]          after: [u, u, u, a]   ← turn 2's assistant gone\n    Turn 4  before: [u, u, u, a]       after: [u, u, u, u, a]\n    Assistant items surviving: 1 / 4\n\n\n\n**`gpt-5.5`** — conv `conv_69f989ac3290819498ee8ae0db928cad022f412c8f450f99`\n\n\n    Turn 1  before: (empty)            after: [u, a]\n    Turn 2  before: [u, a]             after: [u, u, a]\n    Turn 3  before: [u, u, a]          after: [u, u, u, a]\n    Turn 4  before: [u, u, u, a]       after: [u, u, u, u, a]\n    Assistant items surviving: 1 / 4\n\n\n\n**`gpt-5.2` (control)** — conv `conv_69f989e61e148197b1c114069be28d8602c54a0e013c1129`\n\n\n    Turn 1  before: (empty)            after: [u, a]\n    Turn 2  before: [u, a]             after: [u, a, u, a]\n    Turn 3  before: [u, a, u, a]       after: [u, a, u, a, u, a]\n    Turn 4  before: [u, a, u, a, u, a] after: [u, a, u, a, u, a, u, a]\n    Assistant items surviving: 4 / 4\n\n\n\n### Expected behavior\n\n`OpenAIConversationsSession.get_items()` should return all items added by prior `add_items()` calls within the same session, regardless of model. This is what the SDK promises in the Sessions guide and what `gpt-4.1`/`gpt-5.2` deliver in practice.\n\n### What I verified before opening this\n\n  1. The SDK is on the latest version (0.15.1) and includes both prior fixes from PR #1883 and PR #3026.\n\n  2. `OpenAIConversationsSession.add_items()` is a thin wrapper over `conversations.items.create`. Items are persisted correctly — confirmed by the `after-turn` dump returning the assistant message immediately after the turn.\n\n  3. `OpenAIConversationsSession.get_items()` is a thin wrapper over `conversations.items.list`. It returns whatever the API returns.\n\n  4. Between turns the SDK does not call `items.delete` or any destructive operation. The unlinking happens server-side, and `get_items()` faithfully reflects the new state.\n\n  5. The behavior is 100% model-dependent on the same SDK + openai client + transport.\n\n\n\n\nSo this is structurally upstream of the SDK — the Conversations API on `5.4`/`5.5` is dropping prior assistant linkages. But from the user’s side, the documented `OpenAIConversationsSession` class is the surface that breaks, and right now there’s no documented workaround within the Sessions abstraction (sessions can’t be combined with `conversation_id` / `previous_response_id` / `auto_previous_response_id` per the docs).\n\n### Debug information\n\n  * Agents SDK version: `0.15.1`\n\n  * openai version: `2.34.0`\n\n  * Python version: `3.12`\n\n  * OS: Windows\n\n  * Models reproduced on: `gpt-5.4`, `gpt-5.5`\n\n  * Models verified working: `gpt-4.1`, `gpt-5.2`\n\n\n\n\n### Asks\n\n  1. Is this on your radar? It feels like the next iteration of #1883 / #3026.\n\n  2. Any guidance for users currently on `OpenAIConversationsSession` who need to keep using `5.4`/`5.5`? Pinning to `5.2` works as a stopgap but isn’t viable long-term.\n\n\n\n\n* * *\n\n##",
  "title": "OpenAIConversationsSession loses prior assistant items on gpt-5.4 / gpt-5.5"
}