Skip to content

non-interactive support for fork #10106

Closed as not planned
Closed as not planned

Description

@dmahurin

What feature would you like to see?

Support non-interactive fork, similar to /fork.

Consider the following scenario:

codex exec "Create hello world example in hello.py"
# Now we are at a checkpoint, so we fork.
codex exec fork --last

codex exec "Create a similar program in C."  resume --last 
codex exec "Create a similar program in Javascript."  resume --last

Now we decide that the additional programs were not needed, We re-fork.

codex exec resume --parent
codex exec fork --last

Or we could just re-fork with:

codex exec fork --parent

The changes implied in above:

  • Add support for 'exec fork', which creates a new derrived session and exits.
  • exec fork could allow --last, --parent or a specific session id.

Optional changes would be similar for exec resume:

  • Allow codex exec resume to work without prompt. Without a prompt, it would just reset the current session (if needed) and exit.
  • Allow --parent to be passed to exec resume.

The above allows forking at some checkpoint, and going back to that checkpoint non-interactivly, without determining session id's.

As an alternative to using --parent, codex could expose /status as 'codex exec status'. This could allow:

parent=$(codex exec status | grep 'Forked from:' | sed 's/.*: *//')"

Additional information

No response

Activity

  1. added
    enhancement
    on Jan 28, 2026
  2. github-actions commented on Jan 28, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. dmahurin commented on Feb 3, 2026

    @dmahurin
    Author

    Until fork, status and other commands are available with exec, a crude workaround is to run codex in a pty and run the slash commands.

    You can use this to run codex commands non-interactively. It is currently specific to codex.
    https://github.com/dmahurin/pty-runner

    Examples:
    pty-runner codex ... /status /exit
    pty-runner codex ... /fork /status /exit

  4. added
    exec
    agent
    and removed
    agent
    on Feb 3, 2026
  5. etraut-openai commented on Mar 20, 2026

    @etraut-openai
    Contributor

    This feature request hasn't received enough upvotes, so closing.

  6. btomaj commented on Jun 20, 2026

    @btomaj

    @etraut-openai has this received enough upvotes now across #10106, #17568, and #11750 ?

  7. etraut-openai commented on Aug 7, 2026

    @etraut-openai
    Contributor

    This will be included in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementexec

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions