mirror of
https://github.com/openai/codex.git
synced 2026-11-18 23:02:23 +00:00
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:
1 parent
4636819a35
commit
3921a30d6b
47 files changed
+555
-52
No files matched your search
@@ -3158,6 +3158,7 @@ mod tests {
|
||||
agent_role: None,
|
||||
git_info: None,
|
||||
name: None,
|
||||
daybreak_enabled: None,
|
||||
turns: Vec::new(),
|
||||
},
|
||||
model: "gpt-5".to_string(),
|
||||
@@ -3219,6 +3220,7 @@ mod tests {
|
||||
"agentRole": null,
|
||||
"gitInfo": null,
|
||||
"name": null,
|
||||
"daybreakEnabled": null,
|
||||
"turns": []
|
||||
},
|
||||
"model": "gpt-5",
|
||||
|
||||
@@ -312,6 +312,7 @@ fn thread_resume_response_round_trips_initial_turns_page() {
|
||||
agent_role: None,
|
||||
git_info: None,
|
||||
name: None,
|
||||
daybreak_enabled: None,
|
||||
turns: Vec::new(),
|
||||
},
|
||||
model: "gpt-5".to_string(),
|
||||
|
||||
@@ -988,6 +988,12 @@ pub struct ThreadMetadataUpdateParams {
|
||||
/// provide a string to replace the stored value.
|
||||
#[ts(optional = nullable)]
|
||||
pub git_info: Option<ThreadMetadataGitInfoUpdateParams>,
|
||||
/// Save the client's Daybreak choice for this persistent thread.
|
||||
/// Omitted or null leaves it unchanged. This does not select a turn's
|
||||
/// `cyberAccessProgram` or grant access.
|
||||
#[experimental("thread/metadata/update.daybreakEnabled")]
|
||||
#[ts(optional = nullable)]
|
||||
pub daybreak_enabled: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
|
||||
@@ -283,6 +283,9 @@ pub struct Thread {
|
||||
pub git_info: Option<GitInfo>,
|
||||
/// Optional user-facing thread title.
|
||||
pub name: Option<String>,
|
||||
/// Saved Daybreak choice, independent of turn execution. Null if unset.
|
||||
#[experimental("thread.daybreakEnabled")]
|
||||
pub daybreak_enabled: Option<bool>,
|
||||
/// Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read`
|
||||
/// (when `includeTurns` is true) responses.
|
||||
/// For all other responses and notifications returning a Thread,
|
||||
@@ -330,6 +333,7 @@ struct ThreadCompatibility {
|
||||
agent_role: Option<String>,
|
||||
git_info: Option<GitInfo>,
|
||||
name: Option<String>,
|
||||
daybreak_enabled: Option<bool>,
|
||||
turns: Vec<Turn>,
|
||||
}
|
||||
|
||||
@@ -370,6 +374,7 @@ impl<'de> Deserialize<'de> for Thread {
|
||||
agent_role: thread.agent_role,
|
||||
git_info: thread.git_info,
|
||||
name: thread.name,
|
||||
daybreak_enabled: thread.daybreak_enabled,
|
||||
turns: thread.turns,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user