Quarantine Epiphany route dispatch

This commit is contained in:
Meta Vens 2026-05-18 11:20:56 +01:00
commit 34a8607309
5 changed files with 110 additions and 74 deletions

View file

@ -78,7 +78,7 @@ remembers doctrine; the branch remembers the blade.
- Heartbeat durable document/schema types now live in `epiphany-core/src/heartbeat_state/heartbeat_documents.rs`, role/default construction lives in `epiphany-core/src/heartbeat_state/heartbeat_roles.rs`, persistence/validation lives in `epiphany-core/src/heartbeat_state/heartbeat_store.rs`, and status/artifact JSON projection lives in `epiphany-core/src/heartbeat_state/heartbeat_projection.rs`. The root `heartbeat_state.rs` keeps scheduling and Void cognition orchestration for the next cuts. Focused heartbeat tests and `epiphany-core` check pass after the splits.
- Heartbeat role/default and store seams now have module-local unit tests: fixed lane catalog, Ghostlight scene role projection, and typed state/cognition CultCache round-trip. Keep future heartbeat cuts aligned to those seam tests instead of growing root integration-only coverage.
- Heartbeat adaptive pacing now lives in `epiphany-core/src/heartbeat_state/heartbeat_pacing.rs`, including running-turn count and effective cooldown multipliers. It has a module-local unit test for pending-turn counting; root scheduling calls the pacing seam instead of owning pressure/concurrency math directly.
- Thread projection now lives in `codex_message_processor/thread_projection.rs`: state-db/thread-store/rollout summary projection, `ConversationSummary` to API `Thread` mapping, thread-title attachment helpers, turn pagination, and rollout turn reconstruction. `codex_message_processor.rs` is about 1,009 lines after this extraction and mostly owns JSON-RPC dispatch, processor construction, shared thread lookup/submit/error helpers, and lifecycle shutdown.
- Thread projection now lives in `codex_message_processor/thread_projection.rs`: state-db/thread-store/rollout summary projection, `ConversationSummary` to API `Thread` mapping, thread-title attachment helpers, turn pagination, and rollout turn reconstruction. `codex_message_processor.rs` is about 954 lines after extraction and the Epiphany dispatch gate; it mostly owns JSON-RPC dispatch, processor construction, shared thread lookup/submit/error helpers, and lifecycle shutdown. Epiphany route enumeration lives in `codex_message_processor/epiphany_dispatch.rs`, not the root Codex dispatcher.
- Turn paging/reconstruction now lives in `codex_message_processor/thread_turn_projection.rs`; `thread_projection.rs` keeps state-db/thread-store/rollout summary projection and `ConversationSummary` to API `Thread` mapping. Focused `thread_turns_list` cursor tests and stale in-progress turn interruption coverage pass.
- The `thread/turns/list` route handler now lives in `codex_message_processor/thread_turn_routes.rs`, beside the turn projection helpers it consumes. `thread_read_routes.rs` is back to persisted/live thread listing, `thread/read`, loaded-thread listing, and summary reads.
- Listener/subscription lifecycle now lives in `codex_message_processor/listener_lifecycle.rs`: connection attach/detach, listener startup, idle unload, unsubscribe, teardown, archive preparation, listener task context, idle-unload state, shutdown result handling, and listener command routing.

Binary file not shown.

File diff suppressed because one or more lines are too long

View file

@ -2,6 +2,7 @@ mod auth_routes;
mod catalog_routes;
mod command_routes;
mod epiphany_automation;
mod epiphany_dispatch;
mod epiphany_mutation_routes;
mod epiphany_read_routes;
mod listener_lifecycle;
@ -545,6 +546,13 @@ impl CodexMessageProcessor {
app_server_client_version: Option<String>,
request_context: RequestContext,
) {
let request = match self
.maybe_handle_epiphany_request(connection_id, request)
.await
{
Some(request) => request,
None => return,
};
let to_connection_request_id = |request_id| ConnectionRequestId {
connection_id,
request_id,
@ -636,78 +644,6 @@ impl CodexMessageProcessor {
self.thread_read(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyView { request_id, params } => {
self.thread_epiphany_view(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyRoleLaunch { request_id, params } => {
self.thread_epiphany_role_launch(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyRoleResult { request_id, params } => {
self.thread_epiphany_role_result(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyRoleAccept { request_id, params } => {
self.thread_epiphany_role_accept(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyFreshness { request_id, params } => {
self.thread_epiphany_freshness(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyContext { request_id, params } => {
self.thread_epiphany_context(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyGraphQuery { request_id, params } => {
self.thread_epiphany_graph_query(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyReorientLaunch { request_id, params } => {
self.thread_epiphany_reorient_launch(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyReorientResult { request_id, params } => {
self.thread_epiphany_reorient_result(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyReorientAccept { request_id, params } => {
self.thread_epiphany_reorient_accept(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyIndex { request_id, params } => {
self.thread_epiphany_index(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyDistill { request_id, params } => {
self.thread_epiphany_distill(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyPropose { request_id, params } => {
self.thread_epiphany_propose(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyPromote { request_id, params } => {
self.thread_epiphany_promote(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyJobLaunch { request_id, params } => {
self.thread_epiphany_job_launch(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyJobInterrupt { request_id, params } => {
self.thread_epiphany_job_interrupt(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyUpdate { request_id, params } => {
self.thread_epiphany_update(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyRetrieve { request_id, params } => {
self.thread_epiphany_retrieve(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadTurnsList { request_id, params } => {
self.thread_turns_list(to_connection_request_id(request_id), params)
.await;
@ -921,6 +857,7 @@ impl CodexMessageProcessor {
self.upload_feedback(to_connection_request_id(request_id), params)
.await;
}
_ => unreachable!("Epiphany requests are handled before the Codex dispatcher"),
}
}

View file

@ -0,0 +1,96 @@
use codex_app_server_protocol::ClientRequest;
use super::CodexMessageProcessor;
use super::ConnectionId;
use super::ConnectionRequestId;
impl CodexMessageProcessor {
pub(super) async fn maybe_handle_epiphany_request(
&self,
connection_id: ConnectionId,
request: ClientRequest,
) -> Option<ClientRequest> {
let to_connection_request_id = |request_id| ConnectionRequestId {
connection_id,
request_id,
};
match request {
ClientRequest::ThreadEpiphanyView { request_id, params } => {
self.thread_epiphany_view(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyRoleLaunch { request_id, params } => {
self.thread_epiphany_role_launch(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyRoleResult { request_id, params } => {
self.thread_epiphany_role_result(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyRoleAccept { request_id, params } => {
self.thread_epiphany_role_accept(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyFreshness { request_id, params } => {
self.thread_epiphany_freshness(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyContext { request_id, params } => {
self.thread_epiphany_context(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyGraphQuery { request_id, params } => {
self.thread_epiphany_graph_query(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyReorientLaunch { request_id, params } => {
self.thread_epiphany_reorient_launch(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyReorientResult { request_id, params } => {
self.thread_epiphany_reorient_result(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyReorientAccept { request_id, params } => {
self.thread_epiphany_reorient_accept(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyIndex { request_id, params } => {
self.thread_epiphany_index(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyDistill { request_id, params } => {
self.thread_epiphany_distill(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyPropose { request_id, params } => {
self.thread_epiphany_propose(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyPromote { request_id, params } => {
self.thread_epiphany_promote(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyJobLaunch { request_id, params } => {
self.thread_epiphany_job_launch(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyJobInterrupt { request_id, params } => {
self.thread_epiphany_job_interrupt(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyUpdate { request_id, params } => {
self.thread_epiphany_update(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadEpiphanyRetrieve { request_id, params } => {
self.thread_epiphany_retrieve(to_connection_request_id(request_id), params)
.await;
}
other => return Some(other),
}
None
}
}