Add workspace thread combine support
Summary
Implement combine function for codex to be able create a new conversation from the merged history of multiple threads.
Related PR: https://github.com/vishaltandale00/codex/pull/1
Motivation
When working on the same worktree I often usually fork multiple threads and after a certain point I want to merge those threads back into the base thread. This is a feature that I come across as needing frequently and I want to propose to add it to codex as well.
What the feature does
Given a source thread and K additional threads create a new thread with merged histories of all those threads.
User-facing behavior
In the implementation from the PR, the feature is exposed in the TUI via /combine.
The flow is:
- choose a base thread
- load candidate threads from the same workspace
- select source threads in order
- review the selection
- create a new combined thread
The resulting thread shows provenance in history and metadata so the user can see which threads were combined.
Why this is needed
Forking is already a strong workflow for branching exploration, but there is currently no clean way to bring useful branches back together.
Creating a merge function gets complex quickly with trying to derive ancestors and maintaining thread history post compaction. Thus we decide to open this feature up to combine any N threads and leave it up to the user to decide if threads should be merged.
Below are screen shots of the feature working
<img width="755" height="328" alt="Image" src="https://github.com/user-attachments/assets/23a27835-d132-4f5a-bf6d-53756cd11c3b" />
<img width="762" height="395" alt="Image" src="https://github.com/user-attachments/assets/e7d7b4d9-b390-4e28-b1a6-961f2e4b92cf" />
<img width="759" height="371" alt="Image" src="https://github.com/user-attachments/assets/bc84d4d4-b37b-4cd4-9022-e3ae9b7189f3" />
<img width="761" height="399" alt="Image" src="https://github.com/user-attachments/assets/2d0b10f6-760f-48e3-bf6a-bfd70987a0fd" />
<img width="748" height="356" alt="Image" src="https://github.com/user-attachments/assets/916bad1c-b585-49f4-bdb5-b205e9155bd8" />
<img width="752" height="661" alt="Image" src="https://github.com/user-attachments/assets/b3c1e8ff-f9f3-49b2-9f48-16ce6e96764f" />
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗