Skip to content

Comments

fix(core): auto-unarchive archived sessions on id lookup#12481

Open
friel-openai wants to merge 1 commit intoopenai:mainfrom
friel-openai:friel/auto-unarchive-resume
Open

fix(core): auto-unarchive archived sessions on id lookup#12481
friel-openai wants to merge 1 commit intoopenai:mainfrom
friel-openai:friel/auto-unarchive-resume

Conversation

@friel-openai
Copy link
Contributor

Restore archived rollout files back into sessions when resolving a thread by id. This lets resume, fork, and resume_agent paths that rely on find_thread_path_by_id_str recover archived sessions automatically instead of reporting them missing.

Also adds a regression test covering archived->sessions restoration and lookup behavior.

Restore archived rollout files back into sessions when resolving a thread by id. This lets resume, fork, and resume_agent paths that rely on find_thread_path_by_id_str recover archived sessions automatically instead of reporting them missing.

Also adds a regression test covering archived->sessions restoration and lookup behavior.
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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.

Reviewed commit: fe31d1a911

ℹ️ 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".

.join(day);
tokio::fs::create_dir_all(&restored_dir).await?;
let restored_path = restored_dir.join(&file_name);
match tokio::fs::rename(&archived_path, &restored_path).await {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Validate archived path and id before unarchiving

try_unarchive_thread_path_by_id_str renames whatever path lookup returns, but it never checks that the source is actually under archived_sessions or that the filename ends with the requested thread id. Because DB lookup in find_thread_path_by_id_str_in_subdir accepts any existing rollout_path, a stale/corrupt row can move an unrelated file and then mark the wrong thread unarchived.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant