Allow setting daybreakEnabled when starting a thread (#45513)

## What changed

Add experimental `thread/start.daybreakEnabled` so clients can set the initial preference for persistent threads. Omitted or null values leave it unset; explicit values are rejected for ephemeral threads.

Return the choice in the start response, `thread/started`, and reads before persistence. Stage it with the initial thread metadata and save it when the thread is persisted. Later changes still use `thread/metadata/update`. The preference does not select `turn/start.cyberAccessProgram` or grant access.

## Testing

Add coverage for true, false, and unset values in responses, notifications, reads, and reads after persistence and restart, plus rejection for ephemeral threads. Update existing metadata and access-program tests to exercise threads with an initial preference.

GitOrigin-RevId: 3bff3dc55a18436067bc2a3f156f5abf52d7321b
This commit is contained in:
faizan-oai
2026-09-14 20:45:04 +00:00
committed by copyberry
parent ea3c4848d8
commit ef8b356c22
8 changed files with 181 additions and 4 deletions

View File

@@ -481,6 +481,19 @@ impl ThreadStore for LocalThreadStore {
})
}
fn read_pending_thread_metadata(
&self,
thread_id: ThreadId,
) -> ThreadStoreFuture<'_, Option<ThreadMetadataPatch>> {
Box::pin(async move {
Ok(self
.pending_thread_metadata
.lock(thread_id)
.await
.and_then(|metadata| metadata.clone()))
})
}
fn remove_pending_thread_metadata(&self, thread_id: ThreadId) -> ThreadStoreFuture<'_, ()> {
Box::pin(async move {
self.pending_thread_metadata.remove(thread_id).await;

View File

@@ -116,6 +116,14 @@ pub trait ThreadStore: Any + Send + Sync {
})
}
/// Reads metadata staged for a reserved thread without persisting it.
fn read_pending_thread_metadata(
&self,
_thread_id: ThreadId,
) -> ThreadStoreFuture<'_, Option<ThreadMetadataPatch>> {
Box::pin(async { Ok(None) })
}
/// Removes host-owned metadata staged for a reserved thread ID.
fn remove_pending_thread_metadata(&self, _thread_id: ThreadId) -> ThreadStoreFuture<'_, ()> {
Box::pin(async {