Skip to content

fix(tui): accept prompts with resume and fork#26818

Merged
fcoury-oai merged 2 commits into
mainfrom
codex/fork-last-prompt-fix
Jun 7, 2026
Merged

fix(tui): accept prompts with resume and fork#26818
fcoury-oai merged 2 commits into
mainfrom
codex/fork-last-prompt-fix

Conversation

@fcoury-oai

@fcoury-oai fcoury-oai commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Why

Interactive codex resume and codex fork expose both a session ID positional and an initial prompt positional. With --last, Clap still assigns the first positional to the session ID, so a command such as codex fork --last "/compact focus on auth" either fails parsing or attempts to look up the prompt as a session ID instead of sending it to the latest session.

This makes it impossible to select the latest session and immediately provide a follow-up prompt, even though codex exec resume --last already supports that workflow.

CleanShot 2026-06-06 at 17 00 47@2x

What Changed

  • Reinterpret the first positional as the initial prompt when interactive resume --last or fork --last is used and no explicit second prompt was parsed.
  • Preserve the existing resume SESSION_ID PROMPT and fork SESSION_ID PROMPT behavior.
  • Add parser-level regression coverage for latest-session and explicit-session prompt forms.

How to Test

  1. Start an interactive session, exit it, then run codex resume --last "continue from the latest session".
  2. Confirm Codex resumes the latest session and submits the supplied prompt instead of treating it as a session ID.
  3. Run codex fork --last "take a different approach".
  4. Confirm Codex forks the latest session and submits the supplied prompt.
  5. Also verify codex resume SESSION_ID "continue here" and codex fork SESSION_ID "branch here" still target the explicit session and submit the prompt.

Targeted tests:

  • just test -p codex-cli (267 passed)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b1e12943b7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/cli/src/main.rs

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. 👍

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@fcoury-oai fcoury-oai changed the title fix(cli): accept prompts with resume and fork fix(tui): accept prompts with resume and fork Jun 6, 2026

@etraut-openai etraut-openai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I manually tested the change. Looks good.

@fcoury-oai fcoury-oai merged commit e093d81 into main Jun 7, 2026
31 checks passed
@fcoury-oai fcoury-oai deleted the codex/fork-last-prompt-fix branch June 7, 2026 21:34
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants