-
Notifications
You must be signed in to change notification settings - Fork 6.4k
feat: add save and fork capabilities #6993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # codex-rs/cli/src/main.rs # codex-rs/tui/src/cli.rs
# Conflicts: # codex-rs/core/src/codex.rs
There was a problem hiding this comment.
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.
ℹ️ 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".
| pub async fn resolve_rollout_path(codex_home: &Path, identifier: &str) -> Result<Option<PathBuf>> { | ||
| if let Some(entry) = resolve_saved_session(codex_home, identifier).await? { | ||
| if entry.rollout_path.exists() { | ||
| return Ok(Some(entry.rollout_path)); | ||
| } | ||
| warn!( | ||
| "saved session '{}' points to missing rollout at {}", | ||
| identifier, | ||
| entry.rollout_path.display() | ||
| ); | ||
| } | ||
| Ok(find_conversation_path_by_id_str(codex_home, identifier).await?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep saved sessions usable after archive
If a user saves a session and then closes it, the app server’s archive path moves the rollout into ARCHIVED_SESSIONS_SUBDIR (codex-rs/app-server/src/codex_message_processor.rs lines 2264-2273). When the user later runs codex resume some-name or forks from that saved name, this helper first checks the stored path and then falls back to find_conversation_path_by_id_str. The stored path no longer exists post-archive, and find_conversation_path_by_id_str only searches ~/.codex/sessions (codex-rs/core/src/rollout/list.rs lines 559-590), so we always return None. That means every saved session becomes impossible to resume once the conversation is archived, effectively breaking the new feature. Please make this resolve look in the archived directory (or otherwise keep stored paths valid) so saved sessions remain usable.
Useful? React with 👍 / 👎.
When you are in a session you can now run. If the name already exists, we simply override the name assignment (we do not touch the former session content)
This will save the session with a human readable name. You can use this name to resume (as previously):
Or to fork it. A fork will create a clone of the entire session at the time when the fork happen. The typical use case is for example asking the model "Explore codex-core". Save it as "core" and then fork from it for the different tasks for the day.
A fork is just a new session so it supports everything as expected (e.g. you can save a fork into a new name if you want)
Another use-case is just to make it easier to pause a task and come back to it later. No need to remember the session ID