From 6fa0b7704c3f1cf4bbcf85189d4f49bc78b5bc82 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 30 Apr 2026 09:19:33 +0100 Subject: [PATCH] Force compact after CRRC checkpoint steering --- notes/epiphany-current-algorithmic-map.md | 2 +- notes/epiphany-fork-implementation-plan.md | 9 ++- notes/fresh-workspace-handoff.md | 8 +-- state/evidence.jsonl | 1 + state/map.yaml | 12 ++-- .../app-server/src/bespoke_event_handling.rs | 7 ++- .../app-server/src/codex_message_processor.rs | 41 ++++++++++++- .../codex-rs/app-server/src/thread_state.rs | 58 +++++++++++++++++++ 8 files changed, 120 insertions(+), 18 deletions(-) diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index 2ffec96c..5f3c19d2 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -30,7 +30,7 @@ The spine exists in twenty-five live paths: - targeted context reflection: app-server declares experimental read-only `thread/epiphany/context`, reads the same live/stored Epiphany state view used by scene/jobs, and derives a bounded state shard containing selected graph nodes/edges, links, active frontier, checkpoint, the full durable investigation-checkpoint packet, observations, direct evidence, linked evidence, and missing requested ids without retrieval, proposal, promotion, notification, mutation, or persistence in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:355), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4253), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4261), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:11152). - graph traversal reflection: app-server declares experimental read-only `thread/epiphany/graphQuery`, reads the same live Epiphany state view used by context, and derives explicit node/edge lookup, path/symbol matches, bounded neighbors, edge-kind matches, and frontier neighborhoods with architecture/dataflow links plus frontier/checkpoint identity, matched selectors, and missing ids without retrieval, proposal, promotion, indexing, notification, mutation, or scheduling in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:379), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4720), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:5060), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:15201). - context-pressure reflection: core token telemetry carries `model_auto_compact_token_limit` beside total/last usage and `model_context_window`; app-server declares experimental read-only `thread/epiphany/pressure`, reads live token usage or the latest stored rollout `TokenCount`, and derives `unknown`/`low`/`elevated`/`high`/`critical` pressure plus a non-acting compaction-prep recommendation without mutating Epiphany state or scheduling compaction in [protocol.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/protocol/src/protocol.rs:2237), [turn_context.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/session/turn_context.rs:103), [session/mod.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/session/mod.rs:2716), [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:360), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4361), [token_usage_replay.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor/token_usage_replay.rs:75), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4306), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:11028). -- pre-compaction checkpoint intervention: app-server `TokenCount` handling now checks the same pressure mapper, and for loaded Epiphany threads crossing `shouldPrepareCompaction` it steers the active turn once with a bounded CRRC checkpoint directive to bank working context before compaction/reorientation. The per-turn dedupe bit lives in listener `ThreadState`, and the intervention uses existing turn steering rather than a new scheduler in [bespoke_event_handling.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/bespoke_event_handling.rs:1467), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:15405), and [thread_state.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/thread_state.rs:144). +- pre-compaction checkpoint intervention: app-server `TokenCount` handling now checks the same pressure mapper, and for loaded Epiphany threads crossing `shouldPrepareCompaction` it steers the active turn once with a bounded CRRC checkpoint directive to bank working context before compaction/reorientation. The per-turn dedupe bit and the pending compact handoff live in listener `ThreadState`; successful steering marks the active turn for a forced compact action at clean turn completion, while aborted turns clear the handoff. The intervention uses existing turn steering and turn-boundary automation rather than a new scheduler in [bespoke_event_handling.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/bespoke_event_handling.rs:1467), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:15405), and [thread_state.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/thread_state.rs:144). - reorientation policy: app-server declares experimental read-only `thread/epiphany/reorient`, reuses the same live/stored thread view plus mapped pressure/freshness/watcher signals, and derives a bounded `resume`/`regather` verdict with checkpoint-path/frontier reasons without mutating, compacting, scheduling, notifying, or continuing work in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:365), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4514), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4394), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:11424). - CRRC coordinator recommendation: app-server declares experimental read-only `thread/epiphany/crrc`, reuses the same pressure/freshness/watcher/reorientation mapping plus the fixed `reorient-worker` binding and result read-back helper, recognizes already accepted reorientation findings so an accepted result is not recommended for acceptance again, and returns one bounded recommendation such as continue, prepare checkpoint, launch worker, wait, review, accept, or regather manually without mutating, launching, accepting, compacting, notifying, scheduling, or silently continuing work in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:370), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4661), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4546). - role ownership projection: app-server declares experimental read-only `thread/epiphany/roles`, reuses the same state/jobs/pressure/reorient/result/CRRC signals as the coordinator loop, and projects implementation, modeling/checkpoint, verification/review, and reorientation lanes with owner roles, status, linked jobs, authority scopes, and recommended scene actions without launching, scheduling, accepting, compacting, notifying, or mutating state in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:350), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4161), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4310). diff --git a/notes/epiphany-fork-implementation-plan.md b/notes/epiphany-fork-implementation-plan.md index d020d97c..6ded3b86 100644 --- a/notes/epiphany-fork-implementation-plan.md +++ b/notes/epiphany-fork-implementation-plan.md @@ -117,7 +117,7 @@ These boundaries are more important than the individual method names: - `thread/epiphany/reorient` is a bounded policy verdict, not an automatic runtime coordinator, scheduler, compactor, or hidden state writer. - `thread/epiphany/crrc` is a read-only coordinator recommendation over existing signals, not a scheduler, launch button, acceptance gate, compactor, or hidden state writer. - `thread/epiphany/coordinator` is a read-only fixed-lane MVP policy projection over existing signals, not a scheduler, launcher, acceptance gate, compactor, or hidden state writer. -- Native CRRC automation may act only at safe turn-complete boundaries and only for coordinator-approved `compactRehydrateReorient` and `launchReorientWorker` actions. It must not auto-launch modeling or verification, auto-accept semantic findings, promote evidence, edit implementation code, or silently continue after unresolved drift. +- Native CRRC automation may act only at safe turn-complete boundaries and only for coordinator-approved `compactRehydrateReorient`, successful pre-compaction checkpoint handoff compact, and coordinator-approved `launchReorientWorker` actions. It must not auto-launch modeling or verification, auto-accept semantic findings, promote evidence, edit implementation code, or silently continue after unresolved drift. - Pre-compaction checkpoint intervention may steer an active loaded Epiphany turn once at the token-count boundary when pressure reaches the existing `shouldPrepareCompaction` threshold. The steering directive is allowed to ask the agent to bank scratch/checkpoint/map/evidence before compaction/reorientation; it must not auto-accept semantic findings, promote evidence, launch arbitrary workers, or continue implementation after unresolved drift. - `thread/epiphany/roles` is a read-only role ownership projection, not a specialist scheduler, marketplace, launcher, acceptance gate, or second job backend. - `thread/epiphany/roleLaunch` is a bounded authority surface for fixed modeling/checkpoint and verification/review templates, not a broad scheduler or specialist marketplace. @@ -222,7 +222,10 @@ workspace, report through `report_agent_job_result`, and return a completed proved the sequence-locked MVP policy across cold start, clean checkpoint, modeling, verification, CRRC drift/reorient, and high-pressure compact/dry-run paths. Native CRRC automation then wired the proved policy into turn-complete -safe boundaries for compact and fixed reorient-worker launch only. The first +safe boundaries for compact and fixed reorient-worker launch only. Successful +pre-compaction checkpoint steering now also latches a pending compact handoff +for the completed turn, so the brake becomes a real compaction request instead +of a polite suggestion. The first pre-compaction checkpoint intervention is now also landed: token-count pressure events steer active loaded Epiphany turns once at the `shouldPrepareCompaction` threshold so working context can be banked before compaction. The next MVP @@ -241,7 +244,7 @@ Useful candidates: 1. Keep dogfood execution agent-run and auditable, then put the fixed-lane coordinator and pre-compaction checkpoint loop in front of the user through the smallest local GUI/operator view over the same status/artifact surfaces. 2. Keep accepted worker findings review-gated; do not convert acceptance into automatic promotion of arbitrary worker output. -3. Keep pre-compaction intervention narrow: steer once at `shouldPrepareCompaction`, then let explicit checkpointing, compact/resume/reorient, and review gates do their jobs. +3. Keep pre-compaction intervention narrow: steer once at `shouldPrepareCompaction`, latch the compact handoff only after successful steering, then let explicit checkpointing, compact/resume/reorient, and review gates do their jobs. Do not spend Phase 6 polishing Phase 5 out of anxiety. The Phase 5 smoke harness is a regression guardrail, not a ritual drum circle for summoning more tiny diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 14d8d233..89e6616d 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -31,8 +31,8 @@ Do not trust this file for the exact live HEAD. Always check git. - Phase 6 has read-only `thread/epiphany/scene`, `thread/epiphany/jobs`, `thread/epiphany/roles`, `thread/epiphany/freshness`, `thread/epiphany/context`, `thread/epiphany/graphQuery`, `thread/epiphany/pressure`, `thread/epiphany/reorient`, `thread/epiphany/crrc`, `thread/epiphany/coordinator`, `thread/epiphany/reorientResult`, and `thread/epiphany/roleResult`; durable `jobBindings` now act as a thin Epiphany-owned launcher seam with launcher id, authority scope, and backend kind/job id, `thread/epiphany/jobLaunch` / `thread/epiphany/jobInterrupt` / `thread/epiphany/roleLaunch` now provide explicit bounded authority over that seam, jobs can overlay it onto live runtime `agent_jobs` progress for loaded threads, and `thread/epiphany/jobsUpdated` now translates live `agent_job_progress:{json}` background events into changed launcher-bound notifications without polling or scheduling. Freshness carries watcher-backed invalidation inputs, graphQuery traverses authoritative typed graph neighborhoods and path/symbol matches without mutation, roles project implementation/modeling/verification/reorientation ownership from existing signals without becoming a scheduler, `roleLaunch` can launch only fixed modeling/checkpoint or verification/review specialists, `roleResult` reads those outputs back as reviewable findings without mutation, `thread/epiphany/roleAccept` can apply a reviewed modeling/checkpoint `statePatch` through the existing state validator, reorient turns checkpoint plus freshness/pressure/watcher signals into a read-only resume-versus-regather verdict, `thread/epiphany/reorientLaunch` is the explicit runtime consumer over that verdict, `thread/epiphany/reorientResult` reads the launched worker output back as a reviewable finding without mutation or promotion, `thread/epiphany/reorientAccept` explicitly banks completed findings into accepted observation/evidence plus optional scratch/checkpoint state, `thread/epiphany/crrc` recommends the next explicit CRRC action without launching, accepting, compacting, scheduling, or mutating, and `thread/epiphany/coordinator` composes those signals into a fixed-lane MVP action recommendation without becoming a writer. - `tools/epiphany_mvp_status.py` is the first dogfood operator view. It starts or reads a thread through app-server and prints scene, pressure, reorient, jobs, roles, modeling/verification role result read-backs, reorient result, and CRRC recommendation as text or JSON. - `tools/epiphany_mvp_coordinator.py` is the first auditable fixed-lane coordinator runner. It starts or reads a thread through app-server, follows the harness-native coordinator action, can auto-launch modeling, verification, or reorient-worker jobs, keeps semantic findings review-gated by default, and writes summary, steps, rendered snapshots, transcript, stderr, and final next-action artifacts under `.epiphany-dogfood/coordinator` or a caller-provided artifact directory. -- Native CRRC automation is now landed only at turn-complete safe boundaries. It may submit `Op::Compact` for coordinator-approved `compactRehydrateReorient`, and it may launch the fixed `reorient-worker` for coordinator-approved `launchReorientWorker`. It does not auto-launch modeling/verification, accept findings, promote evidence, edit implementation code, or keep going after reviewable semantic output. -- Pre-compaction checkpoint intervention is now landed. On token-count events for loaded Epiphany threads, when pressure reaches the existing `shouldPrepareCompaction` threshold, the harness steers the active turn once with a CRRC checkpoint directive so the agent banks working context before compaction/reorientation. This is still bounded steering, not automatic semantic acceptance, a broad scheduler, or implementation continuation. +- Native CRRC automation is now landed only at turn-complete safe boundaries. It may submit `Op::Compact` for coordinator-approved `compactRehydrateReorient` or for a successful pre-compaction checkpoint intervention's pending compact handoff, and it may launch the fixed `reorient-worker` for coordinator-approved `launchReorientWorker`. It does not auto-launch modeling/verification, accept findings, promote evidence, edit implementation code, or keep going after reviewable semantic output. +- Pre-compaction checkpoint intervention is now landed. On token-count events for loaded Epiphany threads, when pressure reaches the existing `shouldPrepareCompaction` threshold, the harness steers the active turn once with a CRRC checkpoint directive so the agent banks working context before compaction/reorientation. A successful steer now latches a turn-scoped compact handoff that is consumed at clean turn completion, preventing the brake from decaying into another implementation turn. This is still bounded steering plus compaction handoff, not automatic semantic acceptance, a broad scheduler, or implementation continuation. - `tools/epiphany_mvp_dogfood.py` is the first auditable dogfood runner. It drives a bounded state/role/CRRC/reorientation loop and writes local artifacts under `.epiphany-dogfood/mvp-loop`, including sealed app-server transcript diagnostics, rendered snapshots, operator-safe final status, vanilla-reference prompt/output, and comparison notes. The runner now writes truthful vanilla/comparison artifacts whether the optional vanilla reference is skipped, fails, or completes. - `tools/epiphany_mvp_live_specialist.py` is the first auditable live-specialist runner. It launches a real role specialist through `thread/epiphany/roleLaunch`, lets the spawned worker report through `report_agent_job_result`, reads it back through `thread/epiphany/roleResult`, and writes local artifacts under `.epiphany-dogfood/live-specialist`. - The first MVP GUI shell now exists under `apps/epiphany-gui`. It is a Tauri v2 + React operator console over the existing status bridge, dogfood artifacts, and GUI action artifacts, not a new source of truth. It can prepare a durable Epiphany checkpoint for a resumable operator thread, run status snapshots and coordinator-plan artifacts, launch/read the fixed modeling and verification lanes, launch/read the fixed reorient-worker, and explicitly accept completed reorient findings after review. @@ -43,7 +43,7 @@ Do not trust this file for the exact live HEAD. Always check git. - The dogfood quarantine now has a direct-thought boundary. The supervisor may read coordinator actions, role/reorient statuses, structured finding summaries, reviewed state patches, rendered status snapshots, and artifact manifests. It must not read raw worker transcripts, direct worker messages, full turn logs, or `rawResult` payloads during normal dogfood. Those artifacts are sealed for explicit forensic debugging only. - `tools/epiphany_agent_telemetry.py` is the safe instrument panel for sealed runs. Status/coordinator/GUI/dogfood/live-specialist tools generate telemetry JSON from sealed transcripts that preserves method names, call shape, job/status/path counts, and any visible function/tool names while sealing text, direct messages, and raw results. - Latest Aetheria supervised dogfood thread: `019ddc52-4ee8-7203-b6c0-106a9c270067` with codex-home `.epiphany-dogfood/aetheria-supervised/codex-home`. CRRC compact/reorient/reorientAccept reached Epiphany state revision 16 after rollout replay fixes, and a fresh coordinator resume cleared to `continueImplementation`. -- The implementation lane is the current product blocker, but it is now harness-visible. The latest audited artifact is `.epiphany-dogfood/aetheria-supervised/gui-actions/continueImplementation-1777528376766401900-25000`: it shows `workspaceChanged: false`, wrote `implementation-audit.md`, applied a no-diff `thread/epiphany/update`, advanced Epiphany state to revision 17, and marked the investigation checkpoint `regather_required`. +- The implementation lane is the current product blocker, but it is now harness-visible. The latest audited artifact is `.epiphany-dogfood/aetheria-supervised/gui-actions/continueImplementation-1777528376766401900-25000`: it shows `workspaceChanged: false`, wrote `implementation-audit.md`, applied a no-diff `thread/epiphany/update`, advanced Epiphany state to revision 17, and marked the investigation checkpoint `regather_required`. The next clean run should retry through the operator-safe coordinator lanes after the pre-compaction handoff repair, not by reading sealed worker thoughts. - A follow-up coordinator plan at `.epiphany-dogfood/aetheria-supervised/coordinator-after-nodiff-state-20260430-plan` now returns `regatherManually` with implementation blocked, instead of continuing fake progress. - The GUI parses `implementation-result.json` into artifact metadata, surfaces the latest implementation diff/no-diff outcome, and pauses immediate `Continue Implementation` repeats when the newest artifact is a no-diff implementation audit. - The repo is an Epiphany fork of Codex, not a Codex preset. @@ -104,7 +104,7 @@ The current spine: - read-only CRRC next-action recommendation through `thread/epiphany/crrc` - read-only fixed-lane MVP action recommendation through `thread/epiphany/coordinator` - limited turn-complete CRRC automation for coordinator-approved compact and fixed reorient-worker launch actions -- token-count pre-compaction checkpoint intervention for loaded Epiphany turns at the `shouldPrepareCompaction` threshold +- token-count pre-compaction checkpoint intervention for loaded Epiphany turns at the `shouldPrepareCompaction` threshold, with a turn-scoped compact handoff consumed after a successful steer - durable investigation checkpoint packet through typed state, prompt, scene, and context - distilled shared and config-backed specialist prompt doctrine through the base prompt, rendered Epiphany state, modeling/body, verification/soul, reorientation/life, and coordinator/Self surfaces - live scene app-server smoke through `tools/epiphany_phase6_scene_smoke.py` diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 28a40cd2..a1525e0c 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -42,3 +42,4 @@ {"ts": "2026-04-30T05:45:38+00:00", "type": "implementation", "status": "ok", "note": "The GUI action bridge now writes implementation-result.json for continueImplementation turns, emits implementation-audit.md on future runs, and the Tauri/React operator console parses implementation-result.json into artifact metadata so the latest no-diff or diff outcome is visible without opening terminal artifacts."} {"ts": "2026-04-30T05:47:56+00:00", "type": "implementation", "status": "ok", "note": "The GUI now treats a newest no-diff implementation artifact as a soft operator gate: Continue Implementation is paused until the operator reviews or runs another lane, preventing immediate repeated no-diff pseudo-progress from the console."} {"ts": "2026-04-30T05:54:22+00:00", "type": "verification", "status": "ok", "note": "Stateful no-diff implementation handling landed and was exercised on the Aetheria dogfood thread: continueImplementation-1777528376766401900-25000 produced no tracked diff, thread/epiphany/update marked the investigation checkpoint regather_required with audit evidence, advanced Epiphany state to revision 17, and a follow-up coordinator plan returned regatherManually with implementation blocked."} +{"ts": "2026-04-30T08:18:46+00:00", "type": "implementation", "status": "ok", "note": "CRRC pre-compaction steering now creates a turn-scoped pending compact handoff after successful steer_input, and clean turn completion forces the existing compact automation even if the ordinary coordinator would continue; aborted turns clear the handoff. Focused Rust tests, coordinator smoke, and reorient-launch smoke passed."} diff --git a/state/map.yaml b/state/map.yaml index 4f222f22..75bbb6c6 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -96,8 +96,8 @@ accepted_design: - A narrow auditable coordinator is likely central to the MVP because implementation, modeling/checkpoint, verification/review, and CRRC automation depend on each other's signals. CRRC itself is harness workflow automation, not a specialist-agent role: it watches pressure/continuity, ensures persistence, triggers compaction/rehydration/reorientation when needed, and may launch a bounded reorient-worker specialist when semantic regathering is required. - `thread/epiphany/coordinator` is the first harness-native fixed-lane coordinator surface: it composes roles, pressure, reorient, CRRC, roleResult, and reorientResult into a read-only action recommendation with target role, source signals, review requirements, automation eligibility, reason, and current lane summaries without mutating state or launching work. - `tools/epiphany_mvp_coordinator.py` is the first auditable coordinator runner: it drives the fixed single-user lanes through app-server APIs, may auto-launch modeling, verification, or reorient-worker jobs, keeps semantic findings review-gated by default, and writes coordinator summaries, JSONL steps, rendered snapshots, transcript, stderr, and final next-action artifacts. - - Limited native CRRC automation is now wired only at turn-complete safe boundaries: it can submit a compact operation when the read-only coordinator recommends `compactRehydrateReorient`, and it can launch the fixed `reorient-worker` when the coordinator recommends `launchReorientWorker`. It does not auto-launch modeling or verification, auto-accept findings, promote evidence, edit implementation code, or continue after reviewable semantic results. - - Pre-compaction checkpoint intervention is now wired at token-count boundaries: when a loaded Epiphany thread crosses the existing `shouldPrepareCompaction` pressure threshold during an active turn, the harness steers the active agent once for that turn with a bounded CRRC directive to bank scratch/checkpoint/map/evidence before compaction/reorientation. This is still steering, not semantic acceptance, broad scheduling, or automatic implementation continuation. + - Limited native CRRC automation is now wired only at turn-complete safe boundaries: it can submit a compact operation when the read-only coordinator recommends `compactRehydrateReorient` or when a successful pre-compaction checkpoint intervention left a pending compact handoff for the completed turn, and it can launch the fixed `reorient-worker` when the coordinator recommends `launchReorientWorker`. It does not auto-launch modeling or verification, auto-accept findings, promote evidence, edit implementation code, or continue after reviewable semantic results. + - Pre-compaction checkpoint intervention is now wired at token-count boundaries: when a loaded Epiphany thread crosses the existing `shouldPrepareCompaction` pressure threshold during an active turn, the harness steers the active agent once for that turn with a bounded CRRC directive to bank scratch/checkpoint/map/evidence before compaction/reorientation. A successful steer marks a turn-scoped pending compact handoff consumed at clean turn completion; this is still steering plus compaction handoff, not semantic acceptance, broad scheduling, or automatic implementation continuation. - `tools/epiphany_mvp_status.py` is the first dogfood operator view: it starts or reads a thread through app-server and renders scene, pressure, reorient, jobs, role result read-backs, reorient result, CRRC recommendation, and MVP role lanes as text or JSON without becoming a state store. - `thread/epiphany/roles` is the first harness-native role ownership surface: it projects implementation, modeling/checkpoint, verification/review, and reorientation lanes from authoritative typed state, bound jobs, pressure/reorient/CRRC, and worker result status without launching, scheduling, accepting, compacting, or mutating state. - `thread/epiphany/roleLaunch` and `thread/epiphany/roleResult` are the first explicit role-scoped specialist templates: modeling/checkpoint and verification/review can be launched through fixed bindings over the existing job-control seam and read back as reviewable findings, while implementation stays owned by the main coding agent and reorientation stays on the CRRC-specific launch/result path. @@ -140,8 +140,8 @@ landed_baseline: - Phase 6 role specialists: explicit `thread/epiphany/roleLaunch` and read-only `thread/epiphany/roleResult` templates for modeling/checkpoint and verification/review. - Phase 6 modeling role acceptance: explicit `thread/epiphany/roleAccept` for reviewed modeling/checkpoint `statePatch` findings that can grow graphs/frontier/checkpoints through the existing state validator. - Phase 6 coordinator: read-only `thread/epiphany/coordinator` plus `tools/epiphany_mvp_coordinator.py` and smoke coverage for the fixed-lane MVP loop. - - Phase 6 safe-boundary CRRC automation: turn-complete automation limited to coordinator-approved compact and fixed reorient-worker launch actions. - - Phase 6 pre-compaction checkpoint intervention: token-count pressure hook that steers active turns once when `shouldPrepareCompaction` is reached so working context is banked before compaction. + - Phase 6 safe-boundary CRRC automation: turn-complete automation limited to coordinator-approved compact, successful pre-compaction handoff compact, and fixed reorient-worker launch actions. + - Phase 6 pre-compaction checkpoint intervention: token-count pressure hook that steers active turns once when `shouldPrepareCompaction` is reached so working context is banked before compaction, then latches a pending compact handoff for clean turn completion. - Phase 6 GUI operator shell: Tauri v2 + React console under `apps/epiphany-gui` over the existing status bridge and artifact bundles, with visual smoke, durable checkpoint preparation, fixed lane launch/read-back controls, and explicit review-gated reorient acceptance. guardrails: - Use `tools/epiphany_phase5_smoke.py` before modifying update, distill, propose, promote, read-projection, or notification behavior. @@ -180,5 +180,5 @@ rejected_paths: reason: persistent state that accumulates every local truth becomes memory cruft and weakens rehydration current_status: - summary: Phase 1 durable state through the Phase 6 GUI/coordinator/specialist/CRRC MVP surfaces are landed. Aetheria dogfood first exposed a supervisor contamination scar, so the quarantine now keeps the supervisor on operator-safe projections and sealed transcripts. The clean supervised pass proved the CRRC compact/reorient/reorientAccept lane can reach state revision 16 and clear to `continueImplementation`; the follow-up implementation pass produced no tracked Aetheria diff, wrote audit artifacts, marked the investigation checkpoint `regather_required`, advanced state to revision 17, and caused the coordinator to block implementation with `regatherManually` instead of fake progress. - next_action: Repair the Aetheria implementation lane through operator-safe regathering. The harness now detects no-diff implementation and blocks continuation; the next run should launch or perform a bounded modeling/reorientation repair that turns the checkpoint back into implementation-ready guidance, then retry implementation through the GUI/coordinator lanes. Do not inspect raw worker transcripts or `rawResult` payloads unless the user explicitly requests forensic debugging. + summary: Phase 1 durable state through the Phase 6 GUI/coordinator/specialist/CRRC MVP surfaces are landed. Aetheria dogfood first exposed a supervisor contamination scar, so the quarantine now keeps the supervisor on operator-safe projections and sealed transcripts. The clean supervised pass proved the CRRC compact/reorient/reorientAccept lane can reach state revision 16 and clear to `continueImplementation`; the follow-up implementation pass produced no tracked Aetheria diff, wrote audit artifacts, marked the investigation checkpoint `regather_required`, advanced state to revision 17, and caused the coordinator to block implementation with `regatherManually` instead of fake progress. A follow-up harness repair now turns successful CRRC pre-compaction steering into a pending compact handoff consumed at clean turn completion, so the brake cannot silently decay into another implementation turn. + next_action: Retry Aetheria dogfood from the operator-safe coordinator lanes after the pre-compaction handoff repair. Start with a bounded regather/modeling repair for the `regather_required` checkpoint, then retry implementation through the GUI/coordinator path and require either a tracked Aetheria diff or an explicit reviewable failure artifact. Do not inspect raw worker transcripts or `rawResult` payloads unless the user explicitly requests forensic debugging. diff --git a/vendor/codex/codex-rs/app-server/src/bespoke_event_handling.rs b/vendor/codex/codex-rs/app-server/src/bespoke_event_handling.rs index a8960ef0..81ee5001 100644 --- a/vendor/codex/codex-rs/app-server/src/bespoke_event_handling.rs +++ b/vendor/codex/codex-rs/app-server/src/bespoke_event_handling.rs @@ -235,11 +235,12 @@ pub(crate) async fn apply_bespoke_event_handling( EventMsg::TurnComplete(turn_complete_event) => { // All per-thread requests are bound to a turn, so abort them. outgoing.abort_pending_server_requests().await; - let (turn_failed, turn_was_context_compaction) = { - let state = thread_state.lock().await; + let (turn_failed, turn_was_context_compaction, force_checkpoint_compaction) = { + let mut state = thread_state.lock().await; ( state.turn_summary.last_error.is_some(), state.turn_summary.context_compaction_started, + state.take_epiphany_checkpoint_intervention_pending_compaction(&event_turn_id), ) }; thread_watch_manager @@ -260,6 +261,7 @@ pub(crate) async fn apply_bespoke_event_handling( conversation, epiphany_invalidation_manager, &outgoing, + force_checkpoint_compaction, ) .await; } @@ -1885,6 +1887,7 @@ pub(crate) async fn apply_bespoke_event_handling( outgoing.abort_pending_server_requests().await; let pending = { let mut state = thread_state.lock().await; + state.clear_epiphany_checkpoint_intervention_pending_compaction(); std::mem::take(&mut state.pending_interrupts) }; if !pending.is_empty() { diff --git a/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs b/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs index bbff350e..9c309ccb 100644 --- a/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs +++ b/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs @@ -13975,6 +13975,16 @@ fn map_epiphany_coordinator_automation_action( } } +fn select_epiphany_coordinator_automation_action( + decision: &EpiphanyCoordinatorDecision, + force_checkpoint_compaction: bool, +) -> EpiphanyCoordinatorAutomationAction { + if force_checkpoint_compaction { + return EpiphanyCoordinatorAutomationAction::CompactRehydrateReorient; + } + map_epiphany_coordinator_automation_action(decision) +} + fn map_epiphany_coordinator( state_status: ThreadEpiphanyReorientStateStatus, checkpoint_present: bool, @@ -16247,6 +16257,7 @@ pub(crate) async fn maybe_run_epiphany_coordinator_automation_for_turn_boundary( thread: Arc, epiphany_invalidation_manager: EpiphanyInvalidationManager, outgoing: &ThreadScopedOutgoingMessageSender, + force_checkpoint_compaction: bool, ) { let thread_id_text = thread_id.to_string(); let Some(state) = thread.epiphany_state().await else { @@ -16348,7 +16359,7 @@ pub(crate) async fn maybe_run_epiphany_coordinator_automation_for_turn_boundary( reorient_finding_accepted, ); - match map_epiphany_coordinator_automation_action(&coordinator) { + match select_epiphany_coordinator_automation_action(&coordinator, force_checkpoint_compaction) { EpiphanyCoordinatorAutomationAction::None => {} EpiphanyCoordinatorAutomationAction::CompactRehydrateReorient => { if let Err(err) = thread.submit(Op::Compact).await { @@ -16432,7 +16443,12 @@ pub(crate) async fn maybe_run_epiphany_pre_compaction_checkpoint_intervention_fo ) .await { - Ok(_) => {} + Ok(_) => { + thread_state + .lock() + .await + .mark_epiphany_checkpoint_intervention_pending_compaction(&turn_id); + } Err(SteerInputError::NoActiveTurn(_)) | Err(SteerInputError::ExpectedTurnMismatch { .. }) | Err(SteerInputError::ActiveTurnNotSteerable { .. }) @@ -19671,6 +19687,27 @@ mod tests { ); } + #[test] + fn select_epiphany_coordinator_automation_forces_checkpoint_compaction_handoff() { + let decision = EpiphanyCoordinatorDecision { + action: ThreadEpiphanyCoordinatorAction::ContinueImplementation, + target_role: Some(ThreadEpiphanyRoleId::Implementation), + recommended_scene_action: None, + requires_review: false, + can_auto_run: false, + reason: "ordinary coordinator would continue".to_string(), + }; + + assert_eq!( + map_epiphany_coordinator_automation_action(&decision), + EpiphanyCoordinatorAutomationAction::None + ); + assert_eq!( + select_epiphany_coordinator_automation_action(&decision, true), + EpiphanyCoordinatorAutomationAction::CompactRehydrateReorient + ); + } + #[test] fn map_epiphany_coordinator_launches_reorient_worker_from_crrc() { let pressure = map_epiphany_pressure(None); diff --git a/vendor/codex/codex-rs/app-server/src/thread_state.rs b/vendor/codex/codex-rs/app-server/src/thread_state.rs index 229e7b87..45b25917 100644 --- a/vendor/codex/codex-rs/app-server/src/thread_state.rs +++ b/vendor/codex/codex-rs/app-server/src/thread_state.rs @@ -68,6 +68,7 @@ pub(crate) struct ThreadState { current_turn_history: ThreadHistoryBuilder, last_epiphany_jobs_by_job_id: HashMap, last_epiphany_checkpoint_intervention_turn_id: Option, + pending_epiphany_checkpoint_compaction_turn_id: Option, listener_thread: Option>, } @@ -101,6 +102,7 @@ impl ThreadState { self.listener_command_tx = None; self.current_turn_history.reset(); self.last_epiphany_jobs_by_job_id.clear(); + self.pending_epiphany_checkpoint_compaction_turn_id = None; self.listener_thread = None; } @@ -153,6 +155,62 @@ impl ThreadState { self.last_epiphany_checkpoint_intervention_turn_id = Some(turn_id.to_string()); true } + + pub(crate) fn mark_epiphany_checkpoint_intervention_pending_compaction( + &mut self, + turn_id: &str, + ) { + self.pending_epiphany_checkpoint_compaction_turn_id = Some(turn_id.to_string()); + } + + pub(crate) fn take_epiphany_checkpoint_intervention_pending_compaction( + &mut self, + turn_id: &str, + ) -> bool { + if self + .pending_epiphany_checkpoint_compaction_turn_id + .as_deref() + != Some(turn_id) + { + return false; + } + self.pending_epiphany_checkpoint_compaction_turn_id = None; + true + } + + pub(crate) fn clear_epiphany_checkpoint_intervention_pending_compaction(&mut self) { + self.pending_epiphany_checkpoint_compaction_turn_id = None; + } +} + +#[cfg(test)] +mod tests { + use super::ThreadState; + + #[test] + fn epiphany_checkpoint_intervention_pending_compaction_is_turn_scoped() { + let mut state = ThreadState::default(); + + assert!(state.record_epiphany_checkpoint_intervention("turn-a")); + assert!(!state.record_epiphany_checkpoint_intervention("turn-a")); + assert!(!state.take_epiphany_checkpoint_intervention_pending_compaction("turn-a")); + + state.mark_epiphany_checkpoint_intervention_pending_compaction("turn-a"); + + assert!(!state.take_epiphany_checkpoint_intervention_pending_compaction("turn-b")); + assert!(state.take_epiphany_checkpoint_intervention_pending_compaction("turn-a")); + assert!(!state.take_epiphany_checkpoint_intervention_pending_compaction("turn-a")); + } + + #[test] + fn epiphany_checkpoint_intervention_pending_compaction_can_be_cleared() { + let mut state = ThreadState::default(); + + state.mark_epiphany_checkpoint_intervention_pending_compaction("turn-a"); + state.clear_epiphany_checkpoint_intervention_pending_compaction(); + + assert!(!state.take_epiphany_checkpoint_intervention_pending_compaction("turn-a")); + } } pub(crate) async fn resolve_server_request_on_thread_listener(