Keep CRRC recommendations core-shaped

This commit is contained in:
Meta Vens 2026-05-19 21:58:29 +01:00
commit 12453e609a
5 changed files with 32 additions and 32 deletions

View file

@ -87,8 +87,8 @@ pub fn map_epiphany_crrc_recommendation(
checkpoint_present: bool,
finding_present: bool,
finding_accepted: bool,
) -> ThreadEpiphanyCrrcRecommendation {
map_core_crrc_recommendation(recommend_crrc_action(EpiphanyCrrcInput {
) -> CoreEpiphanyCrrcRecommendation {
recommend_crrc_action(EpiphanyCrrcInput {
loaded,
state_status: map_core_crrc_state_status(state_status),
should_prepare_compaction: pressure.should_prepare_compaction,
@ -97,7 +97,7 @@ pub fn map_epiphany_crrc_recommendation(
checkpoint_present,
finding_present,
finding_accepted,
}))
})
}
fn map_core_crrc_state_status(
@ -158,7 +158,7 @@ fn map_protocol_coordinator_source_signals(
pressure_level: map_protocol_pressure_level(signals.pressure_level),
should_prepare_compaction: signals.should_prepare_compaction,
reorient_action: map_protocol_reorient_action(signals.reorient_action),
crrc_action: map_core_crrc_action(signals.crrc_action),
crrc_action: map_protocol_crrc_action(signals.crrc_action),
modeling_result_status: map_protocol_coordinator_role_result_status(
signals.modeling_result_status,
),
@ -224,7 +224,7 @@ fn map_protocol_crrc_result_status(
}
}
fn map_core_crrc_action(action: CoreEpiphanyCrrcAction) -> ThreadEpiphanyCrrcAction {
pub fn map_protocol_crrc_action(action: CoreEpiphanyCrrcAction) -> ThreadEpiphanyCrrcAction {
match action {
CoreEpiphanyCrrcAction::Continue => ThreadEpiphanyCrrcAction::Continue,
CoreEpiphanyCrrcAction::PrepareCheckpoint => ThreadEpiphanyCrrcAction::PrepareCheckpoint,
@ -254,11 +254,11 @@ fn map_core_crrc_scene_action(action: CoreEpiphanyCrrcSceneAction) -> ThreadEpip
}
}
fn map_core_crrc_recommendation(
pub fn map_protocol_crrc_recommendation(
recommendation: CoreEpiphanyCrrcRecommendation,
) -> ThreadEpiphanyCrrcRecommendation {
ThreadEpiphanyCrrcRecommendation {
action: map_core_crrc_action(recommendation.action),
action: map_protocol_crrc_action(recommendation.action),
recommended_scene_action: recommendation
.recommended_scene_action
.map(map_core_crrc_scene_action),
@ -293,7 +293,7 @@ pub async fn derive_epiphany_coordinator_status(
runtime_store_path: Option<&Path>,
state_status: ThreadEpiphanyReorientStateStatus,
pressure: &epiphany_core::EpiphanyPressure,
recommendation: &ThreadEpiphanyCrrcRecommendation,
recommendation: &CoreEpiphanyCrrcRecommendation,
roles: Vec<ThreadEpiphanyRoleLane>,
reorient_decision: Option<&ThreadEpiphanyReorientDecision>,
reorient_result_status: ThreadEpiphanyReorientResultStatus,
@ -378,7 +378,7 @@ pub async fn derive_epiphany_coordinator_status(
.map(|decision| decision.action)
.map(map_core_reorient_action_from_protocol)
.unwrap_or(CoreEpiphanyReorientAction::Resume),
crrc_action: map_core_crrc_action_from_protocol(recommendation.action),
crrc_action: recommendation.action,
modeling_result_status: map_core_coordinator_role_result_status(modeling_result_status),
verification_result_status: map_core_coordinator_role_result_status(
verification_result_status,
@ -404,7 +404,7 @@ pub async fn derive_epiphany_coordinator_status(
reorient_finding_accepted,
);
let note = render_epiphany_coordinator_note(
recommendation.action,
map_protocol_crrc_action(recommendation.action),
map_protocol_pressure_level(pressure.level),
modeling_result_status,
verification_result_status,
@ -615,7 +615,7 @@ pub fn map_epiphany_coordinator(
state_status: ThreadEpiphanyReorientStateStatus,
checkpoint_present: bool,
pressure: &epiphany_core::EpiphanyPressure,
recommendation: &ThreadEpiphanyCrrcRecommendation,
recommendation: &CoreEpiphanyCrrcRecommendation,
roles: &[ThreadEpiphanyRoleLane],
signals: &EpiphanyCoordinatorSourceSignals,
modeling_result_accepted: bool,
@ -633,7 +633,12 @@ pub fn map_epiphany_coordinator(
state_status: map_core_crrc_state_status(state_status),
checkpoint_present,
should_prepare_compaction: pressure.should_prepare_compaction,
recommendation: map_core_coordinator_crrc_recommendation(recommendation),
recommendation: EpiphanyCoordinatorCrrcRecommendation {
action: recommendation.action,
recommended_scene_action: recommendation
.recommended_scene_action
.map(epiphany_core::crrc_scene_action_to_coordinator_scene_action),
},
roles: roles.iter().map(map_core_coordinator_role_lane).collect(),
signals: EpiphanyCoordinatorSignals {
modeling_result_status: signals.modeling_result_status,
@ -652,17 +657,6 @@ pub fn map_epiphany_coordinator(
})
}
fn map_core_coordinator_crrc_recommendation(
recommendation: &ThreadEpiphanyCrrcRecommendation,
) -> EpiphanyCoordinatorCrrcRecommendation {
EpiphanyCoordinatorCrrcRecommendation {
action: map_core_crrc_action_from_protocol(recommendation.action),
recommended_scene_action: recommendation
.recommended_scene_action
.map(map_core_coordinator_scene_action_from_protocol),
}
}
fn map_core_crrc_action_from_protocol(action: ThreadEpiphanyCrrcAction) -> CoreEpiphanyCrrcAction {
match action {
ThreadEpiphanyCrrcAction::Continue => CoreEpiphanyCrrcAction::Continue,
@ -1094,7 +1088,7 @@ pub fn map_epiphany_roles(
jobs: &[ThreadEpiphanyJob],
decision: &ThreadEpiphanyReorientDecision,
pressure: &ThreadEpiphanyPressure,
recommendation: &ThreadEpiphanyCrrcRecommendation,
recommendation: &CoreEpiphanyCrrcRecommendation,
result_status: ThreadEpiphanyReorientResultStatus,
reorient_job: Option<&ThreadEpiphanyJob>,
) -> Vec<ThreadEpiphanyRoleLane> {
@ -1130,10 +1124,10 @@ pub fn map_epiphany_roles(
}),
reorient_next_action: decision.next_action.clone(),
jobs: source_jobs.iter().map(map_core_role_board_job).collect(),
crrc_action: map_core_crrc_action_from_protocol(recommendation.action),
crrc_action: recommendation.action,
crrc_recommended_scene_action: recommendation
.recommended_scene_action
.map(map_core_coordinator_scene_action_from_protocol),
.map(epiphany_core::crrc_scene_action_to_coordinator_scene_action),
crrc_reason: recommendation.reason.clone(),
reorient_decision_action: format!("{:?}", decision.action),
pressure_level: format!("{:?}", pressure.level),

View file

@ -19,6 +19,8 @@ use crate::coordinator::epiphany_reorient_finding_already_accepted;
use crate::coordinator::map_epiphany_coordinator_view;
use crate::coordinator::map_epiphany_crrc_recommendation;
use crate::coordinator::map_epiphany_roles;
use crate::coordinator::map_protocol_crrc_action;
use crate::coordinator::map_protocol_crrc_recommendation;
use crate::coordinator::render_epiphany_roles_note;
use crate::cultnet::EpiphanyFreshnessSurface;
use crate::cultnet::EpiphanySurfaceSource;
@ -320,7 +322,7 @@ pub async fn map_epiphany_view_response(
reorient_state_status,
recommendation
.as_ref()
.map(|recommendation| recommendation.action)
.map(|recommendation| map_protocol_crrc_action(recommendation.action))
.unwrap_or(ThreadEpiphanyCrrcAction::Continue),
),
roles,
@ -369,6 +371,8 @@ pub async fn map_epiphany_view_response(
let pressure = pressure.clone()?;
let decision = reorient_decision.clone()?;
let recommendation = recommendation.clone()?;
let protocol_recommendation =
map_protocol_crrc_recommendation(recommendation.clone());
let available_actions = derive_scene(EpiphanySceneInput {
state,
loaded,
@ -393,7 +397,7 @@ pub async fn map_epiphany_view_response(
state_revision,
pressure,
decision,
recommendation,
recommendation: protocol_recommendation,
reorient_binding_id: EPIPHANY_REORIENT_LAUNCH_BINDING_ID.to_string(),
reorient_result_status,
reorient_job: reorient_job.clone(),

View file

@ -48,7 +48,7 @@ remembers doctrine; the branch remembers the blade.
- `epiphany-codex-bridge` no longer depends on vendored `codex-core` at all. Retrieval takes workspace/Codex-home paths, invalidation owns a native `notify` watcher, runtime-result acceptance takes typed state plus runtime-store path, live rollout/thread reads moved into app-server `epiphany_thread_host`, and mutation policy depends on the small `EpiphanyMutationHost` trait implemented by app-server's `EpiphanyCodexThreadHost` wrapper. The bridge owns Epiphany law; vendored app-server owns CodexThread access.
- `epiphany-codex-bridge` also no longer depends on `codex-protocol`. Bridge durable-state imports point at `epiphany-state-model`, token pressure takes native `EpiphanyTokenUsageSnapshot`, app-server maps Codex token telemetry at the host wall, Codex token usage rollout replay lives in `codex_message_processor/token_usage_replay.rs`, and bridge errors are `EpiphanyBridgeError`. The only remaining vendored bridge dependencies are app-server protocol DTOs and absolute path validation.
- The first bridge JSON-RPC starvation cuts are landed. Freshness now returns a serializable `EpiphanyFreshnessSurface`, job launch/interrupt mutation results carry typed `EpiphanyJobView` plus separate host-edge launcher/backend ids, reorient/pre-compaction decisions consume typed `EpiphanyPressure`, reorient policy consumes typed freshness directly, and reorient launch documents/results use typed core reorient decisions/status before app-server projects them into legacy JSON-RPC DTOs. Continue by cutting the full view/coordinator board into typed surfaces, not by inventing adapters with nicer uniforms.
- Coordinator decision/status is less contaminated now: `epiphany-codex-bridge` stores coordinator decisions and source signals as core-shaped types, core CRRC/coordinator surfaces serialize natively, and `ThreadEpiphany*` projection happens at the legacy view emission boundary. Keep cutting remaining role-board/result/reorient inputs until Aquarium/CultNet can read coordinator surfaces without JSON-RPC DTO authority.
- Coordinator decision/status is less contaminated now: `epiphany-codex-bridge` stores coordinator decisions, source signals, and CRRC recommendations as core-shaped types, core CRRC/coordinator surfaces serialize natively, and `ThreadEpiphany*` projection happens at the legacy view emission boundary. Keep cutting remaining role-board/result/reorient inputs until Aquarium/CultNet can read coordinator surfaces without JSON-RPC DTO authority.
- 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

@ -311,8 +311,10 @@ current_status:
reorient launch documents are built from typed core decisions, reorient
launch mutation results return typed decision/state-status values from the
bridge, and core reorient decisions are serializable CultNet-ready state.
App-server still projects those typed surfaces into `ThreadEpiphany*`
responses at the legacy JSON-RPC edge. The bridge still
Coordinator decisions, coordinator source signals, and CRRC recommendations
now remain core-shaped inside the bridge; app-server still projects those
typed surfaces into `ThreadEpiphany*` responses at the legacy JSON-RPC
edge. 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 view/coordinator/reorient DTO coupling: 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.
next_action: Continue Codex starvation and CultNet liberation by cutting bridge-internal `ThreadEpiphany*` authority. Prioritize role-board/result/reorient 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.