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

@ -3712,11 +3712,39 @@
],
"type": "object"
},
"ThreadEpiphanyStateUpdatedField": {
"enum": [
"objective",
"activeSubgoalId",
"subgoals",
"invariants",
"graphs",
"graphFrontier",
"graphCheckpoint",
"scratch",
"observations",
"evidence",
"churn",
"mode"
],
"type": "string"
},
"ThreadEpiphanyStateUpdatedNotification": {
"properties": {
"changedFields": {
"items": {
"$ref": "#/definitions/ThreadEpiphanyStateUpdatedField"
},
"type": "array"
},
"epiphanyState": {
"$ref": "#/definitions/EpiphanyThreadState"
},
"revision": {
"format": "uint64",
"minimum": 0.0,
"type": "integer"
},
"source": {
"$ref": "#/definitions/ThreadEpiphanyStateUpdatedSource"
},
@ -3725,7 +3753,9 @@
}
},
"required": [
"changedFields",
"epiphanyState",
"revision",
"source",
"threadId"
],

View file

@ -14966,12 +14966,40 @@
],
"type": "object"
},
"ThreadEpiphanyStateUpdatedField": {
"enum": [
"objective",
"activeSubgoalId",
"subgoals",
"invariants",
"graphs",
"graphFrontier",
"graphCheckpoint",
"scratch",
"observations",
"evidence",
"churn",
"mode"
],
"type": "string"
},
"ThreadEpiphanyStateUpdatedNotification": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"changedFields": {
"items": {
"$ref": "#/definitions/v2/ThreadEpiphanyStateUpdatedField"
},
"type": "array"
},
"epiphanyState": {
"$ref": "#/definitions/v2/EpiphanyThreadState"
},
"revision": {
"format": "uint64",
"minimum": 0.0,
"type": "integer"
},
"source": {
"$ref": "#/definitions/v2/ThreadEpiphanyStateUpdatedSource"
},
@ -14980,7 +15008,9 @@
}
},
"required": [
"changedFields",
"epiphanyState",
"revision",
"source",
"threadId"
],

View file

@ -12853,12 +12853,40 @@
],
"type": "object"
},
"ThreadEpiphanyStateUpdatedField": {
"enum": [
"objective",
"activeSubgoalId",
"subgoals",
"invariants",
"graphs",
"graphFrontier",
"graphCheckpoint",
"scratch",
"observations",
"evidence",
"churn",
"mode"
],
"type": "string"
},
"ThreadEpiphanyStateUpdatedNotification": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"changedFields": {
"items": {
"$ref": "#/definitions/ThreadEpiphanyStateUpdatedField"
},
"type": "array"
},
"epiphanyState": {
"$ref": "#/definitions/EpiphanyThreadState"
},
"revision": {
"format": "uint64",
"minimum": 0.0,
"type": "integer"
},
"source": {
"$ref": "#/definitions/ThreadEpiphanyStateUpdatedSource"
},
@ -12867,7 +12895,9 @@
}
},
"required": [
"changedFields",
"epiphanyState",
"revision",
"source",
"threadId"
],

View file

@ -705,6 +705,23 @@
],
"type": "string"
},
"ThreadEpiphanyStateUpdatedField": {
"enum": [
"objective",
"activeSubgoalId",
"subgoals",
"invariants",
"graphs",
"graphFrontier",
"graphCheckpoint",
"scratch",
"observations",
"evidence",
"churn",
"mode"
],
"type": "string"
},
"ThreadEpiphanyStateUpdatedSource": {
"enum": [
"update",
@ -714,9 +731,20 @@
}
},
"properties": {
"changedFields": {
"items": {
"$ref": "#/definitions/ThreadEpiphanyStateUpdatedField"
},
"type": "array"
},
"epiphanyState": {
"$ref": "#/definitions/EpiphanyThreadState"
},
"revision": {
"format": "uint64",
"minimum": 0.0,
"type": "integer"
},
"source": {
"$ref": "#/definitions/ThreadEpiphanyStateUpdatedSource"
},
@ -725,7 +753,9 @@
}
},
"required": [
"changedFields",
"epiphanyState",
"revision",
"source",
"threadId"
],

View file

@ -0,0 +1,5 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ThreadEpiphanyStateUpdatedField = "objective" | "activeSubgoalId" | "subgoals" | "invariants" | "graphs" | "graphFrontier" | "graphCheckpoint" | "scratch" | "observations" | "evidence" | "churn" | "mode";

View file

@ -2,6 +2,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { EpiphanyThreadState } from "../EpiphanyThreadState";
import type { ThreadEpiphanyStateUpdatedField } from "./ThreadEpiphanyStateUpdatedField";
import type { ThreadEpiphanyStateUpdatedSource } from "./ThreadEpiphanyStateUpdatedSource";
export type ThreadEpiphanyStateUpdatedNotification = { threadId: string, source: ThreadEpiphanyStateUpdatedSource, epiphanyState: EpiphanyThreadState, };
export type ThreadEpiphanyStateUpdatedNotification = { threadId: string, source: ThreadEpiphanyStateUpdatedSource, revision: bigint, changedFields: Array<ThreadEpiphanyStateUpdatedField>, epiphanyState: EpiphanyThreadState, };

View file

@ -321,6 +321,7 @@ export type { ThreadEpiphanyRetrieveIndexSummary } from "./ThreadEpiphanyRetriev
export type { ThreadEpiphanyRetrieveResult } from "./ThreadEpiphanyRetrieveResult";
export type { ThreadEpiphanyRetrieveResultKind } from "./ThreadEpiphanyRetrieveResultKind";
export type { ThreadEpiphanyRetrieveShardSummary } from "./ThreadEpiphanyRetrieveShardSummary";
export type { ThreadEpiphanyStateUpdatedField } from "./ThreadEpiphanyStateUpdatedField";
export type { ThreadEpiphanyStateUpdatedNotification } from "./ThreadEpiphanyStateUpdatedNotification";
export type { ThreadEpiphanyStateUpdatedSource } from "./ThreadEpiphanyStateUpdatedSource";
export type { ThreadEpiphanyUpdatePatch } from "./ThreadEpiphanyUpdatePatch";

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/")]