Skip to content

Conversation

@ctate
Copy link
Collaborator

@ctate ctate commented Oct 25, 2025

No description provided.

@vercel
Copy link
Contributor

vercel bot commented Oct 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
coding-agent-platform Ready Ready Preview Comment Oct 25, 2025 5:57pm

// Note: codex resume doesn't take session ID as an argument, it uses a picker or --last
// For now, we'll use --last to continue the most recent session
codexCommand = 'codex resume --last'
// Note: codex resume takes the prompt directly without --last flag when continuing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The codex resume command is missing the session identifier or --last flag, which means the CLI won't know which session to resume. This breaks session resumption for continued conversations.

View Details
📝 Patch Details
diff --git a/lib/sandbox/agents/codex.ts b/lib/sandbox/agents/codex.ts
index 8e3d93e..37a1823 100644
--- a/lib/sandbox/agents/codex.ts
+++ b/lib/sandbox/agents/codex.ts
@@ -283,10 +283,18 @@ url = "${server.baseUrl}"
 
     if (isResumed) {
       // Use resume command instead of exec
-      // Note: codex resume takes the prompt directly without --last flag when continuing
-      codexCommand = 'codex resume'
-      if (logger) {
-        await logger.info('Resuming previous Codex conversation')
+      if (sessionId) {
+        // Resume specific session by ID
+        codexCommand = `codex resume ${sessionId}`
+        if (logger) {
+          await logger.info('Resuming specific Codex chat session')
+        }
+      } else {
+        // Resume most recent session if no specific sessionId provided
+        codexCommand = 'codex resume --last'
+        if (logger) {
+          await logger.info('Resuming previous Codex conversation')
+        }
       }
     }
 

Analysis

Missing session identifier in codex resume command

What fails: The executeCodexInSandbox() function in lib/sandbox/agents/codex.ts (lines 283-297) builds a codex resume command that doesn't specify which session to resume when continuing a conversation in a kept-alive sandbox.

How to reproduce:

  1. Call executeCodexInSandbox() with isResumed=true and a valid sessionId parameter
  2. The generated command will be codex resume (no session identifier)
  3. In a non-interactive sandbox, this fails because codex resume with no arguments opens an interactive picker

Result: The Codex CLI fails to resume the session. According to Codex documentation:

  • codex resume = opens interactive picker (fails in non-interactive sandbox)
  • codex resume --last = resumes most recent session
  • codex resume <SESSION_ID> = resumes specific session by ID

The sessionId parameter is passed to the function (line 35) and available, but was never used after commit 5d8487e removed the --last flag without adding sessionId support.

Expected:

  • When sessionId is provided: use codex resume <sessionId>
  • When sessionId is not provided: fall back to codex resume --last

This follows the pattern used by other agents (Claude, Cursor, Copilot) that also handle session resumption.

@ctate ctate closed this Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants