Label Epiphany state update notifications

This commit is contained in:
Meta Vens 2026-04-25 05:57:23 +01:00
commit 4c770e98dd
17 changed files with 100 additions and 22 deletions

View file

@ -3717,16 +3717,27 @@
"epiphanyState": {
"$ref": "#/definitions/EpiphanyThreadState"
},
"source": {
"$ref": "#/definitions/ThreadEpiphanyStateUpdatedSource"
},
"threadId": {
"type": "string"
}
},
"required": [
"epiphanyState",
"source",
"threadId"
],
"type": "object"
},
"ThreadEpiphanyStateUpdatedSource": {
"enum": [
"update",
"promote"
],
"type": "string"
},
"ThreadId": {
"type": "string"
},

View file

@ -14972,17 +14972,28 @@
"epiphanyState": {
"$ref": "#/definitions/v2/EpiphanyThreadState"
},
"source": {
"$ref": "#/definitions/v2/ThreadEpiphanyStateUpdatedSource"
},
"threadId": {
"type": "string"
}
},
"required": [
"epiphanyState",
"source",
"threadId"
],
"title": "ThreadEpiphanyStateUpdatedNotification",
"type": "object"
},
"ThreadEpiphanyStateUpdatedSource": {
"enum": [
"update",
"promote"
],
"type": "string"
},
"ThreadEpiphanyUpdatePatch": {
"properties": {
"activeSubgoalId": {

View file

@ -12859,17 +12859,28 @@
"epiphanyState": {
"$ref": "#/definitions/EpiphanyThreadState"
},
"source": {
"$ref": "#/definitions/ThreadEpiphanyStateUpdatedSource"
},
"threadId": {
"type": "string"
}
},
"required": [
"epiphanyState",
"source",
"threadId"
],
"title": "ThreadEpiphanyStateUpdatedNotification",
"type": "object"
},
"ThreadEpiphanyStateUpdatedSource": {
"enum": [
"update",
"promote"
],
"type": "string"
},
"ThreadEpiphanyUpdatePatch": {
"properties": {
"activeSubgoalId": {

View file

@ -704,18 +704,29 @@
"default"
],
"type": "string"
},
"ThreadEpiphanyStateUpdatedSource": {
"enum": [
"update",
"promote"
],
"type": "string"
}
},
"properties": {
"epiphanyState": {
"$ref": "#/definitions/EpiphanyThreadState"
},
"source": {
"$ref": "#/definitions/ThreadEpiphanyStateUpdatedSource"
},
"threadId": {
"type": "string"
}
},
"required": [
"epiphanyState",
"source",
"threadId"
],
"title": "ThreadEpiphanyStateUpdatedNotification",

View file

@ -2,5 +2,6 @@
// 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 { ThreadEpiphanyStateUpdatedSource } from "./ThreadEpiphanyStateUpdatedSource";
export type ThreadEpiphanyStateUpdatedNotification = { threadId: string, epiphanyState: EpiphanyThreadState, };
export type ThreadEpiphanyStateUpdatedNotification = { threadId: string, source: ThreadEpiphanyStateUpdatedSource, epiphanyState: EpiphanyThreadState, };

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 ThreadEpiphanyStateUpdatedSource = "update" | "promote";

View file

@ -322,6 +322,7 @@ export type { ThreadEpiphanyRetrieveResult } from "./ThreadEpiphanyRetrieveResul
export type { ThreadEpiphanyRetrieveResultKind } from "./ThreadEpiphanyRetrieveResultKind";
export type { ThreadEpiphanyRetrieveShardSummary } from "./ThreadEpiphanyRetrieveShardSummary";
export type { ThreadEpiphanyStateUpdatedNotification } from "./ThreadEpiphanyStateUpdatedNotification";
export type { ThreadEpiphanyStateUpdatedSource } from "./ThreadEpiphanyStateUpdatedSource";
export type { ThreadEpiphanyUpdatePatch } from "./ThreadEpiphanyUpdatePatch";
export type { ThreadForkParams } from "./ThreadForkParams";
export type { ThreadForkResponse } from "./ThreadForkResponse";

View file

@ -1888,6 +1888,7 @@ mod tests {
let notification = ServerNotification::ThreadEpiphanyStateUpdated(
v2::ThreadEpiphanyStateUpdatedNotification {
thread_id: "thr_123".to_string(),
source: v2::ThreadEpiphanyStateUpdatedSource::Update,
epiphany_state: codex_protocol::protocol::EpiphanyThreadState {
revision: 7,
objective: Some("Keep the map live".to_string()),
@ -1900,6 +1901,7 @@ mod tests {
"method": "thread/epiphany/stateUpdated",
"params": {
"threadId": "thr_123",
"source": "update",
"epiphanyState": {
"revision": 7,
"objective": "Keep the map live"
@ -2512,6 +2514,7 @@ mod tests {
let notification = ServerNotification::ThreadEpiphanyStateUpdated(
v2::ThreadEpiphanyStateUpdatedNotification {
thread_id: "thr_123".to_string(),
source: v2::ThreadEpiphanyStateUpdatedSource::Promote,
epiphany_state: codex_protocol::protocol::EpiphanyThreadState::default(),
},
);

View file

@ -4058,9 +4058,18 @@ pub struct ThreadEpiphanyUpdateResponse {
#[ts(export_to = "v2/")]
pub struct ThreadEpiphanyStateUpdatedNotification {
pub thread_id: String,
pub source: ThreadEpiphanyStateUpdatedSource,
pub epiphany_state: CoreEpiphanyThreadState,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub enum ThreadEpiphanyStateUpdatedSource {
Update,
Promote,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]

View file

@ -145,7 +145,7 @@ Experimental Epiphany retrieval:
- `thread/epiphany/distill` is a loaded-thread-only read surface that turns one explicit observation input into a deterministic observation/evidence patch plus the current `expectedRevision`. It does not mutate thread state; callers must pass the returned patch to `thread/epiphany/update` to promote it.
- `thread/epiphany/promote` is an explicit loaded-thread-only promotion gate. It evaluates a patch plus verifier evidence, rejects with reasons without mutating state when policy fails, and applies the patch through the durable update path when accepted.
- `thread/epiphany/update` is the explicit loaded-thread-only control-plane write path for Epiphany state. It can append observations/evidence and replace bounded typed state fields such as objective, subgoals, graph frontier/checkpoint, scratch, churn, and mode; it bumps the Epiphany revision and persists a rollout snapshot immediately.
- `thread/epiphany/stateUpdated` is an experimental server notification emitted after successful `thread/epiphany/update` and accepted `thread/epiphany/promote`. It carries the updated typed `epiphanyState`; rejected promotions do not emit it.
- `thread/epiphany/stateUpdated` is an experimental server notification emitted after successful `thread/epiphany/update` and accepted `thread/epiphany/promote`. It carries the updated typed `epiphanyState` plus a `source` of `update` or `promote`; rejected promotions do not emit it.
The request envelope is camelCase, but nested reused Epiphany core DTOs currently keep their core snake_case fields, such as `source_kind`, `understanding_status`, and `diff_pressure`.
- `thread/start` — create a new thread; emits `thread/started` (including the current `thread.status`) and auto-subscribes you to turn/item events for that thread. When the request includes a `cwd` and the resolved sandbox is `workspace-write` or full access, app-server also marks that project as trusted in the user `config.toml`. Pass `sessionStartSource: "clear"` when starting a replacement thread after clearing the current session so `SessionStart` hooks receive `source: "clear"` instead of the default `"startup"`. For permissions, prefer `permissionProfile`; the legacy `sandbox` shorthand is still accepted but cannot be combined with `permissionProfile`.

View file

@ -161,6 +161,7 @@ use codex_app_server_protocol::ThreadEpiphanyRetrieveResult;
use codex_app_server_protocol::ThreadEpiphanyRetrieveResultKind;
use codex_app_server_protocol::ThreadEpiphanyRetrieveShardSummary;
use codex_app_server_protocol::ThreadEpiphanyStateUpdatedNotification;
use codex_app_server_protocol::ThreadEpiphanyStateUpdatedSource;
use codex_app_server_protocol::ThreadEpiphanyUpdateParams;
use codex_app_server_protocol::ThreadEpiphanyUpdatePatch;
use codex_app_server_protocol::ThreadEpiphanyUpdateResponse;
@ -4417,6 +4418,7 @@ impl CodexMessageProcessor {
.send_server_notification(ServerNotification::ThreadEpiphanyStateUpdated(
ThreadEpiphanyStateUpdatedNotification {
thread_id: thread_uuid.to_string(),
source: ThreadEpiphanyStateUpdatedSource::Promote,
epiphany_state,
},
))
@ -4494,6 +4496,7 @@ impl CodexMessageProcessor {
.send_server_notification(ServerNotification::ThreadEpiphanyStateUpdated(
ThreadEpiphanyStateUpdatedNotification {
thread_id: thread_uuid.to_string(),
source: ThreadEpiphanyStateUpdatedSource::Update,
epiphany_state,
},
))