Skip to content

Migrate fork and resume reads to thread store#18900

Open
wiltzius-openai wants to merge 2 commits intomainfrom
wiltzius/codex/thread-store-fork-resume
Open

Migrate fork and resume reads to thread store#18900
wiltzius-openai wants to merge 2 commits intomainfrom
wiltzius/codex/thread-store-fork-resume

Conversation

@wiltzius-openai
Copy link
Copy Markdown
Contributor

@wiltzius-openai wiltzius-openai commented Apr 21, 2026

  • Route cold thread/resume and thread/fork source loading through ThreadStore reads instead of direct rollout path operations
  • Keep lookups that explicitly specify a rollout-path using the local thread store methods but return an invalid-request error for remote ThreadStore configurations
  • Add some additional unit tests for code path coverage

@wiltzius-openai wiltzius-openai changed the base branch from main to wiltzius/codex/thread-store-live-writes April 21, 2026 22:16
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch 2 times, most recently from a1cf2fd to 3304803 Compare April 21, 2026 22:27
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-live-writes branch from 6ab42ef to 0a97cbd Compare April 22, 2026 21:06
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from 3304803 to 4684212 Compare April 22, 2026 21:10
@wiltzius-openai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
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: 4684212b00

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

Comment thread codex-rs/app-server/src/codex_message_processor.rs Outdated
Comment thread codex-rs/app-server/src/codex_message_processor.rs Outdated
@wiltzius-openai wiltzius-openai marked this pull request as ready for review April 22, 2026 21:53
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from 1f08dd6 to a32c66c Compare April 22, 2026 22:01
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from a32c66c to 344d17d Compare April 22, 2026 22:19
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from 344d17d to 707e1f3 Compare April 22, 2026 22:31
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-live-writes branch from 58068b9 to 070c747 Compare April 23, 2026 16:33
@wiltzius-openai wiltzius-openai requested a review from a team as a code owner April 23, 2026 16:33
Base automatically changed from wiltzius/codex/thread-store-live-writes to main April 23, 2026 17:17
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from 707e1f3 to 17882c8 Compare April 23, 2026 17:27
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from 17882c8 to a33177f Compare April 23, 2026 21:26
@wiltzius-openai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
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: a33177f384

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

Comment on lines +5030 to +5035
.thread_store
.read_thread(StoreReadThreadParams {
thread_id,
include_archived: true,
include_history: true,
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Read fork result from the fork-configured store

thread_fork builds a per-request config (with user overrides) and creates the new thread using thread_manager, which selects a store from that config. The follow-up read in read_stored_thread_for_new_fork ignores that and always queries self.thread_store (startup store). If overrides change experimental_thread_store_endpoint, the fork is written to one backend but read from another, causing spurious "not found" failures.

Useful? React with 👍 / 👎.

Comment on lines +5031 to +5035
.read_thread(StoreReadThreadParams {
thread_id,
include_archived: true,
include_history: true,
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Avoid loading full history for excludeTurns forks

read_stored_thread_for_new_fork always requests include_history: true. In thread_fork, this runs even when excludeTurns=true (the intended cheap path), so persistent forks still deserialize the entire rollout history just to build a summary. That adds avoidable latency/memory cost and can make large forks slow or fail under load.

Useful? React with 👍 / 👎.

Comment thread codex-rs/thread-store/src/local/read_thread.rs Outdated
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from a33177f to 22e9b89 Compare April 23, 2026 21:46
@wiltzius-openai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
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: 22e9b89dde

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

Comment on lines +4928 to +4933
self.thread_store
.read_thread(StoreReadThreadParams {
thread_id: existing_thread_id,
include_archived: true,
include_history: true,
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Keep fallback path lookup when thread-store read is unavailable

When path is omitted, this now unconditionally uses self.thread_store.read_thread(...). In remote-store mode, RemoteThreadStore::read_thread is currently unimplemented, so thread/fork and thread/resume by thread ID fail with INTERNAL errors instead of working from local rollout files. This is a regression from the prior direct rollout-path lookup behavior.

Useful? React with 👍 / 👎.

Comment thread codex-rs/thread-store/src/local/read_thread.rs Outdated
@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ 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".

@wiltzius-openai
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ 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".

@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from 21610d1 to 71885e6 Compare April 23, 2026 23:52
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from 71885e6 to 86dfb4b Compare April 24, 2026 00:03
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from 86dfb4b to b4e8ff8 Compare April 24, 2026 00:09
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from b4e8ff8 to aa5066a Compare April 24, 2026 01:29
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from aa5066a to 4a63d3d Compare April 24, 2026 01:39
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from 4a63d3d to 35f560c Compare April 24, 2026 02:16
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from 35f560c to 20ce4b4 Compare April 24, 2026 02:47
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from 20ce4b4 to e801d87 Compare April 24, 2026 03:45
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from e801d87 to 51786a8 Compare April 24, 2026 03:46
if !tokio::fs::try_exists(path).await.unwrap_or(false) {
return false;
}
read_thread_from_rollout_path(store, path.to_path_buf())
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

surprised we need to double check ids. not sure how we ever get the missalignment

@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from 51786a8 to 079c897 Compare April 24, 2026 18:31
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-store-fork-resume branch from 079c897 to 9298207 Compare April 24, 2026 18:39
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.

3 participants