You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Request: expose conversation fork/backtrack API in @openai/codex-sdk #4972
In the Codex CLI you can hit Ctrl + T and backtrack to fork a conversation at an earlier user turn. Under the hood the CLI issues Op::GetPath, reads the rollout JSONL, truncates before the selected user message, and calls ConversationManager::fork_conversation to spin up a new branch.
Problem
The TypeScript SDK only exposes startThread, resumeThread, run, and runStreamed, so there’s no way to replicate the CLI’s forking workflow. Once a thread is running, I can’t:
obtain rollout metadata or the JSONL path,
trim history at a given user turn, or
start a new thread seeded with that truncated history.
To approximate the behavior today I have to:
store the entire transcript myself on the client, and
whenever I “rewind,” create a brand-new thread and manually replay the context.
That works, but it diverges from the CLI experience and makes it hard to share forked context across tools.
Request
Please expose an SDK-level API (or document the workflow) that lets developers:
fetch the rollout metadata/path for a thread;
truncate history before the _n_th user message, matching the CLI logic;
optionally prefill the next prompt with the selected user input.
Even lower-level primitives—e.g. codex.getRollout(threadId) returning the JSONL path or entries, plus a codex.forkConversation(options) helper—would let SDK users recreate the CLI backtrack flow without reimplementing Codex internals.
Use case
I’m building a personal project and would like to offer the same “fork from history” capability that the CLI exposes via Ctrl + T. Without official support I have to rebuild the entire context locally, which is cumbersome and error-prone.
Activity
github-actions commentedon Oct 8, 2025
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
matthew-plusprogramming commentedon Oct 22, 2025
Was this completed? I don't see an referenced commit
matthew-plusprogramming commentedon Oct 22, 2025
@SockingPanda
mistercrunch commentedon Apr 10, 2026
I don't think forking is actually supported/implemented on the SDK, can we re-open the issue?