Skip to content

Session continuity not working - no session ID returned from initial calls #2434

@zhendalf

Description

@zhendalf

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:

  1. Initial call to Codex should return both the response text AND a session ID
  2. Subsequent calls should be able to use this session ID to continue the conversation with maintained context

Actual Behavior

  1. Initial Codex call only returns the text response, no session ID
  2. Attempting to continue the conversation fails with "Session not found" errors
  3. Context is lost between calls

Steps to Reproduce

  1. Start a Codex conversation with an initial prompt including context to remember:

    "Hello! My favorite color is blue. Please remember this."
    
  2. Attempt to continue the conversation with a follow-up that references the context:

    "What was my favorite color that I mentioned earlier?"
    
  3. 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

  1. Return session IDs: Modify Codex to return a session identifier along with each response
  2. Document session management: If session management exists but works differently, provide documentation on the correct approach
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmcp-serverIssues related to the use of the `codex mcp-server` subcommand

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions