Move Epiphany state update projection to bridge
This commit is contained in:
parent
9fcf2004e6
commit
1a469e88e9
5 changed files with 41 additions and 67 deletions
|
|
@ -5,6 +5,7 @@ use codex_app_server_protocol::ThreadEpiphanyRoleFinding;
|
|||
use codex_app_server_protocol::ThreadEpiphanyRoleId;
|
||||
use codex_app_server_protocol::ThreadEpiphanyStateUpdatedField;
|
||||
use codex_app_server_protocol::ThreadEpiphanyUpdatePatch;
|
||||
use codex_core::EpiphanyStateUpdate;
|
||||
use codex_protocol::protocol::EpiphanyCodeRef;
|
||||
use codex_protocol::protocol::EpiphanyInvestigationCheckpoint;
|
||||
use codex_protocol::protocol::EpiphanyInvestigationDisposition;
|
||||
|
|
@ -76,6 +77,32 @@ pub fn core_state_patch_from_protocol(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn state_update_from_thread_patch(
|
||||
expected_revision: Option<u64>,
|
||||
patch: ThreadEpiphanyUpdatePatch,
|
||||
) -> EpiphanyStateUpdate {
|
||||
EpiphanyStateUpdate {
|
||||
expected_revision,
|
||||
objective: patch.objective,
|
||||
active_subgoal_id: patch.active_subgoal_id,
|
||||
subgoals: patch.subgoals,
|
||||
invariants: patch.invariants,
|
||||
graphs: patch.graphs,
|
||||
graph_frontier: patch.graph_frontier,
|
||||
graph_checkpoint: patch.graph_checkpoint,
|
||||
scratch: patch.scratch,
|
||||
investigation_checkpoint: patch.investigation_checkpoint,
|
||||
job_bindings: patch.job_bindings,
|
||||
acceptance_receipts: patch.acceptance_receipts,
|
||||
runtime_links: patch.runtime_links,
|
||||
observations: patch.observations,
|
||||
evidence: patch.evidence,
|
||||
churn: patch.churn,
|
||||
mode: patch.mode,
|
||||
planning: patch.planning,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn imagination_role_accept_patch_errors(patch: &ThreadEpiphanyUpdatePatch) -> Vec<String> {
|
||||
imagination_role_state_patch_policy_errors(&core_state_patch_from_protocol(patch))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -523,15 +523,18 @@ accept delegates scratch/checkpoint/evidence bundle construction the same way.
|
|||
`epiphany_mutation_routes.rs` is about 1,143 lines. The route still performs
|
||||
Codex thread lookup, revisioned state writes, and JSON-RPC responses, but no
|
||||
longer owns the acceptance document contract.
|
||||
The twenty-sixth cut moved protocol `ThreadEpiphanyUpdatePatch` to core
|
||||
`EpiphanyStateUpdate` projection into `epiphany-codex-bridge/src/mutation.rs`.
|
||||
Role accept, promote, and update routes no longer hand-copy every patch field
|
||||
into a core update struct. `epiphany_mutation_routes.rs` is about 1,087 lines.
|
||||
|
||||
Also: MCP itself is allowed to be JSON. The target is not "replace MCP JSON";
|
||||
the target is an Epiphany-owned boundary that speaks typed Epiphany
|
||||
intent/result/receipt documents internally and normal MCP JSON-RPC externally.
|
||||
|
||||
Continue with the actual whale-carcass cut: carve remaining route-level mutation
|
||||
orchestration into explicit typed bridge/service calls, starting with generic
|
||||
update/promote patch-to-state-update construction and launch response/
|
||||
notification shaping. Success is a
|
||||
orchestration into explicit typed bridge/service calls, starting with launch
|
||||
response/notification shaping and interrupt result projection. Success is a
|
||||
visibly smaller processor and less mutation authority in Codex, not merely
|
||||
nicer payload names or another adapter reliquary. Do not resume Rider, Unity,
|
||||
Aquarium, Face, dogfood, planning, app, skill, marketplace, or bridge expansion
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -278,5 +278,5 @@ rejected_paths:
|
|||
reason: making Epiphany cleaner inside Codex still preserves the wrong organ; Codex must be starved down to OpenAI subscription auth/model transport, while Epiphany data and subsystem communication move to typed CultCache/CultNet.
|
||||
|
||||
current_status:
|
||||
summary: The Codex starvation pass has five typing receipts, seventeen processor cuts, and now a real physical extraction: `epiphany-codex-bridge` lives outside `vendor/codex` and owns the Codex-facing Epiphany adapters for scene, jobs, context/planning/graph query, retrieval, result projection, runtime-spine result adaptation, launch/prompt doctrine, mutation document mechanics, live-state projection, pressure/pre-compaction rendering, freshness/reorientation projection, CRRC/coordinator/role-board projection, and acceptance/evidence signal helpers. Vendored app-server now retains only `epiphany_invalidation.rs` as a root Epiphany module because watcher lifecycle is still app-server machinery; `codex_message_processor.rs` still contains route dispatch and mutation orchestration. The processor is about 10,339 lines, `epiphany_mutation_routes.rs` is about 1,143 lines, and `epiphany_state_helpers.rs` is down to a 19-line rollout-state loader after moving typed mutation helpers, reviewability checks, completed runtime-result acceptance loading, live-state projection, launched-job fallback projection, and role/reorient acceptance update bundle construction out to the bridge. This is progress, not absolution: the bridge is still Codex-facing compatibility, not the final CultNet runtime, and route-level launch/update/promote/interrupt orchestration still lives inside the Codex processor. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON.
|
||||
next_action: Continue Codex starvation by carving remaining route-level mutation orchestration into explicit outside-vendor service calls, starting with generic update/promote patch-to-state-update construction and launch response/notification shaping. Do not resume app/skill/marketplace expansion.
|
||||
summary: The Codex starvation pass has five typing receipts, seventeen processor cuts, and now a real physical extraction: `epiphany-codex-bridge` lives outside `vendor/codex` and owns the Codex-facing Epiphany adapters for scene, jobs, context/planning/graph query, retrieval, result projection, runtime-spine result adaptation, launch/prompt doctrine, mutation document mechanics, live-state projection, pressure/pre-compaction rendering, freshness/reorientation projection, CRRC/coordinator/role-board projection, and acceptance/evidence signal helpers. Vendored app-server now retains only `epiphany_invalidation.rs` as a root Epiphany module because watcher lifecycle is still app-server machinery; `codex_message_processor.rs` still contains route dispatch and mutation orchestration. The processor is about 10,339 lines, `epiphany_mutation_routes.rs` is about 1,087 lines, and `epiphany_state_helpers.rs` is down to a 19-line rollout-state loader after moving typed mutation helpers, reviewability checks, completed runtime-result acceptance loading, live-state projection, launched-job fallback projection, role/reorient acceptance update bundle construction, and protocol patch-to-core state-update projection out to the bridge. This is progress, not absolution: the bridge is still Codex-facing compatibility, not the final CultNet runtime, and route-level launch/update/promote/interrupt orchestration still lives inside the Codex processor. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON.
|
||||
next_action: Continue Codex starvation by carving remaining route-level mutation orchestration into explicit outside-vendor service calls, starting with launch response/notification shaping and interrupt result projection. Do not resume app/skill/marketplace expansion.
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ use epiphany_codex_bridge::mutation::build_role_acceptance_update;
|
|||
use epiphany_codex_bridge::mutation::epiphany_job_launch_changed_fields;
|
||||
use epiphany_codex_bridge::mutation::epiphany_promote_changed_fields;
|
||||
use epiphany_codex_bridge::mutation::epiphany_update_patch_changed_fields;
|
||||
use epiphany_codex_bridge::mutation::state_update_from_thread_patch;
|
||||
use epiphany_codex_bridge::mutation::thread_epiphany_patch_has_state_replacements;
|
||||
use epiphany_codex_bridge::pressure::map_epiphany_pressure;
|
||||
use epiphany_codex_bridge::reorient::map_epiphany_freshness;
|
||||
|
|
@ -266,26 +267,7 @@ impl CodexMessageProcessor {
|
|||
let applied_patch = patch.clone();
|
||||
|
||||
let epiphany_state = match loaded_thread
|
||||
.epiphany_update_state(EpiphanyStateUpdate {
|
||||
expected_revision,
|
||||
objective: patch.objective,
|
||||
active_subgoal_id: patch.active_subgoal_id,
|
||||
subgoals: patch.subgoals,
|
||||
invariants: patch.invariants,
|
||||
graphs: patch.graphs,
|
||||
graph_frontier: patch.graph_frontier,
|
||||
graph_checkpoint: patch.graph_checkpoint,
|
||||
scratch: patch.scratch,
|
||||
investigation_checkpoint: patch.investigation_checkpoint,
|
||||
job_bindings: patch.job_bindings,
|
||||
acceptance_receipts: patch.acceptance_receipts,
|
||||
runtime_links: patch.runtime_links,
|
||||
observations: patch.observations,
|
||||
evidence: patch.evidence,
|
||||
churn: patch.churn,
|
||||
mode: patch.mode,
|
||||
planning: patch.planning,
|
||||
})
|
||||
.epiphany_update_state(state_update_from_thread_patch(expected_revision, patch))
|
||||
.await
|
||||
{
|
||||
Ok(state) => {
|
||||
|
|
@ -782,28 +764,9 @@ impl CodexMessageProcessor {
|
|||
}
|
||||
|
||||
let changed_fields = epiphany_promote_changed_fields(&patch);
|
||||
let mut evidence = patch.evidence;
|
||||
evidence.push(verifier_evidence);
|
||||
let update = EpiphanyStateUpdate {
|
||||
expected_revision,
|
||||
objective: patch.objective,
|
||||
active_subgoal_id: patch.active_subgoal_id,
|
||||
subgoals: patch.subgoals,
|
||||
invariants: patch.invariants,
|
||||
graphs: patch.graphs,
|
||||
graph_frontier: patch.graph_frontier,
|
||||
graph_checkpoint: patch.graph_checkpoint,
|
||||
scratch: patch.scratch,
|
||||
investigation_checkpoint: patch.investigation_checkpoint,
|
||||
job_bindings: patch.job_bindings,
|
||||
acceptance_receipts: patch.acceptance_receipts,
|
||||
runtime_links: patch.runtime_links,
|
||||
observations: patch.observations,
|
||||
evidence,
|
||||
churn: patch.churn,
|
||||
mode: patch.mode,
|
||||
planning: patch.planning,
|
||||
};
|
||||
let mut patch = patch;
|
||||
patch.evidence.push(verifier_evidence);
|
||||
let update = state_update_from_thread_patch(expected_revision, patch);
|
||||
let epiphany_state = match thread.epiphany_update_state(update).await {
|
||||
Ok(epiphany_state) => epiphany_state,
|
||||
Err(CodexErr::InvalidRequest(message)) => {
|
||||
|
|
@ -876,26 +839,7 @@ impl CodexMessageProcessor {
|
|||
};
|
||||
|
||||
let changed_fields = epiphany_update_patch_changed_fields(&patch);
|
||||
let update = EpiphanyStateUpdate {
|
||||
expected_revision,
|
||||
objective: patch.objective,
|
||||
active_subgoal_id: patch.active_subgoal_id,
|
||||
subgoals: patch.subgoals,
|
||||
invariants: patch.invariants,
|
||||
graphs: patch.graphs,
|
||||
graph_frontier: patch.graph_frontier,
|
||||
graph_checkpoint: patch.graph_checkpoint,
|
||||
scratch: patch.scratch,
|
||||
investigation_checkpoint: patch.investigation_checkpoint,
|
||||
job_bindings: patch.job_bindings,
|
||||
acceptance_receipts: patch.acceptance_receipts,
|
||||
runtime_links: patch.runtime_links,
|
||||
observations: patch.observations,
|
||||
evidence: patch.evidence,
|
||||
churn: patch.churn,
|
||||
mode: patch.mode,
|
||||
planning: patch.planning,
|
||||
};
|
||||
let update = state_update_from_thread_patch(expected_revision, patch);
|
||||
let epiphany_state = match thread.epiphany_update_state(update).await {
|
||||
Ok(epiphany_state) => epiphany_state,
|
||||
Err(CodexErr::InvalidRequest(message)) => {
|
||||
|
|
|
|||
Reference in a new issue