-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Session continuity not working - no session ID returned from initial calls #2434
Description
Description
When using Codex through an MCP (Model Context Protocol) integration, session continuity doesn't work because the initial Codex call doesn't return a session ID that can be used for subsequent conversation turns.
Expected Behavior
Based on the MCP integration design:
- Initial call to Codex should return both the response text AND a session ID
- Subsequent calls should be able to use this session ID to continue the conversation with maintained context
Actual Behavior
- Initial Codex call only returns the text response, no session ID
- Attempting to continue the conversation fails with "Session not found" errors
- Context is lost between calls
Steps to Reproduce
-
Start a Codex conversation with an initial prompt including context to remember:
"Hello! My favorite color is blue. Please remember this." -
Attempt to continue the conversation with a follow-up that references the context:
"What was my favorite color that I mentioned earlier?" -
The continuation fails because there's no session ID to reference
Impact
This prevents building stateful, multi-turn conversations with Codex, which is essential for:
- Complex coding tasks that require iterative refinement
- Maintaining context across multiple related questions
- Building conversational AI experiences with Codex
Possible Solutions
- Return session IDs: Modify Codex to return a session identifier along with each response
- Document session management: If session management exists but works differently, provide documentation on the correct approach
- Stateless context passing: If sessions aren't supported, document how to pass previous context in subsequent calls
Environment
- Using Codex through MCP (Model Context Protocol) integration
- Testing with both sync and async execution modes
Additional Context
The MCP wrapper for Codex expects session functionality (with sessionId parameters), suggesting this was intended to work but may have an implementation gap between what the MCP server expects and what Codex provides.
Would appreciate guidance on whether session continuity is supported and if so, how to properly implement it.