Keep update patches typed in mutation service
This commit is contained in:
parent
f2113379e0
commit
01d6a55b14
6 changed files with 45 additions and 32 deletions
|
|
@ -305,7 +305,9 @@ pub fn epiphany_job_launch_changed_fields() -> Vec<ThreadEpiphanyStateUpdatedFie
|
|||
]
|
||||
}
|
||||
|
||||
pub fn thread_epiphany_patch_has_state_replacements(patch: &ThreadEpiphanyUpdatePatch) -> bool {
|
||||
pub fn thread_epiphany_patch_has_state_replacements(
|
||||
patch: &EpiphanyRoleStatePatchDocument,
|
||||
) -> bool {
|
||||
patch.objective.is_some()
|
||||
|| patch.active_subgoal_id.is_some()
|
||||
|| patch.subgoals.is_some()
|
||||
|
|
@ -382,9 +384,9 @@ pub fn epiphany_update_patch_changed_fields(
|
|||
}
|
||||
|
||||
pub fn epiphany_promote_changed_fields(
|
||||
patch: &ThreadEpiphanyUpdatePatch,
|
||||
patch: &EpiphanyRoleStatePatchDocument,
|
||||
) -> Vec<ThreadEpiphanyStateUpdatedField> {
|
||||
let mut fields = epiphany_update_patch_changed_fields(patch);
|
||||
let mut fields = epiphany_update_patch_changed_fields(&protocol_patch_from_core(patch.clone()));
|
||||
if !fields.contains(&ThreadEpiphanyStateUpdatedField::Evidence) {
|
||||
fields.push(ThreadEpiphanyStateUpdatedField::Evidence);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ use std::path::PathBuf;
|
|||
use codex_app_server_protocol::ThreadEpiphanyReorientSource;
|
||||
use codex_app_server_protocol::ThreadEpiphanyRoleId;
|
||||
use codex_app_server_protocol::ThreadEpiphanyStateUpdatedField;
|
||||
use codex_app_server_protocol::ThreadEpiphanyUpdatePatch;
|
||||
use epiphany_core::EpiphanyJobInterruptRequest;
|
||||
use epiphany_core::EpiphanyJobInterruptResult;
|
||||
use epiphany_core::EpiphanyJobLaunchRequest;
|
||||
|
|
@ -49,7 +48,6 @@ use crate::mutation::build_role_acceptance_update;
|
|||
use crate::mutation::epiphany_job_launch_changed_fields;
|
||||
use crate::mutation::epiphany_promote_changed_fields;
|
||||
use crate::mutation::epiphany_update_patch_changed_fields;
|
||||
use crate::mutation::state_update_from_thread_patch;
|
||||
use crate::mutation::thread_epiphany_patch_has_state_replacements;
|
||||
use crate::pressure::derive_epiphany_pressure;
|
||||
use crate::reorient::EpiphanyFreshnessWatcherSnapshot;
|
||||
|
|
@ -313,10 +311,12 @@ pub async fn interrupt_epiphany_job_on_thread(
|
|||
pub async fn apply_thread_epiphany_update(
|
||||
thread: &impl EpiphanyMutationHost,
|
||||
expected_revision: Option<u64>,
|
||||
patch: ThreadEpiphanyUpdatePatch,
|
||||
patch: EpiphanyRoleStatePatchDocument,
|
||||
) -> BridgeResult<EpiphanyThreadUpdateApplied> {
|
||||
let changed_fields = epiphany_update_patch_changed_fields(&patch);
|
||||
let update = state_update_from_thread_patch(expected_revision, patch);
|
||||
let changed_fields = epiphany_update_patch_changed_fields(
|
||||
&crate::mutation::protocol_patch_from_core(patch.clone()),
|
||||
);
|
||||
let update = crate::mutation::state_update_from_core_patch(expected_revision, patch);
|
||||
let epiphany_state = apply_epiphany_state_update_to_thread(thread, update).await?;
|
||||
let epiphany_state = thread.client_visible_epiphany_state(epiphany_state).await;
|
||||
Ok(EpiphanyThreadUpdateApplied {
|
||||
|
|
@ -329,7 +329,7 @@ pub async fn apply_thread_epiphany_update(
|
|||
pub async fn apply_thread_epiphany_promote(
|
||||
thread: &impl EpiphanyMutationHost,
|
||||
expected_revision: Option<u64>,
|
||||
patch: ThreadEpiphanyUpdatePatch,
|
||||
patch: EpiphanyRoleStatePatchDocument,
|
||||
verifier_evidence: EpiphanyEvidenceRecord,
|
||||
) -> BridgeResult<EpiphanyThreadPromoteApplied> {
|
||||
let decision = evaluate_promotion(EpiphanyPromotionInput {
|
||||
|
|
@ -355,7 +355,7 @@ pub async fn apply_thread_epiphany_promote(
|
|||
let changed_fields = epiphany_promote_changed_fields(&patch);
|
||||
let mut patch = patch;
|
||||
patch.evidence.push(verifier_evidence);
|
||||
let update = state_update_from_thread_patch(expected_revision, patch);
|
||||
let update = crate::mutation::state_update_from_core_patch(expected_revision, patch);
|
||||
let epiphany_state = apply_epiphany_state_update_to_thread(thread, update).await?;
|
||||
let epiphany_state = thread.client_visible_epiphany_state(epiphany_state).await;
|
||||
Ok(EpiphanyThreadPromoteApplied::Accepted(
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ remembers doctrine; the branch remembers the blade.
|
|||
- 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.
|
||||
- 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.
|
||||
- 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.
|
|
@ -336,7 +336,9 @@ current_status:
|
|||
Codex `ThreadEpiphany*` request DTOs are converted before the core graph
|
||||
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.
|
||||
them into legacy accept-response DTOs. Generic update/promote service entry
|
||||
points now take typed `EpiphanyRoleStatePatchDocument` documents; app-server
|
||||
converts `ThreadEpiphanyUpdatePatch` request cargo at the 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 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.
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use epiphany_codex_bridge::invalidation::epiphany_freshness_watcher_snapshot;
|
|||
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::core_state_patch_from_protocol;
|
||||
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;
|
||||
|
|
@ -464,24 +465,29 @@ impl CodexMessageProcessor {
|
|||
};
|
||||
|
||||
let host = EpiphanyCodexThreadHost::new(thread.as_ref());
|
||||
let applied =
|
||||
match apply_thread_epiphany_promote(&host, expected_revision, patch, verifier_evidence)
|
||||
.await
|
||||
{
|
||||
Ok(applied) => applied,
|
||||
Err(EpiphanyBridgeError::InvalidRequest(message)) => {
|
||||
self.send_invalid_request_error(request_id, message).await;
|
||||
return;
|
||||
}
|
||||
Err(err) => {
|
||||
self.send_internal_error(
|
||||
request_id,
|
||||
format!("failed to promote Epiphany state update: {err}"),
|
||||
)
|
||||
.await;
|
||||
return;
|
||||
}
|
||||
};
|
||||
let core_patch = core_state_patch_from_protocol(&patch);
|
||||
let applied = match apply_thread_epiphany_promote(
|
||||
&host,
|
||||
expected_revision,
|
||||
core_patch,
|
||||
verifier_evidence,
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(applied) => applied,
|
||||
Err(EpiphanyBridgeError::InvalidRequest(message)) => {
|
||||
self.send_invalid_request_error(request_id, message).await;
|
||||
return;
|
||||
}
|
||||
Err(err) => {
|
||||
self.send_internal_error(
|
||||
request_id,
|
||||
format!("failed to promote Epiphany state update: {err}"),
|
||||
)
|
||||
.await;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let applied = match applied {
|
||||
EpiphanyThreadPromoteApplied::Accepted(applied) => applied,
|
||||
|
|
@ -538,7 +544,9 @@ impl CodexMessageProcessor {
|
|||
};
|
||||
|
||||
let host = EpiphanyCodexThreadHost::new(thread.as_ref());
|
||||
let applied = match apply_thread_epiphany_update(&host, expected_revision, patch).await {
|
||||
let core_patch = core_state_patch_from_protocol(&patch);
|
||||
let applied = match apply_thread_epiphany_update(&host, expected_revision, core_patch).await
|
||||
{
|
||||
Ok(applied) => applied,
|
||||
Err(EpiphanyBridgeError::InvalidRequest(message)) => {
|
||||
self.send_invalid_request_error(request_id, message).await;
|
||||
|
|
|
|||
Reference in a new issue