non-interactive support for fork
Resolved 💬 4 comments Opened Jan 28, 2026 by dmahurin Closed Mar 20, 2026
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_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗