core: add extra metadata field to Thread struct (#29675)

# Summary

Adds a field Thread.extras that can be used to hold arbitrary metadata
specific to a given thread.
This commit is contained in:
Boyang Niu
2026-06-23 19:15:59 +00:00
committed by GitHub
parent 2cf2a6a844
commit 354807920e
30 changed files with 113 additions and 44 deletions
@@ -4156,6 +4156,7 @@ pub(crate) fn thread_from_stored_thread(
let thread_id = thread.thread_id.to_string();
let thread = Thread {
id: thread_id.clone(),
extra: None,
session_id: thread_id,
forked_from_id: thread.forked_from_id.map(|id| id.to_string()),
parent_thread_id: thread.parent_thread_id.map(|id| id.to_string()),
@@ -4366,6 +4367,7 @@ fn build_thread_from_snapshot(
let now = time::OffsetDateTime::now_utc().unix_timestamp();
Thread {
id: thread_id.to_string(),
extra: None,
session_id,
forked_from_id: None,
parent_thread_id: config_snapshot.parent_thread_id.map(|id| id.to_string()),
@@ -183,6 +183,7 @@ mod tests {
fn test_thread(items: Vec<ThreadItem>) -> Thread {
Thread {
id: "thread-1".to_string(),
extra: None,
session_id: "session-1".to_string(),
forked_from_id: None,
parent_thread_id: None,
@@ -314,6 +314,7 @@ pub(crate) fn summary_to_thread(
let thread_id = conversation_id.to_string();
Thread {
id: thread_id.clone(),
extra: None,
session_id: thread_id,
forked_from_id: None,
parent_thread_id: None,
+1
View File
@@ -889,6 +889,7 @@ mod tests {
fn test_thread(thread_id: &str, source: codex_app_server_protocol::SessionSource) -> Thread {
Thread {
id: thread_id.to_string(),
extra: None,
session_id: thread_id.to_string(),
forked_from_id: None,
parent_thread_id: None,