Move Epiphany invalidation into bridge

This commit is contained in:
Meta Vens 2026-05-13 12:30:24 +01:00
commit 9d2b8540f5
11 changed files with 23 additions and 16 deletions

View file

@ -21,5 +21,7 @@ epiphany-openai-adapter = { path = "../epiphany-openai-adapter" }
epiphany-openai-codex-spine = { path = "../epiphany-openai-codex-spine" }
serde_json = "1"
serde = { version = "1", features = ["derive"] }
tokio = { version = "1", features = ["rt", "sync"] }
toml = "0.9"
tracing = "0.1"
uuid = { version = "1", features = ["v4"] }

View file

@ -17,7 +17,7 @@ use tracing::warn;
const INVALIDATION_WATCH_DEBOUNCE: Duration = Duration::from_millis(200);
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct EpiphanyInvalidationSnapshot {
pub struct EpiphanyInvalidationSnapshot {
pub available: bool,
pub workspace_root: Option<AbsolutePathBuf>,
pub observed_at_unix_seconds: Option<i64>,
@ -25,7 +25,7 @@ pub(crate) struct EpiphanyInvalidationSnapshot {
}
#[derive(Clone)]
pub(crate) struct EpiphanyInvalidationManager {
pub struct EpiphanyInvalidationManager {
available: bool,
file_watcher: Arc<FileWatcher>,
state: Arc<AsyncMutex<HashMap<String, WatchEntry>>>,
@ -46,7 +46,7 @@ struct LatestInvalidation {
}
impl EpiphanyInvalidationManager {
pub(crate) fn new() -> Self {
pub fn new() -> Self {
match FileWatcher::new() {
Ok(file_watcher) => Self {
available: true,
@ -64,11 +64,7 @@ impl EpiphanyInvalidationManager {
}
}
pub(crate) async fn ensure_thread_watch(
&self,
thread_id: &str,
workspace_root: &AbsolutePathBuf,
) {
pub async fn ensure_thread_watch(&self, thread_id: &str, workspace_root: &AbsolutePathBuf) {
if !self.available {
return;
}
@ -135,7 +131,7 @@ impl EpiphanyInvalidationManager {
});
}
pub(crate) async fn snapshot(&self, thread_id: &str) -> EpiphanyInvalidationSnapshot {
pub async fn snapshot(&self, thread_id: &str) -> EpiphanyInvalidationSnapshot {
if !self.available {
return EpiphanyInvalidationSnapshot {
available: false,
@ -174,7 +170,7 @@ impl EpiphanyInvalidationManager {
}
}
pub(crate) async fn remove_thread(&self, thread_id: &str) {
pub async fn remove_thread(&self, thread_id: &str) {
let entry = self.state.lock().await.remove(thread_id);
if let Some(entry) = entry {
stop_watch_entry(entry).await;

View file

@ -1,5 +1,6 @@
pub mod context;
pub mod coordinator;
pub mod invalidation;
pub mod jobs;
pub mod launch;
pub mod mutation;

View file

@ -760,6 +760,13 @@ depends directly on `codex-chatgpt`, `codex-core-plugins`, or `codex-plugin`.
`codex_message_processor.rs` is still too large, but it is no longer carrying
the plugin marketplace altar in its chest cavity.
The watcher invalidation adapter has left the vendored app-server root too.
`epiphany-codex-bridge::invalidation` now owns `EpiphanyInvalidationManager`
and its snapshots around Codex's file watcher; app-server keeps only the
host-lifecycle calls that create, snapshot, and remove watches for loaded
threads. There is no longer a root `epiphany_invalidation.rs` module under
vendored app-server.
The Phase 6 freshness slice is landed. It exposes read-only
`thread/epiphany/freshness` from live retrieval summaries plus graph
frontier/churn state and, for loaded threads, watcher-backed invalidation

Binary file not shown.

File diff suppressed because one or more lines are too long

2
vendor/codex/codex-rs/Cargo.lock generated vendored
View file

@ -5230,7 +5230,9 @@ dependencies = [
"epiphany-openai-codex-spine",
"serde",
"serde_json",
"tokio",
"toml 0.9.11+spec-1.1.0",
"tracing",
"uuid",
]

View file

@ -4,7 +4,6 @@ use crate::codex_message_processor::maybe_run_epiphany_pre_compaction_checkpoint
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::epiphany_invalidation::EpiphanyInvalidationManager;
use crate::error_code::INTERNAL_ERROR_CODE;
use crate::error_code::INVALID_REQUEST_ERROR_CODE;
use crate::outgoing_message::ClientRequestResult;
@ -148,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 epiphany_codex_bridge::invalidation::EpiphanyInvalidationManager;
use std::collections::HashMap;
use std::path::Path;
use std::sync::Arc;

View file

@ -11,8 +11,6 @@ use crate::bespoke_event_handling::maybe_emit_hook_prompt_item_completed;
use crate::command_exec::CommandExecManager;
use crate::command_exec::StartCommandExecParams;
use crate::config_manager::ConfigManager;
use crate::epiphany_invalidation::EpiphanyInvalidationManager;
use crate::epiphany_invalidation::EpiphanyInvalidationSnapshot;
use crate::error_code::INPUT_TOO_LARGE_ERROR_CODE;
use crate::error_code::INTERNAL_ERROR_CODE;
use crate::error_code::INVALID_PARAMS_ERROR_CODE;
@ -327,6 +325,8 @@ use codex_thread_store::ThreadStoreError;
use codex_thread_store::UpdateThreadMetadataParams as StoreUpdateThreadMetadataParams;
use codex_utils_absolute_path::AbsolutePathBuf;
use codex_utils_pty::DEFAULT_OUTPUT_BYTES_CAP;
use epiphany_codex_bridge::invalidation::EpiphanyInvalidationManager;
use epiphany_codex_bridge::invalidation::EpiphanyInvalidationSnapshot;
use epiphany_codex_bridge::reorient::EpiphanyFreshnessWatcherSnapshot;
use epiphany_codex_bridge::state::live_thread_epiphany_state;
use std::collections::HashMap;

View file

@ -16,6 +16,7 @@ use epiphany_codex_bridge::coordinator::epiphany_reorient_finding_already_accept
use epiphany_codex_bridge::coordinator::map_epiphany_crrc_recommendation;
use epiphany_codex_bridge::coordinator::map_epiphany_roles;
use epiphany_codex_bridge::coordinator::select_epiphany_coordinator_automation_action;
use epiphany_codex_bridge::invalidation::EpiphanyInvalidationManager;
use epiphany_codex_bridge::jobs::map_epiphany_jobs;
use epiphany_codex_bridge::launch::EPIPHANY_REORIENT_LAUNCH_BINDING_ID;
use epiphany_codex_bridge::launch::build_epiphany_reorient_launch_request;
@ -31,7 +32,6 @@ use tokio::sync::Mutex;
use tracing::warn;
use super::epiphany_freshness_watcher_snapshot;
use crate::epiphany_invalidation::EpiphanyInvalidationManager;
use crate::outgoing_message::ThreadScopedOutgoingMessageSender;
use crate::thread_state::ThreadState;

View file

@ -74,7 +74,6 @@ mod config_manager;
mod config_manager_service;
mod device_key_api;
mod dynamic_tools;
mod epiphany_invalidation;
mod error_code;
mod filters;
mod fs_api;