Keep acceptance service results core-shaped

This commit is contained in:
Meta Vens 2026-05-20 02:26:04 +01:00
commit f2113379e0
6 changed files with 25 additions and 21 deletions

View file

@ -19,7 +19,7 @@ use crate::results::map_core_role_result_role_id;
pub struct RoleAcceptanceUpdate {
pub state_update: EpiphanyStateUpdate,
pub applied_patch: ThreadEpiphanyUpdatePatch,
pub applied_patch: EpiphanyRoleStatePatchDocument,
pub changed_fields: Vec<ThreadEpiphanyStateUpdatedField>,
pub accepted_receipt_id: String,
pub accepted_observation_id: String,
@ -218,8 +218,9 @@ pub fn build_role_acceptance_update(
core_patch
.acceptance_receipts
.push(acceptance_bundle.receipt);
let applied_patch = protocol_patch_from_core(core_patch.clone());
let changed_fields = epiphany_update_patch_changed_fields(&applied_patch);
let applied_patch = core_patch.clone();
let changed_fields =
epiphany_update_patch_changed_fields(&protocol_patch_from_core(applied_patch.clone()));
let state_update = state_update_from_core_patch(expected_revision, core_patch);
Ok(RoleAcceptanceUpdate {

View file

@ -3,9 +3,7 @@ use chrono::Utc;
use std::path::Path;
use std::path::PathBuf;
use codex_app_server_protocol::ThreadEpiphanyReorientFinding;
use codex_app_server_protocol::ThreadEpiphanyReorientSource;
use codex_app_server_protocol::ThreadEpiphanyRoleFinding;
use codex_app_server_protocol::ThreadEpiphanyRoleId;
use codex_app_server_protocol::ThreadEpiphanyStateUpdatedField;
use codex_app_server_protocol::ThreadEpiphanyUpdatePatch;
@ -16,7 +14,10 @@ use epiphany_core::EpiphanyJobLaunchResult;
use epiphany_core::EpiphanyJobView;
use epiphany_core::EpiphanyPromotionInput;
use epiphany_core::EpiphanyReorientDecision;
use epiphany_core::EpiphanyReorientFindingInterpretation;
use epiphany_core::EpiphanyReorientStateStatus;
use epiphany_core::EpiphanyRoleFindingInterpretation;
use epiphany_core::EpiphanyRoleStatePatchDocument;
use epiphany_core::EpiphanyStateUpdate;
use epiphany_core::EpiphanyTokenUsageSnapshot;
use epiphany_core::RuntimeSpineHeartbeatJobOptions;
@ -54,8 +55,6 @@ use crate::pressure::derive_epiphany_pressure;
use crate::reorient::EpiphanyFreshnessWatcherSnapshot;
use crate::reorient::derive_epiphany_freshness_view;
use crate::reorient::derive_epiphany_reorient;
use crate::results::map_protocol_reorient_finding;
use crate::results::map_protocol_role_finding;
use crate::runtime_results::load_completed_core_epiphany_reorient_finding;
use crate::runtime_results::load_completed_core_epiphany_role_finding;
use uuid::Uuid;
@ -96,8 +95,8 @@ pub struct EpiphanyRoleAcceptApplied {
pub accepted_receipt_id: String,
pub accepted_observation_id: String,
pub accepted_evidence_id: String,
pub applied_patch: ThreadEpiphanyUpdatePatch,
pub finding: ThreadEpiphanyRoleFinding,
pub applied_patch: EpiphanyRoleStatePatchDocument,
pub finding: EpiphanyRoleFindingInterpretation,
}
#[derive(Debug, Clone)]
@ -108,7 +107,7 @@ pub struct EpiphanyReorientAcceptApplied {
pub accepted_receipt_id: String,
pub accepted_observation_id: String,
pub accepted_evidence_id: String,
pub finding: ThreadEpiphanyReorientFinding,
pub finding: EpiphanyReorientFindingInterpretation,
}
#[derive(Debug, Clone)]
@ -418,7 +417,7 @@ pub async fn apply_thread_epiphany_role_accept(
accepted_observation_id,
accepted_evidence_id,
applied_patch,
finding: map_protocol_role_finding(role_id, finding),
finding,
})
}
@ -477,7 +476,7 @@ pub async fn apply_thread_epiphany_reorient_accept(
accepted_receipt_id,
accepted_observation_id,
accepted_evidence_id,
finding: map_protocol_reorient_finding(finding),
finding,
})
}

View file

@ -59,6 +59,7 @@ remembers doctrine; the branch remembers the blade.
- Role-board derivation consumes core `EpiphanyPressure` directly now; `ThreadEpiphanyPressure` is only response projection.
- Job reflection is now core-shaped inside the bridge. `map_epiphany_jobs` returns typed `EpiphanyJobView`, role-board/view/result assembly consumes that typed job surface, and `ThreadEpiphanyJob` is projected only when building legacy JSON-RPC response structs.
- Context and graph-query derivation now receive core `EpiphanyContextParams` / `EpiphanyGraphQuery` documents. The bridge converts `ThreadEpiphanyContextParams` / `ThreadEpiphanyGraphQuery` before invoking core policy, so Codex JSON-RPC request DTOs no longer define the internal graph question.
- Role/reorient acceptance service results now carry core typed findings, and role acceptance carries a typed `EpiphanyRoleStatePatchDocument` for the applied patch. App-server mutation routes project those into `ThreadEpiphany*Finding` / `ThreadEpiphanyUpdatePatch` only for legacy accept responses.
- 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

@ -334,7 +334,9 @@ current_status:
projected only at legacy response edges. Context and graph-query derivation
now receive core `EpiphanyContextParams` / `EpiphanyGraphQuery` documents;
Codex `ThreadEpiphany*` request DTOs are converted before the core graph
policy is invoked. The bridge still depends on vendored Codex for
app-server protocol DTOs and absolute path validation, so the purification
is not done.
policy is invoked. Role/reorient acceptance service results now return core
finding interpretations and typed role-state patches; app-server projects
them into legacy accept-response DTOs. 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

@ -19,6 +19,7 @@ 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::mutation::epiphany_state_updated_notification;
use epiphany_codex_bridge::mutation::protocol_patch_from_core;
use epiphany_codex_bridge::mutation_service::EpiphanyThreadPromoteApplied;
use epiphany_codex_bridge::mutation_service::apply_thread_epiphany_promote;
use epiphany_codex_bridge::mutation_service::apply_thread_epiphany_reorient_accept;
@ -28,6 +29,8 @@ use epiphany_codex_bridge::mutation_service::interrupt_thread_epiphany_job;
use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_job;
use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_reorient;
use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_role;
use epiphany_codex_bridge::results::map_protocol_reorient_finding;
use epiphany_codex_bridge::results::map_protocol_role_finding;
use epiphany_codex_bridge::retrieve::epiphany_retrieval_state_for_paths;
use epiphany_codex_bridge::retrieve::index_epiphany_retrieval_for_paths;
use std::sync::Arc;
@ -221,8 +224,8 @@ impl CodexMessageProcessor {
accepted_receipt_id: applied.accepted_receipt_id,
accepted_observation_id: applied.accepted_observation_id,
accepted_evidence_id: applied.accepted_evidence_id,
applied_patch: applied.applied_patch,
finding: applied.finding,
applied_patch: protocol_patch_from_core(applied.applied_patch),
finding: map_protocol_role_finding(role_id, applied.finding),
},
)
.await;
@ -392,7 +395,7 @@ impl CodexMessageProcessor {
accepted_receipt_id: applied.accepted_receipt_id,
accepted_observation_id: applied.accepted_observation_id,
accepted_evidence_id: applied.accepted_evidence_id,
finding: applied.finding,
finding: map_protocol_reorient_finding(applied.finding),
},
)
.await;
@ -852,9 +855,7 @@ fn thread_epiphany_reorient_watcher_status(
}
}
fn thread_epiphany_reorient_reason(
reason: EpiphanyReorientReason,
) -> ThreadEpiphanyReorientReason {
fn thread_epiphany_reorient_reason(reason: EpiphanyReorientReason) -> ThreadEpiphanyReorientReason {
match reason {
EpiphanyReorientReason::MissingState => ThreadEpiphanyReorientReason::MissingState,
EpiphanyReorientReason::MissingCheckpoint => {