-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add thread archive CLI commands #25021
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
Changes from all commits
5e63b78
d089a58
c523c67
a698619
34a90a0
af22a2d
160e327
83baa66
691e37a
efc80b1
c3ab713
17f9eab
d6a1109
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1308,7 +1308,7 @@ impl ThreadRequestProcessor { | |
| params: ThreadArchiveParams, | ||
| ) -> Result<(ThreadArchiveResponse, Vec<String>), JSONRPCErrorError> { | ||
| let thread_id = ThreadId::from_string(¶ms.thread_id) | ||
| .map_err(|err| invalid_request(format!("invalid thread id: {err}")))?; | ||
| .map_err(|err| invalid_request(format!("invalid session id: {err}")))?; | ||
|
|
||
| let mut thread_ids = vec![thread_id]; | ||
| if let Some(state_db_ctx) = self.state_db.as_ref() { | ||
|
|
@@ -1317,7 +1317,7 @@ impl ThreadRequestProcessor { | |
| .await | ||
| .map_err(|err| { | ||
| internal_error(format!( | ||
| "failed to list spawned descendants for thread id {thread_id}: {err}" | ||
| "failed to list spawned descendants for session {thread_id}: {err}" | ||
| )) | ||
| })?; | ||
| let mut seen = HashSet::from([thread_id]); | ||
|
|
@@ -1629,7 +1629,7 @@ impl ThreadRequestProcessor { | |
| params: ThreadUnarchiveParams, | ||
| ) -> Result<(ThreadUnarchiveResponse, String), JSONRPCErrorError> { | ||
| let thread_id = ThreadId::from_string(¶ms.thread_id) | ||
| .map_err(|err| invalid_request(format!("invalid thread id: {err}")))?; | ||
| .map_err(|err| invalid_request(format!("invalid session id: {err}")))?; | ||
|
|
||
| let fallback_provider = self.config.model_provider_id.clone(); | ||
| let stored_thread = self | ||
|
|
@@ -2968,7 +2968,7 @@ impl ThreadRequestProcessor { | |
| let existing_thread_id = match ThreadId::from_string(thread_id) { | ||
| Ok(id) => id, | ||
| Err(err) => { | ||
| return Err(invalid_request(format!("invalid thread id: {err}"))); | ||
| return Err(invalid_request(format!("invalid session id: {err}"))); | ||
| } | ||
| }; | ||
| let params = StoreReadThreadParams { | ||
|
|
@@ -2979,7 +2979,15 @@ impl ThreadRequestProcessor { | |
| self.thread_store.read_thread(params).await | ||
| }; | ||
|
|
||
| result.map_err(thread_store_resume_read_error) | ||
| let stored_thread = result.map_err(thread_store_resume_read_error)?; | ||
| if stored_thread.archived_at.is_some() { | ||
| let thread_id = stored_thread.thread_id; | ||
| return Err(invalid_request(format!( | ||
| "session {thread_id} is archived. Run `codex unarchive {thread_id}` to unarchive it first." | ||
| ))); | ||
|
Comment on lines
+2983
to
+2987
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a user explicitly forks an archived session by id or rollout path, this new guard rejects the request before Useful? React with 👍 / 👎.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is intended. |
||
| } | ||
|
|
||
| Ok(stored_thread) | ||
| } | ||
|
|
||
| async fn stored_thread_to_initial_history( | ||
|
|
@@ -3964,7 +3972,7 @@ fn thread_store_archive_error(operation: &str, err: ThreadStoreError) -> JSONRPC | |
| ThreadStoreError::Unsupported { | ||
| operation: unsupported_operation, | ||
| } => unsupported_thread_store_operation(unsupported_operation), | ||
| err => internal_error(format!("failed to {operation} thread: {err}")), | ||
| err => internal_error(format!("failed to {operation} session: {err}")), | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.