Skip to content

Move live thread metadata handling above recorder#21874

Open
wiltzius-openai wants to merge 1 commit intowiltzius/codex/thread-metadata-store-apifrom
wiltzius/codex/live-thread-metadata-handler
Open

Move live thread metadata handling above recorder#21874
wiltzius-openai wants to merge 1 commit intowiltzius/codex/thread-metadata-store-apifrom
wiltzius/codex/live-thread-metadata-handler

Conversation

@wiltzius-openai
Copy link
Copy Markdown
Contributor

@wiltzius-openai wiltzius-openai commented May 9, 2026

Builds on #21873 to remove thread metadata handling from the RolloutRecorder, which is now only responsible for writing jsonl files in the local ThreadStore. Instead LiveThread makes ThreadStore API calls to explicitly store metatdata.

Summary

  • wire LiveThread to own ThreadMetadataHandler and send canonical rollout items plus metadata updates in order
  • make RolloutRecorder write already-canonical JSONL only and remove recorder-owned SQLite metadata sync
  • simplify LocalThreadStore live writer create/resume paths around canonical recorder params
  • update local, core, rollout, and app-server tests for the new live metadata boundary

@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/live-thread-metadata-handler branch 2 times, most recently from ecbc5b6 to 8f83c53 Compare May 9, 2026 03:24
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/thread-metadata-store-api branch from f8dfb0b to 8a074e0 Compare May 9, 2026 03:25
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/live-thread-metadata-handler branch 3 times, most recently from 587e2e4 to 93065e7 Compare May 9, 2026 03:53
@wiltzius-openai wiltzius-openai force-pushed the wiltzius/codex/live-thread-metadata-handler branch from 93065e7 to b41516a Compare May 9, 2026 04:04
@wiltzius-openai wiltzius-openai marked this pull request as ready for review May 9, 2026 04:49
@wiltzius-openai wiltzius-openai requested a review from a team as a code owner May 9, 2026 04:49
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: b41516a719

ℹ️ 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 +117 to +125
let (initial, prepared) = {
let mut handler = self.metadata_handler.lock().await;
let prepared = handler.prepare_items(items);
let initial = prepared
.is_some()
.then(|| handler.take_initial_metadata())
.flatten();
(initial, prepared)
};
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 Serialize live appends through metadata application

append_items advances metadata_handler under the mutex, releases it, then performs multiple awaited store calls. Concurrent appends can therefore compute order A then B but enqueue B's rollout item before A's initial/user items or apply B's metadata first, producing out-of-order JSONL/SQLite state for cloned LiveThreads.

Useful? React with 👍 / 👎.

Comment on lines +126 to +132
if let Some(initial) = initial {
self.append_prepared_metadata(initial).await?;
}
let Some(prepared) = prepared else {
return Ok(());
};
self.append_prepared_metadata(prepared).await
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 Do not drop user items when initial metadata application fails

When the initial metadata write fails, this returns before appending the caller's prepared items, but prepare_items has already advanced the handler state. A transient SQLite/apply error during the first append can therefore lose the first user message from the rollout entirely instead of still recording JSONL and retrying metadata later.

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.

2 participants