Add Epiphany jobsUpdated notification
This commit is contained in:
parent
5308724b76
commit
48d6820d7d
22 changed files with 923 additions and 23 deletions
164
vendor/codex/codex-rs/app-server-protocol/schema/json/ServerNotification.json
generated
vendored
164
vendor/codex/codex-rs/app-server-protocol/schema/json/ServerNotification.json
generated
vendored
|
|
@ -3856,6 +3856,150 @@
|
|||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadEpiphanyJob": {
|
||||
"properties": {
|
||||
"activeThreadIds": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"blockingReason": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"itemsProcessed": {
|
||||
"format": "uint32",
|
||||
"minimum": 0.0,
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"itemsTotal": {
|
||||
"format": "uint32",
|
||||
"minimum": 0.0,
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"kind": {
|
||||
"$ref": "#/definitions/ThreadEpiphanyJobKind"
|
||||
},
|
||||
"lastCheckpointAtUnixSeconds": {
|
||||
"format": "int64",
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"linkedGraphNodeIds": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"linkedSubgoalIds": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"ownerRole": {
|
||||
"type": "string"
|
||||
},
|
||||
"progressNote": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"runtimeAgentJobId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"scope": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"$ref": "#/definitions/ThreadEpiphanyJobStatus"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"kind",
|
||||
"ownerRole",
|
||||
"scope",
|
||||
"status"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadEpiphanyJobKind": {
|
||||
"enum": [
|
||||
"indexing",
|
||||
"remap",
|
||||
"verification",
|
||||
"specialist"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"ThreadEpiphanyJobStatus": {
|
||||
"enum": [
|
||||
"idle",
|
||||
"needed",
|
||||
"pending",
|
||||
"running",
|
||||
"completed",
|
||||
"failed",
|
||||
"cancelled",
|
||||
"blocked",
|
||||
"unavailable"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"ThreadEpiphanyJobsUpdatedNotification": {
|
||||
"properties": {
|
||||
"jobs": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/ThreadEpiphanyJob"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"source": {
|
||||
"$ref": "#/definitions/ThreadEpiphanyJobsUpdatedSource"
|
||||
},
|
||||
"stateRevision": {
|
||||
"format": "uint64",
|
||||
"minimum": 0.0,
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"threadId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"source",
|
||||
"threadId"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadEpiphanyJobsUpdatedSource": {
|
||||
"enum": [
|
||||
"runtimeProgress"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"ThreadEpiphanyStateUpdatedField": {
|
||||
"enum": [
|
||||
"objective",
|
||||
|
|
@ -6363,6 +6507,26 @@
|
|||
"title": "Thread/epiphany/stateUpdatedNotification",
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"method": {
|
||||
"enum": [
|
||||
"thread/epiphany/jobsUpdated"
|
||||
],
|
||||
"title": "Thread/epiphany/jobsUpdatedNotificationMethod",
|
||||
"type": "string"
|
||||
},
|
||||
"params": {
|
||||
"$ref": "#/definitions/ThreadEpiphanyJobsUpdatedNotification"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"method",
|
||||
"params"
|
||||
],
|
||||
"title": "Thread/epiphany/jobsUpdatedNotification",
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"method": {
|
||||
|
|
|
|||
|
|
@ -4524,6 +4524,26 @@
|
|||
"title": "Thread/epiphany/stateUpdatedNotification",
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"method": {
|
||||
"enum": [
|
||||
"thread/epiphany/jobsUpdated"
|
||||
],
|
||||
"title": "Thread/epiphany/jobsUpdatedNotificationMethod",
|
||||
"type": "string"
|
||||
},
|
||||
"params": {
|
||||
"$ref": "#/definitions/v2/ThreadEpiphanyJobsUpdatedNotification"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"method",
|
||||
"params"
|
||||
],
|
||||
"title": "Thread/epiphany/jobsUpdatedNotification",
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"method": {
|
||||
|
|
@ -15328,6 +15348,43 @@
|
|||
],
|
||||
"type": "string"
|
||||
},
|
||||
"ThreadEpiphanyJobsUpdatedNotification": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"jobs": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/v2/ThreadEpiphanyJob"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"source": {
|
||||
"$ref": "#/definitions/v2/ThreadEpiphanyJobsUpdatedSource"
|
||||
},
|
||||
"stateRevision": {
|
||||
"format": "uint64",
|
||||
"minimum": 0.0,
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"threadId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"source",
|
||||
"threadId"
|
||||
],
|
||||
"title": "ThreadEpiphanyJobsUpdatedNotification",
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadEpiphanyJobsUpdatedSource": {
|
||||
"enum": [
|
||||
"runtimeProgress"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"ThreadEpiphanyPressure": {
|
||||
"properties": {
|
||||
"basis": {
|
||||
|
|
|
|||
|
|
@ -11726,6 +11726,26 @@
|
|||
"title": "Thread/epiphany/stateUpdatedNotification",
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"method": {
|
||||
"enum": [
|
||||
"thread/epiphany/jobsUpdated"
|
||||
],
|
||||
"title": "Thread/epiphany/jobsUpdatedNotificationMethod",
|
||||
"type": "string"
|
||||
},
|
||||
"params": {
|
||||
"$ref": "#/definitions/ThreadEpiphanyJobsUpdatedNotification"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"method",
|
||||
"params"
|
||||
],
|
||||
"title": "Thread/epiphany/jobsUpdatedNotification",
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"method": {
|
||||
|
|
@ -13215,6 +13235,43 @@
|
|||
],
|
||||
"type": "string"
|
||||
},
|
||||
"ThreadEpiphanyJobsUpdatedNotification": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"jobs": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/ThreadEpiphanyJob"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"source": {
|
||||
"$ref": "#/definitions/ThreadEpiphanyJobsUpdatedSource"
|
||||
},
|
||||
"stateRevision": {
|
||||
"format": "uint64",
|
||||
"minimum": 0.0,
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"threadId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"source",
|
||||
"threadId"
|
||||
],
|
||||
"title": "ThreadEpiphanyJobsUpdatedNotification",
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadEpiphanyJobsUpdatedSource": {
|
||||
"enum": [
|
||||
"runtimeProgress"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"ThreadEpiphanyPressure": {
|
||||
"properties": {
|
||||
"basis": {
|
||||
|
|
|
|||
148
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadEpiphanyJobsUpdatedNotification.json
generated
vendored
Normal file
148
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadEpiphanyJobsUpdatedNotification.json
generated
vendored
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"definitions": {
|
||||
"ThreadEpiphanyJob": {
|
||||
"properties": {
|
||||
"activeThreadIds": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"blockingReason": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"itemsProcessed": {
|
||||
"format": "uint32",
|
||||
"minimum": 0.0,
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"itemsTotal": {
|
||||
"format": "uint32",
|
||||
"minimum": 0.0,
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"kind": {
|
||||
"$ref": "#/definitions/ThreadEpiphanyJobKind"
|
||||
},
|
||||
"lastCheckpointAtUnixSeconds": {
|
||||
"format": "int64",
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"linkedGraphNodeIds": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"linkedSubgoalIds": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"ownerRole": {
|
||||
"type": "string"
|
||||
},
|
||||
"progressNote": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"runtimeAgentJobId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"scope": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"$ref": "#/definitions/ThreadEpiphanyJobStatus"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"kind",
|
||||
"ownerRole",
|
||||
"scope",
|
||||
"status"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadEpiphanyJobKind": {
|
||||
"enum": [
|
||||
"indexing",
|
||||
"remap",
|
||||
"verification",
|
||||
"specialist"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"ThreadEpiphanyJobStatus": {
|
||||
"enum": [
|
||||
"idle",
|
||||
"needed",
|
||||
"pending",
|
||||
"running",
|
||||
"completed",
|
||||
"failed",
|
||||
"cancelled",
|
||||
"blocked",
|
||||
"unavailable"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"ThreadEpiphanyJobsUpdatedSource": {
|
||||
"enum": [
|
||||
"runtimeProgress"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"jobs": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/ThreadEpiphanyJob"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"source": {
|
||||
"$ref": "#/definitions/ThreadEpiphanyJobsUpdatedSource"
|
||||
},
|
||||
"stateRevision": {
|
||||
"format": "uint64",
|
||||
"minimum": 0.0,
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"threadId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"source",
|
||||
"threadId"
|
||||
],
|
||||
"title": "ThreadEpiphanyJobsUpdatedNotification",
|
||||
"type": "object"
|
||||
}
|
||||
3
vendor/codex/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts
generated
vendored
3
vendor/codex/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts
generated
vendored
File diff suppressed because one or more lines are too long
7
vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyJobsUpdatedNotification.ts
generated
vendored
Normal file
7
vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyJobsUpdatedNotification.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
// 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.
|
||||
import type { ThreadEpiphanyJob } from "./ThreadEpiphanyJob";
|
||||
import type { ThreadEpiphanyJobsUpdatedSource } from "./ThreadEpiphanyJobsUpdatedSource";
|
||||
|
||||
export type ThreadEpiphanyJobsUpdatedNotification = { threadId: string, source: ThreadEpiphanyJobsUpdatedSource, stateRevision?: bigint | null, jobs?: Array<ThreadEpiphanyJob>, };
|
||||
5
vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyJobsUpdatedSource.ts
generated
vendored
Normal file
5
vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/ThreadEpiphanyJobsUpdatedSource.ts
generated
vendored
Normal 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 ThreadEpiphanyJobsUpdatedSource = "runtimeProgress";
|
||||
2
vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/index.ts
generated
vendored
2
vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/index.ts
generated
vendored
|
|
@ -331,6 +331,8 @@ export type { ThreadEpiphanyJob } from "./ThreadEpiphanyJob";
|
|||
export type { ThreadEpiphanyJobKind } from "./ThreadEpiphanyJobKind";
|
||||
export type { ThreadEpiphanyJobStatus } from "./ThreadEpiphanyJobStatus";
|
||||
export type { ThreadEpiphanyJobsSource } from "./ThreadEpiphanyJobsSource";
|
||||
export type { ThreadEpiphanyJobsUpdatedNotification } from "./ThreadEpiphanyJobsUpdatedNotification";
|
||||
export type { ThreadEpiphanyJobsUpdatedSource } from "./ThreadEpiphanyJobsUpdatedSource";
|
||||
export type { ThreadEpiphanyPressure } from "./ThreadEpiphanyPressure";
|
||||
export type { ThreadEpiphanyPressureBasis } from "./ThreadEpiphanyPressureBasis";
|
||||
export type { ThreadEpiphanyPressureLevel } from "./ThreadEpiphanyPressureLevel";
|
||||
|
|
|
|||
|
|
@ -1126,6 +1126,8 @@ server_notification_definitions! {
|
|||
ConfigWarning => "configWarning" (v2::ConfigWarningNotification),
|
||||
#[experimental("thread/epiphany/stateUpdated")]
|
||||
ThreadEpiphanyStateUpdated => "thread/epiphany/stateUpdated" (v2::ThreadEpiphanyStateUpdatedNotification),
|
||||
#[experimental("thread/epiphany/jobsUpdated")]
|
||||
ThreadEpiphanyJobsUpdated => "thread/epiphany/jobsUpdated" (v2::ThreadEpiphanyJobsUpdatedNotification),
|
||||
FuzzyFileSearchSessionUpdated => "fuzzyFileSearch/sessionUpdated" (FuzzyFileSearchSessionUpdatedNotification),
|
||||
FuzzyFileSearchSessionCompleted => "fuzzyFileSearch/sessionCompleted" (FuzzyFileSearchSessionCompletedNotification),
|
||||
#[experimental("thread/realtime/started")]
|
||||
|
|
@ -2552,6 +2554,60 @@ mod tests {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_thread_epiphany_jobs_updated_notification() -> Result<()> {
|
||||
let notification = ServerNotification::ThreadEpiphanyJobsUpdated(
|
||||
v2::ThreadEpiphanyJobsUpdatedNotification {
|
||||
thread_id: "thr_123".to_string(),
|
||||
source: v2::ThreadEpiphanyJobsUpdatedSource::RuntimeProgress,
|
||||
state_revision: Some(7),
|
||||
jobs: vec![v2::ThreadEpiphanyJob {
|
||||
id: "specialist-work".to_string(),
|
||||
kind: v2::ThreadEpiphanyJobKind::Specialist,
|
||||
scope: "runtime-bound specialist work".to_string(),
|
||||
owner_role: "epiphany-harness".to_string(),
|
||||
status: v2::ThreadEpiphanyJobStatus::Running,
|
||||
runtime_agent_job_id: Some("job-123".to_string()),
|
||||
items_processed: Some(1),
|
||||
items_total: Some(3),
|
||||
progress_note: Some("Runtime agent job is running.".to_string()),
|
||||
last_checkpoint_at_unix_seconds: Some(1_744_500_123),
|
||||
blocking_reason: None,
|
||||
active_thread_ids: vec!["worker-thread".to_string()],
|
||||
linked_subgoal_ids: vec!["phase6".to_string()],
|
||||
linked_graph_node_ids: vec!["job-surface".to_string()],
|
||||
}],
|
||||
},
|
||||
);
|
||||
assert_eq!(
|
||||
json!({
|
||||
"method": "thread/epiphany/jobsUpdated",
|
||||
"params": {
|
||||
"threadId": "thr_123",
|
||||
"source": "runtimeProgress",
|
||||
"stateRevision": 7,
|
||||
"jobs": [{
|
||||
"id": "specialist-work",
|
||||
"kind": "specialist",
|
||||
"scope": "runtime-bound specialist work",
|
||||
"ownerRole": "epiphany-harness",
|
||||
"status": "running",
|
||||
"runtimeAgentJobId": "job-123",
|
||||
"itemsProcessed": 1,
|
||||
"itemsTotal": 3,
|
||||
"progressNote": "Runtime agent job is running.",
|
||||
"lastCheckpointAtUnixSeconds": 1744500123,
|
||||
"activeThreadIds": ["worker-thread"],
|
||||
"linkedSubgoalIds": ["phase6"],
|
||||
"linkedGraphNodeIds": ["job-surface"]
|
||||
}]
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(¬ification)?,
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_config_requirements_read() -> Result<()> {
|
||||
let request = ClientRequest::ConfigRequirementsRead {
|
||||
|
|
@ -3241,6 +3297,35 @@ mod tests {
|
|||
assert_eq!(reason, Some("thread/epiphany/stateUpdated"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_epiphany_jobs_updated_notification_is_marked_experimental() {
|
||||
let notification = ServerNotification::ThreadEpiphanyJobsUpdated(
|
||||
v2::ThreadEpiphanyJobsUpdatedNotification {
|
||||
thread_id: "thr_123".to_string(),
|
||||
source: v2::ThreadEpiphanyJobsUpdatedSource::RuntimeProgress,
|
||||
state_revision: Some(1),
|
||||
jobs: vec![v2::ThreadEpiphanyJob {
|
||||
id: "specialist-work".to_string(),
|
||||
kind: v2::ThreadEpiphanyJobKind::Specialist,
|
||||
scope: "runtime-bound specialist work".to_string(),
|
||||
owner_role: "epiphany-harness".to_string(),
|
||||
status: v2::ThreadEpiphanyJobStatus::Running,
|
||||
runtime_agent_job_id: Some("job-123".to_string()),
|
||||
items_processed: Some(1),
|
||||
items_total: Some(3),
|
||||
progress_note: Some("Runtime agent job is running.".to_string()),
|
||||
last_checkpoint_at_unix_seconds: Some(1_744_500_123),
|
||||
blocking_reason: None,
|
||||
active_thread_ids: vec!["worker-thread".to_string()],
|
||||
linked_subgoal_ids: vec!["phase6".to_string()],
|
||||
linked_graph_node_ids: vec!["job-surface".to_string()],
|
||||
}],
|
||||
},
|
||||
);
|
||||
let reason = crate::experimental_api::ExperimentalApi::experimental_reason(¬ification);
|
||||
assert_eq!(reason, Some("thread/epiphany/jobsUpdated"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_realtime_start_is_marked_experimental() {
|
||||
let request = ClientRequest::ThreadRealtimeStart {
|
||||
|
|
|
|||
|
|
@ -4800,6 +4800,26 @@ pub enum ThreadEpiphanyStateUpdatedField {
|
|||
Mode,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadEpiphanyJobsUpdatedNotification {
|
||||
pub thread_id: String,
|
||||
pub source: ThreadEpiphanyJobsUpdatedSource,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub state_revision: Option<u64>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub jobs: Vec<ThreadEpiphanyJob>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub enum ThreadEpiphanyJobsUpdatedSource {
|
||||
RuntimeProgress,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
|
|
|
|||
1
vendor/codex/codex-rs/app-server/README.md
vendored
1
vendor/codex/codex-rs/app-server/README.md
vendored
|
|
@ -146,6 +146,7 @@ Experimental Epiphany retrieval:
|
|||
- `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. Accepted responses include the landed `revision` and `changedFields`.
|
||||
- `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, returns `revision` plus `changedFields`, 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`, a `source` of `update` or `promote`, event-level `revision`, and typed `changedFields`; rejected promotions do not emit it.
|
||||
- `thread/epiphany/jobsUpdated` is an experimental server notification emitted from live `agent_job_progress:{json}` background events when a runtime `agent_jobs` owner is bound through durable `jobBindings` and the mapped bound-job payload actually changes. It carries the current `stateRevision` plus the changed bound job snapshots; it does not turn `thread/epiphany/jobs` into a writer or scheduler.
|
||||
- `thread/epiphany/freshness` is a read-only reflection surface for retrieval and graph staleness. It reports revision/source identity, retrieval freshness, graph freshness, and exact dirty-path pressure, and for loaded threads now also reports watcher-backed invalidation inputs with watched root, changed paths, mapped graph-node hits, and active-frontier hits. It still does not mutate state, schedule refresh work, or perform automatic watcher-driven semantic invalidation.
|
||||
- `thread/epiphany/reorient` is a read-only CRRC policy surface. It consumes the durable investigation checkpoint plus freshness, watcher, and pressure signals to return a bounded `resume` versus `regather` verdict with explicit checkpoint-path/frontier reasons. It does not mutate state, compact, notify, schedule, or silently continue work on the caller's behalf.
|
||||
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`.
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use crate::codex_message_processor::ApiVersion;
|
|||
use crate::codex_message_processor::read_rollout_items_from_rollout;
|
||||
use crate::codex_message_processor::read_summary_from_rollout;
|
||||
use crate::codex_message_processor::summary_to_thread;
|
||||
use crate::codex_message_processor::thread_epiphany_jobs_updated_notification_for_runtime_job;
|
||||
use crate::error_code::INTERNAL_ERROR_CODE;
|
||||
use crate::error_code::INVALID_REQUEST_ERROR_CODE;
|
||||
use crate::outgoing_message::ClientRequestResult;
|
||||
|
|
@ -77,6 +78,7 @@ use codex_app_server_protocol::ServerNotification;
|
|||
use codex_app_server_protocol::ServerRequestPayload;
|
||||
use codex_app_server_protocol::SkillsChangedNotification;
|
||||
use codex_app_server_protocol::TerminalInteractionNotification;
|
||||
use codex_app_server_protocol::ThreadEpiphanyJobsUpdatedNotification;
|
||||
use codex_app_server_protocol::ThreadItem;
|
||||
use codex_app_server_protocol::ThreadNameUpdatedNotification;
|
||||
use codex_app_server_protocol::ThreadRealtimeClosedNotification;
|
||||
|
|
@ -145,6 +147,7 @@ use codex_protocol::request_user_input::RequestUserInputResponse as CoreRequestU
|
|||
use codex_sandboxing::policy_transforms::intersect_permission_profiles;
|
||||
use codex_shell_command::parse_command::shlex_join;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
|
@ -167,6 +170,13 @@ struct CommandExecutionCompletionItem {
|
|||
command_actions: Vec<V2ParsedCommand>,
|
||||
}
|
||||
|
||||
const AGENT_JOB_PROGRESS_PREFIX: &str = "agent_job_progress:";
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct AgentJobProgressBackgroundEvent {
|
||||
job_id: String,
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) async fn apply_bespoke_event_handling(
|
||||
event: Event,
|
||||
|
|
@ -1974,6 +1984,18 @@ pub(crate) async fn apply_bespoke_event_handling(
|
|||
)
|
||||
.await;
|
||||
}
|
||||
EventMsg::BackgroundEvent(background_event) => {
|
||||
if let ApiVersion::V2 = api_version {
|
||||
maybe_emit_thread_epiphany_jobs_updated(
|
||||
conversation_id,
|
||||
&conversation,
|
||||
background_event.message.as_str(),
|
||||
&outgoing,
|
||||
&thread_state,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
EventMsg::ShutdownComplete => {
|
||||
thread_watch_manager
|
||||
.note_thread_shutdown(&conversation_id.to_string())
|
||||
|
|
@ -1984,6 +2006,55 @@ pub(crate) async fn apply_bespoke_event_handling(
|
|||
}
|
||||
}
|
||||
|
||||
async fn maybe_emit_thread_epiphany_jobs_updated(
|
||||
conversation_id: ThreadId,
|
||||
conversation: &Arc<CodexThread>,
|
||||
message: &str,
|
||||
outgoing: &ThreadScopedOutgoingMessageSender,
|
||||
thread_state: &Arc<Mutex<ThreadState>>,
|
||||
) {
|
||||
let Some(payload_json) = message.strip_prefix(AGENT_JOB_PROGRESS_PREFIX) else {
|
||||
return;
|
||||
};
|
||||
|
||||
let progress = match serde_json::from_str::<AgentJobProgressBackgroundEvent>(payload_json) {
|
||||
Ok(progress) => progress,
|
||||
Err(err) => {
|
||||
warn!(
|
||||
thread_id = %conversation_id,
|
||||
"failed to parse agent job progress background event: {err}"
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let Some(notification) = thread_epiphany_jobs_updated_notification_for_runtime_job(
|
||||
conversation_id,
|
||||
conversation.as_ref(),
|
||||
progress.job_id.as_str(),
|
||||
)
|
||||
.await
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
if !should_emit_thread_epiphany_jobs_updated(thread_state, ¬ification).await {
|
||||
return;
|
||||
}
|
||||
|
||||
outgoing
|
||||
.send_server_notification(ServerNotification::ThreadEpiphanyJobsUpdated(notification))
|
||||
.await;
|
||||
}
|
||||
|
||||
async fn should_emit_thread_epiphany_jobs_updated(
|
||||
thread_state: &Arc<Mutex<ThreadState>>,
|
||||
notification: &ThreadEpiphanyJobsUpdatedNotification,
|
||||
) -> bool {
|
||||
let mut thread_state = thread_state.lock().await;
|
||||
thread_state.record_epiphany_jobs_update(notification.jobs.as_slice())
|
||||
}
|
||||
|
||||
async fn handle_turn_diff(
|
||||
conversation_id: ThreadId,
|
||||
event_turn_id: &str,
|
||||
|
|
@ -4493,6 +4564,206 @@ mod tests {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn background_agent_job_progress_emits_epiphany_jobs_updated_once() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
let config = load_default_config_for_test(&codex_home).await;
|
||||
let thread_manager = Arc::new(
|
||||
codex_core::test_support::thread_manager_with_models_provider_and_home(
|
||||
CodexAuth::create_dummy_chatgpt_auth_for_testing(),
|
||||
config.model_provider.clone(),
|
||||
config.codex_home.to_path_buf(),
|
||||
Arc::new(codex_exec_server::EnvironmentManager::default_for_tests()),
|
||||
),
|
||||
);
|
||||
let codex_core::NewThread {
|
||||
thread_id: conversation_id,
|
||||
thread: conversation,
|
||||
..
|
||||
} = thread_manager.start_thread(config).await?;
|
||||
let state_db = conversation.state_db().expect("state db should exist");
|
||||
|
||||
state_db
|
||||
.create_agent_job(
|
||||
&codex_state::AgentJobCreateParams {
|
||||
id: "job-specialist".to_string(),
|
||||
name: "epiphany-specialist".to_string(),
|
||||
instruction: "Run the runtime-bound specialist smoke.".to_string(),
|
||||
auto_export: false,
|
||||
max_runtime_seconds: Some(60),
|
||||
output_schema_json: None,
|
||||
input_headers: vec!["row".to_string()],
|
||||
input_csv_path: "input.csv".to_string(),
|
||||
output_csv_path: "output.csv".to_string(),
|
||||
},
|
||||
&[
|
||||
codex_state::AgentJobItemCreateParams {
|
||||
item_id: "item-completed".to_string(),
|
||||
row_index: 0,
|
||||
source_id: Some("row-0".to_string()),
|
||||
row_json: json!({"row": 0}),
|
||||
},
|
||||
codex_state::AgentJobItemCreateParams {
|
||||
item_id: "item-running".to_string(),
|
||||
row_index: 1,
|
||||
source_id: Some("row-1".to_string()),
|
||||
row_json: json!({"row": 1}),
|
||||
},
|
||||
codex_state::AgentJobItemCreateParams {
|
||||
item_id: "item-pending".to_string(),
|
||||
row_index: 2,
|
||||
source_id: Some("row-2".to_string()),
|
||||
row_json: json!({"row": 2}),
|
||||
},
|
||||
],
|
||||
)
|
||||
.await?;
|
||||
state_db.mark_agent_job_running("job-specialist").await?;
|
||||
assert!(
|
||||
state_db
|
||||
.mark_agent_job_item_running_with_thread(
|
||||
"job-specialist",
|
||||
"item-completed",
|
||||
"worker-thread-completed",
|
||||
)
|
||||
.await?
|
||||
);
|
||||
assert!(
|
||||
state_db
|
||||
.report_agent_job_item_result(
|
||||
"job-specialist",
|
||||
"item-completed",
|
||||
"worker-thread-completed",
|
||||
&json!({"accepted": true}),
|
||||
)
|
||||
.await?
|
||||
);
|
||||
assert!(
|
||||
state_db
|
||||
.mark_agent_job_item_running_with_thread(
|
||||
"job-specialist",
|
||||
"item-running",
|
||||
"worker-thread-running",
|
||||
)
|
||||
.await?
|
||||
);
|
||||
|
||||
conversation
|
||||
.epiphany_update_state(codex_core::EpiphanyStateUpdate {
|
||||
expected_revision: Some(0),
|
||||
job_bindings: Some(vec![codex_protocol::protocol::EpiphanyJobBinding {
|
||||
id: "specialist-work".to_string(),
|
||||
kind: codex_protocol::protocol::EpiphanyJobKind::Specialist,
|
||||
scope: "runtime-bound specialist work".to_string(),
|
||||
owner_role: "epiphany-harness".to_string(),
|
||||
runtime_agent_job_id: Some("job-specialist".to_string()),
|
||||
linked_subgoal_ids: vec!["phase6-jobs".to_string()],
|
||||
linked_graph_node_ids: vec!["job-surface".to_string()],
|
||||
progress_note: Some("Bound to a real runtime specialist job.".to_string()),
|
||||
blocking_reason: None,
|
||||
}]),
|
||||
..Default::default()
|
||||
})
|
||||
.await?;
|
||||
|
||||
let thread_state = new_thread_state();
|
||||
let thread_watch_manager = ThreadWatchManager::new();
|
||||
let (tx, mut rx) = mpsc::channel(CHANNEL_CAPACITY);
|
||||
let outgoing = Arc::new(OutgoingMessageSender::new(tx));
|
||||
let outgoing = ThreadScopedOutgoingMessageSender::new(
|
||||
outgoing,
|
||||
vec![ConnectionId(1)],
|
||||
conversation_id,
|
||||
);
|
||||
let message = format!(
|
||||
"{AGENT_JOB_PROGRESS_PREFIX}{}",
|
||||
json!({
|
||||
"job_id": "job-specialist",
|
||||
"total_items": 3,
|
||||
"pending_items": 1,
|
||||
"running_items": 1,
|
||||
"completed_items": 1,
|
||||
"failed_items": 0,
|
||||
"eta_seconds": 42,
|
||||
})
|
||||
);
|
||||
|
||||
apply_bespoke_event_handling(
|
||||
Event {
|
||||
id: "turn-epiphany-jobs".to_string(),
|
||||
msg: EventMsg::BackgroundEvent(codex_protocol::protocol::BackgroundEventEvent {
|
||||
message: message.clone(),
|
||||
}),
|
||||
},
|
||||
conversation_id,
|
||||
conversation.clone(),
|
||||
thread_manager.clone(),
|
||||
None,
|
||||
outgoing.clone(),
|
||||
thread_state.clone(),
|
||||
thread_watch_manager.clone(),
|
||||
ApiVersion::V2,
|
||||
"test-provider".to_string(),
|
||||
codex_home.path(),
|
||||
)
|
||||
.await;
|
||||
|
||||
let first = recv_broadcast_message(&mut rx).await?;
|
||||
match first {
|
||||
OutgoingMessage::AppServerNotification(
|
||||
ServerNotification::ThreadEpiphanyJobsUpdated(payload),
|
||||
) => {
|
||||
assert_eq!(payload.thread_id, conversation_id.to_string());
|
||||
assert_eq!(
|
||||
payload.source,
|
||||
codex_app_server_protocol::ThreadEpiphanyJobsUpdatedSource::RuntimeProgress
|
||||
);
|
||||
assert_eq!(payload.state_revision, Some(1));
|
||||
assert_eq!(payload.jobs.len(), 1);
|
||||
let job = &payload.jobs[0];
|
||||
assert_eq!(job.id, "specialist-work");
|
||||
assert_eq!(
|
||||
job.status,
|
||||
codex_app_server_protocol::ThreadEpiphanyJobStatus::Running
|
||||
);
|
||||
assert_eq!(job.runtime_agent_job_id.as_deref(), Some("job-specialist"));
|
||||
assert_eq!(job.items_processed, Some(1));
|
||||
assert_eq!(job.items_total, Some(3));
|
||||
assert_eq!(
|
||||
job.active_thread_ids,
|
||||
vec!["worker-thread-running".to_string()]
|
||||
);
|
||||
}
|
||||
other => bail!("unexpected notification: {other:?}"),
|
||||
}
|
||||
|
||||
apply_bespoke_event_handling(
|
||||
Event {
|
||||
id: "turn-epiphany-jobs".to_string(),
|
||||
msg: EventMsg::BackgroundEvent(codex_protocol::protocol::BackgroundEventEvent {
|
||||
message,
|
||||
}),
|
||||
},
|
||||
conversation_id,
|
||||
conversation,
|
||||
thread_manager,
|
||||
None,
|
||||
outgoing,
|
||||
thread_state,
|
||||
thread_watch_manager,
|
||||
ApiVersion::V2,
|
||||
"test-provider".to_string(),
|
||||
codex_home.path(),
|
||||
)
|
||||
.await;
|
||||
|
||||
assert!(
|
||||
rx.try_recv().is_err(),
|
||||
"duplicate background progress should not emit unchanged jobsUpdated payloads"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_construct_mcp_tool_call_begin_notification_with_args() {
|
||||
let begin_event = McpToolCallBeginEvent {
|
||||
|
|
|
|||
|
|
@ -172,6 +172,8 @@ use codex_app_server_protocol::ThreadEpiphanyJobStatus;
|
|||
use codex_app_server_protocol::ThreadEpiphanyJobsParams;
|
||||
use codex_app_server_protocol::ThreadEpiphanyJobsResponse;
|
||||
use codex_app_server_protocol::ThreadEpiphanyJobsSource;
|
||||
use codex_app_server_protocol::ThreadEpiphanyJobsUpdatedNotification;
|
||||
use codex_app_server_protocol::ThreadEpiphanyJobsUpdatedSource;
|
||||
use codex_app_server_protocol::ThreadEpiphanyPressure;
|
||||
use codex_app_server_protocol::ThreadEpiphanyPressureBasis;
|
||||
use codex_app_server_protocol::ThreadEpiphanyPressureLevel;
|
||||
|
|
@ -11934,6 +11936,46 @@ struct EpiphanyAgentJobSnapshot {
|
|||
active_thread_ids: Vec<String>,
|
||||
}
|
||||
|
||||
pub(crate) async fn thread_epiphany_jobs_updated_notification_for_runtime_job(
|
||||
thread_id: ThreadId,
|
||||
thread: &CodexThread,
|
||||
runtime_agent_job_id: &str,
|
||||
) -> Option<ThreadEpiphanyJobsUpdatedNotification> {
|
||||
let state = thread.epiphany_state().await?;
|
||||
let binding_ids = state
|
||||
.job_bindings
|
||||
.iter()
|
||||
.filter(|binding| binding.runtime_agent_job_id.as_deref() == Some(runtime_agent_job_id))
|
||||
.map(|binding| binding.id.clone())
|
||||
.collect::<HashSet<_>>();
|
||||
if binding_ids.is_empty() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let state_db_ctx = thread.state_db()?;
|
||||
let retrieval_override = if state.retrieval.is_none() && binding_ids.contains("retrieval-index")
|
||||
{
|
||||
Some(thread.epiphany_retrieval_state().await)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let job_resolution = load_epiphany_agent_job_snapshots(Some(&state_db_ctx), Some(&state)).await;
|
||||
let jobs = map_epiphany_jobs(Some(&state), retrieval_override.as_ref(), &job_resolution)
|
||||
.into_iter()
|
||||
.filter(|job| binding_ids.contains(job.id.as_str()))
|
||||
.collect::<Vec<_>>();
|
||||
if jobs.is_empty() {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(ThreadEpiphanyJobsUpdatedNotification {
|
||||
thread_id: thread_id.to_string(),
|
||||
source: ThreadEpiphanyJobsUpdatedSource::RuntimeProgress,
|
||||
state_revision: Some(state.revision),
|
||||
jobs,
|
||||
})
|
||||
}
|
||||
|
||||
async fn load_epiphany_agent_job_snapshots(
|
||||
state_db_ctx: Option<&StateDbHandle>,
|
||||
state: Option<&EpiphanyThreadState>,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::outgoing_message::ConnectionId;
|
||||
use crate::outgoing_message::ConnectionRequestId;
|
||||
use codex_app_server_protocol::RequestId;
|
||||
use codex_app_server_protocol::ThreadEpiphanyJob;
|
||||
use codex_app_server_protocol::ThreadHistoryBuilder;
|
||||
use codex_app_server_protocol::Turn;
|
||||
use codex_app_server_protocol::TurnError;
|
||||
|
|
@ -64,6 +65,7 @@ pub(crate) struct ThreadState {
|
|||
pub(crate) listener_generation: u64,
|
||||
listener_command_tx: Option<mpsc::UnboundedSender<ThreadListenerCommand>>,
|
||||
current_turn_history: ThreadHistoryBuilder,
|
||||
last_epiphany_jobs_by_job_id: HashMap<String, ThreadEpiphanyJob>,
|
||||
listener_thread: Option<Weak<CodexThread>>,
|
||||
}
|
||||
|
||||
|
|
@ -96,6 +98,7 @@ impl ThreadState {
|
|||
}
|
||||
self.listener_command_tx = None;
|
||||
self.current_turn_history.reset();
|
||||
self.last_epiphany_jobs_by_job_id.clear();
|
||||
self.listener_thread = None;
|
||||
}
|
||||
|
||||
|
|
@ -124,6 +127,18 @@ impl ThreadState {
|
|||
self.current_turn_history.reset();
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn record_epiphany_jobs_update(&mut self, jobs: &[ThreadEpiphanyJob]) -> bool {
|
||||
let mut changed = false;
|
||||
for job in jobs {
|
||||
if self.last_epiphany_jobs_by_job_id.get(job.id.as_str()) != Some(job) {
|
||||
changed = true;
|
||||
self.last_epiphany_jobs_by_job_id
|
||||
.insert(job.id.clone(), job.clone());
|
||||
}
|
||||
}
|
||||
changed
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) async fn resolve_server_request_on_thread_listener(
|
||||
|
|
|
|||
Reference in a new issue