-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Conversation naming #8991
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 naming #8991
Conversation
JaviSoto
left a comment
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.
Looks good!!
Random suggestion I just thought of: it could be useful to give the agent a way to set the name as well via a tool call, so you can tell the agent to name the conversation as well? (you could even add something to your AGENTS.md with instructions on how you want the agent to name your sessions, or to rename them in certain cases etc)
codex-rs/cli/src/main.rs
Outdated
| #[derive(Debug, Parser)] | ||
| struct ResumeCommand { | ||
| /// Conversation/session id (UUID). When provided, resumes this session. | ||
| /// Conversation/session id (UUID) or session name. UUIDs take precedence if it parses. |
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.
👍
| pub struct SessionMetaUpdatedEvent { | ||
| /// Name left as session_id instead of thread_id for backwards compatibility. | ||
| pub session_id: ThreadId, | ||
| #[serde(default, skip_serializing_if = "Option::is_none")] |
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.
👍
jif-oai
left a comment
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.
I would def go to the index file
- can we try to use
threadinstead ofsessionas much as possible
| Ok(()) | ||
| } | ||
|
|
||
| async fn rewrite_session_name( |
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.
Those functions should not be needed. We should use the same mechanism as for the model used during the rollout for example
|
@jif-oai @JaviSoto moved to an index file instead of SessionMeta so we don't touch rollout files. We're reading a Implemented your comments (adding tests on resume, move to thread, thread_name or thread_id naming) |
|
related #4163 |
| - `thread/list` — page through stored rollouts; supports cursor-based pagination and optional `modelProviders` filtering. | ||
| - `thread/loaded/list` — list the thread ids currently loaded in memory. | ||
| - `thread/archive` — move a thread’s rollout file into the archived directory; returns `{}` on success. | ||
| - `thread/name/set` — set or update a thread’s user-facing name; returns `{}` on success. |
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.
We should document what happens on name collisions
| async fn thread_set_name(&self, request_id: RequestId, params: ThreadSetNameParams) { | ||
| let ThreadSetNameParams { thread_id, name } = params; | ||
| let trimmed = name.trim(); | ||
| if trimmed.is_empty() { |
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.
This gets validated both here and in the Op handler (codex.rs)
Maybe we should simplify and have only one validation? (the good answer being: not here :D)
| pub updated_at: String, | ||
| } | ||
|
|
||
| pub async fn append_thread_name( |
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.
Can you doc those functions?
| pub(crate) session_configuration: SessionConfiguration, | ||
| pub(crate) history: ContextManager, | ||
| pub(crate) latest_rate_limits: Option<RateLimitSnapshot>, | ||
| pub(crate) thread_name: Option<String>, |
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.
Why not putting it in SessionConfiguration ?
| use tokio_util::sync::CancellationToken; | ||
|
|
||
| pub(crate) struct SessionServices { | ||
| pub(crate) codex_home: PathBuf, |
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.
this is not a service and it should already be easy to get if from Session
| use pretty_assertions::assert_eq; | ||
| use tempfile::TempDir; | ||
| use uuid::Uuid; | ||
|
|
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.
A true integration test would be cool
| task->>-user: Event::TurnComplete | ||
| ``` | ||
|
|
||
| ### Session Metadata |
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.
huh? v1 doc should not be updated as you did not change the v1 protocol
| │ Approval: on-request │ | ||
| │ Sandbox: read-only │ | ||
| │ Agents.md: <none> │ | ||
| │ Thread name: <none> │ |
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.
That looks like a lot of pollution? Could we make that this line is only displayed when there is a name
| if self.thread_id == Some(event.thread_id) { | ||
| self.thread_name = event.thread_name; | ||
| } | ||
| self.request_redraw(); |
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.
You should not redraw if the if above fails
| fn show_rename_prompt(&mut self) { | ||
| let tx = self.app_event_tx.clone(); | ||
| let view = CustomPromptView::new( | ||
| "Rename thread".to_string(), |
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.
Maybe "Name" and not "Rename" as it had no name before
Session renaming:
/rename my_session/renamewithout arg and passing an argument incustomViewPromptCODEX_HOME/sessions.jsonlSession resuming:
CODEX_HOME/sessions.jsonlfirst entry matching the name and resumes the session