Route app server Epiphany policy through bridge

This commit is contained in:
Meta Vens 2026-05-19 10:26:15 +01:00
commit 824c005524
9 changed files with 51 additions and 14 deletions

View file

@ -590,6 +590,36 @@ pub fn map_core_worker_launch_document(
}
}
pub fn build_epiphany_job_launch_request(
expected_revision: Option<u64>,
binding_id: String,
kind: CoreEpiphanyJobKind,
scope: String,
owner_role: String,
authority_scope: String,
linked_subgoal_ids: Vec<String>,
linked_graph_node_ids: Vec<String>,
instruction: String,
launch_document: ThreadEpiphanyWorkerLaunchDocument,
output_contract_id: String,
max_runtime_seconds: Option<u64>,
) -> EpiphanyJobLaunchRequest {
EpiphanyJobLaunchRequest {
expected_revision,
binding_id,
kind,
scope,
owner_role,
authority_scope,
linked_subgoal_ids,
linked_graph_node_ids,
instruction,
launch_document: map_core_worker_launch_document(launch_document),
output_contract_id,
max_runtime_seconds,
}
}
fn map_core_role_worker_launch_document(
document: ThreadEpiphanyRoleWorkerLaunchDocument,
) -> EpiphanyRoleWorkerLaunchDocument {

View file

@ -7,11 +7,13 @@ use codex_app_server_protocol::ThreadEpiphanyRetrieveShardSummary;
use codex_core::CodexThread;
use codex_protocol::protocol::EpiphanyRetrievalState;
use codex_utils_absolute_path::AbsolutePathBuf;
use std::path::PathBuf;
use epiphany_core::EpiphanyRetrieveQuery;
use epiphany_core::EpiphanyRetrieveResponse as CoreEpiphanyRetrieveResponse;
use epiphany_core::EpiphanyRetrieveResult as CoreEpiphanyRetrieveResult;
use epiphany_core::EpiphanyRetrieveResultKind as CoreEpiphanyRetrieveResultKind;
use epiphany_core::index_workspace;
use epiphany_core::normalize_epiphany_retrieve_query;
use epiphany_core::retrieval_state_for_workspace;
use epiphany_core::retrieve_workspace;
@ -39,6 +41,14 @@ pub async fn index_thread_epiphany_retrieval(
Ok(ThreadEpiphanyIndexResponse { index_summary })
}
pub fn normalize_thread_epiphany_retrieve_query(
query: String,
limit: Option<u32>,
path_prefixes: Vec<PathBuf>,
) -> Result<EpiphanyRetrieveQuery, String> {
normalize_epiphany_retrieve_query(query, limit, path_prefixes).map_err(str::to_string)
}
pub async fn thread_epiphany_retrieval_state(thread: &CodexThread) -> EpiphanyRetrievalState {
let config = thread.config_snapshot().await;
let workspace_root = config.cwd.to_path_buf();

View file

@ -659,9 +659,10 @@ The Codex-core re-export husks for `epiphany_distillation`, `epiphany_promotion`
`epiphany_proposal`, and `epiphany_retrieval` have also been deleted. The
`epiphany_rollout` husk is gone too; `codex-core::lib` keeps only the one
host-boundary function that passes Codex's turn-boundary predicate into
`epiphany-core`. `codex-core` no longer depends on `epiphany-core` at all:
`CodexThread` exposes host persistence/path facts, while `epiphany-codex-bridge`
calls native retrieval/indexing and state-update policy.
`epiphany-core`. Vendored `codex-core` and `codex-app-server` no longer depend
directly on `epiphany-core`: `CodexThread` exposes host persistence/path facts,
while `epiphany-codex-bridge` calls native retrieval/indexing, state-update
policy, and launch request construction.
The runtime-spine job-opening mechanism for heartbeat/specialist launches has
also been pulled into `epiphany-core` as `open_runtime_spine_heartbeat_job`.

Binary file not shown.

View file

@ -116,7 +116,7 @@ accepted_design:
- Qdrant is the preferred persistent semantic backend; BM25 remains the bootstrap/fallback/control path.
- `notes/epiphany-memory-graph-unified-plan.md` applies the mapped-fractal-domain/cache lesson to Epiphany and corrects the organ boundary: repo architecture/dataflow and agent memory are profiles over one `EpiphanyMemoryGraph`, not separate graph engines. The first native skeleton is landed: `epiphany-state-model` owns the public document vocabulary, `epiphany-core::memory_graph` owns stable ids/validation/freshness/context cuts/CultCache persistence, and `epiphany-memory-graph` exposes status/validate/context/smoke without Qdrant. `notes/repo-fractal-dataflow-cache-plan.md` and `notes/agent-memory-fractal-cache-plan.md` are profile plans beneath that substrate. If deleting Qdrant deletes understanding, the design is wrong; the fallback must be slower but still correct typed graph traversal.
- `epiphany-state-model` owns the deterministic prompt-state renderer beside the typed `EpiphanyThreadState` document it serializes. `epiphany-core` re-exports that renderer for compatibility and owns rollout replay helpers, retrieval/indexing, distillation, proposal, promotion policy, scene projection, freshness derivation, pressure derivation, job/progress view derivation, planning view derivation, reorientation resume/regather verdict policy, pure CRRC recommendation policy, fixed-lane coordinator decision policy, role-board projection policy, and role-result interpretation/self-persistence review policy where possible.
- Vendored Codex keeps the thin typed host seam: protocol types, thread bridges, app-server protocol, request routing, watcher lifecycle, notifications, rollout integration, and host persistence facts such as current Epiphany state, reference turn id, workspace root, Codex home, and runtime store path. `codex-core` must not import `epiphany-core`; Epiphany update law, retrieval/indexing, and heartbeat launch/interrupt policy belong in `epiphany-codex-bridge` / `epiphany-core`.
- Vendored Codex keeps the thin typed host seam: protocol types, thread bridges, app-server protocol, request routing, watcher lifecycle, notifications, rollout integration, and host persistence facts such as current Epiphany state, reference turn id, workspace root, Codex home, and runtime store path. Vendored `codex-core` and `codex-app-server` must not import `epiphany-core` directly; Epiphany update law, retrieval/indexing, launch request construction, and heartbeat launch/interrupt policy belong in `epiphany-codex-bridge` / `epiphany-core`.
- The current algorithmic map is the source-grounded description of live control flow.
- Compact-Rehydrate-Reorient-Continue is an architecture primitive; automatic runtime coordination is not landed yet.
- Context pressure must become an explicit runtime signal for automatic CRRC; inference from transcript vibes, user warnings, or shrinking safe scope is useful only as a temporary human/agent heuristic.

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

@ -1913,7 +1913,6 @@ dependencies = [
"constant_time_eq 0.3.1",
"core_test_support",
"epiphany-codex-bridge",
"epiphany-core",
"futures",
"gethostname",
"hmac 0.12.1",

View file

@ -60,7 +60,6 @@ codex-utils-absolute-path = { workspace = true }
codex-utils-json-to-toml = { workspace = true }
codex-utils-rustls-provider = { workspace = true }
chrono = { workspace = true }
epiphany-core = { path = "../../../../epiphany-core" }
epiphany-codex-bridge = { path = "../../../../epiphany-codex-bridge" }
clap = { workspace = true, features = ["derive"] }
constant_time_eq = { workspace = true }

View file

@ -5,8 +5,8 @@ use codex_protocol::error::CodexErr;
use codex_protocol::protocol::EpiphanyThreadState;
use epiphany_codex_bridge::invalidation::epiphany_freshness_watcher_snapshot;
use epiphany_codex_bridge::launch::EPIPHANY_REORIENT_LAUNCH_BINDING_ID;
use epiphany_codex_bridge::launch::build_epiphany_job_launch_request;
use epiphany_codex_bridge::launch::epiphany_role_binding_id;
use epiphany_codex_bridge::launch::map_core_worker_launch_document;
use epiphany_codex_bridge::mutation::epiphany_state_updated_notification;
use epiphany_codex_bridge::mutation_service::EpiphanyThreadPromoteApplied;
use epiphany_codex_bridge::mutation_service::apply_thread_epiphany_promote;
@ -19,7 +19,6 @@ use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_reorient;
use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_role;
use epiphany_codex_bridge::retrieve::index_thread_epiphany_retrieval;
use epiphany_codex_bridge::retrieve::thread_epiphany_retrieval_state;
use epiphany_core::EpiphanyJobLaunchRequest;
use std::sync::Arc;
use super::CodexMessageProcessor;
@ -570,12 +569,11 @@ impl CodexMessageProcessor {
None => return,
};
let launch_document = map_core_worker_launch_document(launch_document);
let applied = match launch_thread_epiphany_job(
thread.as_ref(),
EpiphanyJobLaunchRequest {
build_epiphany_job_launch_request(
expected_revision,
binding_id: binding_id.clone(),
binding_id.clone(),
kind,
scope,
owner_role,
@ -586,7 +584,7 @@ impl CodexMessageProcessor {
launch_document,
output_contract_id,
max_runtime_seconds,
},
),
kind,
"missing launched job projection",
)

View file

@ -4,6 +4,7 @@ use epiphany_codex_bridge::invalidation::epiphany_freshness_watcher_snapshot;
use epiphany_codex_bridge::launch::EPIPHANY_REORIENT_LAUNCH_BINDING_ID;
use epiphany_codex_bridge::launch::epiphany_role_binding_id;
use epiphany_codex_bridge::retrieve::map_epiphany_retrieve_response;
use epiphany_codex_bridge::retrieve::normalize_thread_epiphany_retrieve_query;
use epiphany_codex_bridge::retrieve::retrieve_thread_epiphany;
use epiphany_codex_bridge::retrieve::thread_epiphany_retrieval_state;
use epiphany_codex_bridge::view::EpiphanyFreshnessResponseInput;
@ -23,7 +24,6 @@ use epiphany_codex_bridge::view::map_epiphany_propose_response;
use epiphany_codex_bridge::view::map_epiphany_reorient_result_response;
use epiphany_codex_bridge::view::map_epiphany_role_result_response;
use epiphany_codex_bridge::view::map_epiphany_view_response;
use epiphany_core::normalize_epiphany_retrieve_query;
use super::CodexMessageProcessor;
use super::ConnectionRequestId;
@ -419,7 +419,7 @@ impl CodexMessageProcessor {
}
};
let query = match normalize_epiphany_retrieve_query(query, limit, path_prefixes) {
let query = match normalize_thread_epiphany_retrieve_query(query, limit, path_prefixes) {
Ok(query) => query,
Err(message) => {
self.send_invalid_request_error(request_id, message.to_string())