From 08db7512fe388463c481b7343503fcf4ae93d8bc Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 18 May 2026 04:52:01 +0100 Subject: [PATCH] Tighten modeling memory patch runtime contract --- epiphany-openai-runtime/src/lib.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/epiphany-openai-runtime/src/lib.rs b/epiphany-openai-runtime/src/lib.rs index 9124a205..1d437853 100644 --- a/epiphany-openai-runtime/src/lib.rs +++ b/epiphany-openai-runtime/src/lib.rs @@ -541,7 +541,7 @@ fn worker_instructions( fn worker_output_contract_text(document: &EpiphanyWorkerLaunchDocument) -> &'static str { match document { EpiphanyWorkerLaunchDocument::Role(_) => { - "Required role-result fields: roleId, verdict, summary, nextSafeMove, filesInspected. Modeling and Imagination workers must include their required statePatch. Modeling workers should put proposed graph/memory changes in memoryPatchCandidates instead of relying on prompt-local full graph rewrites. Use arrays for frontierNodeIds, evidenceIds, openQuestions, evidenceGaps, risks, artifactRefs, and memoryPatchCandidates when present." + "Required role-result fields: roleId, verdict, summary, nextSafeMove, filesInspected. Modeling and Imagination workers must include their required statePatch. Modeling workers must put proposed graph/memory changes in memoryPatchCandidates, never statePatch.graphs. Use arrays for frontierNodeIds, evidenceIds, openQuestions, evidenceGaps, risks, artifactRefs, and memoryPatchCandidates when present." } EpiphanyWorkerLaunchDocument::Reorient(_) => { "Required reorient-result fields: mode, summary, nextSafeMove. Include checkpointStillValid, filesInspected, frontierNodeIds, evidenceIds, openQuestions, and continuityRisks when present." @@ -952,7 +952,7 @@ mod tests { &launch_request, &model_request.request_id, &openai_summary, - r#"{"roleId":"modeling","verdict":"checkpoint-ready","summary":"Mapped.","nextSafeMove":"Review the patch.","filesInspected":["src/lib.rs"],"evidenceIds":["ev-1"],"artifactRefs":["artifact:model"],"statePatch":{"objective":"Keep the machine mapped."},"selfPatch":{"reason":"typed nested document"},"memoryPatchCandidates":[{"id":"mempatch-auth-spine","profile":"repo_architecture","status":"proposed","proposedNodes":[{"id":"memnode-auth-spine","domainId":"memdom-repo","profile":"repo_architecture","kind":"module","title":"Auth spine","claim":"Codex remains responsible for OpenAI authentication.","question":"","tension":"","actionImplication":"","lifecycle":"proposed"}],"reasons":["Modeling proposes typed graph growth without full graph cargo."]}]} "#, + r#"{"roleId":"modeling","verdict":"checkpoint-ready","summary":"Mapped.","nextSafeMove":"Review the patch.","filesInspected":["src/lib.rs"],"evidenceIds":["ev-1"],"artifactRefs":["artifact:model"],"statePatch":{"scratch":{"summary":"Keep the machine mapped."}},"selfPatch":{"reason":"typed nested document"},"memoryPatchCandidates":[{"id":"mempatch-auth-spine","profile":"repo_architecture","status":"proposed","proposedNodes":[{"id":"memnode-auth-spine","domainId":"memdom-repo","profile":"repo_architecture","kind":"module","title":"Auth spine","claim":"Codex remains responsible for OpenAI authentication.","question":"","tension":"","actionImplication":"","lifecycle":"proposed"}],"reasons":["Modeling proposes typed graph growth without full graph cargo."]}]} "#, )?; assert_eq!(result.job_id, "worker-job-1"); @@ -965,8 +965,14 @@ mod tests { assert_eq!(typed_result.verdict, "checkpoint-ready"); assert_eq!(typed_result.files_inspected, vec!["src/lib.rs".to_string()]); assert_eq!(typed_result.artifact_refs, result.artifact_refs); + assert!(typed_result.item_error.is_none()); assert_eq!( - typed_result.state_patch()?.expect("state patch").objective, + typed_result + .state_patch()? + .expect("state patch") + .scratch + .expect("scratch patch") + .summary, Some("Keep the machine mapped.".to_string()) ); assert_eq!(