Harden Epiphany state update notifications

This commit is contained in:
Meta Vens 2026-04-25 06:29:45 +01:00
commit 366354d359
16 changed files with 286 additions and 32 deletions

View file

@ -1889,6 +1889,11 @@ mod tests {
v2::ThreadEpiphanyStateUpdatedNotification {
thread_id: "thr_123".to_string(),
source: v2::ThreadEpiphanyStateUpdatedSource::Update,
revision: 7,
changed_fields: vec![
v2::ThreadEpiphanyStateUpdatedField::Objective,
v2::ThreadEpiphanyStateUpdatedField::Evidence,
],
epiphany_state: codex_protocol::protocol::EpiphanyThreadState {
revision: 7,
objective: Some("Keep the map live".to_string()),
@ -1902,6 +1907,8 @@ mod tests {
"params": {
"threadId": "thr_123",
"source": "update",
"revision": 7,
"changedFields": ["objective", "evidence"],
"epiphanyState": {
"revision": 7,
"objective": "Keep the map live"
@ -2515,6 +2522,8 @@ mod tests {
v2::ThreadEpiphanyStateUpdatedNotification {
thread_id: "thr_123".to_string(),
source: v2::ThreadEpiphanyStateUpdatedSource::Promote,
revision: 0,
changed_fields: vec![v2::ThreadEpiphanyStateUpdatedField::Churn],
epiphany_state: codex_protocol::protocol::EpiphanyThreadState::default(),
},
);

View file

@ -4059,6 +4059,8 @@ pub struct ThreadEpiphanyUpdateResponse {
pub struct ThreadEpiphanyStateUpdatedNotification {
pub thread_id: String,
pub source: ThreadEpiphanyStateUpdatedSource,
pub revision: u64,
pub changed_fields: Vec<ThreadEpiphanyStateUpdatedField>,
pub epiphany_state: CoreEpiphanyThreadState,
}
@ -4070,6 +4072,24 @@ pub enum ThreadEpiphanyStateUpdatedSource {
Promote,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub enum ThreadEpiphanyStateUpdatedField {
Objective,
ActiveSubgoalId,
Subgoals,
Invariants,
Graphs,
GraphFrontier,
GraphCheckpoint,
Scratch,
Observations,
Evidence,
Churn,
Mode,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]