Persist Daybreak preferences in thread metadata (#42854)

## Why

Clients need a per-thread Daybreak toggle that survives restarts and can be
restored on resume without changing the access program of an active or future
turn.

## What changed

- Add experimental `daybreakEnabled` support to `thread/metadata/update` and
  expose the saved value on thread responses.
- Store the preference in SQLite, including for threads without a first turn,
  and preserve it through reads, resumes, reconciliation, and restarts.
- Copy the preference when forking a thread while keeping subsequent updates
  independent.
- Keep `daybreakEnabled` separate from the per-turn `cyberAccessProgram` field;
  app-server does not derive one from the other.

## Testing

- Cover persistence across restarts, cold reads, reconciliation, and forks.
- Verify metadata updates do not alter the access program of active or later
  turns.

GitOrigin-RevId: bcf987a9fcd7b0ac8a88b1c8f0df06b33ed8ad6e
This commit is contained in:
faizan-oai authored and copyberry committed 2026-09-04 21:17:25 +00:00
1 parent 4636819a35
commit 3921a30d6b
47 files changed
+555 -52

No files matched your search

@@ -232,6 +232,7 @@ fn overview_thread(
id: thread_id.to_string(),
extra: None,
project_id: None,
daybreak_enabled: None,
session_id: parent_thread_id.unwrap_or(thread_id).to_string(),
forked_from_id: None,
parent_thread_id: None,
+1
View File
@@ -147,6 +147,7 @@ mod tests {
section: None,
section_entered_at: None,
project_id: None,
daybreak_enabled: None,
history_mode: Default::default(),
model_provider: "openai".to_string(),
model: None,
+3
View File
@@ -4078,6 +4078,7 @@ async fn inactive_thread_started_notification_initializes_replay_session() -> Re
section: None,
section_entered_at: None,
project_id: None,
daybreak_enabled: None,
history_mode: Default::default(),
model_provider: "agent-provider".to_string(),
model: None,
@@ -4181,6 +4182,7 @@ async fn inactive_thread_started_notification_preserves_primary_model_when_path_
section: None,
section_entered_at: None,
project_id: None,
daybreak_enabled: None,
history_mode: Default::default(),
model_provider: "agent-provider".to_string(),
model: None,
@@ -4251,6 +4253,7 @@ async fn thread_read_session_state_does_not_reuse_primary_permission_profile() {
section: None,
section_entered_at: None,
project_id: None,
daybreak_enabled: None,
history_mode: Default::default(),
model_provider: "read-provider".to_string(),
model: None,
@@ -1311,6 +1311,7 @@ async fn dynamic_tool_requests_ignore_other_namespaces_and_dispatch_tui_namespac
params: codex_app_server_protocol::ThreadMetadataUpdateParams {
thread_id: creation_source.to_string(),
project_id: Some(project.project.id.clone()),
daybreak_enabled: None,
git_info: None,
},
})
+1
View File
@@ -945,6 +945,7 @@ async fn known_thread_started_preserves_session_without_reading_unmaterialized_r
section: None,
section_entered_at: None,
project_id: None,
daybreak_enabled: None,
history_mode: Default::default(),
model_provider: "notification-provider".to_string(),
model: None,
@@ -422,6 +422,7 @@ mod tests {
section: None,
section_entered_at: None,
project_id: None,
daybreak_enabled: None,
history_mode: Default::default(),
model_provider: "read-provider".to_string(),
model: None,