Keep reorient launch source typed

This commit is contained in:
Meta Vens 2026-05-20 02:46:58 +01:00
commit 62ee3f370e
5 changed files with 18 additions and 7 deletions

View file

@ -3,7 +3,6 @@ use chrono::Utc;
use std::path::Path;
use std::path::PathBuf;
use codex_app_server_protocol::ThreadEpiphanyReorientSource;
use epiphany_core::EpiphanyJobInterruptRequest;
use epiphany_core::EpiphanyJobInterruptResult;
use epiphany_core::EpiphanyJobLaunchRequest;
@ -33,6 +32,7 @@ use epiphany_state_model::EpiphanyJobKind as CoreEpiphanyJobKind;
use epiphany_state_model::EpiphanyRetrievalState;
use epiphany_state_model::EpiphanyThreadState;
use crate::cultnet::EpiphanySurfaceSource;
use crate::error::EpiphanyBridgeError;
use crate::error::Result as BridgeResult;
use crate::jobs::derive_epiphany_jobs;
@ -132,7 +132,7 @@ pub struct EpiphanyJobInterruptApplied {
pub struct EpiphanyReorientLaunchApplied {
pub launcher_job_id: String,
pub backend_job_id: String,
pub source: ThreadEpiphanyReorientSource,
pub source: EpiphanySurfaceSource,
pub state_status: EpiphanyReorientStateStatus,
pub state_revision: Option<u64>,
pub decision: EpiphanyReorientDecision,
@ -631,7 +631,7 @@ pub async fn launch_thread_epiphany_reorient(
Ok(EpiphanyReorientLaunchApplied {
launcher_job_id: launched.launcher_job_id,
backend_job_id: launched.backend_job_id,
source: ThreadEpiphanyReorientSource::Live,
source: EpiphanySurfaceSource::Live,
state_status,
state_revision,
decision,

View file

@ -63,6 +63,7 @@ remembers doctrine; the branch remembers the blade.
- Generic update/promote service entry points now accept typed `EpiphanyRoleStatePatchDocument` patches. Vendored app-server converts `ThreadEpiphanyUpdatePatch` request cargo before invoking the bridge, so the mutation service no longer treats the JSON-RPC patch as its native write document.
- Changed-field authority is native now. `EpiphanyStateUpdatedField` lives in `epiphany-core`; bridge mutation results carry that typed enum, while app-server projects it into `ThreadEpiphanyStateUpdatedField` only for JSON-RPC responses and notifications.
- Role launch, role accept, and role-result runtime lookup now use core `EpiphanyRoleResultRoleId` inside the bridge. App-server maps `ThreadEpiphanyRoleId` at the JSON-RPC boundary and keeps it only for legacy request/response shape.
- Reorient launch service results now use typed `EpiphanySurfaceSource`; app-server projects it into `ThreadEpiphanyReorientSource` only for the legacy launch response.
- MCP remains JSON because MCP is a JSON protocol. The latest processor cut only moved MCP refresh/OAuth/status/resource/tool-call route handling into `codex_message_processor/mcp_routes.rs`, reducing the root processor to about 8,977 lines; it did not claim MCP payloads are CultNet or make MCP an Epiphany-owned runtime contract.
- Codex account auth route handling remains in vendored Codex but now lives in `codex_message_processor/auth_routes.rs`: API-key login, ChatGPT browser/device-code/external-token login, logout, auth status, account, rate limits, and add-credits nudge handling. This preserves Codex ownership of subscription auth while cutting the root processor to about 8,094 lines.
- One-off command execution and command stream write/resize/terminate route handling now live in `codex_message_processor/command_routes.rs`; `CommandExecManager` remains the lifecycle owner, while the root processor is about 7,800 lines.

Binary file not shown.

View file

@ -344,7 +344,9 @@ current_status:
`ThreadEpiphanyStateUpdatedField` only for legacy responses and
notifications. Role launch, role accept, and role-result runtime lookup now
use core `EpiphanyRoleResultRoleId` internally; app-server maps
`ThreadEpiphanyRoleId` at the request/response edge. The bridge still
depends on vendored Codex for app-server protocol DTOs and absolute path
validation, so the purification is not done.
`ThreadEpiphanyRoleId` at the request/response edge. Reorient launch
service results now use typed `EpiphanySurfaceSource`; app-server maps that
to `ThreadEpiphanyReorientSource` only for the legacy response. The bridge
still depends on vendored Codex for app-server protocol DTOs and absolute
path validation, so the purification is not done.
next_action: Continue Codex starvation and CultNet liberation by cutting bridge-internal `ThreadEpiphany*` authority. Prioritize role-result/reorient-result DTO coupling next: derive typed CultNet surfaces first, push JSON-RPC projection into app-server, and keep MCP/OpenAI JSON only at their true protocol/text edges. Do not add compatibility adapters unless they protect a named ownership invariant.

View file

@ -14,6 +14,7 @@ use epiphany_codex_bridge::cultnet::EpiphanyReorientPressureLevel;
use epiphany_codex_bridge::cultnet::EpiphanyReorientReason;
use epiphany_codex_bridge::cultnet::EpiphanyReorientStateStatus;
use epiphany_codex_bridge::cultnet::EpiphanyStateUpdatedField;
use epiphany_codex_bridge::cultnet::EpiphanySurfaceSource;
use epiphany_codex_bridge::error::EpiphanyBridgeError;
use epiphany_codex_bridge::invalidation::epiphany_freshness_watcher_snapshot;
use epiphany_codex_bridge::launch::EPIPHANY_REORIENT_LAUNCH_BINDING_ID;
@ -327,7 +328,7 @@ impl CodexMessageProcessor {
request_id,
ThreadEpiphanyReorientLaunchResponse {
thread_id: thread_uuid.to_string(),
source: applied.source,
source: thread_epiphany_reorient_source(applied.source),
state_status: thread_epiphany_reorient_state_status(applied.state_status),
state_revision: applied.state_revision,
decision: thread_epiphany_reorient_decision(applied.decision),
@ -800,6 +801,13 @@ fn thread_epiphany_reorient_state_status(
}
}
fn thread_epiphany_reorient_source(source: EpiphanySurfaceSource) -> ThreadEpiphanyReorientSource {
match source {
EpiphanySurfaceSource::Stored => ThreadEpiphanyReorientSource::Stored,
EpiphanySurfaceSource::Live => ThreadEpiphanyReorientSource::Live,
}
}
fn thread_epiphany_reorient_decision(
decision: EpiphanyReorientDecision,
) -> ThreadEpiphanyReorientDecision {